<commit_before># Support for iframes.


createHistory = require("./history")
HTML          = require("jsdom").dom.level3.html


# Support for iframes that load content when you set the src attribute.
frameInit = HTML.HTMLFrameElement._init
HTML.HTMLFrameElement._init = ->
  frameInit.call(this)
  frame = this

  parentWindow = frame.ownerDocument.parentWindow
  contentWindow = null

  Object.defineProperties frame,
    contentWindow:
      get: ->
        return contentWindow || create()
    contentDocument:
      get: ->
        return (contentWindow || create()).document

  # URL created on the fly, or when src attribute set
  create = (url)->
    # Change the focus from window to active.
    focus = (active)->
      contentWindow = active
    # Need to bypass JSDOM's window/document creation and use ours
    open = createHistory(parentWindow.browser, focus)
    contentWindow = open(name: frame.name, parent: parentWindow, url: url)
    return contentWindow<commit_msg>set referer to the current window's location.href when creating a new iframe<commit_after># Support for iframes.


createHistory = require("./history")
HTML          = require("jsdom").dom.level3.html


# Support for iframes that load content when you set the src attribute.
frameInit = HTML.HTMLFrameElement._init
HTML.HTMLFrameElement._init = ->
  frameInit.call(this)
  frame = this

  parentWindow = frame.ownerDocument.parentWindow
  contentWindow = null

  Object.defineProperties frame,
    contentWindow:
      get: ->
        return contentWindow || create()
    contentDocument:
      get: ->
        return (contentWindow || create()).document

  # URL created on the fly, or when src attribute set
  create = (url)->
    # Change the focus from window to active.
    focus = (active)->
      contentWindow = active
    # Need to bypass JSDOM's window/document creation and use ours
    open = createHistory(parentWindow.browser, focus)
    contentWindow = open(name: frame.name, parent: parentWindow, url: url, referer: parentWindow.location.href)
    return contentWindow
{'fraction_non_alphanumeric': 0.09090909090909091, 'fraction_numerical': 0.0009671179883945841, 'mean_word_length': 3.3927813163481955, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4094865', 'n_tokens_mistral': 563, 'n_tokens_neox': 546, 'n_words': 184}