<!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>[211818] 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/211818">211818</a></dd>
<dt>Author</dt> <dd>utatane.tea@gmail.com</dd>
<dt>Date</dt> <dd>2017-02-07 10:24:49 -0800 (Tue, 07 Feb 2017)</dd>
</dl>

<h3>Log Message</h3>
<pre>Unreviewed, manual roll out of <a href="http://trac.webkit.org/projects/webkit/changeset/211777">r211777</a>
https://bugs.webkit.org/show_bug.cgi?id=167457

Source/JavaScriptCore:

* jsc.cpp:
(GlobalObject::moduleLoaderImportModule):
* runtime/JSGlobalObjectFunctions.cpp:
(JSC::globalFuncImportModule):

Source/WebCore:

* bindings/js/ScriptModuleLoader.cpp:
(WebCore::ScriptModuleLoader::importModule):

LayoutTests:

Later, I'll reland it with the deterministic tests.

* inspector/controller/resources/cappuccino.js: Removed.
* inspector/controller/resources/cocoa.js: Removed.
* inspector/controller/resources/drink.js: Removed.
* inspector/controller/runtime-controller-expected.txt:
* inspector/controller/runtime-controller.html:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsinspectorcontrollerruntimecontrollerexpectedtxt">trunk/LayoutTests/inspector/controller/runtime-controller-expected.txt</a></li>
<li><a href="#trunkLayoutTestsinspectorcontrollerruntimecontrollerhtml">trunk/LayoutTests/inspector/controller/runtime-controller.html</a></li>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCorejsccpp">trunk/Source/JavaScriptCore/jsc.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeJSGlobalObjectFunctionscpp">trunk/Source/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorebindingsjsScriptModuleLoadercpp">trunk/Source/WebCore/bindings/js/ScriptModuleLoader.cpp</a></li>
</ul>

<h3>Removed Paths</h3>
<ul>
<li>trunk/LayoutTests/inspector/controller/resources/</li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (211817 => 211818)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2017-02-07 18:24:02 UTC (rev 211817)
+++ trunk/LayoutTests/ChangeLog        2017-02-07 18:24:49 UTC (rev 211818)
</span><span class="lines">@@ -1,3 +1,16 @@
</span><ins>+2017-02-07  Yusuke Suzuki  &lt;utatane.tea@gmail.com&gt;
+
+        Unreviewed, manual roll out of r211777
+        https://bugs.webkit.org/show_bug.cgi?id=167457
+
+        Later, I'll reland it with the deterministic tests.
+
+        * inspector/controller/resources/cappuccino.js: Removed.
+        * inspector/controller/resources/cocoa.js: Removed.
+        * inspector/controller/resources/drink.js: Removed.
+        * inspector/controller/runtime-controller-expected.txt:
+        * inspector/controller/runtime-controller.html:
+
</ins><span class="cx"> 2017-02-07  Antoine Quint  &lt;graouts@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [Modern Media Controls] Handle media durations of an hour or more gracefully
</span></span></pre></div>
<a id="trunkLayoutTestsinspectorcontrollerruntimecontrollerexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/inspector/controller/runtime-controller-expected.txt (211817 => 211818)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector/controller/runtime-controller-expected.txt        2017-02-07 18:24:02 UTC (rev 211817)
+++ trunk/LayoutTests/inspector/controller/runtime-controller-expected.txt        2017-02-07 18:24:49 UTC (rev 211818)
</span><span class="lines">@@ -7,12 +7,6 @@
</span><span class="cx"> CONSOLE MESSAGE: line 9: Rejection
</span><span class="cx"> CONSOLE MESSAGE: line 7: %o
</span><span class="cx"> CONSOLE MESSAGE: line 7: %o
</span><del>-CONSOLE MESSAGE: line 9: TypeError: Module specifier does not start with &quot;/&quot;, &quot;./&quot;, or &quot;../&quot;.
-CONSOLE MESSAGE: line 9: TypeError: Importing a module script failed.
-CONSOLE MESSAGE: line 6: Cocoa is Sweet.
-CONSOLE MESSAGE: line 7: %o
-CONSOLE MESSAGE: line 6: Cocoa is Sweet. Cappuccino is Awesome.
-CONSOLE MESSAGE: line 7: %o
</del><span class="cx"> Tests for RuntimeManager operations.
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="lines">@@ -64,13 +58,3 @@
</span><span class="cx"> Source: x = y = await 10
</span><span class="cx"> PASS: Exception. Should not get transformed and produce a SyntaxError.
</span><span class="cx"> 
</span><del>--- Running test case: RuntimeManager.prototype.evaluateInInspectedWindow.ImportFromConsole
-Source: await import('')
-PASS: Transformed. Should log the value or an exception.
-Source: await import('./not-found.js')
-PASS: Transformed. Should log the value or an exception.
-Source: await import('./resources/cocoa.js').then((cocoa) =&gt; console.log(`${cocoa.name} is ${cocoa.taste}.`))
-PASS: Transformed. Should log the value or an exception.
-Source: await import('./resources/drink.js').then((ns) =&gt; console.log(`${ns.Cocoa.name} is ${ns.Cocoa.taste}. ${ns.Cappuccino.name} is ${ns.Cappuccino.taste}.`))
-PASS: Transformed. Should log the value or an exception.
-
</del></span></pre></div>
<a id="trunkLayoutTestsinspectorcontrollerruntimecontrollerhtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/inspector/controller/runtime-controller.html (211817 => 211818)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector/controller/runtime-controller.html        2017-02-07 18:24:02 UTC (rev 211817)
+++ trunk/LayoutTests/inspector/controller/runtime-controller.html        2017-02-07 18:24:49 UTC (rev 211818)
</span><span class="lines">@@ -124,26 +124,6 @@
</span><span class="cx">         }
</span><span class="cx">     });
</span><span class="cx"> 
</span><del>-    suite.addTestCase({
-        name: &quot;RuntimeManager.prototype.evaluateInInspectedWindow.ImportFromConsole&quot;,
-        description: &quot;Test evaluating an import expression from console.&quot;,
-        test(resolve, reject) {
-            function testSource(expression) {
-                WebInspector.runtimeManager.evaluateInInspectedWindow(expression, {objectGroup: &quot;test&quot;}, (result, wasThrown) =&gt; {
-                    InspectorTest.log(&quot;Source: &quot; + expression);
-                    InspectorTest.expectThat(result.isUndefined(), &quot;Transformed. Should log the value or an exception.&quot;);
-                });
-            }
-
-            testSource(&quot;await import('')&quot;);
-            testSource(&quot;await import('./not-found.js')&quot;);
-            testSource(&quot;await import('./resources/cocoa.js').then((cocoa) =&gt; console.log(`${cocoa.name} is ${cocoa.taste}.`))&quot;);
-            testSource(&quot;await import('./resources/drink.js').then((ns) =&gt; console.log(`${ns.Cocoa.name} is ${ns.Cocoa.taste}. ${ns.Cappuccino.name} is ${ns.Cappuccino.taste}.`))&quot;);
-
-            InspectorBackend.runAfterPendingDispatches(resolve);
-        }
-    });
-
</del><span class="cx">     suite.runTestCasesAndFinish();
</span><span class="cx"> }
</span><span class="cx"> &lt;/script&gt;
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (211817 => 211818)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2017-02-07 18:24:02 UTC (rev 211817)
+++ trunk/Source/JavaScriptCore/ChangeLog        2017-02-07 18:24:49 UTC (rev 211818)
</span><span class="lines">@@ -1,5 +1,15 @@
</span><span class="cx"> 2017-02-07  Yusuke Suzuki  &lt;utatane.tea@gmail.com&gt;
</span><span class="cx"> 
</span><ins>+        Unreviewed, manual roll out of r211777
+        https://bugs.webkit.org/show_bug.cgi?id=167457
+
+        * jsc.cpp:
+        (GlobalObject::moduleLoaderImportModule):
+        * runtime/JSGlobalObjectFunctions.cpp:
+        (JSC::globalFuncImportModule):
+
+2017-02-07  Yusuke Suzuki  &lt;utatane.tea@gmail.com&gt;
+
</ins><span class="cx">         Web Inspector: allow import() inside the inspector
</span><span class="cx">         https://bugs.webkit.org/show_bug.cgi?id=167457
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorejsccpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/jsc.cpp (211817 => 211818)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/jsc.cpp        2017-02-07 18:24:02 UTC (rev 211817)
+++ trunk/Source/JavaScriptCore/jsc.cpp        2017-02-07 18:24:49 UTC (rev 211818)
</span><span class="lines">@@ -1551,9 +1551,6 @@
</span><span class="cx">         return JSInternalPromiseDeferred::create(exec, globalObject)-&gt;reject(exec, error);
</span><span class="cx">     };
</span><span class="cx"> 
</span><del>-    if (sourceOrigin.isNull())
-        return rejectPromise(createError(exec, ASCIILiteral(&quot;Could not resolve the module specifier.&quot;)));
-
</del><span class="cx">     auto referrer = sourceOrigin.string();
</span><span class="cx">     auto moduleName = moduleNameValue-&gt;value(exec);
</span><span class="cx">     if (UNLIKELY(scope.exception())) {
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeJSGlobalObjectFunctionscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp (211817 => 211818)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp        2017-02-07 18:24:02 UTC (rev 211817)
+++ trunk/Source/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp        2017-02-07 18:24:49 UTC (rev 211818)
</span><span class="lines">@@ -944,6 +944,11 @@
</span><span class="cx">     RETURN_IF_EXCEPTION(catchScope, { });
</span><span class="cx"> 
</span><span class="cx">     auto sourceOrigin = exec-&gt;callerSourceOrigin();
</span><ins>+    if (sourceOrigin.isNull()) {
+        promise-&gt;reject(exec, createError(exec, ASCIILiteral(&quot;Could not resolve the module specifier.&quot;)));
+        return JSValue::encode(promise-&gt;promise());
+    }
+
</ins><span class="cx">     RELEASE_ASSERT(exec-&gt;argumentCount() == 1);
</span><span class="cx">     auto* specifier = exec-&gt;uncheckedArgument(0).toString(exec);
</span><span class="cx">     if (Exception* exception = catchScope.exception()) {
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (211817 => 211818)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2017-02-07 18:24:02 UTC (rev 211817)
+++ trunk/Source/WebCore/ChangeLog        2017-02-07 18:24:49 UTC (rev 211818)
</span><span class="lines">@@ -1,3 +1,11 @@
</span><ins>+2017-02-07  Yusuke Suzuki  &lt;utatane.tea@gmail.com&gt;
+
+        Unreviewed, manual roll out of r211777
+        https://bugs.webkit.org/show_bug.cgi?id=167457
+
+        * bindings/js/ScriptModuleLoader.cpp:
+        (WebCore::ScriptModuleLoader::importModule):
+
</ins><span class="cx"> 2017-02-07  Carlos Garcia Campos  &lt;cgarcia@igalia.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [GStreamer] Deadlock when media player is destroyed
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsScriptModuleLoadercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/ScriptModuleLoader.cpp (211817 => 211818)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/ScriptModuleLoader.cpp        2017-02-07 18:24:02 UTC (rev 211817)
+++ trunk/Source/WebCore/bindings/js/ScriptModuleLoader.cpp        2017-02-07 18:24:49 UTC (rev 211818)
</span><span class="lines">@@ -218,30 +218,15 @@
</span><span class="cx">     JSC::VM&amp; vm = exec-&gt;vm();
</span><span class="cx">     auto&amp; globalObject = *JSC::jsCast&lt;JSDOMGlobalObject*&gt;(jsGlobalObject);
</span><span class="cx"> 
</span><del>-    // If SourceOrigin and/or CachedScriptFetcher is null, we import the module with the default fetcher.
-    // SourceOrigin can be null if the source code is not coupled with the script file.
-    // The examples,
-    //     1. The code evaluated by the inspector.
-    //     2. The other unusual code execution like the evaluation through the NPAPI.
-    //     3. The code from injected bundle's script.
-    //     4. The code from extension script.
-    URL baseURL;
-    RefPtr&lt;JSC::ScriptFetcher&gt; scriptFetcher;
-    if (sourceOrigin.isNull()) {
-        baseURL = m_document.baseURL();
-        scriptFetcher = CachedScriptFetcher::create(m_document.charset());
-    } else {
-        baseURL = URL(URL(), sourceOrigin.string());
-        if (!baseURL.isValid())
-            return rejectPromise(state, globalObject, TypeError, ASCIILiteral(&quot;Importer module key is not a Symbol or a String.&quot;));
</del><ins>+    // FIXME: setTimeout and setInterval with &quot;string()&quot; should propagate SourceOrigin.
+    // https://webkit.org/b/167097
+    ASSERT_WITH_MESSAGE(!sourceOrigin.isNull(), &quot;If SourceOrigin is null, this function is not invoked.&quot;);
+    if (!sourceOrigin.fetcher())
+        return rejectPromise(state, globalObject, TypeError, ASCIILiteral(&quot;Could not use import operator in this context.&quot;));
</ins><span class="cx"> 
</span><del>-        if (sourceOrigin.fetcher())
-            scriptFetcher = sourceOrigin.fetcher();
-        else
-            scriptFetcher = CachedScriptFetcher::create(m_document.charset());
-    }
-    ASSERT(baseURL.isValid());
-    ASSERT(scriptFetcher);
</del><ins>+    URL baseURL(URL(), sourceOrigin.string());
+    if (!baseURL.isValid())
+        return rejectPromise(state, globalObject, TypeError, ASCIILiteral(&quot;Importer module key is not Symbol or String.&quot;));
</ins><span class="cx"> 
</span><span class="cx">     auto specifier = moduleName-&gt;value(exec);
</span><span class="cx">     auto result = resolveModuleSpecifier(m_document, specifier, baseURL);
</span><span class="lines">@@ -248,7 +233,7 @@
</span><span class="cx">     if (!result)
</span><span class="cx">         return rejectPromise(state, globalObject, TypeError, result.error());
</span><span class="cx"> 
</span><del>-    return JSC::importModule(exec, JSC::Identifier::fromString(&amp;vm, result-&gt;string()), JSC::JSScriptFetcher::create(vm, WTFMove(scriptFetcher) ));
</del><ins>+    return JSC::importModule(exec, JSC::Identifier::fromString(&amp;vm, result-&gt;string()), JSC::JSScriptFetcher::create(vm, sourceOrigin.fetcher() ));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void ScriptModuleLoader::notifyFinished(CachedModuleScriptLoader&amp; loader, RefPtr&lt;DeferredPromise&gt; promise)
</span></span></pre>
</div>
</div>

</body>
</html>