<!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>[198102] trunk/Source/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/198102">198102</a></dd>
<dt>Author</dt> <dd>youenn.fablet@crf.canon.fr</dd>
<dt>Date</dt> <dd>2016-03-14 02:44:44 -0700 (Mon, 14 Mar 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Introduce CallWith=Document in binding generator
https://bugs.webkit.org/show_bug.cgi?id=155358

Reviewed by Darin Adler.

Covered by existing tests and binding test.

* Modules/notifications/Notification.cpp:
(WebCore::Notification::permission): Taking a Document&amp; instead of ScriptExecutionContext&amp;.
(WebCore::Notification::requestPermission): Ditto.
* Modules/notifications/Notification.h:
* Modules/notifications/Notification.idl: Using CallWith=Document.
* bindings/scripts/CodeGeneratorJS.pm: Adding support for CallWith=Document and changed name from scriptContext to context.
(GenerateCallWith):
(GenerateConstructorDefinition):
* bindings/scripts/IDLAttributes.txt: Adding support for CallWith=Document.
* bindings/scripts/test/GObject/WebKitDOMTestObj.cpp:
(webkit_dom_test_obj_with_document_argument):
* bindings/scripts/test/GObject/WebKitDOMTestObj.h:
* bindings/scripts/test/JS/JSTestInterface.cpp:
(WebCore::jsTestInterfacePrototypeFunctionImplementsMethod2):
(WebCore::jsTestInterfacePrototypeFunctionSupplementalMethod2):
* bindings/scripts/test/JS/JSTestObj.cpp:
(WebCore::jsTestObjWithScriptExecutionContextAttribute):
(WebCore::jsTestObjWithScriptExecutionContextAttributeRaises):
(WebCore::jsTestObjWithScriptExecutionContextAndScriptStateAttribute):
(WebCore::jsTestObjWithScriptExecutionContextAndScriptStateAttributeRaises):
(WebCore::jsTestObjWithScriptExecutionContextAndScriptStateWithSpacesAttribute):
(WebCore::setJSTestObjWithScriptExecutionContextAttribute):
(WebCore::setJSTestObjWithScriptExecutionContextAttributeRaises):
(WebCore::setJSTestObjWithScriptExecutionContextAndScriptStateAttribute):
(WebCore::setJSTestObjWithScriptExecutionContextAndScriptStateAttributeRaises):
(WebCore::setJSTestObjWithScriptExecutionContextAndScriptStateWithSpacesAttribute):
(WebCore::jsTestObjPrototypeFunctionWithScriptExecutionContext):
(WebCore::jsTestObjPrototypeFunctionWithScriptExecutionContextAndScriptState):
(WebCore::jsTestObjPrototypeFunctionWithScriptExecutionContextAndScriptStateObjException):
(WebCore::jsTestObjPrototypeFunctionWithScriptExecutionContextAndScriptStateWithSpaces):
(WebCore::jsTestObjPrototypeFunctionWithDocumentArgument):
* bindings/scripts/test/ObjC/DOMTestObj.h:
* bindings/scripts/test/ObjC/DOMTestObj.mm:
(-[DOMTestObj withDocumentArgument]):
* bindings/scripts/test/TestObj.idl: Adding binding test.
* page/DOMWindow.cpp:
(WebCore::DOMWindow::focus): Taking a Document&amp; instead of ScriptExecutionContext&amp;.
(WebCore::DOMWindow::close): Ditto.
* page/DOMWindow.h:
* page/DOMWindow.idl:
* page/History.cpp:
(WebCore::History::back): Ditto.
(WebCore::History::forward): Ditto.
(WebCore::History::go): Ditto.
* page/History.h:
* page/History.idl:
* testing/Internals.cpp:
(WebCore::InspectorStubFrontend::closeWindow): Calling DOMWindow::close() directly.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreModulesnotificationsNotificationcpp">trunk/Source/WebCore/Modules/notifications/Notification.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesnotificationsNotificationh">trunk/Source/WebCore/Modules/notifications/Notification.h</a></li>
<li><a href="#trunkSourceWebCoreModulesnotificationsNotificationidl">trunk/Source/WebCore/Modules/notifications/Notification.idl</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptsCodeGeneratorJSpm">trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptsIDLAttributestxt">trunk/Source/WebCore/bindings/scripts/IDLAttributes.txt</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptstestGObjectWebKitDOMTestObjcpp">trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptstestGObjectWebKitDOMTestObjh">trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptstestJSJSTestInterfacecpp">trunk/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptstestJSJSTestObjcpp">trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptstestObjCDOMTestObjh">trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptstestObjCDOMTestObjmm">trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptstestTestObjidl">trunk/Source/WebCore/bindings/scripts/test/TestObj.idl</a></li>
<li><a href="#trunkSourceWebCorepageDOMWindowcpp">trunk/Source/WebCore/page/DOMWindow.cpp</a></li>
<li><a href="#trunkSourceWebCorepageDOMWindowh">trunk/Source/WebCore/page/DOMWindow.h</a></li>
<li><a href="#trunkSourceWebCorepageDOMWindowidl">trunk/Source/WebCore/page/DOMWindow.idl</a></li>
<li><a href="#trunkSourceWebCorepageHistorycpp">trunk/Source/WebCore/page/History.cpp</a></li>
<li><a href="#trunkSourceWebCorepageHistoryh">trunk/Source/WebCore/page/History.h</a></li>
<li><a href="#trunkSourceWebCorepageHistoryidl">trunk/Source/WebCore/page/History.idl</a></li>
<li><a href="#trunkSourceWebCoretestingInternalscpp">trunk/Source/WebCore/testing/Internals.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (198101 => 198102)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-03-14 09:21:56 UTC (rev 198101)
+++ trunk/Source/WebCore/ChangeLog        2016-03-14 09:44:44 UTC (rev 198102)
</span><span class="lines">@@ -1,3 +1,61 @@
</span><ins>+2016-03-14  Youenn Fablet  &lt;youenn.fablet@crf.canon.fr&gt;
+
+        Introduce CallWith=Document in binding generator
+        https://bugs.webkit.org/show_bug.cgi?id=155358
+
+        Reviewed by Darin Adler.
+
+        Covered by existing tests and binding test.
+
+        * Modules/notifications/Notification.cpp:
+        (WebCore::Notification::permission): Taking a Document&amp; instead of ScriptExecutionContext&amp;.
+        (WebCore::Notification::requestPermission): Ditto.
+        * Modules/notifications/Notification.h:
+        * Modules/notifications/Notification.idl: Using CallWith=Document.
+        * bindings/scripts/CodeGeneratorJS.pm: Adding support for CallWith=Document and changed name from scriptContext to context.
+        (GenerateCallWith):
+        (GenerateConstructorDefinition):
+        * bindings/scripts/IDLAttributes.txt: Adding support for CallWith=Document.
+        * bindings/scripts/test/GObject/WebKitDOMTestObj.cpp:
+        (webkit_dom_test_obj_with_document_argument):
+        * bindings/scripts/test/GObject/WebKitDOMTestObj.h:
+        * bindings/scripts/test/JS/JSTestInterface.cpp:
+        (WebCore::jsTestInterfacePrototypeFunctionImplementsMethod2):
+        (WebCore::jsTestInterfacePrototypeFunctionSupplementalMethod2):
+        * bindings/scripts/test/JS/JSTestObj.cpp:
+        (WebCore::jsTestObjWithScriptExecutionContextAttribute):
+        (WebCore::jsTestObjWithScriptExecutionContextAttributeRaises):
+        (WebCore::jsTestObjWithScriptExecutionContextAndScriptStateAttribute):
+        (WebCore::jsTestObjWithScriptExecutionContextAndScriptStateAttributeRaises):
+        (WebCore::jsTestObjWithScriptExecutionContextAndScriptStateWithSpacesAttribute):
+        (WebCore::setJSTestObjWithScriptExecutionContextAttribute):
+        (WebCore::setJSTestObjWithScriptExecutionContextAttributeRaises):
+        (WebCore::setJSTestObjWithScriptExecutionContextAndScriptStateAttribute):
+        (WebCore::setJSTestObjWithScriptExecutionContextAndScriptStateAttributeRaises):
+        (WebCore::setJSTestObjWithScriptExecutionContextAndScriptStateWithSpacesAttribute):
+        (WebCore::jsTestObjPrototypeFunctionWithScriptExecutionContext):
+        (WebCore::jsTestObjPrototypeFunctionWithScriptExecutionContextAndScriptState):
+        (WebCore::jsTestObjPrototypeFunctionWithScriptExecutionContextAndScriptStateObjException):
+        (WebCore::jsTestObjPrototypeFunctionWithScriptExecutionContextAndScriptStateWithSpaces):
+        (WebCore::jsTestObjPrototypeFunctionWithDocumentArgument):
+        * bindings/scripts/test/ObjC/DOMTestObj.h:
+        * bindings/scripts/test/ObjC/DOMTestObj.mm:
+        (-[DOMTestObj withDocumentArgument]):
+        * bindings/scripts/test/TestObj.idl: Adding binding test.
+        * page/DOMWindow.cpp:
+        (WebCore::DOMWindow::focus): Taking a Document&amp; instead of ScriptExecutionContext&amp;.
+        (WebCore::DOMWindow::close): Ditto.
+        * page/DOMWindow.h:
+        * page/DOMWindow.idl:
+        * page/History.cpp:
+        (WebCore::History::back): Ditto.
+        (WebCore::History::forward): Ditto.
+        (WebCore::History::go): Ditto.
+        * page/History.h:
+        * page/History.idl:
+        * testing/Internals.cpp:
+        (WebCore::InspectorStubFrontend::closeWindow): Calling DOMWindow::close() directly.
+
</ins><span class="cx"> 2016-03-13  Joseph Pecoraro  &lt;pecoraro@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Remove ENABLE(ES6_TEMPLATE_LITERAL_SYNTAX) guards
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesnotificationsNotificationcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/notifications/Notification.cpp (198101 => 198102)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/notifications/Notification.cpp        2016-03-14 09:21:56 UTC (rev 198101)
+++ trunk/Source/WebCore/Modules/notifications/Notification.cpp        2016-03-14 09:44:44 UTC (rev 198102)
</span><span class="lines">@@ -221,10 +221,9 @@
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(NOTIFICATIONS)
</span><del>-const String Notification::permission(ScriptExecutionContext&amp; context)
</del><ins>+const String Notification::permission(Document&amp; document)
</ins><span class="cx"> {
</span><del>-    ASSERT(downcast&lt;Document&gt;(context).page());
-    return permissionString(NotificationController::from(downcast&lt;Document&gt;(context).page())-&gt;client()-&gt;checkPermission(&amp;context));
</del><ins>+    return permissionString(NotificationController::from(document.page())-&gt;client()-&gt;checkPermission(&amp;document));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> const String Notification::permissionString(NotificationClient::Permission permission)
</span><span class="lines">@@ -242,10 +241,9 @@
</span><span class="cx">     return String();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void Notification::requestPermission(ScriptExecutionContext&amp; context, PassRefPtr&lt;NotificationPermissionCallback&gt; callback)
</del><ins>+void Notification::requestPermission(Document&amp; document, PassRefPtr&lt;NotificationPermissionCallback&gt; callback)
</ins><span class="cx"> {
</span><del>-    ASSERT(downcast&lt;Document&gt;(context).page());
-    NotificationController::from(downcast&lt;Document&gt;(context).page())-&gt;client()-&gt;requestPermission(&amp;context, callback);
</del><ins>+    NotificationController::from(document.page())-&gt;client()-&gt;requestPermission(&amp;document, callback);
</ins><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesnotificationsNotificationh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/notifications/Notification.h (198101 => 198102)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/notifications/Notification.h        2016-03-14 09:21:56 UTC (rev 198101)
+++ trunk/Source/WebCore/Modules/notifications/Notification.h        2016-03-14 09:44:44 UTC (rev 198102)
</span><span class="lines">@@ -52,11 +52,11 @@
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="cx"> class Dictionary;
</span><ins>+class Document;
</ins><span class="cx"> class NotificationCenter;
</span><span class="cx"> class NotificationPermissionCallback;
</span><span class="cx"> class ResourceError;
</span><span class="cx"> class ResourceResponse;
</span><del>-class ScriptExecutionContext;
</del><span class="cx"> class ThreadableLoader;
</span><span class="cx"> 
</span><span class="cx"> typedef int ExceptionCode;
</span><span class="lines">@@ -122,9 +122,9 @@
</span><span class="cx">     WEBCORE_EXPORT void finalize();
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(NOTIFICATIONS)
</span><del>-    static const String permission(ScriptExecutionContext&amp;);
</del><ins>+    static const String permission(Document&amp;);
</ins><span class="cx">     WEBCORE_EXPORT static const String permissionString(NotificationClient::Permission);
</span><del>-    static void requestPermission(ScriptExecutionContext&amp;, PassRefPtr&lt;NotificationPermissionCallback&gt; = nullptr);
</del><ins>+    static void requestPermission(Document&amp;, PassRefPtr&lt;NotificationPermissionCallback&gt; = nullptr);
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> private:
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesnotificationsNotificationidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/notifications/Notification.idl (198101 => 198102)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/notifications/Notification.idl        2016-03-14 09:21:56 UTC (rev 198101)
+++ trunk/Source/WebCore/Modules/notifications/Notification.idl        2016-03-14 09:44:44 UTC (rev 198102)
</span><span class="lines">@@ -41,8 +41,8 @@
</span><span class="cx">     [Conditional=LEGACY_NOTIFICATIONS] void cancel();
</span><span class="cx">     [Conditional=NOTIFICATIONS] void close();
</span><span class="cx"> 
</span><del>-    [Conditional=NOTIFICATIONS, CallWith=ScriptExecutionContext] static readonly attribute DOMString permission;
-    [Conditional=NOTIFICATIONS, CallWith=ScriptExecutionContext] static void requestPermission(optional NotificationPermissionCallback callback);
</del><ins>+    [Conditional=NOTIFICATIONS, CallWith=Document] static readonly attribute DOMString permission;
+    [Conditional=NOTIFICATIONS, CallWith=Document] static void requestPermission(optional NotificationPermissionCallback callback);
</ins><span class="cx"> 
</span><span class="cx">     attribute EventHandler onclick;
</span><span class="cx">     attribute EventHandler onclose;
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptsCodeGeneratorJSpm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (198101 => 198102)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm        2016-03-14 09:21:56 UTC (rev 198101)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm        2016-03-14 09:44:44 UTC (rev 198102)
</span><span class="lines">@@ -3289,11 +3289,20 @@
</span><span class="cx">     my @callWithArgs;
</span><span class="cx">     push(@callWithArgs, &quot;*state&quot;) if $codeGenerator-&gt;ExtendedAttributeContains($callWith, &quot;ScriptState&quot;);
</span><span class="cx">     if ($codeGenerator-&gt;ExtendedAttributeContains($callWith, &quot;ScriptExecutionContext&quot;)) {
</span><del>-        push(@$outputArray, &quot;    auto* scriptContext = jsCast&lt;JSDOMGlobalObject*&gt;(state-&gt;lexicalGlobalObject())-&gt;scriptExecutionContext();\n&quot;);
-        push(@$outputArray, &quot;    if (!scriptContext)\n&quot;);
</del><ins>+        push(@$outputArray, &quot;    auto* context = jsCast&lt;JSDOMGlobalObject*&gt;(state-&gt;lexicalGlobalObject())-&gt;scriptExecutionContext();\n&quot;);
+        push(@$outputArray, &quot;    if (!context)\n&quot;);
</ins><span class="cx">         push(@$outputArray, &quot;        return&quot; . ($returnValue ? &quot; &quot; . $returnValue : &quot;&quot;) . &quot;;\n&quot;);
</span><del>-        push(@callWithArgs, &quot;*scriptContext&quot;);
</del><ins>+        push(@callWithArgs, &quot;*context&quot;);
</ins><span class="cx">     }
</span><ins>+    if ($codeGenerator-&gt;ExtendedAttributeContains($callWith, &quot;Document&quot;)) {
+        $implIncludes{&quot;Document.h&quot;} = 1;
+        push(@$outputArray, &quot;    auto* context = jsCast&lt;JSDOMGlobalObject*&gt;(state-&gt;lexicalGlobalObject())-&gt;scriptExecutionContext();\n&quot;);
+        push(@$outputArray, &quot;    if (!context)\n&quot;);
+        push(@$outputArray, &quot;        return&quot; . ($returnValue ? &quot; &quot; . $returnValue : &quot;&quot;) . &quot;;\n&quot;);
+        push(@$outputArray, &quot;    ASSERT(context-&gt;isDocument());\n&quot;);
+        push(@$outputArray, &quot;    auto&amp; document = downcast&lt;Document&gt;(*context);\n&quot;);
+        push(@callWithArgs, &quot;document&quot;);
+    }
</ins><span class="cx">     if ($function and $codeGenerator-&gt;ExtendedAttributeContains($callWith, &quot;ScriptArguments&quot;)) {
</span><span class="cx">         push(@$outputArray, &quot;    RefPtr&lt;Inspector::ScriptArguments&gt; scriptArguments(Inspector::createScriptArguments(state, &quot; . @{$function-&gt;parameters} . &quot;));\n&quot;);
</span><span class="cx">         $implIncludes{&quot;&lt;inspector/ScriptArguments.h&gt;&quot;} = 1;
</span><span class="lines">@@ -4925,6 +4934,7 @@
</span><span class="cx">                 push(@$outputArray, &quot;    ScriptExecutionContext* context = castedThis-&gt;scriptExecutionContext();\n&quot;);
</span><span class="cx">                 push(@$outputArray, &quot;    if (!context)\n&quot;);
</span><span class="cx">                 push(@$outputArray, &quot;        return throwConstructorDocumentUnavailableError(*state, \&quot;${interfaceName}\&quot;);\n&quot;);
</span><ins>+                push(@$outputArray, &quot;    ASSERT(context-&gt;isDocument());\n&quot;);
</ins><span class="cx">                 push(@$outputArray, &quot;    auto&amp; document = downcast&lt;Document&gt;(*context);\n&quot;);
</span><span class="cx">             }
</span><span class="cx">             if ($generatingNamedConstructor) {
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptsIDLAttributestxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/IDLAttributes.txt (198101 => 198102)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/IDLAttributes.txt        2016-03-14 09:21:56 UTC (rev 198101)
+++ trunk/Source/WebCore/bindings/scripts/IDLAttributes.txt        2016-03-14 09:44:44 UTC (rev 198102)
</span><span class="lines">@@ -24,7 +24,7 @@
</span><span class="cx"> CachedAttribute
</span><span class="cx"> CallbackNeedsOperatorEqual
</span><span class="cx"> Callback=FunctionOnly
</span><del>-CallWith=ScriptExecutionContext|ScriptState|ScriptArguments|CallStack|ActiveWindow|FirstWindow
</del><ins>+CallWith=Document|ScriptExecutionContext|ScriptState|ScriptArguments|CallStack|ActiveWindow|FirstWindow
</ins><span class="cx"> CheckSecurity
</span><span class="cx"> CheckSecurityForNode
</span><span class="cx"> Clamp
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestGObjectWebKitDOMTestObjcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp (198101 => 198102)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp        2016-03-14 09:21:56 UTC (rev 198101)
+++ trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp        2016-03-14 09:44:44 UTC (rev 198102)
</span><span class="lines">@@ -1465,6 +1465,14 @@
</span><span class="cx">     return WebKit::kit(gobjectResult.get());
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void webkit_dom_test_obj_with_document_argument(WebKitDOMTestObj* self)
+{
+    WebCore::JSMainThreadNullState state;
+    g_return_if_fail(WEBKIT_DOM_IS_TEST_OBJ(self));
+    WebCore::TestObj* item = WebKit::core(self);
+    item-&gt;withDocumentArgument();
+}
+
</ins><span class="cx"> void webkit_dom_test_obj_method_with_optional_arg(WebKitDOMTestObj* self, glong opt)
</span><span class="cx"> {
</span><span class="cx">     WebCore::JSMainThreadNullState state;
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestGObjectWebKitDOMTestObjh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h (198101 => 198102)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h        2016-03-14 09:21:56 UTC (rev 198101)
+++ trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h        2016-03-14 09:44:44 UTC (rev 198102)
</span><span class="lines">@@ -437,6 +437,15 @@
</span><span class="cx"> webkit_dom_test_obj_with_script_execution_context_and_script_state_with_spaces(WebKitDOMTestObj* self);
</span><span class="cx"> 
</span><span class="cx"> /**
</span><ins>+ * webkit_dom_test_obj_with_document_argument:
+ * @self: A #WebKitDOMTestObj
+ *
+ * Stability: Unstable
+**/
+WEBKIT_API void
+webkit_dom_test_obj_with_document_argument(WebKitDOMTestObj* self);
+
+/**
</ins><span class="cx">  * webkit_dom_test_obj_method_with_optional_arg:
</span><span class="cx">  * @self: A #WebKitDOMTestObj
</span><span class="cx">  * @opt: A #glong
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestJSJSTestInterfacecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp (198101 => 198102)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp        2016-03-14 09:21:56 UTC (rev 198101)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp        2016-03-14 09:44:44 UTC (rev 198102)
</span><span class="lines">@@ -792,8 +792,8 @@
</span><span class="cx">     if (UNLIKELY(state-&gt;argumentCount() &lt; 2))
</span><span class="cx">         return throwVMError(state, createNotEnoughArgumentsError(state));
</span><span class="cx">     ExceptionCode ec = 0;
</span><del>-    auto* scriptContext = jsCast&lt;JSDOMGlobalObject*&gt;(state-&gt;lexicalGlobalObject())-&gt;scriptExecutionContext();
-    if (!scriptContext)
</del><ins>+    auto* context = jsCast&lt;JSDOMGlobalObject*&gt;(state-&gt;lexicalGlobalObject())-&gt;scriptExecutionContext();
+    if (!context)
</ins><span class="cx">         return JSValue::encode(jsUndefined());
</span><span class="cx">     String strArg = state-&gt;argument(0).toString(state)-&gt;value(state);
</span><span class="cx">     if (UNLIKELY(state-&gt;hadException()))
</span><span class="lines">@@ -801,7 +801,7 @@
</span><span class="cx">     TestObj* objArg = JSTestObj::toWrapped(state-&gt;argument(1));
</span><span class="cx">     if (UNLIKELY(state-&gt;hadException()))
</span><span class="cx">         return JSValue::encode(jsUndefined());
</span><del>-    JSValue result = toJS(state, castedThis-&gt;globalObject(), WTF::getPtr(impl.implementsMethod2(*scriptContext, strArg, objArg, ec)));
</del><ins>+    JSValue result = toJS(state, castedThis-&gt;globalObject(), WTF::getPtr(impl.implementsMethod2(*context, strArg, objArg, ec)));
</ins><span class="cx"> 
</span><span class="cx">     setDOMException(state, ec);
</span><span class="cx">     return JSValue::encode(result);
</span><span class="lines">@@ -858,8 +858,8 @@
</span><span class="cx">     if (UNLIKELY(state-&gt;argumentCount() &lt; 2))
</span><span class="cx">         return throwVMError(state, createNotEnoughArgumentsError(state));
</span><span class="cx">     ExceptionCode ec = 0;
</span><del>-    auto* scriptContext = jsCast&lt;JSDOMGlobalObject*&gt;(state-&gt;lexicalGlobalObject())-&gt;scriptExecutionContext();
-    if (!scriptContext)
</del><ins>+    auto* context = jsCast&lt;JSDOMGlobalObject*&gt;(state-&gt;lexicalGlobalObject())-&gt;scriptExecutionContext();
+    if (!context)
</ins><span class="cx">         return JSValue::encode(jsUndefined());
</span><span class="cx">     String strArg = state-&gt;argument(0).toString(state)-&gt;value(state);
</span><span class="cx">     if (UNLIKELY(state-&gt;hadException()))
</span><span class="lines">@@ -867,7 +867,7 @@
</span><span class="cx">     TestObj* objArg = JSTestObj::toWrapped(state-&gt;argument(1));
</span><span class="cx">     if (UNLIKELY(state-&gt;hadException()))
</span><span class="cx">         return JSValue::encode(jsUndefined());
</span><del>-    JSValue result = toJS(state, castedThis-&gt;globalObject(), WTF::getPtr(WebCore::TestSupplemental::supplementalMethod2(impl, *scriptContext, strArg, objArg, ec)));
</del><ins>+    JSValue result = toJS(state, castedThis-&gt;globalObject(), WTF::getPtr(WebCore::TestSupplemental::supplementalMethod2(impl, *context, strArg, objArg, ec)));
</ins><span class="cx"> 
</span><span class="cx">     setDOMException(state, ec);
</span><span class="cx">     return JSValue::encode(result);
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestJSJSTestObjcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp (198101 => 198102)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp        2016-03-14 09:21:56 UTC (rev 198101)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp        2016-03-14 09:44:44 UTC (rev 198102)
</span><span class="lines">@@ -129,6 +129,7 @@
</span><span class="cx"> JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithScriptExecutionContextAndScriptStateObjException(JSC::ExecState*);
</span><span class="cx"> JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithScriptExecutionContextAndScriptStateWithSpaces(JSC::ExecState*);
</span><span class="cx"> JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithScriptArgumentsAndCallStack(JSC::ExecState*);
</span><ins>+JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDocumentArgument(JSC::ExecState*);
</ins><span class="cx"> JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalArg(JSC::ExecState*);
</span><span class="cx"> JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalArgAndDefaultValue(JSC::ExecState*);
</span><span class="cx"> JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndOptionalArg(JSC::ExecState*);
</span><span class="lines">@@ -661,6 +662,7 @@
</span><span class="cx">     { &quot;withScriptExecutionContextAndScriptStateObjException&quot;, JSC::Function, NoIntrinsic, { (intptr_t)static_cast&lt;NativeFunction&gt;(jsTestObjPrototypeFunctionWithScriptExecutionContextAndScriptStateObjException), (intptr_t) (0) } },
</span><span class="cx">     { &quot;withScriptExecutionContextAndScriptStateWithSpaces&quot;, JSC::Function, NoIntrinsic, { (intptr_t)static_cast&lt;NativeFunction&gt;(jsTestObjPrototypeFunctionWithScriptExecutionContextAndScriptStateWithSpaces), (intptr_t) (0) } },
</span><span class="cx">     { &quot;withScriptArgumentsAndCallStack&quot;, JSC::Function, NoIntrinsic, { (intptr_t)static_cast&lt;NativeFunction&gt;(jsTestObjPrototypeFunctionWithScriptArgumentsAndCallStack), (intptr_t) (0) } },
</span><ins>+    { &quot;withDocumentArgument&quot;, JSC::Function, NoIntrinsic, { (intptr_t)static_cast&lt;NativeFunction&gt;(jsTestObjPrototypeFunctionWithDocumentArgument), (intptr_t) (0) } },
</ins><span class="cx">     { &quot;methodWithOptionalArg&quot;, JSC::Function, NoIntrinsic, { (intptr_t)static_cast&lt;NativeFunction&gt;(jsTestObjPrototypeFunctionMethodWithOptionalArg), (intptr_t) (0) } },
</span><span class="cx">     { &quot;methodWithOptionalArgAndDefaultValue&quot;, JSC::Function, NoIntrinsic, { (intptr_t)static_cast&lt;NativeFunction&gt;(jsTestObjPrototypeFunctionMethodWithOptionalArgAndDefaultValue), (intptr_t) (0) } },
</span><span class="cx">     { &quot;methodWithNonOptionalArgAndOptionalArg&quot;, JSC::Function, NoIntrinsic, { (intptr_t)static_cast&lt;NativeFunction&gt;(jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndOptionalArg), (intptr_t) (1) } },
</span><span class="lines">@@ -1474,11 +1476,11 @@
</span><span class="cx">     if (UNLIKELY(!castedThis)) {
</span><span class="cx">         return throwGetterTypeError(*state, &quot;TestObj&quot;, &quot;withScriptExecutionContextAttribute&quot;);
</span><span class="cx">     }
</span><del>-    auto* scriptContext = jsCast&lt;JSDOMGlobalObject*&gt;(state-&gt;lexicalGlobalObject())-&gt;scriptExecutionContext();
-    if (!scriptContext)
</del><ins>+    auto* context = jsCast&lt;JSDOMGlobalObject*&gt;(state-&gt;lexicalGlobalObject())-&gt;scriptExecutionContext();
+    if (!context)
</ins><span class="cx">         return JSValue::encode(jsUndefined());
</span><span class="cx">     auto&amp; impl = castedThis-&gt;wrapped();
</span><del>-    JSValue result = toJS(state, castedThis-&gt;globalObject(), WTF::getPtr(impl.withScriptExecutionContextAttribute(*scriptContext)));
</del><ins>+    JSValue result = toJS(state, castedThis-&gt;globalObject(), WTF::getPtr(impl.withScriptExecutionContextAttribute(*context)));
</ins><span class="cx">     return JSValue::encode(result);
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -1510,11 +1512,11 @@
</span><span class="cx">         return throwGetterTypeError(*state, &quot;TestObj&quot;, &quot;withScriptExecutionContextAttributeRaises&quot;);
</span><span class="cx">     }
</span><span class="cx">     ExceptionCode ec = 0;
</span><del>-    auto* scriptContext = jsCast&lt;JSDOMGlobalObject*&gt;(state-&gt;lexicalGlobalObject())-&gt;scriptExecutionContext();
-    if (!scriptContext)
</del><ins>+    auto* context = jsCast&lt;JSDOMGlobalObject*&gt;(state-&gt;lexicalGlobalObject())-&gt;scriptExecutionContext();
+    if (!context)
</ins><span class="cx">         return JSValue::encode(jsUndefined());
</span><span class="cx">     auto&amp; impl = castedThis-&gt;wrapped();
</span><del>-    JSValue result = toJS(state, castedThis-&gt;globalObject(), WTF::getPtr(impl.withScriptExecutionContextAttributeRaises(*scriptContext, ec)));
</del><ins>+    JSValue result = toJS(state, castedThis-&gt;globalObject(), WTF::getPtr(impl.withScriptExecutionContextAttributeRaises(*context, ec)));
</ins><span class="cx">     setDOMException(state, ec);
</span><span class="cx">     return JSValue::encode(result);
</span><span class="cx"> }
</span><span class="lines">@@ -1529,11 +1531,11 @@
</span><span class="cx">     if (UNLIKELY(!castedThis)) {
</span><span class="cx">         return throwGetterTypeError(*state, &quot;TestObj&quot;, &quot;withScriptExecutionContextAndScriptStateAttribute&quot;);
</span><span class="cx">     }
</span><del>-    auto* scriptContext = jsCast&lt;JSDOMGlobalObject*&gt;(state-&gt;lexicalGlobalObject())-&gt;scriptExecutionContext();
-    if (!scriptContext)
</del><ins>+    auto* context = jsCast&lt;JSDOMGlobalObject*&gt;(state-&gt;lexicalGlobalObject())-&gt;scriptExecutionContext();
+    if (!context)
</ins><span class="cx">         return JSValue::encode(jsUndefined());
</span><span class="cx">     auto&amp; impl = castedThis-&gt;wrapped();
</span><del>-    JSValue result = toJS(state, castedThis-&gt;globalObject(), WTF::getPtr(impl.withScriptExecutionContextAndScriptStateAttribute(*state, *scriptContext)));
</del><ins>+    JSValue result = toJS(state, castedThis-&gt;globalObject(), WTF::getPtr(impl.withScriptExecutionContextAndScriptStateAttribute(*state, *context)));
</ins><span class="cx">     return JSValue::encode(result);
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -1548,11 +1550,11 @@
</span><span class="cx">         return throwGetterTypeError(*state, &quot;TestObj&quot;, &quot;withScriptExecutionContextAndScriptStateAttributeRaises&quot;);
</span><span class="cx">     }
</span><span class="cx">     ExceptionCode ec = 0;
</span><del>-    auto* scriptContext = jsCast&lt;JSDOMGlobalObject*&gt;(state-&gt;lexicalGlobalObject())-&gt;scriptExecutionContext();
-    if (!scriptContext)
</del><ins>+    auto* context = jsCast&lt;JSDOMGlobalObject*&gt;(state-&gt;lexicalGlobalObject())-&gt;scriptExecutionContext();
+    if (!context)
</ins><span class="cx">         return JSValue::encode(jsUndefined());
</span><span class="cx">     auto&amp; impl = castedThis-&gt;wrapped();
</span><del>-    JSValue result = toJS(state, castedThis-&gt;globalObject(), WTF::getPtr(impl.withScriptExecutionContextAndScriptStateAttributeRaises(*state, *scriptContext, ec)));
</del><ins>+    JSValue result = toJS(state, castedThis-&gt;globalObject(), WTF::getPtr(impl.withScriptExecutionContextAndScriptStateAttributeRaises(*state, *context, ec)));
</ins><span class="cx">     setDOMException(state, ec);
</span><span class="cx">     return JSValue::encode(result);
</span><span class="cx"> }
</span><span class="lines">@@ -1567,11 +1569,11 @@
</span><span class="cx">     if (UNLIKELY(!castedThis)) {
</span><span class="cx">         return throwGetterTypeError(*state, &quot;TestObj&quot;, &quot;withScriptExecutionContextAndScriptStateWithSpacesAttribute&quot;);
</span><span class="cx">     }
</span><del>-    auto* scriptContext = jsCast&lt;JSDOMGlobalObject*&gt;(state-&gt;lexicalGlobalObject())-&gt;scriptExecutionContext();
-    if (!scriptContext)
</del><ins>+    auto* context = jsCast&lt;JSDOMGlobalObject*&gt;(state-&gt;lexicalGlobalObject())-&gt;scriptExecutionContext();
+    if (!context)
</ins><span class="cx">         return JSValue::encode(jsUndefined());
</span><span class="cx">     auto&amp; impl = castedThis-&gt;wrapped();
</span><del>-    JSValue result = toJS(state, castedThis-&gt;globalObject(), WTF::getPtr(impl.withScriptExecutionContextAndScriptStateWithSpacesAttribute(*state, *scriptContext)));
</del><ins>+    JSValue result = toJS(state, castedThis-&gt;globalObject(), WTF::getPtr(impl.withScriptExecutionContextAndScriptStateWithSpacesAttribute(*state, *context)));
</ins><span class="cx">     return JSValue::encode(result);
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -2694,10 +2696,10 @@
</span><span class="cx">     TestObj* nativeValue = JSTestObj::toWrapped(value);
</span><span class="cx">     if (UNLIKELY(state-&gt;hadException()))
</span><span class="cx">         return false;
</span><del>-    auto* scriptContext = jsCast&lt;JSDOMGlobalObject*&gt;(state-&gt;lexicalGlobalObject())-&gt;scriptExecutionContext();
-    if (!scriptContext)
</del><ins>+    auto* context = jsCast&lt;JSDOMGlobalObject*&gt;(state-&gt;lexicalGlobalObject())-&gt;scriptExecutionContext();
+    if (!context)
</ins><span class="cx">         return false;
</span><del>-    impl.setWithScriptExecutionContextAttribute(*scriptContext, nativeValue);
</del><ins>+    impl.setWithScriptExecutionContextAttribute(*context, nativeValue);
</ins><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -2731,10 +2733,10 @@
</span><span class="cx">     TestObj* nativeValue = JSTestObj::toWrapped(value);
</span><span class="cx">     if (UNLIKELY(state-&gt;hadException()))
</span><span class="cx">         return false;
</span><del>-    auto* scriptContext = jsCast&lt;JSDOMGlobalObject*&gt;(state-&gt;lexicalGlobalObject())-&gt;scriptExecutionContext();
-    if (!scriptContext)
</del><ins>+    auto* context = jsCast&lt;JSDOMGlobalObject*&gt;(state-&gt;lexicalGlobalObject())-&gt;scriptExecutionContext();
+    if (!context)
</ins><span class="cx">         return false;
</span><del>-    impl.setWithScriptExecutionContextAttributeRaises(*scriptContext, nativeValue);
</del><ins>+    impl.setWithScriptExecutionContextAttributeRaises(*context, nativeValue);
</ins><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -2751,10 +2753,10 @@
</span><span class="cx">     TestObj* nativeValue = JSTestObj::toWrapped(value);
</span><span class="cx">     if (UNLIKELY(state-&gt;hadException()))
</span><span class="cx">         return false;
</span><del>-    auto* scriptContext = jsCast&lt;JSDOMGlobalObject*&gt;(state-&gt;lexicalGlobalObject())-&gt;scriptExecutionContext();
-    if (!scriptContext)
</del><ins>+    auto* context = jsCast&lt;JSDOMGlobalObject*&gt;(state-&gt;lexicalGlobalObject())-&gt;scriptExecutionContext();
+    if (!context)
</ins><span class="cx">         return false;
</span><del>-    impl.setWithScriptExecutionContextAndScriptStateAttribute(*state, *scriptContext, nativeValue);
</del><ins>+    impl.setWithScriptExecutionContextAndScriptStateAttribute(*state, *context, nativeValue);
</ins><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -2771,10 +2773,10 @@
</span><span class="cx">     TestObj* nativeValue = JSTestObj::toWrapped(value);
</span><span class="cx">     if (UNLIKELY(state-&gt;hadException()))
</span><span class="cx">         return false;
</span><del>-    auto* scriptContext = jsCast&lt;JSDOMGlobalObject*&gt;(state-&gt;lexicalGlobalObject())-&gt;scriptExecutionContext();
-    if (!scriptContext)
</del><ins>+    auto* context = jsCast&lt;JSDOMGlobalObject*&gt;(state-&gt;lexicalGlobalObject())-&gt;scriptExecutionContext();
+    if (!context)
</ins><span class="cx">         return false;
</span><del>-    impl.setWithScriptExecutionContextAndScriptStateAttributeRaises(*state, *scriptContext, nativeValue);
</del><ins>+    impl.setWithScriptExecutionContextAndScriptStateAttributeRaises(*state, *context, nativeValue);
</ins><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -2791,10 +2793,10 @@
</span><span class="cx">     TestObj* nativeValue = JSTestObj::toWrapped(value);
</span><span class="cx">     if (UNLIKELY(state-&gt;hadException()))
</span><span class="cx">         return false;
</span><del>-    auto* scriptContext = jsCast&lt;JSDOMGlobalObject*&gt;(state-&gt;lexicalGlobalObject())-&gt;scriptExecutionContext();
-    if (!scriptContext)
</del><ins>+    auto* context = jsCast&lt;JSDOMGlobalObject*&gt;(state-&gt;lexicalGlobalObject())-&gt;scriptExecutionContext();
+    if (!context)
</ins><span class="cx">         return false;
</span><del>-    impl.setWithScriptExecutionContextAndScriptStateWithSpacesAttribute(*state, *scriptContext, nativeValue);
</del><ins>+    impl.setWithScriptExecutionContextAndScriptStateWithSpacesAttribute(*state, *context, nativeValue);
</ins><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -3698,10 +3700,10 @@
</span><span class="cx">         return throwThisTypeError(*state, &quot;TestObj&quot;, &quot;withScriptExecutionContext&quot;);
</span><span class="cx">     ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestObj::info());
</span><span class="cx">     auto&amp; impl = castedThis-&gt;wrapped();
</span><del>-    auto* scriptContext = jsCast&lt;JSDOMGlobalObject*&gt;(state-&gt;lexicalGlobalObject())-&gt;scriptExecutionContext();
-    if (!scriptContext)
</del><ins>+    auto* context = jsCast&lt;JSDOMGlobalObject*&gt;(state-&gt;lexicalGlobalObject())-&gt;scriptExecutionContext();
+    if (!context)
</ins><span class="cx">         return JSValue::encode(jsUndefined());
</span><del>-    impl.withScriptExecutionContext(*scriptContext);
</del><ins>+    impl.withScriptExecutionContext(*context);
</ins><span class="cx">     return JSValue::encode(jsUndefined());
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -3713,10 +3715,10 @@
</span><span class="cx">         return throwThisTypeError(*state, &quot;TestObj&quot;, &quot;withScriptExecutionContextAndScriptState&quot;);
</span><span class="cx">     ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestObj::info());
</span><span class="cx">     auto&amp; impl = castedThis-&gt;wrapped();
</span><del>-    auto* scriptContext = jsCast&lt;JSDOMGlobalObject*&gt;(state-&gt;lexicalGlobalObject())-&gt;scriptExecutionContext();
-    if (!scriptContext)
</del><ins>+    auto* context = jsCast&lt;JSDOMGlobalObject*&gt;(state-&gt;lexicalGlobalObject())-&gt;scriptExecutionContext();
+    if (!context)
</ins><span class="cx">         return JSValue::encode(jsUndefined());
</span><del>-    impl.withScriptExecutionContextAndScriptState(*state, *scriptContext);
</del><ins>+    impl.withScriptExecutionContextAndScriptState(*state, *context);
</ins><span class="cx">     return JSValue::encode(jsUndefined());
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -3729,10 +3731,10 @@
</span><span class="cx">     ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestObj::info());
</span><span class="cx">     auto&amp; impl = castedThis-&gt;wrapped();
</span><span class="cx">     ExceptionCode ec = 0;
</span><del>-    auto* scriptContext = jsCast&lt;JSDOMGlobalObject*&gt;(state-&gt;lexicalGlobalObject())-&gt;scriptExecutionContext();
-    if (!scriptContext)
</del><ins>+    auto* context = jsCast&lt;JSDOMGlobalObject*&gt;(state-&gt;lexicalGlobalObject())-&gt;scriptExecutionContext();
+    if (!context)
</ins><span class="cx">         return JSValue::encode(jsUndefined());
</span><del>-    JSValue result = toJS(state, castedThis-&gt;globalObject(), WTF::getPtr(impl.withScriptExecutionContextAndScriptStateObjException(*state, *scriptContext, ec)));
</del><ins>+    JSValue result = toJS(state, castedThis-&gt;globalObject(), WTF::getPtr(impl.withScriptExecutionContextAndScriptStateObjException(*state, *context, ec)));
</ins><span class="cx"> 
</span><span class="cx">     setDOMException(state, ec);
</span><span class="cx">     if (UNLIKELY(state-&gt;hadException()))
</span><span class="lines">@@ -3748,10 +3750,10 @@
</span><span class="cx">         return throwThisTypeError(*state, &quot;TestObj&quot;, &quot;withScriptExecutionContextAndScriptStateWithSpaces&quot;);
</span><span class="cx">     ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestObj::info());
</span><span class="cx">     auto&amp; impl = castedThis-&gt;wrapped();
</span><del>-    auto* scriptContext = jsCast&lt;JSDOMGlobalObject*&gt;(state-&gt;lexicalGlobalObject())-&gt;scriptExecutionContext();
-    if (!scriptContext)
</del><ins>+    auto* context = jsCast&lt;JSDOMGlobalObject*&gt;(state-&gt;lexicalGlobalObject())-&gt;scriptExecutionContext();
+    if (!context)
</ins><span class="cx">         return JSValue::encode(jsUndefined());
</span><del>-    JSValue result = toJS(state, castedThis-&gt;globalObject(), WTF::getPtr(impl.withScriptExecutionContextAndScriptStateWithSpaces(*state, *scriptContext)));
</del><ins>+    JSValue result = toJS(state, castedThis-&gt;globalObject(), WTF::getPtr(impl.withScriptExecutionContextAndScriptStateWithSpaces(*state, *context)));
</ins><span class="cx">     if (UNLIKELY(state-&gt;hadException()))
</span><span class="cx">         return JSValue::encode(jsUndefined());
</span><span class="cx">     return JSValue::encode(result);
</span><span class="lines">@@ -3770,6 +3772,23 @@
</span><span class="cx">     return JSValue::encode(jsUndefined());
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDocumentArgument(ExecState* state)
+{
+    JSValue thisValue = state-&gt;thisValue();
+    auto castedThis = jsDynamicCast&lt;JSTestObj*&gt;(thisValue);
+    if (UNLIKELY(!castedThis))
+        return throwThisTypeError(*state, &quot;TestObj&quot;, &quot;withDocumentArgument&quot;);
+    ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestObj::info());
+    auto&amp; impl = castedThis-&gt;wrapped();
+    auto* context = jsCast&lt;JSDOMGlobalObject*&gt;(state-&gt;lexicalGlobalObject())-&gt;scriptExecutionContext();
+    if (!context)
+        return JSValue::encode(jsUndefined());
+    ASSERT(context-&gt;isDocument());
+    auto&amp; document = downcast&lt;Document&gt;(*context);
+    impl.withDocumentArgument(document);
+    return JSValue::encode(jsUndefined());
+}
+
</ins><span class="cx"> EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalArg(ExecState* state)
</span><span class="cx"> {
</span><span class="cx">     JSValue thisValue = state-&gt;thisValue();
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestObjCDOMTestObjh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h (198101 => 198102)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h        2016-03-14 09:21:56 UTC (rev 198101)
+++ trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h        2016-03-14 09:44:44 UTC (rev 198102)
</span><span class="lines">@@ -168,6 +168,7 @@
</span><span class="cx"> - (DOMTestObj *)withScriptExecutionContextAndScriptStateObjException;
</span><span class="cx"> - (DOMTestObj *)withScriptExecutionContextAndScriptStateWithSpaces;
</span><span class="cx"> - (void)withScriptArgumentsAndCallStack;
</span><ins>+- (void)withDocumentArgument;
</ins><span class="cx"> - (void)methodWithOptionalArg:(int)opt;
</span><span class="cx"> - (void)methodWithOptionalArgAndDefaultValue:(int)opt;
</span><span class="cx"> - (void)methodWithNonOptionalArgAndOptionalArg:(int)nonOpt opt:(int)opt;
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestObjCDOMTestObjmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm (198101 => 198102)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm        2016-03-14 09:21:56 UTC (rev 198101)
+++ trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm        2016-03-14 09:44:44 UTC (rev 198102)
</span><span class="lines">@@ -1172,6 +1172,12 @@
</span><span class="cx">     IMPL-&gt;withScriptArgumentsAndCallStack();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+- (void)withDocumentArgument
+{
+    WebCore::JSMainThreadNullState state;
+    IMPL-&gt;withDocumentArgument();
+}
+
</ins><span class="cx"> - (void)methodWithOptionalArg:(int)opt
</span><span class="cx"> {
</span><span class="cx">     WebCore::JSMainThreadNullState state;
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestTestObjidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/TestObj.idl (198101 => 198102)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/TestObj.idl        2016-03-14 09:21:56 UTC (rev 198101)
+++ trunk/Source/WebCore/bindings/scripts/test/TestObj.idl        2016-03-14 09:44:44 UTC (rev 198102)
</span><span class="lines">@@ -159,6 +159,7 @@
</span><span class="cx">     [CallWith=ScriptExecutionContext&amp;ScriptState, RaisesException] TestObj withScriptExecutionContextAndScriptStateObjException();
</span><span class="cx">     [CallWith=  ScriptExecutionContext  &amp;  ScriptState  ] TestObj withScriptExecutionContextAndScriptStateWithSpaces();
</span><span class="cx">     [CallWith=ScriptArguments&amp;CallStack] void withScriptArgumentsAndCallStack();
</span><ins>+    [CallWith=Document] void withDocumentArgument();
</ins><span class="cx"> 
</span><span class="cx">     [CallWith=ScriptState] attribute long withScriptStateAttribute;
</span><span class="cx">     [CallWith=ScriptState, SetterCallWith=ActiveWindow&amp;FirstWindow] attribute long withCallWithAndSetterCallWithAttribute;
</span></span></pre></div>
<a id="trunkSourceWebCorepageDOMWindowcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/DOMWindow.cpp (198101 => 198102)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/DOMWindow.cpp        2016-03-14 09:21:56 UTC (rev 198101)
+++ trunk/Source/WebCore/page/DOMWindow.cpp        2016-03-14 09:44:44 UTC (rev 198102)
</span><span class="lines">@@ -962,8 +962,13 @@
</span><span class="cx">     return m_frame-&gt;ownerElement();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void DOMWindow::focus(ScriptExecutionContext* context)
</del><ins>+void DOMWindow::focus(Document&amp; document)
</ins><span class="cx"> {
</span><ins>+    focus(opener() &amp;&amp; opener() != this &amp;&amp; document.domWindow() == opener());
+}
+
+void DOMWindow::focus(bool allowFocus)
+{
</ins><span class="cx">     if (!m_frame)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><span class="lines">@@ -971,13 +976,7 @@
</span><span class="cx">     if (!page)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    bool allowFocus = WindowFocusAllowedIndicator::windowFocusAllowed() || !m_frame-&gt;settings().windowFocusRestricted();
-    if (context) {
-        ASSERT(isMainThread());
-        Document&amp; activeDocument = downcast&lt;Document&gt;(*context);
-        if (opener() &amp;&amp; opener() != this &amp;&amp; activeDocument.domWindow() == opener())
-            allowFocus = true;
-    }
</del><ins>+    allowFocus = allowFocus || WindowFocusAllowedIndicator::windowFocusAllowed() || !m_frame-&gt;settings().windowFocusRestricted();
</ins><span class="cx"> 
</span><span class="cx">     // If we're a top level window, bring the window to the front.
</span><span class="cx">     if (m_frame-&gt;isMainFrame() &amp;&amp; allowFocus)
</span><span class="lines">@@ -1012,8 +1011,15 @@
</span><span class="cx">     page-&gt;chrome().unfocus();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void DOMWindow::close(ScriptExecutionContext* context)
</del><ins>+void DOMWindow::close(Document&amp; document)
</ins><span class="cx"> {
</span><ins>+    if (!document.canNavigate(m_frame))
+        return;
+    close();
+}
+
+void DOMWindow::close()
+{
</ins><span class="cx">     if (!m_frame)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><span class="lines">@@ -1024,12 +1030,6 @@
</span><span class="cx">     if (!m_frame-&gt;isMainFrame())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    if (context) {
-        ASSERT(isMainThread());
-        if (!downcast&lt;Document&gt;(*context).canNavigate(m_frame))
-            return;
-    }
-
</del><span class="cx">     bool allowScriptsToCloseWindows = m_frame-&gt;settings().allowScriptsToCloseWindows();
</span><span class="cx"> 
</span><span class="cx">     if (!(page-&gt;openedByDOM() || page-&gt;backForward().count() &lt;= 1 || allowScriptsToCloseWindows)) {
</span></span></pre></div>
<a id="trunkSourceWebCorepageDOMWindowh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/DOMWindow.h (198101 => 198102)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/DOMWindow.h        2016-03-14 09:21:56 UTC (rev 198101)
+++ trunk/Source/WebCore/page/DOMWindow.h        2016-03-14 09:44:44 UTC (rev 198102)
</span><span class="lines">@@ -160,11 +160,11 @@
</span><span class="cx"> 
</span><span class="cx">         Element* frameElement() const;
</span><span class="cx"> 
</span><del>-        void focus(ScriptExecutionContext* = nullptr);
-        void focus(ScriptExecutionContext&amp; context) { focus(&amp;context); }
</del><ins>+        void focus(bool allowFocus = false);
+        void focus(Document&amp;);
</ins><span class="cx">         void blur();
</span><del>-        WEBCORE_EXPORT void close(ScriptExecutionContext* = nullptr);
-        void close(ScriptExecutionContext&amp; context) { close(&amp;context); }
</del><ins>+        WEBCORE_EXPORT void close();
+        void close(Document&amp;);
</ins><span class="cx">         void print();
</span><span class="cx">         void stop();
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorepageDOMWindowidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/DOMWindow.idl (198101 => 198102)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/DOMWindow.idl        2016-03-14 09:21:56 UTC (rev 198101)
+++ trunk/Source/WebCore/page/DOMWindow.idl        2016-03-14 09:44:44 UTC (rev 198102)
</span><span class="lines">@@ -57,9 +57,9 @@
</span><span class="cx"> 
</span><span class="cx">     [CheckSecurityForNode] readonly attribute Element frameElement;
</span><span class="cx"> 
</span><del>-    [DoNotCheckSecurity, CallWith=ScriptExecutionContext, ForwardDeclareInHeader] void focus();
</del><ins>+    [DoNotCheckSecurity, CallWith=Document, ForwardDeclareInHeader] void focus();
</ins><span class="cx">     [DoNotCheckSecurity, ForwardDeclareInHeader] void blur();
</span><del>-    [DoNotCheckSecurity, CallWith=ScriptExecutionContext, ForwardDeclareInHeader] void close();
</del><ins>+    [DoNotCheckSecurity, CallWith=Document, ForwardDeclareInHeader] void close();
</ins><span class="cx"> 
</span><span class="cx">     void print();
</span><span class="cx">     void stop();
</span></span></pre></div>
<a id="trunkSourceWebCorepageHistorycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/History.cpp (198101 => 198102)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/History.cpp        2016-03-14 09:21:56 UTC (rev 198101)
+++ trunk/Source/WebCore/page/History.cpp        2016-03-14 09:44:44 UTC (rev 198102)
</span><span class="lines">@@ -91,9 +91,9 @@
</span><span class="cx">     go(-1);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void History::back(ScriptExecutionContext* context)
</del><ins>+void History::back(Document&amp; document)
</ins><span class="cx"> {
</span><del>-    go(context, -1);
</del><ins>+    go(document, -1);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void History::forward()
</span><span class="lines">@@ -101,9 +101,9 @@
</span><span class="cx">     go(1);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void History::forward(ScriptExecutionContext* context)
</del><ins>+void History::forward(Document&amp; document)
</ins><span class="cx"> {
</span><del>-    go(context, 1);
</del><ins>+    go(document, 1);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void History::go(int distance)
</span><span class="lines">@@ -114,17 +114,14 @@
</span><span class="cx">     m_frame-&gt;navigationScheduler().scheduleHistoryNavigation(distance);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void History::go(ScriptExecutionContext* context, int distance)
</del><ins>+void History::go(Document&amp; document, int distance)
</ins><span class="cx"> {
</span><span class="cx">     if (!m_frame)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     ASSERT(isMainThread());
</span><del>-    Document* activeDocument = downcast&lt;Document&gt;(context);
-    if (!activeDocument)
-        return;
</del><span class="cx"> 
</span><del>-    if (!activeDocument-&gt;canNavigate(m_frame))
</del><ins>+    if (!document.canNavigate(m_frame))
</ins><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     m_frame-&gt;navigationScheduler().scheduleHistoryNavigation(distance);
</span></span></pre></div>
<a id="trunkSourceWebCorepageHistoryh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/History.h (198101 => 198102)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/History.h        2016-03-14 09:21:56 UTC (rev 198101)
+++ trunk/Source/WebCore/page/History.h        2016-03-14 09:44:44 UTC (rev 198102)
</span><span class="lines">@@ -36,8 +36,8 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><ins>+class Document;
</ins><span class="cx"> class Frame;
</span><del>-class ScriptExecutionContext;
</del><span class="cx"> struct ExceptionCodeWithMessage;
</span><span class="cx"> typedef int ExceptionCode;
</span><span class="cx"> 
</span><span class="lines">@@ -49,16 +49,12 @@
</span><span class="cx">     PassRefPtr&lt;SerializedScriptValue&gt; state();
</span><span class="cx">     void back();
</span><span class="cx">     void forward();
</span><del>-    void go(int distance);
</del><ins>+    void go(int);
</ins><span class="cx"> 
</span><del>-    void back(ScriptExecutionContext&amp; context) { back(&amp;context); }
-    void forward(ScriptExecutionContext&amp; context) { forward(&amp;context); }
-    void go(ScriptExecutionContext&amp; context, int distance) { go(&amp;context, distance); }
</del><ins>+    void back(Document&amp;);
+    void forward(Document&amp;);
+    void go(Document&amp;, int);
</ins><span class="cx"> 
</span><del>-    void back(ScriptExecutionContext*);
-    void forward(ScriptExecutionContext*);
-    void go(ScriptExecutionContext*, int distance);
-
</del><span class="cx">     bool stateChanged() const;
</span><span class="cx">     bool isSameAsCurrentState(SerializedScriptValue*) const;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorepageHistoryidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/History.idl (198101 => 198102)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/History.idl        2016-03-14 09:21:56 UTC (rev 198101)
+++ trunk/Source/WebCore/page/History.idl        2016-03-14 09:44:44 UTC (rev 198102)
</span><span class="lines">@@ -29,9 +29,9 @@
</span><span class="cx">     readonly attribute unsigned long length;
</span><span class="cx">     [CachedAttribute, Custom] readonly attribute SerializedScriptValue state;
</span><span class="cx"> 
</span><del>-    [CallWith=ScriptExecutionContext, ForwardDeclareInHeader] void back();
-    [CallWith=ScriptExecutionContext, ForwardDeclareInHeader] void forward();
-    [CallWith=ScriptExecutionContext, ForwardDeclareInHeader] void go([Default=Undefined] optional long distance);
</del><ins>+    [CallWith=Document, ForwardDeclareInHeader] void back();
+    [CallWith=Document, ForwardDeclareInHeader] void forward();
+    [CallWith=Document, ForwardDeclareInHeader] void go([Default=Undefined] optional long distance);
</ins><span class="cx"> 
</span><span class="cx">     [Custom, RaisesException] void pushState(any data, DOMString title, optional DOMString url);
</span><span class="cx">     [Custom, RaisesException] void replaceState(any data, DOMString title, optional DOMString url);
</span></span></pre></div>
<a id="trunkSourceWebCoretestingInternalscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/testing/Internals.cpp (198101 => 198102)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/testing/Internals.cpp        2016-03-14 09:21:56 UTC (rev 198101)
+++ trunk/Source/WebCore/testing/Internals.cpp        2016-03-14 09:44:44 UTC (rev 198102)
</span><span class="lines">@@ -296,7 +296,7 @@
</span><span class="cx">     m_frontendController.setInspectorFrontendClient(nullptr);
</span><span class="cx">     inspectedPage()-&gt;inspectorController().disconnectFrontend(this);
</span><span class="cx"> 
</span><del>-    m_frontendWindow-&gt;close(m_frontendWindow-&gt;scriptExecutionContext());
</del><ins>+    m_frontendWindow-&gt;close();
</ins><span class="cx">     m_frontendWindow = nullptr;
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>