<!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>[196706] trunk</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/196706">196706</a></dd>
<dt>Author</dt> <dd>cdumez@apple.com</dd>
<dt>Date</dt> <dd>2016-02-17 11:31:10 -0800 (Wed, 17 Feb 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Regression(<a href="http://trac.webkit.org/projects/webkit/changeset/196648">r196648</a>): window.showModalDialog is no longer undefined if the client does not allow showing modal dialog
https://bugs.webkit.org/show_bug.cgi?id=154330

Reviewed by Gavin Barraclough.

Source/WebCore:

window.showModalDialog is no longer undefined if the client does not
allow showing modal dialog after <a href="http://trac.webkit.org/projects/webkit/changeset/196648">r196648</a>. This patch fixes the issue
and add test coverage for this.

Test: fast/dom/Window/forbid-showModalDialog.html

* bindings/js/JSDOMWindowCustom.cpp:
(WebCore::JSDOMWindow::getOwnPropertySlot):
- Move the DOMWindow::canShowModalDialog() check *before* checking
  for static properties as showModalDialog is now in the static
  property table after <a href="http://trac.webkit.org/projects/webkit/changeset/196648">r196648</a>.
- Add check for Base::getOwnPropertySlot() first to support overriding
  window.showModalDialog (This behavior matches Firefox).
- Return false if DOMWindow::canShowModalDialog() returns false as this
  seems cleaner than claiming that the property is there but undefined.

* page/DOMWindow.cpp:
(WebCore::DOMWindow::canShowModalDialogNow): Deleted.
This was indentical to canShowModalDialog().

(WebCore::DOMWindow::canShowModalDialog):
(WebCore::DOMWindow::setCanShowModalDialogOverride):
(WebCore::DOMWindow::showModalDialog):
* page/DOMWindow.h:
* testing/Internals.cpp:
(WebCore::Internals::setCanShowModalDialogOverride):
* testing/Internals.h:
* testing/Internals.idl:
Add support for overriding the ChromeClient's canShowModalDialog
decision and hook it up to Internals to add layout test coverage.

LayoutTests:

Add layout test to make sure that window.showModalDialog is undefined
when the client does not allow showing modal dialog and to check that
window.showModalDialog can be shadowed.

* fast/dom/Window/forbid-showModalDialog-expected.txt: Added.
* fast/dom/Window/forbid-showModalDialog.html: Added.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorebindingsjsJSDOMWindowCustomcpp">trunk/Source/WebCore/bindings/js/JSDOMWindowCustom.cpp</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="#trunkSourceWebCoretestingInternalscpp">trunk/Source/WebCore/testing/Internals.cpp</a></li>
<li><a href="#trunkSourceWebCoretestingInternalsh">trunk/Source/WebCore/testing/Internals.h</a></li>
<li><a href="#trunkSourceWebCoretestingInternalsidl">trunk/Source/WebCore/testing/Internals.idl</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsfastdomWindowforbidshowModalDialogexpectedtxt">trunk/LayoutTests/fast/dom/Window/forbid-showModalDialog-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastdomWindowforbidshowModalDialoghtml">trunk/LayoutTests/fast/dom/Window/forbid-showModalDialog.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (196705 => 196706)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2016-02-17 19:21:59 UTC (rev 196705)
+++ trunk/LayoutTests/ChangeLog        2016-02-17 19:31:10 UTC (rev 196706)
</span><span class="lines">@@ -1,3 +1,17 @@
</span><ins>+2016-02-17  Chris Dumez  &lt;cdumez@apple.com&gt;
+
+        Regression(r196648): window.showModalDialog is no longer undefined if the client does not allow showing modal dialog
+        https://bugs.webkit.org/show_bug.cgi?id=154330
+
+        Reviewed by Gavin Barraclough.
+
+        Add layout test to make sure that window.showModalDialog is undefined
+        when the client does not allow showing modal dialog and to check that
+        window.showModalDialog can be shadowed.
+
+        * fast/dom/Window/forbid-showModalDialog-expected.txt: Added.
+        * fast/dom/Window/forbid-showModalDialog.html: Added.
+
</ins><span class="cx"> 2016-02-17  Commit Queue  &lt;commit-queue@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         Unreviewed, rolling out r196675.
</span></span></pre></div>
<a id="trunkLayoutTestsfastdomWindowforbidshowModalDialogexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/dom/Window/forbid-showModalDialog-expected.txt (0 => 196706)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/Window/forbid-showModalDialog-expected.txt                                (rev 0)
+++ trunk/LayoutTests/fast/dom/Window/forbid-showModalDialog-expected.txt        2016-02-17 19:31:10 UTC (rev 196706)
</span><span class="lines">@@ -0,0 +1,31 @@
</span><ins>+Tests that Window.showModalDialog is undefined if the client does not allow showing modal dialogs.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+Make sure window.showModalDialog is undefined when modal dialogs are not allowed.
+internals.setCanShowModalDialogOverride(false)
+PASS window.showModalDialog is undefined
+PASS window.hasOwnProperty('showModalDialog') is false
+
+Tests having a named property with name 'showModalDialog'.
+document.body.append(testFrame)
+PASS window.showModalDialog is testFrame.contentWindow
+testFrame.remove()
+PASS window.showModalDialog is undefined
+
+Tests that window.showModalDialog is no longer undefined when modal dialogs become allowed.
+internals.setCanShowModalDialogOverride(true)
+PASS window.showModalDialog is not undefined
+PASS window.hasOwnProperty('showModalDialog') is true
+PASS window.showModalDialog is an instance of Function
+
+Make sure window.showModalDialog can be shadowed.
+window.showModalDialog = 1
+PASS window.showModalDialog is 1
+delete window.showModalDialog
+PASS window.showModalDialog is undefined
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsfastdomWindowforbidshowModalDialoghtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/dom/Window/forbid-showModalDialog.html (0 => 196706)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/Window/forbid-showModalDialog.html                                (rev 0)
+++ trunk/LayoutTests/fast/dom/Window/forbid-showModalDialog.html        2016-02-17 19:31:10 UTC (rev 196706)
</span><span class="lines">@@ -0,0 +1,40 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;body&gt;
+&lt;script src=&quot;../../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;script&gt;
+description(&quot;Tests that Window.showModalDialog is undefined if the client does not allow showing modal dialogs.&quot;);
+
+debug(&quot;Make sure window.showModalDialog is undefined when modal dialogs are not allowed.&quot;);
+evalAndLog(&quot;internals.setCanShowModalDialogOverride(false)&quot;);
+shouldBe(&quot;window.showModalDialog&quot;, &quot;undefined&quot;);
+shouldBeFalse(&quot;window.hasOwnProperty('showModalDialog')&quot;);
+
+
+debug(&quot;&quot;);
+debug(&quot;Tests having a named property with name 'showModalDialog'.&quot;);
+var testFrame = document.createElement(&quot;iframe&quot;);
+testFrame.name = &quot;showModalDialog&quot;;
+evalAndLog(&quot;document.body.append(testFrame)&quot;);
+shouldBe(&quot;window.showModalDialog&quot;, &quot;testFrame.contentWindow&quot;);
+evalAndLog(&quot;testFrame.remove()&quot;);
+shouldBe(&quot;window.showModalDialog&quot;, &quot;undefined&quot;);
+
+debug(&quot;&quot;);
+debug(&quot;Tests that window.showModalDialog is no longer undefined when modal dialogs become allowed.&quot;);
+evalAndLog(&quot;internals.setCanShowModalDialogOverride(true)&quot;);
+shouldNotBe(&quot;window.showModalDialog&quot;, &quot;undefined&quot;);
+shouldBeTrue(&quot;window.hasOwnProperty('showModalDialog')&quot;);
+shouldBeType(&quot;window.showModalDialog&quot;, &quot;Function&quot;);
+
+debug(&quot;&quot;);
+debug(&quot;Make sure window.showModalDialog can be shadowed.&quot;);
+evalAndLog(&quot;window.showModalDialog = 1&quot;);
+shouldBe(&quot;window.showModalDialog&quot; , &quot;1&quot;);
+evalAndLog(&quot;delete window.showModalDialog&quot;);
+shouldBe(&quot;window.showModalDialog&quot;, &quot;undefined&quot;);
+
+&lt;/script&gt;
+&lt;script src=&quot;../../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (196705 => 196706)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-02-17 19:21:59 UTC (rev 196705)
+++ trunk/Source/WebCore/ChangeLog        2016-02-17 19:31:10 UTC (rev 196706)
</span><span class="lines">@@ -1,3 +1,41 @@
</span><ins>+2016-02-17  Chris Dumez  &lt;cdumez@apple.com&gt;
+
+        Regression(r196648): window.showModalDialog is no longer undefined if the client does not allow showing modal dialog
+        https://bugs.webkit.org/show_bug.cgi?id=154330
+
+        Reviewed by Gavin Barraclough.
+
+        window.showModalDialog is no longer undefined if the client does not
+        allow showing modal dialog after r196648. This patch fixes the issue
+        and add test coverage for this.
+
+        Test: fast/dom/Window/forbid-showModalDialog.html
+
+        * bindings/js/JSDOMWindowCustom.cpp:
+        (WebCore::JSDOMWindow::getOwnPropertySlot):
+        - Move the DOMWindow::canShowModalDialog() check *before* checking
+          for static properties as showModalDialog is now in the static
+          property table after r196648.
+        - Add check for Base::getOwnPropertySlot() first to support overriding
+          window.showModalDialog (This behavior matches Firefox).
+        - Return false if DOMWindow::canShowModalDialog() returns false as this
+          seems cleaner than claiming that the property is there but undefined.
+
+        * page/DOMWindow.cpp:
+        (WebCore::DOMWindow::canShowModalDialogNow): Deleted.
+        This was indentical to canShowModalDialog().
+
+        (WebCore::DOMWindow::canShowModalDialog):
+        (WebCore::DOMWindow::setCanShowModalDialogOverride):
+        (WebCore::DOMWindow::showModalDialog):
+        * page/DOMWindow.h:
+        * testing/Internals.cpp:
+        (WebCore::Internals::setCanShowModalDialogOverride):
+        * testing/Internals.h:
+        * testing/Internals.idl:
+        Add support for overriding the ChromeClient's canShowModalDialog
+        decision and hook it up to Internals to add layout test coverage.
+
</ins><span class="cx"> 2016-02-17  Brady Eidson  &lt;beidson@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Modern IDB: More WK2 IPC Scaffolding.
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsJSDOMWindowCustomcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/JSDOMWindowCustom.cpp (196705 => 196706)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/JSDOMWindowCustom.cpp        2016-02-17 19:21:59 UTC (rev 196705)
+++ trunk/Source/WebCore/bindings/js/JSDOMWindowCustom.cpp        2016-02-17 19:31:10 UTC (rev 196706)
</span><span class="lines">@@ -275,16 +275,18 @@
</span><span class="cx">             slot.setCustom(thisObject, ReadOnly | DontDelete | DontEnum, nonCachingStaticFunctionGetter&lt;jsDOMWindowInstanceFunctionPostMessage, 2&gt;);
</span><span class="cx">         return true;
</span><span class="cx">     }
</span><ins>+
+    if (propertyName == exec-&gt;propertyNames().showModalDialog) {
+        if (Base::getOwnPropertySlot(thisObject, exec, propertyName, slot))
+            return true;
+        if (!DOMWindow::canShowModalDialog(frame))
+            return jsDOMWindowGetOwnPropertySlotNamedItemGetter(thisObject, *frame, exec, propertyName, slot);
+    }
+
</ins><span class="cx">     // (2) Regular own properties.
</span><span class="cx">     if (getStaticPropertySlot&lt;JSDOMWindow, Base&gt;(exec, *JSDOMWindow::info()-&gt;staticPropHashTable, thisObject, propertyName, slot))
</span><span class="cx">         return true;
</span><del>-    // FIXME: this looks pretty bogus. It seems highly likely that if !canShowModalDialog the
-    // funtion should still be present, or should be omitted entirely - present but reads as
-    // undefined with unspecified attributes is likely wrong.
-    if (propertyName == exec-&gt;propertyNames().showModalDialog &amp;&amp; !DOMWindow::canShowModalDialog(frame)) {
-        slot.setUndefined();
-        return true;
-    }
</del><ins>+
</ins><span class="cx"> #if ENABLE(INDEXED_DATABASE)
</span><span class="cx">     // FIXME: With generated JS bindings built on static property tables there is no way to
</span><span class="cx">     // completely remove a generated property at runtime. So to completely disable IndexedDB
</span></span></pre></div>
<a id="trunkSourceWebCorepageDOMWindowcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/DOMWindow.cpp (196705 => 196706)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/DOMWindow.cpp        2016-02-17 19:21:59 UTC (rev 196705)
+++ trunk/Source/WebCore/page/DOMWindow.cpp        2016-02-17 19:31:10 UTC (rev 196706)
</span><span class="lines">@@ -373,20 +373,22 @@
</span><span class="cx"> {
</span><span class="cx">     if (!frame)
</span><span class="cx">         return false;
</span><del>-    Page* page = frame-&gt;page();
-    if (!page)
-        return false;
-    return page-&gt;chrome().canRunModal();
</del><ins>+
+    // Override support for layout testing purposes.
+    if (auto* document = frame-&gt;document()) {
+        if (auto* window = document-&gt;domWindow()) {
+            if (window-&gt;m_canShowModalDialogOverride)
+                return window-&gt;m_canShowModalDialogOverride.value();
+        }
+    }
+
+    auto* page = frame-&gt;page();
+    return page ? page-&gt;chrome().canRunModal() : false;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool DOMWindow::canShowModalDialogNow(const Frame* frame)
</del><ins>+void DOMWindow::setCanShowModalDialogOverride(bool allow)
</ins><span class="cx"> {
</span><del>-    if (!frame)
-        return false;
-    Page* page = frame-&gt;page();
-    if (!page)
-        return false;
-    return page-&gt;chrome().canRunModal();
</del><ins>+    m_canShowModalDialogOverride = allow;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> DOMWindow::DOMWindow(Document* document)
</span><span class="lines">@@ -2240,7 +2242,7 @@
</span><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    if (!canShowModalDialogNow(m_frame) || !firstWindow.allowPopUp())
</del><ins>+    if (!canShowModalDialog(m_frame) || !firstWindow.allowPopUp())
</ins><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     RefPtr&lt;Frame&gt; dialogFrame = createWindow(urlString, emptyAtom, parseDialogFeatures(dialogFeaturesString, screenAvailableRect(m_frame-&gt;view())), activeWindow, *firstFrame, *m_frame, WTFMove(prepareDialogFunction));
</span></span></pre></div>
<a id="trunkSourceWebCorepageDOMWindowh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/DOMWindow.h (196705 => 196706)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/DOMWindow.h        2016-02-17 19:21:59 UTC (rev 196705)
+++ trunk/Source/WebCore/page/DOMWindow.h        2016-02-17 19:31:10 UTC (rev 196706)
</span><span class="lines">@@ -34,6 +34,7 @@
</span><span class="cx"> #include &quot;Supplementable.h&quot;
</span><span class="cx"> #include &lt;functional&gt;
</span><span class="cx"> #include &lt;memory&gt;
</span><ins>+#include &lt;wtf/Optional.h&gt;
</ins><span class="cx"> #include &lt;wtf/WeakPtr.h&gt;
</span><span class="cx"> 
</span><span class="cx"> namespace Inspector {
</span><span class="lines">@@ -135,7 +136,7 @@
</span><span class="cx">         bool allowPopUp(); // Call on first window, not target window.
</span><span class="cx">         static bool allowPopUp(Frame* firstFrame);
</span><span class="cx">         static bool canShowModalDialog(const Frame*);
</span><del>-        static bool canShowModalDialogNow(const Frame*);
</del><ins>+        WEBCORE_EXPORT void setCanShowModalDialogOverride(bool);
</ins><span class="cx"> 
</span><span class="cx">         // DOM Level 0
</span><span class="cx"> 
</span><span class="lines">@@ -370,6 +371,7 @@
</span><span class="cx"> 
</span><span class="cx">         bool m_shouldPrintWhenFinishedLoading;
</span><span class="cx">         bool m_suspendedForDocumentSuspension;
</span><ins>+        Optional&lt;bool&gt; m_canShowModalDialogOverride;
</ins><span class="cx"> 
</span><span class="cx">         HashSet&lt;DOMWindowProperty*&gt; m_properties;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoretestingInternalscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/testing/Internals.cpp (196705 => 196706)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/testing/Internals.cpp        2016-02-17 19:21:59 UTC (rev 196705)
+++ trunk/Source/WebCore/testing/Internals.cpp        2016-02-17 19:31:10 UTC (rev 196706)
</span><span class="lines">@@ -580,6 +580,16 @@
</span><span class="cx">     frame()-&gt;loader().setOverrideCachePolicyForTesting(stringToResourceRequestCachePolicy(policy));
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void Internals::setCanShowModalDialogOverride(bool allow, ExceptionCode&amp; ec)
+{
+    if (!contextDocument() || !contextDocument()-&gt;domWindow()) {
+        ec = INVALID_ACCESS_ERR;
+        return;
+    }
+
+    contextDocument()-&gt;domWindow()-&gt;setCanShowModalDialogOverride(allow);
+}
+
</ins><span class="cx"> static ResourceLoadPriority stringToResourceLoadPriority(const String&amp; policy)
</span><span class="cx"> {
</span><span class="cx">     if (policy == &quot;ResourceLoadPriorityVeryLow&quot;)
</span></span></pre></div>
<a id="trunkSourceWebCoretestingInternalsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/testing/Internals.h (196705 => 196706)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/testing/Internals.h        2016-02-17 19:21:59 UTC (rev 196705)
+++ trunk/Source/WebCore/testing/Internals.h        2016-02-17 19:31:10 UTC (rev 196706)
</span><span class="lines">@@ -98,6 +98,7 @@
</span><span class="cx">     bool isSharingStyleSheetContents(Element* linkA, Element* linkB);
</span><span class="cx">     bool isStyleSheetLoadingSubresources(Element* link);
</span><span class="cx">     void setOverrideCachePolicy(const String&amp;);
</span><ins>+    void setCanShowModalDialogOverride(bool allow, ExceptionCode&amp;);
</ins><span class="cx">     void setOverrideResourceLoadPriority(const String&amp;);
</span><span class="cx">     void setStrictRawResourceValidationPolicyDisabled(bool);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoretestingInternalsidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/testing/Internals.idl (196705 => 196706)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/testing/Internals.idl        2016-02-17 19:21:59 UTC (rev 196705)
+++ trunk/Source/WebCore/testing/Internals.idl        2016-02-17 19:31:10 UTC (rev 196706)
</span><span class="lines">@@ -437,4 +437,6 @@
</span><span class="cx"> 
</span><span class="cx">     DOMString resourceLoadStatisticsForOrigin(DOMString domain);
</span><span class="cx">     void setResourceLoadStatisticsEnabled(boolean enable);
</span><ins>+
+    [RaisesException] void setCanShowModalDialogOverride(boolean allow);
</ins><span class="cx"> };
</span></span></pre>
</div>
</div>

</body>
</html>