<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[37966] trunk/WebCore</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/37966">37966</a></dd>
<dt>Author</dt> <dd>ap@webkit.org</dd>
<dt>Date</dt> <dd>2008-10-29 03:26:58 -0700 (Wed, 29 Oct 2008)</dd>
</dl>

<h3>Log Message</h3>
<pre>        Reviewed by Darin Adler.

        https://bugs.webkit.org/show_bug.cgi?id=21923
        Create an abstraction for script execution context

        * GNUmakefile.am:
        * WebCore.pro:
        * WebCore.vcproj/WebCore.vcproj:
        * WebCore.xcodeproj/project.pbxproj:
        * WebCoreSources.bkl:
        Added ScriptExecutionContext.{h,cpp}.

        * bindings/js/JSAudioConstructor.cpp:
        (WebCore::JSAudioConstructor::JSAudioConstructor):
        * bindings/js/JSAudioConstructor.h:
        * bindings/js/JSImageConstructor.cpp:
        (WebCore::JSImageConstructor::JSImageConstructor):
        * bindings/js/JSImageConstructor.h:
        * bindings/js/JSOptionConstructor.cpp:
        (WebCore::JSOptionConstructor::JSOptionConstructor):
        * bindings/js/JSOptionConstructor.h:
        * bindings/js/JSXMLHttpRequestConstructor.cpp:
        (WebCore::JSXMLHttpRequestConstructor::JSXMLHttpRequestConstructor):
        * bindings/js/JSXMLHttpRequestConstructor.h:
        Pass ScriptExecutionContext instead of Document to make getDOMConstructor() happy.
        Since these objects can only work within documents now, it is immediately converted back
        to Document.

        * bindings/js/JSMessageChannelConstructor.cpp:
        (WebCore::JSMessageChannelConstructor::JSMessageChannelConstructor):
        (WebCore::JSMessageChannelConstructor::construct):
        * bindings/js/JSMessageChannelConstructor.h:
        (WebCore::JSMessageChannelConstructor::scriptExecutionContext):
        MessageChannel needs to be supported in workers right away, so the constructor operates with
        it directly.

        * dom/ActiveDOMObject.cpp:
        (WebCore::ActiveDOMObject::ActiveDOMObject):
        (WebCore::ActiveDOMObject::~ActiveDOMObject):
        (WebCore::ActiveDOMObject::contextDestroyed):
        * dom/ActiveDOMObject.h:
        (WebCore::ActiveDOMObject::scriptExecutionContext):
        * bindings/js/JSDOMBinding.cpp:
        (WebCore::markActiveObjectsForContext):
        (WebCore::markCrossHeapDependentObjectsForContext):
        Use ScriptExecutionContext instead of Document, now that ActiveDOMObject and MessagePort
        tracking is handled by ScriptExecutionContext.

        * bindings/js/JSDOMBinding.h: (WebCore::getDOMPrototype): Moved to JSDOMGlobalObject.

        * bindings/js/JSDOMGlobalObject.h:
        (WebCore::getDOMConstructor): Moved to this file, as constructors live in JSDOMGlobalObject.
        Also, the two-argument version that used to be in JSDOMWindowBase.cpp need to be accessible
        to worker context implementation.
        (WebCore::scriptExecutionContext): Added a pure virtual method to access
        ScriptExecutionContext, implemented by subclasses.

        * bindings/js/JSDOMWindowBase.h:
        * bindings/js/JSDOMWindowBase.cpp: (WebCore::JSDOMWindowBase::scriptExecutionContext):
        Implement by returning the associated document. Note that this method currently gives bogus
        results after navigation - DOMWindow Frame reference is not zeroed out, so we get a document
        that is currently in the frame, not the one associated with this window.

        * bindings/js/JSDedicatedWorkerConstructor.cpp: Removed unnecessary include of DOMWindow.h.

        * bindings/js/JSDocumentCustom.cpp: (WebCore::JSDocument::mark):
        Call markActiveObjectsForContext() by its new name.

        * dom/DedicatedWorker.cpp:
        (WebCore::DedicatedWorker::DedicatedWorker):
        (WebCore::DedicatedWorker::document):
        * dom/DedicatedWorker.h:
        * xml/XMLHttpRequest.cpp:
        (WebCore::XMLHttpRequest::document):
        * xml/XMLHttpRequest.h:
        Added a document() function that upcasts ScriptExecutionContext, as these objects only work
        within documents currently (at least for XMLHttpRequest, this will change soon though).

        * dom/Document.cpp:
        (WebCore::Document::Document):
        (WebCore::Document::~Document):
        Moved active object and MessagePort tracking up to ScriptExecutionContext, to share code
        with workers.
        
        * dom/Document.h:
        (WebCore::Document::isDocument):
        (WebCore::Document::refScriptExecutionContext):
        (WebCore::Document::derefScriptExecutionContext):
        Inherit from ScriptExecutionContext.

        * dom/MessageChannel.cpp:
        (WebCore::MessageChannel::MessageChannel):
        * dom/MessageChannel.h:
        (WebCore::MessageChannel::create):
        Use ScriptExecutionContext instead of Document.

        * dom/MessagePort.cpp:
        (WebCore::CloseMessagePortTimer::CloseMessagePortTimer): Make m_port a RefPtr, because
        MessagePort doesn't ref() itself when posting this event any more (this is a fix for an
        unrelated issue that was causing random crashes in layout tests).
        (WebCore::MessagePort::MessagePort):
        (WebCore::MessagePort::~MessagePort):
        (WebCore::MessagePort::associatedFrame):
        (WebCore::MessagePort::clone):
        (WebCore::MessagePort::postMessage):
        (WebCore::MessagePort::startConversation):
        (WebCore::MessagePort::start):
        (WebCore::MessagePort::contextDestroyed):
        (WebCore::MessagePort::dispatchMessages):
        * dom/MessagePort.h:
        (WebCore::MessagePort::create):
        (WebCore::MessagePort::scriptExecutionContext):
        Use ScriptExecutionContext instead of Document. This is a step toward making MessagePort
        work in worker contexts - we need to also make some its method thread safe for cross-thread
        messaging, and make event dispatching thread safe.

        * dom/ScriptExecutionContext.cpp: Added.
        * dom/ScriptExecutionContext.h: Added.
        ActiveDOMObject and MessagePort tracking is moved from Document.
        It is debatable whether ScriptExecutionContext should be a parent of Document or DOMWindow,
        but as I'm just moving Document code, and it is Document that is the main context object
        in our implementation currently.
        Changing ScriptExecutionContext to be a parent of DOMWindow causes a number of bugs that
        seem non-trivial to fix, and isn't really a part of this task.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkWebCoreChangeLog">trunk/WebCore/ChangeLog</a></li>
<li><a href="#trunkWebCoreGNUmakefileam">trunk/WebCore/GNUmakefile.am</a></li>
<li><a href="#trunkWebCoreWebCorepro">trunk/WebCore/WebCore.pro</a></li>
<li><a href="#trunkWebCoreWebCorevcprojWebCorevcproj">trunk/WebCore/WebCore.vcproj/WebCore.vcproj</a></li>
<li><a href="#trunkWebCoreWebCorexcodeprojprojectpbxproj">trunk/WebCore/WebCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkWebCoreWebCoreSourcesbkl">trunk/WebCore/WebCoreSources.bkl</a></li>
<li><a href="#trunkWebCorebindingsjsJSAudioConstructorcpp">trunk/WebCore/bindings/js/JSAudioConstructor.cpp</a></li>
<li><a href="#trunkWebCorebindingsjsJSAudioConstructorh">trunk/WebCore/bindings/js/JSAudioConstructor.h</a></li>
<li><a href="#trunkWebCorebindingsjsJSDOMBindingcpp">trunk/WebCore/bindings/js/JSDOMBinding.cpp</a></li>
<li><a href="#trunkWebCorebindingsjsJSDOMBindingh">trunk/WebCore/bindings/js/JSDOMBinding.h</a></li>
<li><a href="#trunkWebCorebindingsjsJSDOMGlobalObjecth">trunk/WebCore/bindings/js/JSDOMGlobalObject.h</a></li>
<li><a href="#trunkWebCorebindingsjsJSDOMWindowBasecpp">trunk/WebCore/bindings/js/JSDOMWindowBase.cpp</a></li>
<li><a href="#trunkWebCorebindingsjsJSDOMWindowBaseh">trunk/WebCore/bindings/js/JSDOMWindowBase.h</a></li>
<li><a href="#trunkWebCorebindingsjsJSDedicatedWorkerConstructorcpp">trunk/WebCore/bindings/js/JSDedicatedWorkerConstructor.cpp</a></li>
<li><a href="#trunkWebCorebindingsjsJSDocumentCustomcpp">trunk/WebCore/bindings/js/JSDocumentCustom.cpp</a></li>
<li><a href="#trunkWebCorebindingsjsJSImageConstructorcpp">trunk/WebCore/bindings/js/JSImageConstructor.cpp</a></li>
<li><a href="#trunkWebCorebindingsjsJSImageConstructorh">trunk/WebCore/bindings/js/JSImageConstructor.h</a></li>
<li><a href="#trunkWebCorebindingsjsJSMessageChannelConstructorcpp">trunk/WebCore/bindings/js/JSMessageChannelConstructor.cpp</a></li>
<li><a href="#trunkWebCorebindingsjsJSMessageChannelConstructorh">trunk/WebCore/bindings/js/JSMessageChannelConstructor.h</a></li>
<li><a href="#trunkWebCorebindingsjsJSOptionConstructorcpp">trunk/WebCore/bindings/js/JSOptionConstructor.cpp</a></li>
<li><a href="#trunkWebCorebindingsjsJSOptionConstructorh">trunk/WebCore/bindings/js/JSOptionConstructor.h</a></li>
<li><a href="#trunkWebCorebindingsjsJSXMLHttpRequestConstructorcpp">trunk/WebCore/bindings/js/JSXMLHttpRequestConstructor.cpp</a></li>
<li><a href="#trunkWebCorebindingsjsJSXMLHttpRequestConstructorh">trunk/WebCore/bindings/js/JSXMLHttpRequestConstructor.h</a></li>
<li><a href="#trunkWebCoredomActiveDOMObjectcpp">trunk/WebCore/dom/ActiveDOMObject.cpp</a></li>
<li><a href="#trunkWebCoredomActiveDOMObjecth">trunk/WebCore/dom/ActiveDOMObject.h</a></li>
<li><a href="#trunkWebCoredomDedicatedWorkercpp">trunk/WebCore/dom/DedicatedWorker.cpp</a></li>
<li><a href="#trunkWebCoredomDedicatedWorkerh">trunk/WebCore/dom/DedicatedWorker.h</a></li>
<li><a href="#trunkWebCoredomDocumentcpp">trunk/WebCore/dom/Document.cpp</a></li>
<li><a href="#trunkWebCoredomDocumenth">trunk/WebCore/dom/Document.h</a></li>
<li><a href="#trunkWebCoredomMessageChannelcpp">trunk/WebCore/dom/MessageChannel.cpp</a></li>
<li><a href="#trunkWebCoredomMessageChannelh">trunk/WebCore/dom/MessageChannel.h</a></li>
<li><a href="#trunkWebCoredomMessagePortcpp">trunk/WebCore/dom/MessagePort.cpp</a></li>
<li><a href="#trunkWebCoredomMessagePorth">trunk/WebCore/dom/MessagePort.h</a></li>
<li><a href="#trunkWebCorexmlXMLHttpRequestcpp">trunk/WebCore/xml/XMLHttpRequest.cpp</a></li>
<li><a href="#trunkWebCorexmlXMLHttpRequesth">trunk/WebCore/xml/XMLHttpRequest.h</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkWebCoredomScriptExecutionContextcpp">trunk/WebCore/dom/ScriptExecutionContext.cpp</a></li>
<li><a href="#trunkWebCoredomScriptExecutionContexth">trunk/WebCore/dom/ScriptExecutionContext.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/ChangeLog (37965 => 37966)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/ChangeLog        2008-10-29 06:01:41 UTC (rev 37965)
+++ trunk/WebCore/ChangeLog        2008-10-29 10:26:58 UTC (rev 37966)
</span><span class="lines">@@ -1,3 +1,130 @@
</span><ins>+2008-10-28  Alexey Proskuryakov  &lt;ap@webkit.org&gt;
+
+        Reviewed by Darin Adler.
+
+        https://bugs.webkit.org/show_bug.cgi?id=21923
+        Create an abstraction for script execution context
+
+        * GNUmakefile.am:
+        * WebCore.pro:
+        * WebCore.vcproj/WebCore.vcproj:
+        * WebCore.xcodeproj/project.pbxproj:
+        * WebCoreSources.bkl:
+        Added ScriptExecutionContext.{h,cpp}.
+
+        * bindings/js/JSAudioConstructor.cpp:
+        (WebCore::JSAudioConstructor::JSAudioConstructor):
+        * bindings/js/JSAudioConstructor.h:
+        * bindings/js/JSImageConstructor.cpp:
+        (WebCore::JSImageConstructor::JSImageConstructor):
+        * bindings/js/JSImageConstructor.h:
+        * bindings/js/JSOptionConstructor.cpp:
+        (WebCore::JSOptionConstructor::JSOptionConstructor):
+        * bindings/js/JSOptionConstructor.h:
+        * bindings/js/JSXMLHttpRequestConstructor.cpp:
+        (WebCore::JSXMLHttpRequestConstructor::JSXMLHttpRequestConstructor):
+        * bindings/js/JSXMLHttpRequestConstructor.h:
+        Pass ScriptExecutionContext instead of Document to make getDOMConstructor() happy.
+        Since these objects can only work within documents now, it is immediately converted back
+        to Document.
+
+        * bindings/js/JSMessageChannelConstructor.cpp:
+        (WebCore::JSMessageChannelConstructor::JSMessageChannelConstructor):
+        (WebCore::JSMessageChannelConstructor::construct):
+        * bindings/js/JSMessageChannelConstructor.h:
+        (WebCore::JSMessageChannelConstructor::scriptExecutionContext):
+        MessageChannel needs to be supported in workers right away, so the constructor operates with
+        it directly.
+
+        * dom/ActiveDOMObject.cpp:
+        (WebCore::ActiveDOMObject::ActiveDOMObject):
+        (WebCore::ActiveDOMObject::~ActiveDOMObject):
+        (WebCore::ActiveDOMObject::contextDestroyed):
+        * dom/ActiveDOMObject.h:
+        (WebCore::ActiveDOMObject::scriptExecutionContext):
+        * bindings/js/JSDOMBinding.cpp:
+        (WebCore::markActiveObjectsForContext):
+        (WebCore::markCrossHeapDependentObjectsForContext):
+        Use ScriptExecutionContext instead of Document, now that ActiveDOMObject and MessagePort
+        tracking is handled by ScriptExecutionContext.
+
+        * bindings/js/JSDOMBinding.h: (WebCore::getDOMPrototype): Moved to JSDOMGlobalObject.
+
+        * bindings/js/JSDOMGlobalObject.h:
+        (WebCore::getDOMConstructor): Moved to this file, as constructors live in JSDOMGlobalObject.
+        Also, the two-argument version that used to be in JSDOMWindowBase.cpp need to be accessible
+        to worker context implementation.
+        (WebCore::scriptExecutionContext): Added a pure virtual method to access
+        ScriptExecutionContext, implemented by subclasses.
+
+        * bindings/js/JSDOMWindowBase.h:
+        * bindings/js/JSDOMWindowBase.cpp: (WebCore::JSDOMWindowBase::scriptExecutionContext):
+        Implement by returning the associated document. Note that this method currently gives bogus
+        results after navigation - DOMWindow Frame reference is not zeroed out, so we get a document
+        that is currently in the frame, not the one associated with this window.
+
+        * bindings/js/JSDedicatedWorkerConstructor.cpp: Removed unnecessary include of DOMWindow.h.
+
+        * bindings/js/JSDocumentCustom.cpp: (WebCore::JSDocument::mark):
+        Call markActiveObjectsForContext() by its new name.
+
+        * dom/DedicatedWorker.cpp:
+        (WebCore::DedicatedWorker::DedicatedWorker):
+        (WebCore::DedicatedWorker::document):
+        * dom/DedicatedWorker.h:
+        * xml/XMLHttpRequest.cpp:
+        (WebCore::XMLHttpRequest::document):
+        * xml/XMLHttpRequest.h:
+        Added a document() function that upcasts ScriptExecutionContext, as these objects only work
+        within documents currently (at least for XMLHttpRequest, this will change soon though).
+
+        * dom/Document.cpp:
+        (WebCore::Document::Document):
+        (WebCore::Document::~Document):
+        Moved active object and MessagePort tracking up to ScriptExecutionContext, to share code
+        with workers.
+        
+        * dom/Document.h:
+        (WebCore::Document::isDocument):
+        (WebCore::Document::refScriptExecutionContext):
+        (WebCore::Document::derefScriptExecutionContext):
+        Inherit from ScriptExecutionContext.
+
+        * dom/MessageChannel.cpp:
+        (WebCore::MessageChannel::MessageChannel):
+        * dom/MessageChannel.h:
+        (WebCore::MessageChannel::create):
+        Use ScriptExecutionContext instead of Document.
+
+        * dom/MessagePort.cpp:
+        (WebCore::CloseMessagePortTimer::CloseMessagePortTimer): Make m_port a RefPtr, because
+        MessagePort doesn't ref() itself when posting this event any more (this is a fix for an
+        unrelated issue that was causing random crashes in layout tests).
+        (WebCore::MessagePort::MessagePort):
+        (WebCore::MessagePort::~MessagePort):
+        (WebCore::MessagePort::associatedFrame):
+        (WebCore::MessagePort::clone):
+        (WebCore::MessagePort::postMessage):
+        (WebCore::MessagePort::startConversation):
+        (WebCore::MessagePort::start):
+        (WebCore::MessagePort::contextDestroyed):
+        (WebCore::MessagePort::dispatchMessages):
+        * dom/MessagePort.h:
+        (WebCore::MessagePort::create):
+        (WebCore::MessagePort::scriptExecutionContext):
+        Use ScriptExecutionContext instead of Document. This is a step toward making MessagePort
+        work in worker contexts - we need to also make some its method thread safe for cross-thread
+        messaging, and make event dispatching thread safe.
+
+        * dom/ScriptExecutionContext.cpp: Added.
+        * dom/ScriptExecutionContext.h: Added.
+        ActiveDOMObject and MessagePort tracking is moved from Document.
+        It is debatable whether ScriptExecutionContext should be a parent of Document or DOMWindow,
+        but as I'm just moving Document code, and it is Document that is the main context object
+        in our implementation currently.
+        Changing ScriptExecutionContext to be a parent of DOMWindow causes a number of bugs that
+        seem non-trivial to fix, and isn't really a part of this task.
+
</ins><span class="cx"> 2008-10-28  Alp Toker  &lt;alp@nuanti.com&gt;
</span><span class="cx"> 
</span><span class="cx">         List newly-added ImageBufferData.h in build system.
</span></span></pre></div>
<a id="trunkWebCoreGNUmakefileam"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/GNUmakefile.am (37965 => 37966)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/GNUmakefile.am        2008-10-29 06:01:41 UTC (rev 37965)
+++ trunk/WebCore/GNUmakefile.am        2008-10-29 10:26:58 UTC (rev 37966)
</span><span class="lines">@@ -627,6 +627,8 @@
</span><span class="cx">         WebCore/dom/RegisteredEventListener.h \
</span><span class="cx">         WebCore/dom/ScriptElement.cpp \
</span><span class="cx">         WebCore/dom/ScriptElement.h \
</span><ins>+        WebCore/dom/ScriptExecutionContext.cpp \
+        WebCore/dom/ScriptExecutionContext.h \
</ins><span class="cx">         WebCore/dom/SelectorNodeList.cpp \
</span><span class="cx">         WebCore/dom/SelectorNodeList.h \
</span><span class="cx">         WebCore/dom/StaticNodeList.cpp \
</span></span></pre></div>
<a id="trunkWebCoreWebCorepro"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/WebCore.pro (37965 => 37966)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/WebCore.pro        2008-10-29 06:01:41 UTC (rev 37965)
+++ trunk/WebCore/WebCore.pro        2008-10-29 10:26:58 UTC (rev 37966)
</span><span class="lines">@@ -563,6 +563,7 @@
</span><span class="cx">     dom/Range.cpp \
</span><span class="cx">     dom/RegisteredEventListener.cpp \
</span><span class="cx">     dom/ScriptElement.cpp \
</span><ins>+    dom/ScriptExecutionContext.cpp \
</ins><span class="cx">     dom/SelectorNodeList.cpp \
</span><span class="cx">     dom/StaticNodeList.cpp \
</span><span class="cx">     dom/StyledElement.cpp \
</span></span></pre></div>
<a id="trunkWebCoreWebCorevcprojWebCorevcproj"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/WebCore.vcproj/WebCore.vcproj (37965 => 37966)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/WebCore.vcproj/WebCore.vcproj        2008-10-29 06:01:41 UTC (rev 37965)
+++ trunk/WebCore/WebCore.vcproj/WebCore.vcproj        2008-10-29 10:26:58 UTC (rev 37966)
</span><span class="lines">@@ -11118,6 +11118,22 @@
</span><span class="cx">                                 &gt;
</span><span class="cx">                         &lt;/File&gt;
</span><span class="cx">                         &lt;File
</span><ins>+                                RelativePath=&quot;..\dom\ScriptExecutionContext.cpp&quot;
+                                &gt;
+                                &lt;FileConfiguration
+                                        Name=&quot;Release_PGO|Win32&quot;
+                                        &gt;
+                                        &lt;Tool
+                                                Name=&quot;VCCLCompilerTool&quot;
+                                                WholeProgramOptimization=&quot;true&quot;
+                                        /&gt;
+                                &lt;/FileConfiguration&gt;
+                        &lt;/File&gt;
+                        &lt;File
+                                RelativePath=&quot;..\dom\ScriptExecutionContext.h&quot;
+                                &gt;
+                        &lt;/File&gt;
+                        &lt;File
</ins><span class="cx">                                 RelativePath=&quot;..\dom\SelectorNodeList.cpp&quot;
</span><span class="cx">                                 &gt;
</span><span class="cx">                                 &lt;FileConfiguration
</span></span></pre></div>
<a id="trunkWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/WebCore.xcodeproj/project.pbxproj (37965 => 37966)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/WebCore.xcodeproj/project.pbxproj        2008-10-29 06:01:41 UTC (rev 37965)
+++ trunk/WebCore/WebCore.xcodeproj/project.pbxproj        2008-10-29 10:26:58 UTC (rev 37966)
</span><span class="lines">@@ -4142,6 +4142,8 @@
</span><span class="cx">                 E10B9B6D0B747599003ED890 /* NativeXPathNSResolver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E10B9B6B0B747599003ED890 /* NativeXPathNSResolver.cpp */; };
</span><span class="cx">                 E10B9CCC0B747A44003ED890 /* DOMCustomXPathNSResolver.h in Headers */ = {isa = PBXBuildFile; fileRef = E10B9CCA0B747A44003ED890 /* DOMCustomXPathNSResolver.h */; };
</span><span class="cx">                 E10B9CCD0B747A44003ED890 /* DOMCustomXPathNSResolver.mm in Sources */ = {isa = PBXBuildFile; fileRef = E10B9CCB0B747A44003ED890 /* DOMCustomXPathNSResolver.mm */; };
</span><ins>+                E11C9D9B0EB3681200E409DB /* ScriptExecutionContext.h in Headers */ = {isa = PBXBuildFile; fileRef = E11C9D9A0EB3681200E409DB /* ScriptExecutionContext.h */; settings = {ATTRIBUTES = (Private, ); }; };
+                E11C9DB00EB3699500E409DB /* ScriptExecutionContext.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E11C9DAF0EB3699500E409DB /* ScriptExecutionContext.cpp */; };
</ins><span class="cx">                 E12EDB7B0B308A78002704B6 /* EventTarget.h in Headers */ = {isa = PBXBuildFile; fileRef = E12EDB7A0B308A78002704B6 /* EventTarget.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 E12EDBEA0B308E0B002704B6 /* EventTarget.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E12EDBE90B308E0B002704B6 /* EventTarget.cpp */; };
</span><span class="cx">                 E17A4A1B0D97991D00FC10C6 /* DOMSVGAltGlyphElement.h in Copy Generated Headers */ = {isa = PBXBuildFile; fileRef = 65AA6BAC0D974A00000541AE /* DOMSVGAltGlyphElement.h */; };
</span><span class="lines">@@ -8752,6 +8754,8 @@
</span><span class="cx">                 E10B9B6B0B747599003ED890 /* NativeXPathNSResolver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NativeXPathNSResolver.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 E10B9CCA0B747A44003ED890 /* DOMCustomXPathNSResolver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMCustomXPathNSResolver.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 E10B9CCB0B747A44003ED890 /* DOMCustomXPathNSResolver.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DOMCustomXPathNSResolver.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                E11C9D9A0EB3681200E409DB /* ScriptExecutionContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptExecutionContext.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                E11C9DAF0EB3699500E409DB /* ScriptExecutionContext.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScriptExecutionContext.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 E12EDB7A0B308A78002704B6 /* EventTarget.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EventTarget.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 E12EDBE90B308E0B002704B6 /* EventTarget.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = EventTarget.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 E1A302BB0DE8370300C52F2C /* StringBuilder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StringBuilder.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -13978,6 +13982,8 @@
</span><span class="cx">                                 85031B360A44EFC700F992E0 /* RegisteredEventListener.h */,
</span><span class="cx">                                 08A484750E5272C500C3FE76 /* ScriptElement.cpp */,
</span><span class="cx">                                 08A484760E5272C500C3FE76 /* ScriptElement.h */,
</span><ins>+                                E11C9DAF0EB3699500E409DB /* ScriptExecutionContext.cpp */,
+                                E11C9D9A0EB3681200E409DB /* ScriptExecutionContext.h */,
</ins><span class="cx">                                 BC7FA6800D1F167900DB22A9 /* SelectorNodeList.cpp */,
</span><span class="cx">                                 BC7FA67F0D1F167900DB22A9 /* SelectorNodeList.h */,
</span><span class="cx">                                 BC7FA62C0D1F0EFF00DB22A9 /* StaticNodeList.cpp */,
</span><span class="lines">@@ -16154,6 +16160,7 @@
</span><span class="cx">                                 BCFF64920EAD15C200C1D6F7 /* LengthSize.h in Headers */,
</span><span class="cx">                                 E1C36C030EB076D6007410BC /* JSDOMGlobalObject.h in Headers */,
</span><span class="cx">                                 0FC705210EB1815600B90AD8 /* AtomicStringHash.h in Headers */,
</span><ins>+                                E11C9D9B0EB3681200E409DB /* ScriptExecutionContext.h in Headers */,
</ins><span class="cx">                         );
</span><span class="cx">                         runOnlyForDeploymentPostprocessing = 0;
</span><span class="cx">                 };
</span><span class="lines">@@ -18039,6 +18046,7 @@
</span><span class="cx">                                 BCE65BEA0EACDF16007E4533 /* Length.cpp in Sources */,
</span><span class="cx">                                 BCE65D320EAD1211007E4533 /* Theme.cpp in Sources */,
</span><span class="cx">                                 E1C36CBD0EB08062007410BC /* JSDOMGlobalObject.cpp in Sources */,
</span><ins>+                                E11C9DB00EB3699500E409DB /* ScriptExecutionContext.cpp in Sources */,
</ins><span class="cx">                         );
</span><span class="cx">                         runOnlyForDeploymentPostprocessing = 0;
</span><span class="cx">                 };
</span></span></pre></div>
<a id="trunkWebCoreWebCoreSourcesbkl"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/WebCoreSources.bkl (37965 => 37966)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/WebCoreSources.bkl        2008-10-29 06:01:41 UTC (rev 37965)
+++ trunk/WebCore/WebCoreSources.bkl        2008-10-29 10:26:58 UTC (rev 37966)
</span><span class="lines">@@ -428,6 +428,7 @@
</span><span class="cx">         dom/Range.cpp
</span><span class="cx">         dom/RegisteredEventListener.cpp
</span><span class="cx">         dom/ScriptElement.cpp
</span><ins>+        dom/ScriptExecutionContext.cpp
</ins><span class="cx">         dom/SelectorNodeList.cpp
</span><span class="cx">         dom/StaticNodeList.cpp
</span><span class="cx">         dom/StyleElement.cpp
</span></span></pre></div>
<a id="trunkWebCorebindingsjsJSAudioConstructorcpp"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/bindings/js/JSAudioConstructor.cpp (37965 => 37966)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/bindings/js/JSAudioConstructor.cpp        2008-10-29 06:01:41 UTC (rev 37965)
+++ trunk/WebCore/bindings/js/JSAudioConstructor.cpp        2008-10-29 10:26:58 UTC (rev 37966)
</span><span class="lines">@@ -29,9 +29,9 @@
</span><span class="cx"> 
</span><span class="cx"> #include &quot;JSAudioConstructor.h&quot;
</span><span class="cx"> 
</span><del>-#include &quot;Document.h&quot;
</del><span class="cx"> #include &quot;HTMLAudioElement.h&quot;
</span><span class="cx"> #include &quot;JSHTMLAudioElement.h&quot;
</span><ins>+#include &quot;ScriptExecutionContext.h&quot;
</ins><span class="cx"> #include &quot;Text.h&quot;
</span><span class="cx"> 
</span><span class="cx"> using namespace JSC;
</span><span class="lines">@@ -40,10 +40,12 @@
</span><span class="cx"> 
</span><span class="cx"> const ClassInfo JSAudioConstructor::s_info = { &quot;AudioConstructor&quot;, 0, 0, 0 };
</span><span class="cx"> 
</span><del>-JSAudioConstructor::JSAudioConstructor(ExecState* exec, Document* document)
</del><ins>+JSAudioConstructor::JSAudioConstructor(ExecState* exec, ScriptExecutionContext* context)
</ins><span class="cx">     : DOMObject(JSAudioConstructor::createStructureID(exec-&gt;lexicalGlobalObject()-&gt;objectPrototype()))
</span><del>-    , m_document(static_cast&lt;JSDocument*&gt;(asObject(toJS(exec, document))))
</del><span class="cx"> {
</span><ins>+    ASSERT(context-&gt;isDocument());
+    m_document = static_cast&lt;JSDocument*&gt;(asObject(toJS(exec, static_cast&lt;Document*&gt;(context))));
+
</ins><span class="cx">     putDirect(exec-&gt;propertyNames().length, jsNumber(exec, 1), ReadOnly|DontDelete|DontEnum);
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkWebCorebindingsjsJSAudioConstructorh"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/bindings/js/JSAudioConstructor.h (37965 => 37966)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/bindings/js/JSAudioConstructor.h        2008-10-29 06:01:41 UTC (rev 37965)
+++ trunk/WebCore/bindings/js/JSAudioConstructor.h        2008-10-29 10:26:58 UTC (rev 37966)
</span><span class="lines">@@ -36,7 +36,7 @@
</span><span class="cx"> 
</span><span class="cx">     class JSAudioConstructor : public DOMObject {
</span><span class="cx">     public:
</span><del>-        JSAudioConstructor(JSC::ExecState*, Document*);
</del><ins>+        JSAudioConstructor(JSC::ExecState*, ScriptExecutionContext*);
</ins><span class="cx"> 
</span><span class="cx">         Document* document() const { return m_document-&gt;impl(); }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkWebCorebindingsjsJSDOMBindingcpp"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/bindings/js/JSDOMBinding.cpp (37965 => 37966)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/bindings/js/JSDOMBinding.cpp        2008-10-29 06:01:41 UTC (rev 37965)
+++ trunk/WebCore/bindings/js/JSDOMBinding.cpp        2008-10-29 10:26:58 UTC (rev 37966)
</span><span class="lines">@@ -35,7 +35,6 @@
</span><span class="cx"> #include &quot;HTMLImageElement.h&quot;
</span><span class="cx"> #include &quot;HTMLNames.h&quot;
</span><span class="cx"> #include &quot;JSDOMCoreException.h&quot;
</span><del>-#include &quot;JSDOMGlobalObject.h&quot;
</del><span class="cx"> #include &quot;JSDOMWindowCustom.h&quot;
</span><span class="cx"> #include &quot;JSEventException.h&quot;
</span><span class="cx"> #include &quot;JSNode.h&quot;
</span><span class="lines">@@ -281,12 +280,12 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void markActiveObjectsForDocument(JSGlobalData&amp; globalData, Document* doc)
</del><ins>+void markActiveObjectsForContext(JSGlobalData&amp; globalData, ScriptExecutionContext* scriptExecutionContext)
</ins><span class="cx"> {
</span><span class="cx">     // If an element has pending activity that may result in listeners being called
</span><span class="cx">     // (e.g. an XMLHttpRequest), we need to keep all JS wrappers alive.
</span><span class="cx"> 
</span><del>-    const HashMap&lt;ActiveDOMObject*, void*&gt;&amp; activeObjects = doc-&gt;activeDOMObjects();
</del><ins>+    const HashMap&lt;ActiveDOMObject*, void*&gt;&amp; activeObjects = scriptExecutionContext-&gt;activeDOMObjects();
</ins><span class="cx">     HashMap&lt;ActiveDOMObject*, void*&gt;::const_iterator activeObjectsEnd = activeObjects.end();
</span><span class="cx">     for (HashMap&lt;ActiveDOMObject*, void*&gt;::const_iterator iter = activeObjects.begin(); iter != activeObjectsEnd; ++iter) {
</span><span class="cx">         if (iter-&gt;first-&gt;hasPendingActivity()) {
</span><span class="lines">@@ -297,7 +296,7 @@
</span><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    const HashSet&lt;MessagePort*&gt;&amp; messagePorts = doc-&gt;messagePorts();
</del><ins>+    const HashSet&lt;MessagePort*&gt;&amp; messagePorts = scriptExecutionContext-&gt;messagePorts();
</ins><span class="cx">     HashSet&lt;MessagePort*&gt;::const_iterator portsEnd = messagePorts.end();
</span><span class="cx">     for (HashSet&lt;MessagePort*&gt;::const_iterator iter = messagePorts.begin(); iter != portsEnd; ++iter) {
</span><span class="cx">         if ((*iter)-&gt;hasPendingActivity()) {
</span><span class="lines">@@ -309,9 +308,9 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void markCrossHeapDependentObjectsForDocument(JSGlobalData&amp; globalData, Document* document)
</del><ins>+void markCrossHeapDependentObjectsForContext(JSGlobalData&amp; globalData, ScriptExecutionContext* scriptExecutionContext)
</ins><span class="cx"> {
</span><del>-    const HashSet&lt;MessagePort*&gt;&amp; messagePorts = document-&gt;messagePorts();
</del><ins>+    const HashSet&lt;MessagePort*&gt;&amp; messagePorts = scriptExecutionContext-&gt;messagePorts();
</ins><span class="cx">     HashSet&lt;MessagePort*&gt;::const_iterator portsEnd = messagePorts.end();
</span><span class="cx">     for (HashSet&lt;MessagePort*&gt;::const_iterator iter = messagePorts.begin(); iter != portsEnd; ++iter) {
</span><span class="cx">         MessagePort* port = *iter;
</span><span class="lines">@@ -324,7 +323,7 @@
</span><span class="cx"> 
</span><span class="cx">             // Don't use cross-heap model of marking on same-heap pairs. Otherwise, they will never be destroyed, because a port will mark its entangled one,
</span><span class="cx">             // and it will never get a chance to be marked as inaccessible. So, the port will keep getting marked in this function.
</span><del>-            if ((port-&gt;document() &amp;&amp; entangledPort-&gt;document()) || (port-&gt;workerContext() == entangledPort-&gt;workerContext()))
</del><ins>+            if ((port-&gt;scriptExecutionContext() == entangledPort-&gt;scriptExecutionContext()) || (port-&gt;scriptExecutionContext()-&gt;isDocument() &amp;&amp; entangledPort-&gt;scriptExecutionContext()-&gt;isDocument()))
</ins><span class="cx">                 continue;
</span><span class="cx"> 
</span><span class="cx">             // If the wrapper hasn't been marked during the mark phase of GC, then the port shouldn't protect its entangled one.
</span></span></pre></div>
<a id="trunkWebCorebindingsjsJSDOMBindingh"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/bindings/js/JSDOMBinding.h (37965 => 37966)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/bindings/js/JSDOMBinding.h        2008-10-29 06:01:41 UTC (rev 37965)
+++ trunk/WebCore/bindings/js/JSDOMBinding.h        2008-10-29 10:26:58 UTC (rev 37966)
</span><span class="lines">@@ -21,9 +21,10 @@
</span><span class="cx"> #ifndef JSDOMBinding_h
</span><span class="cx"> #define JSDOMBinding_h
</span><span class="cx"> 
</span><del>-#include &lt;runtime/JSFunction.h&gt;
</del><ins>+#include &quot;JSDOMGlobalObject.h&quot;
</ins><span class="cx"> #include &lt;kjs/interpreter.h&gt;
</span><span class="cx"> #include &lt;kjs/lookup.h&gt;
</span><ins>+#include &lt;runtime/JSFunction.h&gt;
</ins><span class="cx"> #include &lt;wtf/Noncopyable.h&gt;
</span><span class="cx"> 
</span><span class="cx"> namespace JSC {
</span><span class="lines">@@ -68,9 +69,9 @@
</span><span class="cx">     void forgetAllDOMNodesForDocument(Document*);
</span><span class="cx">     void updateDOMNodeDocument(Node*, Document* oldDocument, Document* newDocument);
</span><span class="cx">     void markDOMNodesForDocument(Document*);
</span><del>-    void markActiveObjectsForDocument(JSC::JSGlobalData&amp;, Document*);
</del><ins>+    void markActiveObjectsForContext(JSC::JSGlobalData&amp;, ScriptExecutionContext*);
</ins><span class="cx">     void markDOMObjectWrapper(JSC::JSGlobalData&amp; globalData, void* object);
</span><del>-    void markCrossHeapDependentObjectsForDocument(JSC::JSGlobalData&amp;, Document*);
</del><ins>+    void markCrossHeapDependentObjectsForContext(JSC::JSGlobalData&amp;, ScriptExecutionContext*);
</ins><span class="cx"> 
</span><span class="cx">     JSC::StructureID* getCachedDOMStructure(JSC::ExecState*, const JSC::ClassInfo*);
</span><span class="cx">     JSC::StructureID* cacheDOMStructure(JSC::ExecState*, PassRefPtr&lt;JSC::StructureID&gt;, const JSC::ClassInfo*);
</span><span class="lines">@@ -88,15 +89,6 @@
</span><span class="cx">     {
</span><span class="cx">         return static_cast&lt;JSC::JSObject*&gt;(asObject(getDOMStructure&lt;WrapperClass&gt;(exec)-&gt;storedPrototype()));
</span><span class="cx">     }
</span><del>-    template&lt;class ConstructorClass&gt; inline JSC::JSObject* getDOMConstructor(JSC::ExecState* exec)
-    {
-        if (JSC::JSObject* constructor = getCachedDOMConstructor(exec, &amp;ConstructorClass::s_info))
-            return constructor;
-        JSC::JSObject* constructor = new (exec) ConstructorClass(exec);
-        cacheDOMConstructor(exec, &amp;ConstructorClass::s_info, constructor);
-        return constructor;
-    }
-
</del><span class="cx">     #define CREATE_DOM_OBJECT_WRAPPER(exec, className, object) createDOMObjectWrapper&lt;JS##className&gt;(exec, static_cast&lt;className*&gt;(object))
</span><span class="cx">     template&lt;class WrapperClass, class DOMClass&gt; inline DOMObject* createDOMObjectWrapper(JSC::ExecState* exec, DOMClass* object)
</span><span class="cx">     {
</span></span></pre></div>
<a id="trunkWebCorebindingsjsJSDOMGlobalObjecth"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/bindings/js/JSDOMGlobalObject.h (37965 => 37966)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/bindings/js/JSDOMGlobalObject.h        2008-10-29 06:01:41 UTC (rev 37965)
+++ trunk/WebCore/bindings/js/JSDOMGlobalObject.h        2008-10-29 10:26:58 UTC (rev 37966)
</span><span class="lines">@@ -31,6 +31,8 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><ins>+    class ScriptExecutionContext;
+
</ins><span class="cx">     typedef HashMap&lt;const JSC::ClassInfo*, RefPtr&lt;JSC::StructureID&gt; &gt; JSDOMStructureMap;
</span><span class="cx">     typedef HashMap&lt;const JSC::ClassInfo*, JSC::JSObject*&gt; JSDOMConstructorMap;
</span><span class="cx"> 
</span><span class="lines">@@ -45,14 +47,38 @@
</span><span class="cx">         JSDOMGlobalObject(PassRefPtr&lt;JSC::StructureID&gt;, JSDOMGlobalObjectData*, JSC::JSObject* thisValue);
</span><span class="cx"> 
</span><span class="cx">     public:
</span><del>-        JSDOMGlobalObjectData* d() const { return static_cast&lt;JSDOMGlobalObjectData*&gt;(JSC::JSVariableObject::d); }
-
</del><span class="cx">         JSDOMStructureMap&amp; structures() { return d()-&gt;structures; }
</span><span class="cx">         JSDOMConstructorMap&amp; constructors() const { return d()-&gt;constructors; }
</span><span class="cx"> 
</span><ins>+        virtual ScriptExecutionContext* scriptExecutionContext() const = 0;
+
</ins><span class="cx">         virtual void mark();
</span><ins>+
+    private:
+        JSDOMGlobalObjectData* d() const { return static_cast&lt;JSDOMGlobalObjectData*&gt;(JSC::JSVariableObject::d); }
</ins><span class="cx">     };
</span><span class="cx"> 
</span><ins>+    template&lt;class ConstructorClass&gt;
+    inline JSC::JSObject* getDOMConstructor(JSC::ExecState* exec)
+    {
+        if (JSC::JSObject* constructor = getCachedDOMConstructor(exec, &amp;ConstructorClass::s_info))
+            return constructor;
+        JSC::JSObject* constructor = new (exec) ConstructorClass(exec);
+        cacheDOMConstructor(exec, &amp;ConstructorClass::s_info, constructor);
+        return constructor;
+    }
+
+    template&lt;class ConstructorClass&gt;
+    inline JSC::JSObject* getDOMConstructor(JSC::ExecState* exec, JSDOMGlobalObject* globalObject)
+    {
+        if (JSC::JSObject* constructor = globalObject-&gt;constructors().get(&amp;ConstructorClass::s_info))
+            return constructor;
+        JSC::JSObject* constructor = new (exec) ConstructorClass(exec, globalObject-&gt;scriptExecutionContext());
+        ASSERT(!globalObject-&gt;constructors().contains(&amp;ConstructorClass::s_info));
+        globalObject-&gt;constructors().set(&amp;ConstructorClass::s_info, constructor);
+        return constructor;
+    }
+
</ins><span class="cx"> } // namespace WebCore
</span><span class="cx"> 
</span><span class="cx"> #endif // JSDOMGlobalObject_h
</span></span></pre></div>
<a id="trunkWebCorebindingsjsJSDOMWindowBasecpp"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/bindings/js/JSDOMWindowBase.cpp (37965 => 37966)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/bindings/js/JSDOMWindowBase.cpp        2008-10-29 06:01:41 UTC (rev 37965)
+++ trunk/WebCore/bindings/js/JSDOMWindowBase.cpp        2008-10-29 10:26:58 UTC (rev 37966)
</span><span class="lines">@@ -223,6 +223,11 @@
</span><span class="cx">         i1-&gt;second-&gt;clearWindow();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+ScriptExecutionContext* JSDOMWindowBase::scriptExecutionContext() const
+{
+    return d()-&gt;impl-&gt;document();
+}
+
</ins><span class="cx"> static bool allowPopUp(ExecState* exec)
</span><span class="cx"> {
</span><span class="cx">     Frame* frame = asJSDOMWindow(exec-&gt;dynamicGlobalObject())-&gt;impl()-&gt;frame();
</span><span class="lines">@@ -402,17 +407,6 @@
</span><span class="cx">     return returnValue ? returnValue : jsUndefined();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-template&lt;class ConstructorClass&gt;
-static JSObject* getDOMConstructor(JSC::ExecState* exec, const JSDOMWindowBase* window)
-{
-    if (JSObject* constructor = window-&gt;constructors().get(&amp;ConstructorClass::s_info))
-        return constructor;
-    JSObject* constructor = new (exec) ConstructorClass(exec, window-&gt;impl()-&gt;document());
-    ASSERT(!window-&gt;constructors().contains(&amp;ConstructorClass::s_info));
-    window-&gt;constructors().set(&amp;ConstructorClass::s_info, constructor);
-    return constructor;
-}
-
</del><span class="cx"> } // namespace WebCore
</span><span class="cx"> 
</span><span class="cx"> using namespace WebCore;
</span><span class="lines">@@ -526,7 +520,7 @@
</span><span class="cx">     if (!document)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    markCrossHeapDependentObjectsForDocument(*globalData(), document);
</del><ins>+    markCrossHeapDependentObjectsForContext(*globalData(), document);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool JSDOMWindowBase::getOwnPropertySlot(ExecState* exec, const Identifier&amp; propertyName, PropertySlot&amp; slot)
</span></span></pre></div>
<a id="trunkWebCorebindingsjsJSDOMWindowBaseh"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/bindings/js/JSDOMWindowBase.h (37965 => 37966)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/bindings/js/JSDOMWindowBase.h        2008-10-29 06:01:41 UTC (rev 37965)
+++ trunk/WebCore/bindings/js/JSDOMWindowBase.h        2008-10-29 10:26:58 UTC (rev 37966)
</span><span class="lines">@@ -22,7 +22,6 @@
</span><span class="cx"> 
</span><span class="cx"> #include &quot;PlatformString.h&quot;
</span><span class="cx"> #include &quot;JSDOMBinding.h&quot;
</span><del>-#include &quot;JSDOMGlobalObject.h&quot;
</del><span class="cx"> #include &lt;kjs/protect.h&gt;
</span><span class="cx"> #include &lt;wtf/HashMap.h&gt;
</span><span class="cx"> #include &lt;wtf/OwnPtr.h&gt;
</span><span class="lines">@@ -59,6 +58,7 @@
</span><span class="cx">         void updateDocument();
</span><span class="cx"> 
</span><span class="cx">         DOMWindow* impl() const { return d()-&gt;impl.get(); }
</span><ins>+        virtual ScriptExecutionContext* scriptExecutionContext() const;
</ins><span class="cx"> 
</span><span class="cx">         void disconnectFrame();
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkWebCorebindingsjsJSDedicatedWorkerConstructorcpp"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/bindings/js/JSDedicatedWorkerConstructor.cpp (37965 => 37966)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/bindings/js/JSDedicatedWorkerConstructor.cpp        2008-10-29 06:01:41 UTC (rev 37965)
+++ trunk/WebCore/bindings/js/JSDedicatedWorkerConstructor.cpp        2008-10-29 10:26:58 UTC (rev 37966)
</span><span class="lines">@@ -29,7 +29,6 @@
</span><span class="cx"> 
</span><span class="cx"> #include &quot;JSDedicatedWorkerConstructor.h&quot;
</span><span class="cx"> 
</span><del>-#include &quot;DOMWindow.h&quot;
</del><span class="cx"> #include &quot;DedicatedWorker.h&quot;
</span><span class="cx"> #include &quot;Document.h&quot;
</span><span class="cx"> #include &quot;ExceptionCode.h&quot;
</span></span></pre></div>
<a id="trunkWebCorebindingsjsJSDocumentCustomcpp"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/bindings/js/JSDocumentCustom.cpp (37965 => 37966)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/bindings/js/JSDocumentCustom.cpp        2008-10-29 06:01:41 UTC (rev 37965)
+++ trunk/WebCore/bindings/js/JSDocumentCustom.cpp        2008-10-29 10:26:58 UTC (rev 37966)
</span><span class="lines">@@ -46,7 +46,7 @@
</span><span class="cx"> {
</span><span class="cx">     JSEventTargetNode::mark();
</span><span class="cx">     markDOMNodesForDocument(impl());
</span><del>-    markActiveObjectsForDocument(*Heap::heap(this)-&gt;globalData(), impl());
</del><ins>+    markActiveObjectsForContext(*Heap::heap(this)-&gt;globalData(), impl());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> JSValue* JSDocument::location(ExecState* exec) const
</span></span></pre></div>
<a id="trunkWebCorebindingsjsJSImageConstructorcpp"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/bindings/js/JSImageConstructor.cpp (37965 => 37966)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/bindings/js/JSImageConstructor.cpp        2008-10-29 06:01:41 UTC (rev 37965)
+++ trunk/WebCore/bindings/js/JSImageConstructor.cpp        2008-10-29 10:26:58 UTC (rev 37966)
</span><span class="lines">@@ -20,9 +20,9 @@
</span><span class="cx"> #include &quot;config.h&quot;
</span><span class="cx"> #include &quot;JSImageConstructor.h&quot;
</span><span class="cx"> 
</span><del>-#include &quot;Document.h&quot;
</del><span class="cx"> #include &quot;HTMLImageElement.h&quot;
</span><span class="cx"> #include &quot;JSNode.h&quot;
</span><ins>+#include &quot;ScriptExecutionContext.h&quot;
</ins><span class="cx"> 
</span><span class="cx"> using namespace JSC;
</span><span class="cx"> 
</span><span class="lines">@@ -32,10 +32,11 @@
</span><span class="cx"> 
</span><span class="cx"> const ClassInfo JSImageConstructor::s_info = { &quot;ImageConstructor&quot;, 0, 0, 0 };
</span><span class="cx"> 
</span><del>-JSImageConstructor::JSImageConstructor(ExecState* exec, Document* document)
</del><ins>+JSImageConstructor::JSImageConstructor(ExecState* exec, ScriptExecutionContext* context)
</ins><span class="cx">     : DOMObject(JSImageConstructor::createStructureID(exec-&gt;lexicalGlobalObject()-&gt;objectPrototype()))
</span><del>-    , m_document(static_cast&lt;JSDocument*&gt;(asObject(toJS(exec, document))))
</del><span class="cx"> {
</span><ins>+    ASSERT(context-&gt;isDocument());
+    m_document = static_cast&lt;JSDocument*&gt;(asObject(toJS(exec, static_cast&lt;Document*&gt;(context))));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static JSObject* constructImage(ExecState* exec, JSObject* constructor, const ArgList&amp; args)
</span></span></pre></div>
<a id="trunkWebCorebindingsjsJSImageConstructorh"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/bindings/js/JSImageConstructor.h (37965 => 37966)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/bindings/js/JSImageConstructor.h        2008-10-29 06:01:41 UTC (rev 37965)
+++ trunk/WebCore/bindings/js/JSImageConstructor.h        2008-10-29 10:26:58 UTC (rev 37966)
</span><span class="lines">@@ -25,11 +25,9 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-    class Document;
-
</del><span class="cx">     class JSImageConstructor : public DOMObject {
</span><span class="cx">     public:
</span><del>-        JSImageConstructor(JSC::ExecState*, Document*);
</del><ins>+        JSImageConstructor(JSC::ExecState*, ScriptExecutionContext*);
</ins><span class="cx">         Document* document() const { return m_document-&gt;impl(); }
</span><span class="cx"> 
</span><span class="cx">         static const JSC::ClassInfo s_info;
</span></span></pre></div>
<a id="trunkWebCorebindingsjsJSMessageChannelConstructorcpp"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/bindings/js/JSMessageChannelConstructor.cpp (37965 => 37966)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/bindings/js/JSMessageChannelConstructor.cpp        2008-10-29 06:01:41 UTC (rev 37965)
+++ trunk/WebCore/bindings/js/JSMessageChannelConstructor.cpp        2008-10-29 10:26:58 UTC (rev 37966)
</span><span class="lines">@@ -27,6 +27,7 @@
</span><span class="cx"> #include &quot;JSMessageChannelConstructor.h&quot;
</span><span class="cx"> 
</span><span class="cx"> #include &quot;Document.h&quot;
</span><ins>+#include &quot;JSDocument.h&quot;
</ins><span class="cx"> #include &quot;JSMessageChannel.h&quot;
</span><span class="cx"> #include &quot;MessageChannel.h&quot;
</span><span class="cx"> 
</span><span class="lines">@@ -36,10 +37,17 @@
</span><span class="cx"> 
</span><span class="cx"> const ClassInfo JSMessageChannelConstructor::s_info = { &quot;MessageChannelConstructor&quot;, 0, 0, 0 };
</span><span class="cx"> 
</span><del>-JSMessageChannelConstructor::JSMessageChannelConstructor(ExecState* exec, Document* document)
</del><ins>+JSMessageChannelConstructor::JSMessageChannelConstructor(ExecState* exec, ScriptExecutionContext* scriptExecutionContext)
</ins><span class="cx">     : DOMObject(JSMessageChannelConstructor::createStructureID(exec-&gt;lexicalGlobalObject()-&gt;objectPrototype()))
</span><del>-    , m_document(static_cast&lt;JSDocument*&gt;(asObject(toJS(exec, document))))
</del><ins>+    , m_scriptExecutionContext(scriptExecutionContext)
</ins><span class="cx"> {
</span><ins>+    if (m_scriptExecutionContext-&gt;isDocument())
+        m_contextWrapper = toJS(exec, static_cast&lt;Document*&gt;(scriptExecutionContext));
+    else if (m_scriptExecutionContext-&gt;isWorkerContext())
+        ; // Not yet implemented.
+    else
+        ASSERT_NOT_REACHED();
+
</ins><span class="cx">     putDirect(exec-&gt;propertyNames().prototype, JSMessageChannelPrototype::self(exec), None);
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -55,14 +63,14 @@
</span><span class="cx"> 
</span><span class="cx"> JSObject* JSMessageChannelConstructor::construct(ExecState* exec, JSObject* constructor, const ArgList&amp;)
</span><span class="cx"> {
</span><del>-    return asObject(toJS(exec, MessageChannel::create(static_cast&lt;JSMessageChannelConstructor*&gt;(constructor)-&gt;document())));
</del><ins>+    return asObject(toJS(exec, MessageChannel::create(static_cast&lt;JSMessageChannelConstructor*&gt;(constructor)-&gt;scriptExecutionContext())));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void JSMessageChannelConstructor::mark()
</span><span class="cx"> {
</span><span class="cx">     DOMObject::mark();
</span><del>-    if (!m_document-&gt;marked())
-        m_document-&gt;mark();
</del><ins>+    if (!m_contextWrapper-&gt;marked())
+        m_contextWrapper-&gt;mark();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkWebCorebindingsjsJSMessageChannelConstructorh"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/bindings/js/JSMessageChannelConstructor.h (37965 => 37966)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/bindings/js/JSMessageChannelConstructor.h        2008-10-29 06:01:41 UTC (rev 37965)
+++ trunk/WebCore/bindings/js/JSMessageChannelConstructor.h        2008-10-29 10:26:58 UTC (rev 37966)
</span><span class="lines">@@ -27,28 +27,27 @@
</span><span class="cx"> #define JSMessageChannelConstructor_h
</span><span class="cx"> 
</span><span class="cx"> #include &quot;JSDOMBinding.h&quot;
</span><del>-#include &quot;JSDocument.h&quot;
</del><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-    class Frame;
-
</del><span class="cx">     class JSMessageChannelConstructor : public DOMObject {
</span><span class="cx">     public:
</span><del>-        JSMessageChannelConstructor(JSC::ExecState*, Document*);
</del><ins>+        JSMessageChannelConstructor(JSC::ExecState*, ScriptExecutionContext*);
</ins><span class="cx">         virtual ~JSMessageChannelConstructor();
</span><span class="cx">         virtual const JSC::ClassInfo* classInfo() const { return &amp;s_info; }
</span><span class="cx">         static const JSC::ClassInfo s_info;
</span><span class="cx"> 
</span><del>-        Document* document() const { return m_document-&gt;impl(); }
</del><ins>+        ScriptExecutionContext* scriptExecutionContext() const { return m_scriptExecutionContext; }
</ins><span class="cx"> 
</span><span class="cx">         virtual bool implementsHasInstance() const { return true; }
</span><span class="cx">         static JSC::JSObject* construct(JSC::ExecState*, JSC::JSObject*, const JSC::ArgList&amp;);
</span><span class="cx">         virtual JSC::ConstructType getConstructData(JSC::ConstructData&amp;);
</span><span class="cx"> 
</span><span class="cx">         virtual void mark();
</span><ins>+
</ins><span class="cx">     private:
</span><del>-        JSDocument* m_document;
</del><ins>+        ScriptExecutionContext* m_scriptExecutionContext;
+        JSC::JSValue* m_contextWrapper;
</ins><span class="cx">     };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkWebCorebindingsjsJSOptionConstructorcpp"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/bindings/js/JSOptionConstructor.cpp (37965 => 37966)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/bindings/js/JSOptionConstructor.cpp        2008-10-29 06:01:41 UTC (rev 37965)
+++ trunk/WebCore/bindings/js/JSOptionConstructor.cpp        2008-10-29 10:26:58 UTC (rev 37966)
</span><span class="lines">@@ -20,9 +20,9 @@
</span><span class="cx"> #include &quot;config.h&quot;
</span><span class="cx"> #include &quot;JSOptionConstructor.h&quot;
</span><span class="cx"> 
</span><del>-#include &quot;Document.h&quot;
</del><span class="cx"> #include &quot;HTMLOptionElement.h&quot;
</span><span class="cx"> #include &quot;JSHTMLOptionElement.h&quot;
</span><ins>+#include &quot;ScriptExecutionContext.h&quot;
</ins><span class="cx"> #include &quot;Text.h&quot;
</span><span class="cx"> 
</span><span class="cx"> using namespace JSC;
</span><span class="lines">@@ -33,10 +33,12 @@
</span><span class="cx"> 
</span><span class="cx"> const ClassInfo JSOptionConstructor::s_info = { &quot;OptionConstructor&quot;, 0, 0, 0 };
</span><span class="cx"> 
</span><del>-JSOptionConstructor::JSOptionConstructor(ExecState* exec, Document* document)
</del><ins>+JSOptionConstructor::JSOptionConstructor(ExecState* exec, ScriptExecutionContext* context)
</ins><span class="cx">     : DOMObject(JSOptionConstructor::createStructureID(exec-&gt;lexicalGlobalObject()-&gt;objectPrototype()))
</span><del>-    , m_document(static_cast&lt;JSDocument*&gt;(asObject(toJS(exec, document))))
</del><span class="cx"> {
</span><ins>+    ASSERT(context-&gt;isDocument());
+    m_document = static_cast&lt;JSDocument*&gt;(asObject(toJS(exec, static_cast&lt;Document*&gt;(context))));
+
</ins><span class="cx">     putDirect(exec-&gt;propertyNames().length, jsNumber(exec, 4), ReadOnly|DontDelete|DontEnum);
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkWebCorebindingsjsJSOptionConstructorh"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/bindings/js/JSOptionConstructor.h (37965 => 37966)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/bindings/js/JSOptionConstructor.h        2008-10-29 06:01:41 UTC (rev 37965)
+++ trunk/WebCore/bindings/js/JSOptionConstructor.h        2008-10-29 10:26:58 UTC (rev 37966)
</span><span class="lines">@@ -28,7 +28,7 @@
</span><span class="cx"> 
</span><span class="cx">     class JSOptionConstructor : public DOMObject {
</span><span class="cx">     public:
</span><del>-        JSOptionConstructor(JSC::ExecState*, Document*);
</del><ins>+        JSOptionConstructor(JSC::ExecState*, ScriptExecutionContext*);
</ins><span class="cx">         Document* document() const { return m_document-&gt;impl(); }
</span><span class="cx"> 
</span><span class="cx">         static const JSC::ClassInfo s_info;
</span></span></pre></div>
<a id="trunkWebCorebindingsjsJSXMLHttpRequestConstructorcpp"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/bindings/js/JSXMLHttpRequestConstructor.cpp (37965 => 37966)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/bindings/js/JSXMLHttpRequestConstructor.cpp        2008-10-29 06:01:41 UTC (rev 37965)
+++ trunk/WebCore/bindings/js/JSXMLHttpRequestConstructor.cpp        2008-10-29 10:26:58 UTC (rev 37966)
</span><span class="lines">@@ -20,8 +20,8 @@
</span><span class="cx"> #include &quot;config.h&quot;
</span><span class="cx"> #include &quot;JSXMLHttpRequestConstructor.h&quot;
</span><span class="cx"> 
</span><del>-#include &quot;Document.h&quot;
</del><span class="cx"> #include &quot;JSXMLHttpRequest.h&quot;
</span><ins>+#include &quot;ScriptExecutionContext.h&quot;
</ins><span class="cx"> #include &quot;XMLHttpRequest.h&quot;
</span><span class="cx"> 
</span><span class="cx"> using namespace JSC;
</span><span class="lines">@@ -32,10 +32,12 @@
</span><span class="cx"> 
</span><span class="cx"> const ClassInfo JSXMLHttpRequestConstructor::s_info = { &quot;XMLHttpRequestConstructor&quot;, 0, 0, 0 };
</span><span class="cx"> 
</span><del>-JSXMLHttpRequestConstructor::JSXMLHttpRequestConstructor(ExecState* exec, Document* document)
</del><ins>+JSXMLHttpRequestConstructor::JSXMLHttpRequestConstructor(ExecState* exec, ScriptExecutionContext* context)
</ins><span class="cx">     : DOMObject(JSXMLHttpRequestConstructor::createStructureID(exec-&gt;lexicalGlobalObject()-&gt;objectPrototype()))
</span><del>-    , m_document(static_cast&lt;JSDocument*&gt;(asObject(toJS(exec, document))))
</del><span class="cx"> {
</span><ins>+    ASSERT(context-&gt;isDocument());
+    m_document = static_cast&lt;JSDocument*&gt;(asObject(toJS(exec, static_cast&lt;Document*&gt;(context))));
+
</ins><span class="cx">     putDirect(exec-&gt;propertyNames().prototype, JSXMLHttpRequestPrototype::self(exec), None);
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkWebCorebindingsjsJSXMLHttpRequestConstructorh"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/bindings/js/JSXMLHttpRequestConstructor.h (37965 => 37966)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/bindings/js/JSXMLHttpRequestConstructor.h        2008-10-29 06:01:41 UTC (rev 37965)
+++ trunk/WebCore/bindings/js/JSXMLHttpRequestConstructor.h        2008-10-29 10:26:58 UTC (rev 37966)
</span><span class="lines">@@ -25,11 +25,9 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-class Document;
-
</del><span class="cx"> class JSXMLHttpRequestConstructor : public DOMObject {
</span><span class="cx"> public:
</span><del>-    JSXMLHttpRequestConstructor(JSC::ExecState*, Document*);
</del><ins>+    JSXMLHttpRequestConstructor(JSC::ExecState*, ScriptExecutionContext*);
</ins><span class="cx">     Document* document() const { return m_document-&gt;impl(); }
</span><span class="cx">     static const JSC::ClassInfo s_info;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkWebCoredomActiveDOMObjectcpp"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/dom/ActiveDOMObject.cpp (37965 => 37966)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/dom/ActiveDOMObject.cpp        2008-10-29 06:01:41 UTC (rev 37965)
+++ trunk/WebCore/dom/ActiveDOMObject.cpp        2008-10-29 10:26:58 UTC (rev 37966)
</span><span class="lines">@@ -27,26 +27,26 @@
</span><span class="cx"> #include &quot;config.h&quot;
</span><span class="cx"> #include &quot;ActiveDOMObject.h&quot;
</span><span class="cx"> 
</span><del>-#include &quot;Document.h&quot;
</del><ins>+#include &quot;ScriptExecutionContext.h&quot;
</ins><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-ActiveDOMObject::ActiveDOMObject(Document* document, void* upcastPointer)
-    : m_document(document)
</del><ins>+ActiveDOMObject::ActiveDOMObject(ScriptExecutionContext* scriptExecutionContext, void* upcastPointer)
+    : m_scriptExecutionContext(scriptExecutionContext)
</ins><span class="cx">     , m_pendingActivityCount(0)
</span><span class="cx"> {
</span><del>-    m_document-&gt;createdActiveDOMObject(this, upcastPointer);
</del><ins>+    m_scriptExecutionContext-&gt;createdActiveDOMObject(this, upcastPointer);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> ActiveDOMObject::~ActiveDOMObject()
</span><span class="cx"> {
</span><del>-    if (m_document)
-        m_document-&gt;destroyedActiveDOMObject(this);
</del><ins>+    if (m_scriptExecutionContext)
+        m_scriptExecutionContext-&gt;destroyedActiveDOMObject(this);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void ActiveDOMObject::contextDestroyed()
</span><span class="cx"> {
</span><del>-    m_document = 0;
</del><ins>+    m_scriptExecutionContext = 0;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void ActiveDOMObject::stop()
</span></span></pre></div>
<a id="trunkWebCoredomActiveDOMObjecth"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/dom/ActiveDOMObject.h (37965 => 37966)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/dom/ActiveDOMObject.h        2008-10-29 06:01:41 UTC (rev 37965)
+++ trunk/WebCore/dom/ActiveDOMObject.h        2008-10-29 10:26:58 UTC (rev 37966)
</span><span class="lines">@@ -31,13 +31,13 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-    class Document;
</del><ins>+    class ScriptExecutionContext;
</ins><span class="cx"> 
</span><span class="cx">     class ActiveDOMObject {
</span><span class="cx">     public:
</span><del>-        ActiveDOMObject(Document*, void* upcastPointer);
</del><ins>+        ActiveDOMObject(ScriptExecutionContext*, void* upcastPointer);
</ins><span class="cx"> 
</span><del>-        Document* document() const { return m_document; }
</del><ins>+        ScriptExecutionContext* scriptExecutionContext() const { return m_scriptExecutionContext; }
</ins><span class="cx">         bool hasPendingActivity() { return m_pendingActivityCount; }
</span><span class="cx"> 
</span><span class="cx">         virtual void contextDestroyed();
</span><span class="lines">@@ -61,7 +61,7 @@
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">     private:
</span><del>-        Document* m_document;
</del><ins>+        ScriptExecutionContext* m_scriptExecutionContext;
</ins><span class="cx">         unsigned m_pendingActivityCount;
</span><span class="cx">     };
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkWebCoredomDedicatedWorkercpp"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/dom/DedicatedWorker.cpp (37965 => 37966)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/dom/DedicatedWorker.cpp        2008-10-29 06:01:41 UTC (rev 37965)
+++ trunk/WebCore/dom/DedicatedWorker.cpp        2008-10-29 10:26:58 UTC (rev 37966)
</span><span class="lines">@@ -31,6 +31,7 @@
</span><span class="cx"> #include &quot;DedicatedWorker.h&quot;
</span><span class="cx"> 
</span><span class="cx"> #include &quot;CachedScript.h&quot;
</span><ins>+#include &quot;DOMWindow.h&quot;
</ins><span class="cx"> #include &quot;DocLoader.h&quot;
</span><span class="cx"> #include &quot;Document.h&quot;
</span><span class="cx"> #include &quot;Event.h&quot;
</span><span class="lines">@@ -41,6 +42,7 @@
</span><span class="cx"> #include &quot;FrameLoader.h&quot;
</span><span class="cx"> #include &quot;MessagePort.h&quot;
</span><span class="cx"> #include &quot;SecurityOrigin.h&quot;
</span><ins>+#include &quot;ScriptExecutionContext.h&quot;
</ins><span class="cx"> #include &quot;Timer.h&quot;
</span><span class="cx"> #include &lt;wtf/MainThread.h&gt;
</span><span class="cx"> 
</span><span class="lines">@@ -87,8 +89,14 @@
</span><span class="cx">     ASSERT(isMainThread());
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-PassRefPtr&lt;MessagePort&gt; DedicatedWorker::startConversation(Document* /*scriptContextDocument*/, const String&amp; /*message*/)
</del><ins>+Document* DedicatedWorker::document() const
</ins><span class="cx"> {
</span><ins>+    ASSERT(scriptExecutionContext()-&gt;isDocument());
+    return static_cast&lt;Document*&gt;(scriptExecutionContext());
+}
+
+PassRefPtr&lt;MessagePort&gt; DedicatedWorker::startConversation(ScriptExecutionContext* /*scriptExecutionContext*/, const String&amp; /*message*/)
+{
</ins><span class="cx">     // Not implemented.
</span><span class="cx">     return 0;
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkWebCoredomDedicatedWorkerh"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/dom/DedicatedWorker.h (37965 => 37966)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/dom/DedicatedWorker.h        2008-10-29 06:01:41 UTC (rev 37965)
+++ trunk/WebCore/dom/DedicatedWorker.h        2008-10-29 10:26:58 UTC (rev 37966)
</span><span class="lines">@@ -42,6 +42,7 @@
</span><span class="cx">     class CachedResource;
</span><span class="cx">     class CachedScript;
</span><span class="cx">     class Document;
</span><ins>+    class ScriptExecutionContext;
</ins><span class="cx">     class MessagePort;
</span><span class="cx">     class String;
</span><span class="cx"> 
</span><span class="lines">@@ -52,7 +53,9 @@
</span><span class="cx">         static PassRefPtr&lt;DedicatedWorker&gt; create(const String&amp; url, Document* document, ExceptionCode&amp; ec) { return adoptRef(new DedicatedWorker(url, document, ec)); }
</span><span class="cx">         ~DedicatedWorker();
</span><span class="cx"> 
</span><del>-        PassRefPtr&lt;MessagePort&gt; startConversation(Document*, const String&amp; message);
</del><ins>+        Document* document() const;
+
+        PassRefPtr&lt;MessagePort&gt; startConversation(ScriptExecutionContext*, const String&amp; message);
</ins><span class="cx">         void close();
</span><span class="cx">         void postMessage(const String&amp; message, MessagePort* port = 0);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkWebCoredomDocumentcpp"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/dom/Document.cpp (37965 => 37966)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/dom/Document.cpp        2008-10-29 06:01:41 UTC (rev 37965)
+++ trunk/WebCore/dom/Document.cpp        2008-10-29 10:26:58 UTC (rev 37966)
</span><span class="lines">@@ -75,7 +75,6 @@
</span><span class="cx"> #include &quot;KeyboardEvent.h&quot;
</span><span class="cx"> #include &quot;Logging.h&quot;
</span><span class="cx"> #include &quot;MessageEvent.h&quot;
</span><del>-#include &quot;MessagePort.h&quot;
</del><span class="cx"> #include &quot;MouseEvent.h&quot;
</span><span class="cx"> #include &quot;MouseEventWithHitTestResults.h&quot;
</span><span class="cx"> #include &quot;MutationEvent.h&quot;
</span><span class="lines">@@ -262,23 +261,6 @@
</span><span class="cx"> 
</span><span class="cx"> static HashSet&lt;Document*&gt;* changedDocuments = 0;
</span><span class="cx"> 
</span><del>-class MessagePortTimer : public TimerBase {
-public:
-    MessagePortTimer(PassRefPtr&lt;Document&gt; document)
-        : m_document(document)
-    {
-    }
-
-private:
-    virtual void fired()
-    {
-        m_document-&gt;dispatchMessagePortEvents();
-        delete this;
-    }
-
-    RefPtr&lt;Document&gt; m_document;
-};
-
</del><span class="cx"> Document::Document(Frame* frame, bool isXHTML)
</span><span class="cx">     : ContainerNode(0)
</span><span class="cx">     , m_domtree_version(0)
</span><span class="lines">@@ -292,7 +274,6 @@
</span><span class="cx"> #endif
</span><span class="cx">     , m_xmlVersion(&quot;1.0&quot;)
</span><span class="cx">     , m_xmlStandalone(false)
</span><del>-    , m_firedMessagePortTimer(false)
</del><span class="cx"> #if ENABLE(XBL)
</span><span class="cx">     , m_bindingManager(new XBLBindingManager(this))
</span><span class="cx"> #endif
</span><span class="lines">@@ -427,18 +408,6 @@
</span><span class="cx"> 
</span><span class="cx">     removeAllEventListeners();
</span><span class="cx"> 
</span><del>-    HashMap&lt;ActiveDOMObject*, void*&gt;::iterator activeObjectsEnd = m_activeDOMObjects.end();
-    for (HashMap&lt;ActiveDOMObject*, void*&gt;::iterator iter = m_activeDOMObjects.begin(); iter != activeObjectsEnd; ++iter) {
-        ASSERT(iter-&gt;first-&gt;document() == this);
-        iter-&gt;first-&gt;contextDestroyed();
-    }
-
-    HashSet&lt;MessagePort*&gt;::iterator messagePortsEnd = m_messagePorts.end();
-    for (HashSet&lt;MessagePort*&gt;::iterator iter = m_messagePorts.begin(); iter != messagePortsEnd; ++iter) {
-        ASSERT((*iter)-&gt;document() == this);
-        (*iter)-&gt;contextDestroyed();
-    }
-
</del><span class="cx">     forgetAllDOMNodesForDocument(this);
</span><span class="cx"> 
</span><span class="cx">     if (m_docChanged &amp;&amp; changedDocuments)
</span><span class="lines">@@ -4365,69 +4334,6 @@
</span><span class="cx">     return result.get();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void Document::processMessagePortMessagesSoon()
-{
-    if (m_firedMessagePortTimer)
-        return;
-
-    MessagePortTimer* timer = new MessagePortTimer(this);
-    timer-&gt;startOneShot(0);
-
-    m_firedMessagePortTimer = true;
-}
-
-void Document::dispatchMessagePortEvents()
-{
-    RefPtr&lt;Document&gt; protect(this);
-
-    // Make a frozen copy.
-    Vector&lt;MessagePort*&gt; ports;
-    copyToVector(m_messagePorts, ports);
-
-    m_firedMessagePortTimer = false;
-
-    unsigned portCount = ports.size();
-    for (unsigned i = 0; i &lt; portCount; ++i) {
-        MessagePort* port = ports[i];
-        if (m_messagePorts.contains(port) &amp;&amp; port-&gt;queueIsOpen())
-            port-&gt;dispatchMessages();
-    }
-}
-
-void Document::createdMessagePort(MessagePort* port)
-{
-    ASSERT(port);
-    m_messagePorts.add(port);
-}
-
-void Document::destroyedMessagePort(MessagePort* port)
-{
-    ASSERT(port);
-    m_messagePorts.remove(port);
-}
-
-void Document::stopActiveDOMObjects()
-{
-    HashMap&lt;ActiveDOMObject*, void*&gt;::iterator activeObjectsEnd = m_activeDOMObjects.end();
-    for (HashMap&lt;ActiveDOMObject*, void*&gt;::iterator iter = m_activeDOMObjects.begin(); iter != activeObjectsEnd; ++iter) {
-        ASSERT(iter-&gt;first-&gt;document() == this);
-        iter-&gt;first-&gt;stop();
-    }
-}
-
-void Document::createdActiveDOMObject(ActiveDOMObject* object, void* upcastPointer)
-{
-    ASSERT(object);
-    ASSERT(upcastPointer);
-    m_activeDOMObjects.add(object, upcastPointer);
-}
-
-void Document::destroyedActiveDOMObject(ActiveDOMObject* object)
-{
-    ASSERT(object);
-    m_activeDOMObjects.remove(object);
-}
-
</del><span class="cx"> void Document::initDNSPrefetch()
</span><span class="cx"> {
</span><span class="cx">     m_haveExplicitlyDisabledDNSPrefetch = false;
</span></span></pre></div>
<a id="trunkWebCoredomDocumenth"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/dom/Document.h (37965 => 37966)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/dom/Document.h        2008-10-29 06:01:41 UTC (rev 37965)
+++ trunk/WebCore/dom/Document.h        2008-10-29 10:26:58 UTC (rev 37966)
</span><span class="lines">@@ -32,6 +32,7 @@
</span><span class="cx"> #include &quot;HTMLCollection.h&quot;
</span><span class="cx"> #include &quot;HTMLFormElement.h&quot;
</span><span class="cx"> #include &quot;KURL.h&quot;
</span><ins>+#include &quot;ScriptExecutionContext.h&quot;
</ins><span class="cx"> #include &quot;StringHash.h&quot;
</span><span class="cx"> #include &quot;Timer.h&quot;
</span><span class="cx"> #include &lt;wtf/HashCountedSet.h&gt;
</span><span class="lines">@@ -48,7 +49,6 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-    class ActiveDOMObject;
</del><span class="cx">     class AXObjectCache;
</span><span class="cx">     class Attr;
</span><span class="cx">     class Attribute;
</span><span class="lines">@@ -86,7 +86,6 @@
</span><span class="cx">     class ImageLoader;
</span><span class="cx">     class IntPoint;
</span><span class="cx">     class JSNode;
</span><del>-    class MessagePort;
</del><span class="cx">     class MouseEventWithHitTestResults;
</span><span class="cx">     class NodeFilter;
</span><span class="cx">     class NodeIterator;
</span><span class="lines">@@ -168,7 +167,7 @@
</span><span class="cx">     static bool isDeletedValue(const FormElementKey&amp; value) { return value.isHashTableDeletedValue(); }
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-class Document : public ContainerNode {
</del><ins>+class Document : public ContainerNode, public ScriptExecutionContext {
</ins><span class="cx"> public:
</span><span class="cx">     static PassRefPtr&lt;Document&gt; create(Frame* frame)
</span><span class="cx">     {
</span><span class="lines">@@ -180,6 +179,10 @@
</span><span class="cx">     }
</span><span class="cx">     virtual ~Document();
</span><span class="cx"> 
</span><ins>+    virtual bool isDocument() const { return true; }
+
+    using ContainerNode::ref;
+    using ContainerNode::deref;
</ins><span class="cx">     virtual void removedLastRef();
</span><span class="cx"> 
</span><span class="cx">     // Nodes belonging to this document hold &quot;self-only&quot; references -
</span><span class="lines">@@ -765,19 +768,6 @@
</span><span class="cx">     CanvasRenderingContext2D* getCSSCanvasContext(const String&amp; type, const String&amp; name, int width, int height);
</span><span class="cx">     HTMLCanvasElement* getCSSCanvasElement(const String&amp; name);
</span><span class="cx"> 
</span><del>-    // Active objects are not garbage collected even if inaccessible, e.g. because their activity may result in callbacks being invoked.
-    void stopActiveDOMObjects();
-    void createdActiveDOMObject(ActiveDOMObject*, void* upcastPointer);
-    void destroyedActiveDOMObject(ActiveDOMObject*);
-    const HashMap&lt;ActiveDOMObject*, void*&gt;&amp; activeDOMObjects() const { return m_activeDOMObjects; }
-
-    // MessagePort is conceptually a kind of ActiveDOMObject, but it needs to be tracked separately for message dispatch, and for cross-heap GC support.
-    void processMessagePortMessagesSoon();
-    void dispatchMessagePortEvents();
-    void createdMessagePort(MessagePort*);
-    void destroyedMessagePort(MessagePort*);
-    const HashSet&lt;MessagePort*&gt;&amp; messagePorts() const { return m_messagePorts; }
-
</del><span class="cx">     bool isDNSPrefetchEnabled() const { return m_isDNSPrefetchEnabled; }
</span><span class="cx">     void initDNSPrefetch();
</span><span class="cx">     void parseDNSPrefetchControlHeader(const String&amp;);
</span><span class="lines">@@ -786,6 +776,9 @@
</span><span class="cx">     Document(Frame*, bool isXHTML);
</span><span class="cx"> 
</span><span class="cx"> private:
</span><ins>+    virtual void refScriptExecutionContext() { ref(); }
+    virtual void derefScriptExecutionContext() { deref(); }
+
</ins><span class="cx">     CSSStyleSelector* m_styleSelector;
</span><span class="cx">     bool m_didCalculateStyleSelector;
</span><span class="cx"> 
</span><span class="lines">@@ -935,11 +928,6 @@
</span><span class="cx"> 
</span><span class="cx">     String m_contentLanguage;
</span><span class="cx"> 
</span><del>-    bool m_firedMessagePortTimer;
-    HashSet&lt;MessagePort*&gt; m_messagePorts;
-
-    HashMap&lt;ActiveDOMObject*, void*&gt; m_activeDOMObjects;
-
</del><span class="cx"> public:
</span><span class="cx">     bool inPageCache();
</span><span class="cx">     void setInPageCache(bool flag);
</span><span class="lines">@@ -1084,7 +1072,6 @@
</span><span class="cx"> #if USE(LOW_BANDWIDTH_DISPLAY)
</span><span class="cx">     bool m_inLowBandwidthDisplay;
</span><span class="cx"> #endif
</span><del>-
</del><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> inline bool Document::hasElementWithId(AtomicStringImpl* id) const
</span></span></pre></div>
<a id="trunkWebCoredomMessageChannelcpp"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/dom/MessageChannel.cpp (37965 => 37966)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/dom/MessageChannel.cpp        2008-10-29 06:01:41 UTC (rev 37965)
+++ trunk/WebCore/dom/MessageChannel.cpp        2008-10-29 10:26:58 UTC (rev 37966)
</span><span class="lines">@@ -31,9 +31,9 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-MessageChannel::MessageChannel(Document* document)
-    : m_port1(MessagePort::create(document))
-    , m_port2(MessagePort::create(document))
</del><ins>+MessageChannel::MessageChannel(ScriptExecutionContext* context)
+    : m_port1(MessagePort::create(context))
+    , m_port2(MessagePort::create(context))
</ins><span class="cx"> {
</span><span class="cx">     MessagePort::entangle(m_port1.get(), m_port2.get());
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkWebCoredomMessageChannelh"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/dom/MessageChannel.h (37965 => 37966)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/dom/MessageChannel.h        2008-10-29 06:01:41 UTC (rev 37965)
+++ trunk/WebCore/dom/MessageChannel.h        2008-10-29 10:26:58 UTC (rev 37966)
</span><span class="lines">@@ -33,19 +33,19 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-    class Document;
</del><span class="cx">     class MessagePort;
</span><ins>+    class ScriptExecutionContext;
</ins><span class="cx"> 
</span><span class="cx">     class MessageChannel : public RefCounted&lt;MessageChannel&gt; {
</span><span class="cx">     public:
</span><del>-        static PassRefPtr&lt;MessageChannel&gt; create(Document* document) { return adoptRef(new MessageChannel(document)); }
</del><ins>+        static PassRefPtr&lt;MessageChannel&gt; create(ScriptExecutionContext* context) { return adoptRef(new MessageChannel(context)); }
</ins><span class="cx">         ~MessageChannel();
</span><span class="cx"> 
</span><span class="cx">         MessagePort* port1() const { return m_port1.get(); }
</span><span class="cx">         MessagePort* port2() const { return m_port2.get(); }
</span><span class="cx"> 
</span><span class="cx">     private:
</span><del>-        MessageChannel(Document*);
</del><ins>+        MessageChannel(ScriptExecutionContext*);
</ins><span class="cx"> 
</span><span class="cx">         RefPtr&lt;MessagePort&gt; m_port1;
</span><span class="cx">         RefPtr&lt;MessagePort&gt; m_port2;
</span></span></pre></div>
<a id="trunkWebCoredomMessagePortcpp"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/dom/MessagePort.cpp (37965 => 37966)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/dom/MessagePort.cpp        2008-10-29 06:01:41 UTC (rev 37965)
+++ trunk/WebCore/dom/MessagePort.cpp        2008-10-29 10:26:58 UTC (rev 37966)
</span><span class="lines">@@ -40,7 +40,7 @@
</span><span class="cx"> 
</span><span class="cx"> class CloseMessagePortTimer : public TimerBase {
</span><span class="cx"> public:
</span><del>-    CloseMessagePortTimer(MessagePort* port)
</del><ins>+    CloseMessagePortTimer(PassRefPtr&lt;MessagePort&gt; port)
</ins><span class="cx">         : m_port(port)
</span><span class="cx">     {
</span><span class="cx">         ASSERT(m_port);
</span><span class="lines">@@ -59,17 +59,17 @@
</span><span class="cx">         delete this;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    MessagePort* m_port;
</del><ins>+    RefPtr&lt;MessagePort&gt; m_port;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><del>-MessagePort::MessagePort(Document* document)
</del><ins>+MessagePort::MessagePort(ScriptExecutionContext* scriptExecutionContext)
</ins><span class="cx">     : m_entangledPort(0)
</span><span class="cx">     , m_queueIsOpen(false)
</span><del>-    , m_document(document)
</del><ins>+    , m_scriptExecutionContext(scriptExecutionContext)
</ins><span class="cx">     , m_pendingCloseEvent(false)
</span><span class="cx">     , m_jsWrapperIsInaccessible(false)
</span><span class="cx"> {
</span><del>-    document-&gt;createdMessagePort(this);
</del><ins>+    scriptExecutionContext-&gt;createdMessagePort(this);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> MessagePort::~MessagePort()
</span><span class="lines">@@ -77,18 +77,18 @@
</span><span class="cx">     if (m_entangledPort)
</span><span class="cx">         unentangle();
</span><span class="cx"> 
</span><del>-    if (m_document)
-        m_document-&gt;destroyedMessagePort(this);
</del><ins>+    if (m_scriptExecutionContext)
+        m_scriptExecutionContext-&gt;destroyedMessagePort(this);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> Frame* MessagePort::associatedFrame() const
</span><span class="cx"> {
</span><del>-    if (!m_document)
</del><ins>+    if (!m_scriptExecutionContext || !m_scriptExecutionContext-&gt;isDocument())
</ins><span class="cx">         return 0;
</span><del>-    return m_document-&gt;frame();
</del><ins>+    return static_cast&lt;Document*&gt;(m_scriptExecutionContext)-&gt;frame();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-PassRefPtr&lt;MessagePort&gt; MessagePort::clone(Document* newOwner, ExceptionCode&amp; ec)
</del><ins>+PassRefPtr&lt;MessagePort&gt; MessagePort::clone(ScriptExecutionContext* newOwner, ExceptionCode&amp; ec)
</ins><span class="cx"> {
</span><span class="cx">     if (!m_entangledPort) {
</span><span class="cx">         ec = INVALID_STATE_ERR;
</span><span class="lines">@@ -115,7 +115,7 @@
</span><span class="cx"> 
</span><span class="cx"> void MessagePort::postMessage(const String&amp; message, MessagePort* dataPort, ExceptionCode&amp; ec)
</span><span class="cx"> {
</span><del>-    if (!m_entangledPort || !m_document || !m_entangledPort-&gt;m_document)
</del><ins>+    if (!m_entangledPort || !m_scriptExecutionContext || !m_entangledPort-&gt;m_scriptExecutionContext)
</ins><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     RefPtr&lt;MessagePort&gt; newMessagePort;
</span><span class="lines">@@ -124,38 +124,42 @@
</span><span class="cx">             ec = INVALID_ACCESS_ERR;
</span><span class="cx">             return;
</span><span class="cx">         }
</span><del>-        newMessagePort = dataPort-&gt;clone(m_entangledPort-&gt;m_document, ec);
</del><ins>+        newMessagePort = dataPort-&gt;clone(m_entangledPort-&gt;m_scriptExecutionContext, ec);
</ins><span class="cx">         if (ec)
</span><span class="cx">             return;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    m_entangledPort-&gt;m_messageQueue.append(MessageEvent::create(message, &quot;&quot;, &quot;&quot;, m_document-&gt;domWindow(), newMessagePort.get()));
</del><ins>+    DOMWindow* window = (m_scriptExecutionContext-&gt;isDocument() &amp;&amp; m_entangledPort-&gt;m_scriptExecutionContext-&gt;isDocument()) ?
+        static_cast&lt;Document*&gt;(m_scriptExecutionContext)-&gt;domWindow() : 0;
+    m_entangledPort-&gt;m_messageQueue.append(MessageEvent::create(message, &quot;&quot;, &quot;&quot;, window, newMessagePort.get()));
</ins><span class="cx">     if (m_entangledPort-&gt;m_queueIsOpen)
</span><del>-        m_entangledPort-&gt;m_document-&gt;processMessagePortMessagesSoon();
</del><ins>+        m_entangledPort-&gt;m_scriptExecutionContext-&gt;processMessagePortMessagesSoon();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-PassRefPtr&lt;MessagePort&gt; MessagePort::startConversation(Document* scriptContextDocument, const String&amp; message)
</del><ins>+PassRefPtr&lt;MessagePort&gt; MessagePort::startConversation(ScriptExecutionContext* scriptExecutionContext, const String&amp; message)
</ins><span class="cx"> {
</span><del>-    RefPtr&lt;MessagePort&gt; port1 = MessagePort::create(scriptContextDocument);
-    if (!m_entangledPort || !m_document || !m_entangledPort-&gt;m_document)
</del><ins>+    RefPtr&lt;MessagePort&gt; port1 = MessagePort::create(scriptExecutionContext);
+    if (!m_entangledPort || !m_scriptExecutionContext || !m_entangledPort-&gt;m_scriptExecutionContext)
</ins><span class="cx">         return port1;
</span><del>-    RefPtr&lt;MessagePort&gt; port2 = MessagePort::create(m_entangledPort-&gt;m_document);
</del><ins>+    RefPtr&lt;MessagePort&gt; port2 = MessagePort::create(m_entangledPort-&gt;m_scriptExecutionContext);
</ins><span class="cx"> 
</span><span class="cx">     entangle(port1.get(), port2.get());
</span><span class="cx"> 
</span><del>-    m_entangledPort-&gt;m_messageQueue.append(MessageEvent::create(message, &quot;&quot;, &quot;&quot;, m_document-&gt;domWindow(), port2.get()));
</del><ins>+    DOMWindow* window = (m_scriptExecutionContext-&gt;isDocument() &amp;&amp; m_entangledPort-&gt;m_scriptExecutionContext-&gt;isDocument()) ?
+        static_cast&lt;Document*&gt;(m_scriptExecutionContext)-&gt;domWindow() : 0;
+    m_entangledPort-&gt;m_messageQueue.append(MessageEvent::create(message, &quot;&quot;, &quot;&quot;, window, port2.get()));
</ins><span class="cx">     if (m_entangledPort-&gt;m_queueIsOpen)
</span><del>-        m_entangledPort-&gt;m_document-&gt;processMessagePortMessagesSoon();
</del><ins>+        m_entangledPort-&gt;m_scriptExecutionContext-&gt;processMessagePortMessagesSoon();
</ins><span class="cx">     return port1;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void MessagePort::start()
</span><span class="cx"> {
</span><del>-    if (m_queueIsOpen || !m_document)
</del><ins>+    if (m_queueIsOpen || !m_scriptExecutionContext)
</ins><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     m_queueIsOpen = true;
</span><del>-    m_document-&gt;processMessagePortMessagesSoon();
</del><ins>+    m_scriptExecutionContext-&gt;processMessagePortMessagesSoon();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void MessagePort::close()
</span><span class="lines">@@ -199,15 +203,15 @@
</span><span class="cx">     if (m_entangledPort) {
</span><span class="cx">         RefPtr&lt;MessagePort&gt; survivingPort = m_entangledPort;
</span><span class="cx">         unentangle();
</span><del>-        if (survivingPort-&gt;document() != document()) // Otherwise, survivingPort won't really survive.
</del><ins>+        if (survivingPort-&gt;m_scriptExecutionContext != m_scriptExecutionContext) // Otherwise, survivingPort won't really survive.
</ins><span class="cx">             survivingPort-&gt;queueCloseEvent();
</span><span class="cx">     }
</span><del>-    m_document = 0;
</del><ins>+    m_scriptExecutionContext = 0;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void MessagePort::dispatchMessages()
</span><span class="cx"> {
</span><del>-    // Messages for documents that are not fully active get dispatched too, but JSAbstractEventListener::handleEvent() doesn't call handlers for these.
</del><ins>+    // Messages for contexts that are not fully active get dispatched too, but JSAbstractEventListener::handleEvent() doesn't call handlers for these.
</ins><span class="cx">     ASSERT(queueIsOpen());
</span><span class="cx"> 
</span><span class="cx">     RefPtr&lt;Event&gt; evt;
</span></span></pre></div>
<a id="trunkWebCoredomMessagePorth"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/dom/MessagePort.h (37965 => 37966)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/dom/MessagePort.h        2008-10-29 06:01:41 UTC (rev 37965)
+++ trunk/WebCore/dom/MessagePort.h        2008-10-29 10:26:58 UTC (rev 37966)
</span><span class="lines">@@ -40,23 +40,23 @@
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="cx">     class AtomicStringImpl;
</span><del>-    class Document;
</del><span class="cx">     class Event;
</span><span class="cx">     class Frame;
</span><ins>+    class ScriptExecutionContext;
</ins><span class="cx">     class String;
</span><span class="cx">     class WorkerContext;
</span><span class="cx"> 
</span><span class="cx">     class MessagePort : public ThreadSafeShared&lt;MessagePort&gt;, public EventTarget {
</span><span class="cx">     public:
</span><del>-        static PassRefPtr&lt;MessagePort&gt; create(Document* document) { return adoptRef(new MessagePort(document)); }
</del><ins>+        static PassRefPtr&lt;MessagePort&gt; create(ScriptExecutionContext* scriptExecutionContext) { return adoptRef(new MessagePort(scriptExecutionContext)); }
</ins><span class="cx">         ~MessagePort();
</span><span class="cx"> 
</span><del>-        PassRefPtr&lt;MessagePort&gt; clone(Document*, ExceptionCode&amp;);
</del><ins>+        PassRefPtr&lt;MessagePort&gt; clone(ScriptExecutionContext*, ExceptionCode&amp;);
</ins><span class="cx"> 
</span><span class="cx">         bool active() const { return m_entangledPort; }
</span><span class="cx">         void postMessage(const String&amp; message, ExceptionCode&amp;);
</span><span class="cx">         void postMessage(const String&amp; message, MessagePort*, ExceptionCode&amp;);
</span><del>-        PassRefPtr&lt;MessagePort&gt; startConversation(Document*, const String&amp; message);
</del><ins>+        PassRefPtr&lt;MessagePort&gt; startConversation(ScriptExecutionContext*, const String&amp; message);
</ins><span class="cx">         void start();
</span><span class="cx">         void close();
</span><span class="cx"> 
</span><span class="lines">@@ -67,8 +67,7 @@
</span><span class="cx">         void unentangle();
</span><span class="cx"> 
</span><span class="cx">         void contextDestroyed();
</span><del>-        Document* document() { return m_document; }
-        WorkerContext* workerContext() { return 0; } // Not implemented yet.
</del><ins>+        ScriptExecutionContext* scriptExecutionContext() { return m_scriptExecutionContext; }
</ins><span class="cx"> 
</span><span class="cx">         virtual MessagePort* toMessagePort() { return this; }
</span><span class="cx"> 
</span><span class="lines">@@ -102,7 +101,7 @@
</span><span class="cx">     private:
</span><span class="cx">         friend class CloseMessagePortTimer;
</span><span class="cx"> 
</span><del>-        MessagePort(Document*);
</del><ins>+        MessagePort(ScriptExecutionContext*);
</ins><span class="cx"> 
</span><span class="cx">         virtual void refEventTarget() { ref(); }
</span><span class="cx">         virtual void derefEventTarget() { deref(); }
</span><span class="lines">@@ -113,7 +112,7 @@
</span><span class="cx">         MessageQueue&lt;RefPtr&lt;Event&gt; &gt; m_messageQueue;
</span><span class="cx">         bool m_queueIsOpen;
</span><span class="cx"> 
</span><del>-        Document* m_document; // Will be 0 if the context does not contain a document (e.g. if it's a worker thread).
</del><ins>+        ScriptExecutionContext* m_scriptExecutionContext;
</ins><span class="cx"> 
</span><span class="cx">         RefPtr&lt;EventListener&gt; m_onMessageListener;
</span><span class="cx">         RefPtr&lt;EventListener&gt; m_onCloseListener;
</span></span></pre></div>
<a id="trunkWebCoredomScriptExecutionContextcpp"></a>
<div class="addfile"><h4>Added: trunk/WebCore/dom/ScriptExecutionContext.cpp (0 => 37966)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/dom/ScriptExecutionContext.cpp                                (rev 0)
+++ trunk/WebCore/dom/ScriptExecutionContext.cpp        2008-10-29 10:26:58 UTC (rev 37966)
</span><span class="lines">@@ -0,0 +1,138 @@
</span><ins>+/*
+ * Copyright (C) 2008 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ *
+ */
+
+#include &quot;config.h&quot;
+#include &quot;ScriptExecutionContext.h&quot;
+
+#include &quot;ActiveDOMObject.h&quot;
+#include &quot;MessagePort.h&quot;
+#include &quot;Timer.h&quot;
+#include &lt;wtf/PassRefPtr.h&gt;
+
+namespace WebCore {
+
+class MessagePortTimer : public TimerBase {
+public:
+    MessagePortTimer(PassRefPtr&lt;ScriptExecutionContext&gt; context)
+        : m_context(context)
+    {
+    }
+
+private:
+    virtual void fired()
+    {
+        m_context-&gt;dispatchMessagePortEvents();
+        delete this;
+    }
+
+    RefPtr&lt;ScriptExecutionContext&gt; m_context;
+};
+
+ScriptExecutionContext::ScriptExecutionContext()
+    : m_firedMessagePortTimer(false)
+{
+}
+
+ScriptExecutionContext::~ScriptExecutionContext()
+{
+    HashMap&lt;ActiveDOMObject*, void*&gt;::iterator activeObjectsEnd = m_activeDOMObjects.end();
+    for (HashMap&lt;ActiveDOMObject*, void*&gt;::iterator iter = m_activeDOMObjects.begin(); iter != activeObjectsEnd; ++iter) {
+        ASSERT(iter-&gt;first-&gt;scriptExecutionContext() == this);
+        iter-&gt;first-&gt;contextDestroyed();
+    }
+
+    HashSet&lt;MessagePort*&gt;::iterator messagePortsEnd = m_messagePorts.end();
+    for (HashSet&lt;MessagePort*&gt;::iterator iter = m_messagePorts.begin(); iter != messagePortsEnd; ++iter) {
+        ASSERT((*iter)-&gt;scriptExecutionContext() == this);
+        (*iter)-&gt;contextDestroyed();
+    }
+}
+
+void ScriptExecutionContext::processMessagePortMessagesSoon()
+{
+    if (m_firedMessagePortTimer)
+        return;
+
+    MessagePortTimer* timer = new MessagePortTimer(this);
+    timer-&gt;startOneShot(0);
+
+    m_firedMessagePortTimer = true;
+}
+
+void ScriptExecutionContext::dispatchMessagePortEvents()
+{
+    RefPtr&lt;ScriptExecutionContext&gt; protect(this);
+
+    // Make a frozen copy.
+    Vector&lt;MessagePort*&gt; ports;
+    copyToVector(m_messagePorts, ports);
+
+    m_firedMessagePortTimer = false;
+
+    unsigned portCount = ports.size();
+    for (unsigned i = 0; i &lt; portCount; ++i) {
+        MessagePort* port = ports[i];
+        if (m_messagePorts.contains(port) &amp;&amp; port-&gt;queueIsOpen())
+            port-&gt;dispatchMessages();
+    }
+}
+
+void ScriptExecutionContext::createdMessagePort(MessagePort* port)
+{
+    ASSERT(port);
+    m_messagePorts.add(port);
+}
+
+void ScriptExecutionContext::destroyedMessagePort(MessagePort* port)
+{
+    ASSERT(port);
+    m_messagePorts.remove(port);
+}
+
+void ScriptExecutionContext::stopActiveDOMObjects()
+{
+    HashMap&lt;ActiveDOMObject*, void*&gt;::iterator activeObjectsEnd = m_activeDOMObjects.end();
+    for (HashMap&lt;ActiveDOMObject*, void*&gt;::iterator iter = m_activeDOMObjects.begin(); iter != activeObjectsEnd; ++iter) {
+        ASSERT(iter-&gt;first-&gt;scriptExecutionContext() == this);
+        iter-&gt;first-&gt;stop();
+    }
+}
+
+void ScriptExecutionContext::createdActiveDOMObject(ActiveDOMObject* object, void* upcastPointer)
+{
+    ASSERT(object);
+    ASSERT(upcastPointer);
+    m_activeDOMObjects.add(object, upcastPointer);
+}
+
+void ScriptExecutionContext::destroyedActiveDOMObject(ActiveDOMObject* object)
+{
+    ASSERT(object);
+    m_activeDOMObjects.remove(object);
+}
+
+
+} // namespace WebCore
</ins><span class="cx">Property changes on: trunk/WebCore/dom/ScriptExecutionContext.cpp
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4>Added: svn:eol-style</h4></div>
<a id="trunkWebCoredomScriptExecutionContexth"></a>
<div class="addfile"><h4>Added: trunk/WebCore/dom/ScriptExecutionContext.h (0 => 37966)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/dom/ScriptExecutionContext.h                                (rev 0)
+++ trunk/WebCore/dom/ScriptExecutionContext.h        2008-10-29 10:26:58 UTC (rev 37966)
</span><span class="lines">@@ -0,0 +1,78 @@
</span><ins>+/*
+ * Copyright (C) 2008 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ *
+ */
+
+#ifndef ScriptExecutionContext_h
+#define ScriptExecutionContext_h
+
+#include &lt;wtf/HashMap.h&gt;
+#include &lt;wtf/HashSet.h&gt;
+
+namespace WebCore {
+
+    class ActiveDOMObject;
+    class MessagePort;
+    class KURL;
+    class SecurityOrigin;
+    class String;
+
+    class ScriptExecutionContext {
+    public:
+        ScriptExecutionContext();
+        virtual ~ScriptExecutionContext();
+
+        virtual bool isDocument() const { return false; }
+        virtual bool isWorkerContext() const { return false; }
+
+        // Active objects are not garbage collected even if inaccessible, e.g. because their activity may result in callbacks being invoked.
+        void stopActiveDOMObjects();
+        void createdActiveDOMObject(ActiveDOMObject*, void* upcastPointer);
+        void destroyedActiveDOMObject(ActiveDOMObject*);
+        const HashMap&lt;ActiveDOMObject*, void*&gt;&amp; activeDOMObjects() const { return m_activeDOMObjects; }
+
+        // MessagePort is conceptually a kind of ActiveDOMObject, but it needs to be tracked separately for message dispatch, and for cross-heap GC support.
+        void processMessagePortMessagesSoon();
+        void dispatchMessagePortEvents();
+        void createdMessagePort(MessagePort*);
+        void destroyedMessagePort(MessagePort*);
+        const HashSet&lt;MessagePort*&gt;&amp; messagePorts() const { return m_messagePorts; }
+
+        void ref() { refScriptExecutionContext(); }
+        void deref() { derefScriptExecutionContext(); }
+
+    private:
+        bool m_firedMessagePortTimer;
+        HashSet&lt;MessagePort*&gt; m_messagePorts;
+
+        HashMap&lt;ActiveDOMObject*, void*&gt; m_activeDOMObjects;
+
+        virtual void refScriptExecutionContext() = 0;
+        virtual void derefScriptExecutionContext() = 0;
+    };
+
+} // namespace WebCore
+
+
+#endif // ScriptExecutionContext_h
</ins><span class="cx">Property changes on: trunk/WebCore/dom/ScriptExecutionContext.h
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4>Added: svn:eol-style</h4></div>
<a id="trunkWebCorexmlXMLHttpRequestcpp"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/xml/XMLHttpRequest.cpp (37965 => 37966)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/xml/XMLHttpRequest.cpp        2008-10-29 06:01:41 UTC (rev 37965)
+++ trunk/WebCore/xml/XMLHttpRequest.cpp        2008-10-29 10:26:58 UTC (rev 37966)
</span><span class="lines">@@ -189,6 +189,12 @@
</span><span class="cx">         m_upload-&gt;disconnectXMLHttpRequest();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+Document* XMLHttpRequest::document() const
+{
+    ASSERT(scriptExecutionContext()-&gt;isDocument());
+    return static_cast&lt;Document*&gt;(scriptExecutionContext());
+}
+
</ins><span class="cx"> Frame* XMLHttpRequest::associatedFrame() const
</span><span class="cx"> {
</span><span class="cx">     if (!document())
</span></span></pre></div>
<a id="trunkWebCorexmlXMLHttpRequesth"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/xml/XMLHttpRequest.h (37965 => 37966)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/xml/XMLHttpRequest.h        2008-10-29 06:01:41 UTC (rev 37965)
+++ trunk/WebCore/xml/XMLHttpRequest.h        2008-10-29 10:26:58 UTC (rev 37966)
</span><span class="lines">@@ -114,6 +114,8 @@
</span><span class="cx">     virtual void refEventTarget() { ref(); }
</span><span class="cx">     virtual void derefEventTarget() { deref(); }
</span><span class="cx"> 
</span><ins>+    Document* document() const;
+
</ins><span class="cx">     virtual void willSendRequest(SubresourceLoader*, ResourceRequest&amp; request, const ResourceResponse&amp; redirectResponse);
</span><span class="cx">     virtual void didSendData(SubresourceLoader*, unsigned long long bytesSent, unsigned long long totalBytesToBeSent);
</span><span class="cx">     virtual void didReceiveResponse(SubresourceLoader*, const ResourceResponse&amp;);
</span></span></pre>
</div>
</div>

</body>
</html>