<!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>[210537] 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/210537">210537</a></dd>
<dt>Author</dt> <dd>utatane.tea@gmail.com</dd>
<dt>Date</dt> <dd>2017-01-09 21:58:19 -0800 (Mon, 09 Jan 2017)</dd>
</dl>
<h3>Log Message</h3>
<pre>Implement JSSourceCode to propagate SourceCode in module pipeline
https://bugs.webkit.org/show_bug.cgi?id=166861
Reviewed by Saam Barati.
Source/JavaScriptCore:
Instead of propagating source code string, we propagate JSSourceCode
cell in the module pipeline. This allows us to attach a metadata
to the propagated source code string. In particular, it propagates
SourceOrigin through the module pipeline.
* CMakeLists.txt:
* JavaScriptCore.xcodeproj/project.pbxproj:
* builtins/ModuleLoaderPrototype.js:
(fulfillFetch):
(requestFetch):
* jsc.cpp:
(GlobalObject::moduleLoaderFetch):
* llint/LLIntData.cpp:
(JSC::LLInt::Data::performAssertions):
* llint/LowLevelInterpreter.asm:
* runtime/Completion.cpp:
(JSC::loadAndEvaluateModule):
(JSC::loadModule):
* runtime/JSModuleLoader.cpp:
(JSC::JSModuleLoader::provide):
* runtime/JSModuleLoader.h:
* runtime/JSSourceCode.cpp: Added.
(JSC::JSSourceCode::destroy):
* runtime/JSSourceCode.h: Added.
(JSC::JSSourceCode::createStructure):
(JSC::JSSourceCode::create):
(JSC::JSSourceCode::sourceCode):
(JSC::JSSourceCode::JSSourceCode):
* runtime/JSType.h:
* runtime/ModuleLoaderPrototype.cpp:
(JSC::moduleLoaderPrototypeParseModule):
* runtime/VM.cpp:
(JSC::VM::VM):
* runtime/VM.h:
Source/WebCore:
Now SourceOrigin is correctly propagated through the module pipeline.
So the error reported by http/tests/security/contentSecurityPolicy/module-eval-blocked-expected.html
is updated.
* ForwardingHeaders/runtime/JSSourceCode.h: Added.
* bindings/js/JSDOMPromise.h:
(WebCore::DeferredPromise::resolveWithCallback):
* bindings/js/ScriptModuleLoader.cpp:
(WebCore::ScriptModuleLoader::notifyFinished):
LayoutTests:
* http/tests/security/contentSecurityPolicy/module-eval-blocked-expected.txt:</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestshttptestssecuritycontentSecurityPolicymoduleevalblockedexpectedtxt">trunk/LayoutTests/http/tests/security/contentSecurityPolicy/module-eval-blocked-expected.txt</a></li>
<li><a href="#trunkSourceJavaScriptCoreCMakeListstxt">trunk/Source/JavaScriptCore/CMakeLists.txt</a></li>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCoreJavaScriptCorexcodeprojprojectpbxproj">trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceJavaScriptCorebuiltinsModuleLoaderPrototypejs">trunk/Source/JavaScriptCore/builtins/ModuleLoaderPrototype.js</a></li>
<li><a href="#trunkSourceJavaScriptCorejsccpp">trunk/Source/JavaScriptCore/jsc.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorellintLLIntDatacpp">trunk/Source/JavaScriptCore/llint/LLIntData.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorellintLowLevelInterpreterasm">trunk/Source/JavaScriptCore/llint/LowLevelInterpreter.asm</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeCompletioncpp">trunk/Source/JavaScriptCore/runtime/Completion.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeJSModuleLoadercpp">trunk/Source/JavaScriptCore/runtime/JSModuleLoader.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeJSModuleLoaderh">trunk/Source/JavaScriptCore/runtime/JSModuleLoader.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeJSTypeh">trunk/Source/JavaScriptCore/runtime/JSType.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeModuleLoaderPrototypecpp">trunk/Source/JavaScriptCore/runtime/ModuleLoaderPrototype.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeVMcpp">trunk/Source/JavaScriptCore/runtime/VM.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeVMh">trunk/Source/JavaScriptCore/runtime/VM.h</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorebindingsjsJSDOMPromiseh">trunk/Source/WebCore/bindings/js/JSDOMPromise.h</a></li>
<li><a href="#trunkSourceWebCorebindingsjsScriptModuleLoadercpp">trunk/Source/WebCore/bindings/js/ScriptModuleLoader.cpp</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceJavaScriptCoreruntimeJSSourceCodecpp">trunk/Source/JavaScriptCore/runtime/JSSourceCode.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeJSSourceCodeh">trunk/Source/JavaScriptCore/runtime/JSSourceCode.h</a></li>
<li><a href="#trunkSourceWebCoreForwardingHeadersruntimeJSSourceCodeh">trunk/Source/WebCore/ForwardingHeaders/runtime/JSSourceCode.h</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (210536 => 210537)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2017-01-10 05:04:36 UTC (rev 210536)
+++ trunk/LayoutTests/ChangeLog        2017-01-10 05:58:19 UTC (rev 210537)
</span><span class="lines">@@ -1,3 +1,12 @@
</span><ins>+2017-01-09 Yusuke Suzuki <utatane.tea@gmail.com>
+
+ Implement JSSourceCode to propagate SourceCode in module pipeline
+ https://bugs.webkit.org/show_bug.cgi?id=166861
+
+ Reviewed by Saam Barati.
+
+ * http/tests/security/contentSecurityPolicy/module-eval-blocked-expected.txt:
+
</ins><span class="cx"> 2017-01-09 Chris Dumez <cdumez@apple.com>
</span><span class="cx">
</span><span class="cx"> REGRESSION(r189555): ImageDocument title no longer includes the size of the image
</span></span></pre></div>
<a id="trunkLayoutTestshttptestssecuritycontentSecurityPolicymoduleevalblockedexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/http/tests/security/contentSecurityPolicy/module-eval-blocked-expected.txt (210536 => 210537)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/security/contentSecurityPolicy/module-eval-blocked-expected.txt        2017-01-10 05:04:36 UTC (rev 210536)
+++ trunk/LayoutTests/http/tests/security/contentSecurityPolicy/module-eval-blocked-expected.txt        2017-01-10 05:58:19 UTC (rev 210537)
</span><span class="lines">@@ -1,37 +1,37 @@
</span><del>-CONSOLE MESSAGE: line 1: EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'unsafe-inline'".
</del><ins>+CONSOLE MESSAGE: line 16: EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'unsafe-inline'".
</ins><span class="cx">
</span><del>-CONSOLE MESSAGE: line 1: EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'unsafe-inline'".
</del><ins>+CONSOLE MESSAGE: line 17: EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'unsafe-inline'".
</ins><span class="cx">
</span><del>-CONSOLE MESSAGE: line 1: EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'unsafe-inline'".
</del><ins>+CONSOLE MESSAGE: line 34: EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'unsafe-inline'".
</ins><span class="cx">
</span><del>-CONSOLE MESSAGE: line 1: EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'unsafe-inline'".
</del><ins>+CONSOLE MESSAGE: line 35: EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'unsafe-inline'".
</ins><span class="cx">
</span><del>-CONSOLE MESSAGE: line 1: EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'unsafe-inline'".
</del><ins>+CONSOLE MESSAGE: line 36: EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'unsafe-inline'".
</ins><span class="cx">
</span><del>-CONSOLE MESSAGE: line 1: EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'unsafe-inline'".
</del><ins>+CONSOLE MESSAGE: line 37: EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'unsafe-inline'".
</ins><span class="cx">
</span><del>-CONSOLE MESSAGE: line 1: EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'unsafe-inline'".
</del><ins>+CONSOLE MESSAGE: line 38: EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'unsafe-inline'".
</ins><span class="cx">
</span><del>-CONSOLE MESSAGE: line 1: EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'unsafe-inline'".
</del><ins>+CONSOLE MESSAGE: line 39: EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'unsafe-inline'".
</ins><span class="cx">
</span><del>-CONSOLE MESSAGE: line 1: EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'unsafe-inline'".
</del><ins>+CONSOLE MESSAGE: line 40: EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'unsafe-inline'".
</ins><span class="cx">
</span><del>-CONSOLE MESSAGE: line 1: EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'unsafe-inline'".
</del><ins>+CONSOLE MESSAGE: line 41: EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'unsafe-inline'".
</ins><span class="cx">
</span><del>-CONSOLE MESSAGE: line 1: EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'unsafe-inline'".
</del><ins>+CONSOLE MESSAGE: line 42: EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'unsafe-inline'".
</ins><span class="cx">
</span><del>-CONSOLE MESSAGE: line 1: EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'unsafe-inline'".
</del><ins>+CONSOLE MESSAGE: line 43: EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'unsafe-inline'".
</ins><span class="cx">
</span><del>-CONSOLE MESSAGE: line 1: EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'unsafe-inline'".
</del><ins>+CONSOLE MESSAGE: line 44: EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'unsafe-inline'".
</ins><span class="cx">
</span><del>-CONSOLE MESSAGE: line 1: EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'unsafe-inline'".
</del><ins>+CONSOLE MESSAGE: line 45: EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'unsafe-inline'".
</ins><span class="cx">
</span><del>-CONSOLE MESSAGE: line 1: EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'unsafe-inline'".
</del><ins>+CONSOLE MESSAGE: line 46: EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'unsafe-inline'".
</ins><span class="cx">
</span><del>-CONSOLE MESSAGE: line 1: EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'unsafe-inline'".
</del><ins>+CONSOLE MESSAGE: line 47: EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'unsafe-inline'".
</ins><span class="cx">
</span><del>-CONSOLE MESSAGE: line 1: EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'unsafe-inline'".
</del><ins>+CONSOLE MESSAGE: line 48: EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'unsafe-inline'".
</ins><span class="cx">
</span><del>-CONSOLE MESSAGE: line 1: EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'unsafe-inline'".
</del><ins>+CONSOLE MESSAGE: line 49: EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'unsafe-inline'".
</ins><span class="cx">
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreCMakeListstxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/CMakeLists.txt (210536 => 210537)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/CMakeLists.txt        2017-01-10 05:04:36 UTC (rev 210536)
+++ trunk/Source/JavaScriptCore/CMakeLists.txt        2017-01-10 05:58:19 UTC (rev 210537)
</span><span class="lines">@@ -788,6 +788,7 @@
</span><span class="cx"> runtime/JSSegmentedVariableObject.cpp
</span><span class="cx"> runtime/JSSet.cpp
</span><span class="cx"> runtime/JSSetIterator.cpp
</span><ins>+ runtime/JSSourceCode.cpp
</ins><span class="cx"> runtime/JSString.cpp
</span><span class="cx"> runtime/JSStringIterator.cpp
</span><span class="cx"> runtime/JSStringJoiner.cpp
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (210536 => 210537)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2017-01-10 05:04:36 UTC (rev 210536)
+++ trunk/Source/JavaScriptCore/ChangeLog        2017-01-10 05:58:19 UTC (rev 210537)
</span><span class="lines">@@ -1,5 +1,47 @@
</span><span class="cx"> 2017-01-09 Yusuke Suzuki <utatane.tea@gmail.com>
</span><span class="cx">
</span><ins>+ Implement JSSourceCode to propagate SourceCode in module pipeline
+ https://bugs.webkit.org/show_bug.cgi?id=166861
+
+ Reviewed by Saam Barati.
+
+ Instead of propagating source code string, we propagate JSSourceCode
+ cell in the module pipeline. This allows us to attach a metadata
+ to the propagated source code string. In particular, it propagates
+ SourceOrigin through the module pipeline.
+
+ * CMakeLists.txt:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * builtins/ModuleLoaderPrototype.js:
+ (fulfillFetch):
+ (requestFetch):
+ * jsc.cpp:
+ (GlobalObject::moduleLoaderFetch):
+ * llint/LLIntData.cpp:
+ (JSC::LLInt::Data::performAssertions):
+ * llint/LowLevelInterpreter.asm:
+ * runtime/Completion.cpp:
+ (JSC::loadAndEvaluateModule):
+ (JSC::loadModule):
+ * runtime/JSModuleLoader.cpp:
+ (JSC::JSModuleLoader::provide):
+ * runtime/JSModuleLoader.h:
+ * runtime/JSSourceCode.cpp: Added.
+ (JSC::JSSourceCode::destroy):
+ * runtime/JSSourceCode.h: Added.
+ (JSC::JSSourceCode::createStructure):
+ (JSC::JSSourceCode::create):
+ (JSC::JSSourceCode::sourceCode):
+ (JSC::JSSourceCode::JSSourceCode):
+ * runtime/JSType.h:
+ * runtime/ModuleLoaderPrototype.cpp:
+ (JSC::moduleLoaderPrototypeParseModule):
+ * runtime/VM.cpp:
+ (JSC::VM::VM):
+ * runtime/VM.h:
+
+2017-01-09 Yusuke Suzuki <utatane.tea@gmail.com>
+
</ins><span class="cx"> REGRESSION (r210522): ASSERTION FAILED: divot.offset >= divotStart.offset seen with stress/import-basic.js and stress/import-from-eval.js
</span><span class="cx"> https://bugs.webkit.org/show_bug.cgi?id=166873
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreJavaScriptCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj (210536 => 210537)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj        2017-01-10 05:04:36 UTC (rev 210536)
+++ trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj        2017-01-10 05:58:19 UTC (rev 210537)
</span><span class="lines">@@ -2372,6 +2372,8 @@
</span><span class="cx">                 FED94F2F171E3E2300BE77A4 /* Watchdog.h in Headers */ = {isa = PBXBuildFile; fileRef = FED94F2C171E3E2300BE77A4 /* Watchdog.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 FEF040511AAE662D00BD28B0 /* CompareAndSwapTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FEF040501AAE662D00BD28B0 /* CompareAndSwapTest.cpp */; };
</span><span class="cx">                 FEFD6FC61D5E7992008F2F0B /* JSStringInlines.h in Headers */ = {isa = PBXBuildFile; fileRef = FEFD6FC51D5E7970008F2F0B /* JSStringInlines.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><ins>+                FA3AB211C8494524AB390267 /* JSSourceCode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F73926918DC64330AFCDF0D7 /* JSSourceCode.cpp */; };
+                BDFCB2BBE90F41349E1B0BED /* JSSourceCode.h in Headers */ = {isa = PBXBuildFile; fileRef = 3032175DF1AD47D8998B34E1 /* JSSourceCode.h */; settings = {ATTRIBUTES = (Private, ); }; };
</ins><span class="cx"> /* End PBXBuildFile section */
</span><span class="cx">
</span><span class="cx"> /* Begin PBXContainerItemProxy section */
</span><span class="lines">@@ -4900,6 +4902,8 @@
</span><span class="cx">                 FEF040501AAE662D00BD28B0 /* CompareAndSwapTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CompareAndSwapTest.cpp; path = API/tests/CompareAndSwapTest.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 FEF040521AAEC4ED00BD28B0 /* CompareAndSwapTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CompareAndSwapTest.h; path = API/tests/CompareAndSwapTest.h; sourceTree = "<group>"; };
</span><span class="cx">                 FEFD6FC51D5E7970008F2F0B /* JSStringInlines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSStringInlines.h; sourceTree = "<group>"; };
</span><ins>+                F73926918DC64330AFCDF0D7 /* JSSourceCode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JSSourceCode.cpp; path = JSSourceCode.cpp; sourceTree = "<group>"; };
+                3032175DF1AD47D8998B34E1 /* JSSourceCode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSSourceCode.h; path = JSSourceCode.h; sourceTree = "<group>"; };
</ins><span class="cx"> /* End PBXFileReference section */
</span><span class="cx">
</span><span class="cx"> /* Begin PBXFrameworksBuildPhase section */
</span><span class="lines">@@ -6740,6 +6744,8 @@
</span><span class="cx">                                 A7DCB77912E3D90500911940 /* WriteBarrier.h */,
</span><span class="cx">                                 C2B6D75218A33793004A9301 /* WriteBarrierInlines.h */,
</span><span class="cx">                                 425BA1337E4344E1B269A671 /* SourceOrigin.h */,
</span><ins>+                                F73926918DC64330AFCDF0D7 /* JSSourceCode.cpp */,
+                                3032175DF1AD47D8998B34E1 /* JSSourceCode.h */,
</ins><span class="cx">                         );
</span><span class="cx">                         path = runtime;
</span><span class="cx">                         sourceTree = "<group>";
</span><span class="lines">@@ -9114,6 +9120,7 @@
</span><span class="cx">                                 86704B8A12DBA33700A9FE7B /* YarrPattern.h in Headers */,
</span><span class="cx">                                 86704B4312DB8A8100A9FE7B /* YarrSyntaxChecker.h in Headers */,
</span><span class="cx">                                 2D342F36F7244096804ADB24 /* SourceOrigin.h in Headers */,
</span><ins>+                                BDFCB2BBE90F41349E1B0BED /* JSSourceCode.h in Headers */,
</ins><span class="cx">                         );
</span><span class="cx">                         runOnlyForDeploymentPostprocessing = 0;
</span><span class="cx">                 };
</span><span class="lines">@@ -10502,6 +10509,7 @@
</span><span class="cx">                                 86704B8612DBA33700A9FE7B /* YarrJIT.cpp in Sources */,
</span><span class="cx">                                 86704B8912DBA33700A9FE7B /* YarrPattern.cpp in Sources */,
</span><span class="cx">                                 86704B4212DB8A8100A9FE7B /* YarrSyntaxChecker.cpp in Sources */,
</span><ins>+                                FA3AB211C8494524AB390267 /* JSSourceCode.cpp in Sources */,
</ins><span class="cx">                         );
</span><span class="cx">                         runOnlyForDeploymentPostprocessing = 0;
</span><span class="cx">                 };
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorebuiltinsModuleLoaderPrototypejs"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/builtins/ModuleLoaderPrototype.js (210536 => 210537)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/builtins/ModuleLoaderPrototype.js        2017-01-10 05:04:36 UTC (rev 210536)
+++ trunk/Source/JavaScriptCore/builtins/ModuleLoaderPrototype.js        2017-01-10 05:58:19 UTC (rev 210537)
</span><span class="lines">@@ -127,7 +127,7 @@
</span><span class="cx"> @fulfillPromise(promise, value);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-function fulfillFetch(entry, payload)
</del><ins>+function fulfillFetch(entry, source)
</ins><span class="cx"> {
</span><span class="cx"> // https://whatwg.github.io/loader/#fulfill-fetch
</span><span class="cx">
</span><span class="lines">@@ -135,7 +135,7 @@
</span><span class="cx">
</span><span class="cx"> if (!entry.fetch)
</span><span class="cx"> entry.fetch = @newPromiseCapability(@InternalPromise).@promise;
</span><del>- this.forceFulfillPromise(entry.fetch, payload);
</del><ins>+ this.forceFulfillPromise(entry.fetch, source);
</ins><span class="cx"> @setStateToMax(entry, @ModuleInstantiate);
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -220,9 +220,9 @@
</span><span class="cx"> // Take the key and fetch the resource actually.
</span><span class="cx"> // For example, JavaScriptCore shell can provide the hook fetching the resource
</span><span class="cx"> // from the local file system.
</span><del>- var fetchPromise = this.fetch(key, initiator).then((payload) => {
</del><ins>+ var fetchPromise = this.fetch(key, initiator).then((source) => {
</ins><span class="cx"> @setStateToMax(entry, @ModuleInstantiate);
</span><del>- return payload;
</del><ins>+ return source;
</ins><span class="cx"> });
</span><span class="cx"> entry.fetch = fetchPromise;
</span><span class="cx"> return fetchPromise;
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorejsccpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/jsc.cpp (210536 => 210537)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/jsc.cpp        2017-01-10 05:04:36 UTC (rev 210536)
+++ trunk/Source/JavaScriptCore/jsc.cpp        2017-01-10 05:58:19 UTC (rev 210537)
</span><span class="lines">@@ -53,6 +53,7 @@
</span><span class="cx"> #include "JSNativeStdFunction.h"
</span><span class="cx"> #include "JSONObject.h"
</span><span class="cx"> #include "JSProxy.h"
</span><ins>+#include "JSSourceCode.h"
</ins><span class="cx"> #include "JSString.h"
</span><span class="cx"> #include "JSTypedArrays.h"
</span><span class="cx"> #include "JSWebAssemblyCallee.h"
</span><span class="lines">@@ -1576,7 +1577,7 @@
</span><span class="cx"> if (!fetchModuleFromLocalFileSystem(moduleKey, utf8))
</span><span class="cx"> return deferred->reject(exec, createError(exec, makeString("Could not open file '", moduleKey, "'.")));
</span><span class="cx">
</span><del>- return deferred->resolve(exec, jsString(exec, stringFromUTF(utf8)));
</del><ins>+ return deferred->resolve(exec, JSSourceCode::create(exec->vm(), makeSource(stringFromUTF(utf8), SourceOrigin { moduleKey })));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorellintLLIntDatacpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/llint/LLIntData.cpp (210536 => 210537)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/llint/LLIntData.cpp        2017-01-10 05:04:36 UTC (rev 210536)
+++ trunk/Source/JavaScriptCore/llint/LLIntData.cpp        2017-01-10 05:58:19 UTC (rev 210537)
</span><span class="lines">@@ -156,21 +156,21 @@
</span><span class="cx">
</span><span class="cx"> STATIC_ASSERT(StringType == 6);
</span><span class="cx"> STATIC_ASSERT(SymbolType == 7);
</span><del>- STATIC_ASSERT(ObjectType == 21);
- STATIC_ASSERT(FinalObjectType == 22);
- STATIC_ASSERT(JSFunctionType == 24);
- STATIC_ASSERT(ArrayType == 32);
- STATIC_ASSERT(DerivedArrayType == 33);
- STATIC_ASSERT(ProxyObjectType == 51);
- STATIC_ASSERT(Int8ArrayType == 34);
- STATIC_ASSERT(Int16ArrayType == 35);
- STATIC_ASSERT(Int32ArrayType == 36);
- STATIC_ASSERT(Uint8ArrayType == 37);
- STATIC_ASSERT(Uint8ClampedArrayType == 38);
- STATIC_ASSERT(Uint16ArrayType == 39);
- STATIC_ASSERT(Uint32ArrayType == 40);
- STATIC_ASSERT(Float32ArrayType == 41);
- STATIC_ASSERT(Float64ArrayType == 42);
</del><ins>+ STATIC_ASSERT(ObjectType == 22);
+ STATIC_ASSERT(FinalObjectType == 23);
+ STATIC_ASSERT(JSFunctionType == 25);
+ STATIC_ASSERT(ArrayType == 33);
+ STATIC_ASSERT(DerivedArrayType == 34);
+ STATIC_ASSERT(ProxyObjectType == 52);
+ STATIC_ASSERT(Int8ArrayType == 35);
+ STATIC_ASSERT(Int16ArrayType == 36);
+ STATIC_ASSERT(Int32ArrayType == 37);
+ STATIC_ASSERT(Uint8ArrayType == 38);
+ STATIC_ASSERT(Uint8ClampedArrayType == 39);
+ STATIC_ASSERT(Uint16ArrayType == 40);
+ STATIC_ASSERT(Uint32ArrayType == 41);
+ STATIC_ASSERT(Float32ArrayType == 42);
+ STATIC_ASSERT(Float64ArrayType == 43);
</ins><span class="cx"> STATIC_ASSERT(MasqueradesAsUndefined == 1);
</span><span class="cx"> STATIC_ASSERT(ImplementsDefaultHasInstance == 2);
</span><span class="cx"> STATIC_ASSERT(FirstConstantRegisterIndex == 0x40000000);
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorellintLowLevelInterpreterasm"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/llint/LowLevelInterpreter.asm (210536 => 210537)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/llint/LowLevelInterpreter.asm        2017-01-10 05:04:36 UTC (rev 210536)
+++ trunk/Source/JavaScriptCore/llint/LowLevelInterpreter.asm        2017-01-10 05:58:19 UTC (rev 210537)
</span><span class="lines">@@ -345,24 +345,24 @@
</span><span class="cx"> # Type constants.
</span><span class="cx"> const StringType = 6
</span><span class="cx"> const SymbolType = 7
</span><del>-const ObjectType = 21
-const FinalObjectType = 22
-const JSFunctionType = 24
-const ArrayType = 32
-const DerivedArrayType = 33
-const ProxyObjectType = 51
</del><ins>+const ObjectType = 22
+const FinalObjectType = 23
+const JSFunctionType = 25
+const ArrayType = 33
+const DerivedArrayType = 34
+const ProxyObjectType = 52
</ins><span class="cx">
</span><span class="cx"> # The typed array types need to be numbered in a particular order because of the manually written
</span><span class="cx"> # switch statement in get_by_val and put_by_val.
</span><del>-const Int8ArrayType = 34
-const Int16ArrayType = 35
-const Int32ArrayType = 36
-const Uint8ArrayType = 37
-const Uint8ClampedArrayType = 38
-const Uint16ArrayType = 39
-const Uint32ArrayType = 40
-const Float32ArrayType = 41
-const Float64ArrayType = 42
</del><ins>+const Int8ArrayType = 35
+const Int16ArrayType = 36
+const Int32ArrayType = 37
+const Uint8ArrayType = 38
+const Uint8ClampedArrayType = 39
+const Uint16ArrayType = 40
+const Uint32ArrayType = 41
+const Float32ArrayType = 42
+const Float64ArrayType = 43
</ins><span class="cx">
</span><span class="cx"> const FirstArrayType = Int8ArrayType
</span><span class="cx"> const LastArrayType = Float64ArrayType
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeCompletioncpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/Completion.cpp (210536 => 210537)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/Completion.cpp        2017-01-10 05:04:36 UTC (rev 210536)
+++ trunk/Source/JavaScriptCore/runtime/Completion.cpp        2017-01-10 05:58:19 UTC (rev 210537)
</span><span class="lines">@@ -193,7 +193,7 @@
</span><span class="cx"> JSGlobalObject* globalObject = exec->vmEntryGlobalObject();
</span><span class="cx">
</span><span class="cx"> // Insert the given source code to the ModuleLoader registry as the fetched registry entry.
</span><del>- globalObject->moduleLoader()->provide(exec, key, JSModuleLoader::Status::Fetch, source.view().toString());
</del><ins>+ globalObject->moduleLoader()->provide(exec, key, JSModuleLoader::Status::Fetch, source);
</ins><span class="cx"> RETURN_IF_EXCEPTION(scope, rejectPromise(exec, globalObject));
</span><span class="cx">
</span><span class="cx"> return loadAndEvaluateModule(lock, exec, globalObject, key, jsUndefined(), initiator);
</span><span class="lines">@@ -232,7 +232,7 @@
</span><span class="cx">
</span><span class="cx"> // Insert the given source code to the ModuleLoader registry as the fetched registry entry.
</span><span class="cx"> // FIXME: Introduce JSSourceCode object to wrap around this source.
</span><del>- globalObject->moduleLoader()->provide(exec, key, JSModuleLoader::Status::Fetch, source.view().toString());
</del><ins>+ globalObject->moduleLoader()->provide(exec, key, JSModuleLoader::Status::Fetch, source);
</ins><span class="cx"> RETURN_IF_EXCEPTION(scope, rejectPromise(exec, globalObject));
</span><span class="cx">
</span><span class="cx"> return loadModule(lock, exec, globalObject, key, jsUndefined(), initiator);
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeJSModuleLoadercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/JSModuleLoader.cpp (210536 => 210537)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/JSModuleLoader.cpp        2017-01-10 05:04:36 UTC (rev 210536)
+++ trunk/Source/JavaScriptCore/runtime/JSModuleLoader.cpp        2017-01-10 05:58:19 UTC (rev 210537)
</span><span class="lines">@@ -38,6 +38,7 @@
</span><span class="cx"> #include "JSMap.h"
</span><span class="cx"> #include "JSModuleEnvironment.h"
</span><span class="cx"> #include "JSModuleRecord.h"
</span><ins>+#include "JSSourceCode.h"
</ins><span class="cx"> #include "ModuleAnalyzer.h"
</span><span class="cx"> #include "ModuleLoaderPrototype.h"
</span><span class="cx"> #include "Nodes.h"
</span><span class="lines">@@ -75,17 +76,19 @@
</span><span class="cx"> return exec->propertyNames().emptyIdentifier.impl();
</span><span class="cx"> }
</span><span class="cx">
</span><del>-JSValue JSModuleLoader::provide(ExecState* exec, JSValue key, Status status, const String& source)
</del><ins>+JSValue JSModuleLoader::provide(ExecState* exec, JSValue key, Status status, const SourceCode& sourceCode)
</ins><span class="cx"> {
</span><ins>+ VM& vm = exec->vm();
</ins><span class="cx"> JSObject* function = jsCast<JSObject*>(get(exec, exec->propertyNames().builtinNames().providePublicName()));
</span><span class="cx"> CallData callData;
</span><span class="cx"> CallType callType = JSC::getCallData(function, callData);
</span><span class="cx"> ASSERT(callType != CallType::None);
</span><span class="cx">
</span><ins>+ SourceCode source { sourceCode };
</ins><span class="cx"> MarkedArgumentBuffer arguments;
</span><span class="cx"> arguments.append(key);
</span><span class="cx"> arguments.append(jsNumber(status));
</span><del>- arguments.append(jsString(exec, source));
</del><ins>+ arguments.append(JSSourceCode::create(vm, WTFMove(source)));
</ins><span class="cx">
</span><span class="cx"> return call(exec, function, callType, callData, this, arguments);
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeJSModuleLoaderh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/JSModuleLoader.h (210536 => 210537)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/JSModuleLoader.h        2017-01-10 05:04:36 UTC (rev 210536)
+++ trunk/Source/JavaScriptCore/runtime/JSModuleLoader.h        2017-01-10 05:58:19 UTC (rev 210537)
</span><span class="lines">@@ -32,6 +32,7 @@
</span><span class="cx">
</span><span class="cx"> class JSInternalPromise;
</span><span class="cx"> class JSModuleNamespaceObject;
</span><ins>+class SourceCode;
</ins><span class="cx">
</span><span class="cx"> class JSModuleLoader : public JSNonFinalObject {
</span><span class="cx"> private:
</span><span class="lines">@@ -62,7 +63,7 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // APIs to control the module loader.
</span><del>- JSValue provide(ExecState*, JSValue key, Status, const String&);
</del><ins>+ JSValue provide(ExecState*, JSValue key, Status, const SourceCode&);
</ins><span class="cx"> JSInternalPromise* loadAndEvaluateModule(ExecState*, JSValue moduleName, JSValue referrer, JSValue initiator);
</span><span class="cx"> JSInternalPromise* loadModule(ExecState*, JSValue moduleName, JSValue referrer, JSValue initiator);
</span><span class="cx"> JSValue linkAndEvaluateModule(ExecState*, JSValue moduleKey, JSValue initiator);
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeJSSourceCodecpp"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/runtime/JSSourceCode.cpp (0 => 210537)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/JSSourceCode.cpp         (rev 0)
+++ trunk/Source/JavaScriptCore/runtime/JSSourceCode.cpp        2017-01-10 05:58:19 UTC (rev 210537)
</span><span class="lines">@@ -0,0 +1,40 @@
</span><ins>+/*
+ * Copyright (C) 2016 Yusuke Suzuki <utatane.tea@gmail.com>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "JSSourceCode.h"
+
+#include "JSCInlines.h"
+
+namespace JSC {
+
+const ClassInfo JSSourceCode::s_info = { "JSSourceCode", nullptr, nullptr, CREATE_METHOD_TABLE(JSSourceCode) };
+
+void JSSourceCode::destroy(JSCell* cell)
+{
+ static_cast<JSSourceCode*>(cell)->~JSSourceCode();
+}
+
+} // namespace JSC
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeJSSourceCodeh"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/runtime/JSSourceCode.h (0 => 210537)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/JSSourceCode.h         (rev 0)
+++ trunk/Source/JavaScriptCore/runtime/JSSourceCode.h        2017-01-10 05:58:19 UTC (rev 210537)
</span><span class="lines">@@ -0,0 +1,77 @@
</span><ins>+/*
+ * Copyright (C) 2016 Yusuke Suzuki <utatane.tea@gmail.com>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include "JSGlobalObject.h"
+#include "JSObject.h"
+#include "SourceCode.h"
+
+namespace JSC {
+
+class JSSourceCode : public JSCell {
+public:
+ using Base = JSCell;
+
+ static const unsigned StructureFlags = Base::StructureFlags | StructureIsImmortal;
+ static const bool needsDestruction = true;
+
+ DECLARE_EXPORT_INFO;
+
+ static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype)
+ {
+ return Structure::create(vm, globalObject, prototype, TypeInfo(JSSourceCodeType, StructureFlags), info());
+ }
+
+ static JSSourceCode* create(VM& vm, Structure* structure, SourceCode&& sourceCode)
+ {
+ auto* result = new (NotNull, allocateCell<JSSourceCode>(vm.heap)) JSSourceCode(vm, structure, WTFMove(sourceCode));
+ result->finishCreation(vm);
+ return result;
+ }
+
+ static JSSourceCode* create(VM& vm, SourceCode&& sourceCode)
+ {
+ return create(vm, vm.sourceCodeStructure.get(), WTFMove(sourceCode));
+ }
+
+ const SourceCode& sourceCode() const
+ {
+ return m_sourceCode;
+ }
+
+ static void destroy(JSCell*);
+
+private:
+ JSSourceCode(VM& vm, Structure* structure, SourceCode&& sourceCode)
+ : Base(vm, structure)
+ , m_sourceCode(WTFMove(sourceCode))
+ {
+ }
+
+ SourceCode m_sourceCode;
+};
+
+} // namespace JSC
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeJSTypeh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/JSType.h (210536 => 210537)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/JSType.h        2017-01-10 05:04:36 UTC (rev 210536)
+++ trunk/Source/JavaScriptCore/runtime/JSType.h        2017-01-10 05:58:19 UTC (rev 210537)
</span><span class="lines">@@ -50,6 +50,7 @@
</span><span class="cx"> UnlinkedFunctionCodeBlockType,
</span><span class="cx">
</span><span class="cx"> JSFixedArrayType,
</span><ins>+ JSSourceCodeType,
</ins><span class="cx">
</span><span class="cx"> // The ObjectType value must come before any JSType that is a subclass of JSObject.
</span><span class="cx"> ObjectType,
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeModuleLoaderPrototypecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/ModuleLoaderPrototype.cpp (210536 => 210537)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/ModuleLoaderPrototype.cpp        2017-01-10 05:04:36 UTC (rev 210536)
+++ trunk/Source/JavaScriptCore/runtime/ModuleLoaderPrototype.cpp        2017-01-10 05:58:19 UTC (rev 210537)
</span><span class="lines">@@ -39,6 +39,7 @@
</span><span class="cx"> #include "JSModuleLoader.h"
</span><span class="cx"> #include "JSModuleNamespaceObject.h"
</span><span class="cx"> #include "JSModuleRecord.h"
</span><ins>+#include "JSSourceCode.h"
</ins><span class="cx"> #include "ModuleAnalyzer.h"
</span><span class="cx"> #include "Nodes.h"
</span><span class="cx"> #include "Parser.h"
</span><span class="lines">@@ -112,11 +113,11 @@
</span><span class="cx"> const Identifier moduleKey = exec->argument(0).toPropertyKey(exec);
</span><span class="cx"> RETURN_IF_EXCEPTION(scope, encodedJSValue());
</span><span class="cx">
</span><del>- String source = exec->argument(1).toWTFString(exec);
- RETURN_IF_EXCEPTION(scope, encodedJSValue());
</del><ins>+ auto* jsSourceCode = jsDynamicCast<JSSourceCode*>(exec->argument(1));
+ if (!jsSourceCode)
+ return throwVMTypeError(exec, scope);
+ SourceCode sourceCode = jsSourceCode->sourceCode();
</ins><span class="cx">
</span><del>- SourceCode sourceCode = makeSource(source, SourceOrigin { moduleKey.impl() }, moduleKey.impl(), TextPosition(), SourceProviderSourceType::Module);
-
</del><span class="cx"> CodeProfiling profile(sourceCode);
</span><span class="cx">
</span><span class="cx"> ParserError error;
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeVMcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/VM.cpp (210536 => 210537)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/VM.cpp        2017-01-10 05:04:36 UTC (rev 210536)
+++ trunk/Source/JavaScriptCore/runtime/VM.cpp        2017-01-10 05:58:19 UTC (rev 210537)
</span><span class="lines">@@ -71,6 +71,7 @@
</span><span class="cx"> #include "JSMap.h"
</span><span class="cx"> #include "JSPromiseDeferred.h"
</span><span class="cx"> #include "JSPropertyNameEnumerator.h"
</span><ins>+#include "JSSourceCode.h"
</ins><span class="cx"> #include "JSTemplateRegistryKey.h"
</span><span class="cx"> #include "JSWebAssembly.h"
</span><span class="cx"> #include "JSWithScope.h"
</span><span class="lines">@@ -238,6 +239,7 @@
</span><span class="cx"> symbolStructure.set(*this, Symbol::createStructure(*this, 0, jsNull()));
</span><span class="cx"> symbolTableStructure.set(*this, SymbolTable::createStructure(*this, 0, jsNull()));
</span><span class="cx"> fixedArrayStructure.set(*this, JSFixedArray::createStructure(*this, 0, jsNull()));
</span><ins>+ sourceCodeStructure.set(*this, JSSourceCode::createStructure(*this, 0, jsNull()));
</ins><span class="cx"> structureChainStructure.set(*this, StructureChain::createStructure(*this, 0, jsNull()));
</span><span class="cx"> sparseArrayValueMapStructure.set(*this, SparseArrayValueMap::createStructure(*this, 0, jsNull()));
</span><span class="cx"> templateRegistryKeyStructure.set(*this, JSTemplateRegistryKey::createStructure(*this, 0, jsNull()));
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeVMh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/VM.h (210536 => 210537)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/VM.h        2017-01-10 05:04:36 UTC (rev 210536)
+++ trunk/Source/JavaScriptCore/runtime/VM.h        2017-01-10 05:58:19 UTC (rev 210537)
</span><span class="lines">@@ -326,6 +326,7 @@
</span><span class="cx"> Strong<Structure> symbolStructure;
</span><span class="cx"> Strong<Structure> symbolTableStructure;
</span><span class="cx"> Strong<Structure> fixedArrayStructure;
</span><ins>+ Strong<Structure> sourceCodeStructure;
</ins><span class="cx"> Strong<Structure> structureChainStructure;
</span><span class="cx"> Strong<Structure> sparseArrayValueMapStructure;
</span><span class="cx"> Strong<Structure> templateRegistryKeyStructure;
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (210536 => 210537)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2017-01-10 05:04:36 UTC (rev 210536)
+++ trunk/Source/WebCore/ChangeLog        2017-01-10 05:58:19 UTC (rev 210537)
</span><span class="lines">@@ -1,3 +1,20 @@
</span><ins>+2017-01-09 Yusuke Suzuki <utatane.tea@gmail.com>
+
+ Implement JSSourceCode to propagate SourceCode in module pipeline
+ https://bugs.webkit.org/show_bug.cgi?id=166861
+
+ Reviewed by Saam Barati.
+
+ Now SourceOrigin is correctly propagated through the module pipeline.
+ So the error reported by http/tests/security/contentSecurityPolicy/module-eval-blocked-expected.html
+ is updated.
+
+ * ForwardingHeaders/runtime/JSSourceCode.h: Added.
+ * bindings/js/JSDOMPromise.h:
+ (WebCore::DeferredPromise::resolveWithCallback):
+ * bindings/js/ScriptModuleLoader.cpp:
+ (WebCore::ScriptModuleLoader::notifyFinished):
+
</ins><span class="cx"> 2017-01-09 Chris Dumez <cdumez@apple.com>
</span><span class="cx">
</span><span class="cx"> REGRESSION(r189555): ImageDocument title no longer includes the size of the image
</span></span></pre></div>
<a id="trunkSourceWebCoreForwardingHeadersruntimeJSSourceCodeh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/ForwardingHeaders/runtime/JSSourceCode.h (0 => 210537)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ForwardingHeaders/runtime/JSSourceCode.h         (rev 0)
+++ trunk/Source/WebCore/ForwardingHeaders/runtime/JSSourceCode.h        2017-01-10 05:58:19 UTC (rev 210537)
</span><span class="lines">@@ -0,0 +1,27 @@
</span><ins>+/*
+ * Copyright (C) 2016 Yusuke Suzuki <utatane.tea@gmail.com>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+#include <JavaScriptCore/JSSourceCode.h>
</ins></span></pre></div>
<a id="trunkSourceWebCorebindingsjsJSDOMPromiseh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/JSDOMPromise.h (210536 => 210537)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/JSDOMPromise.h        2017-01-10 05:04:36 UTC (rev 210536)
+++ trunk/Source/WebCore/bindings/js/JSDOMPromise.h        2017-01-10 05:58:19 UTC (rev 210537)
</span><span class="lines">@@ -94,6 +94,18 @@
</span><span class="cx"> void reject(ExceptionCode, const String& = { });
</span><span class="cx"> void reject(const JSC::PrivateName&);
</span><span class="cx">
</span><ins>+ template<typename Callback, typename Value>
+ void resolveWithCallback(Callback callback, Value value)
+ {
+ if (isSuspended())
+ return;
+ ASSERT(m_deferred);
+ ASSERT(m_globalObject);
+ JSC::ExecState* exec = m_globalObject->globalExec();
+ JSC::JSLockHolder locker(exec);
+ resolve(*exec, callback(*exec, *m_globalObject.get(), std::forward<Value>(value)));
+ }
+
</ins><span class="cx"> JSC::JSValue promise() const;
</span><span class="cx">
</span><span class="cx"> bool isSuspended() { return !m_deferred || !canInvokeCallback(); } // The wrapper world has gone away or active DOM objects have been suspended.
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsScriptModuleLoadercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/ScriptModuleLoader.cpp (210536 => 210537)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/ScriptModuleLoader.cpp        2017-01-10 05:04:36 UTC (rev 210536)
+++ trunk/Source/WebCore/bindings/js/ScriptModuleLoader.cpp        2017-01-10 05:58:19 UTC (rev 210537)
</span><span class="lines">@@ -40,6 +40,7 @@
</span><span class="cx"> #include <runtime/JSInternalPromise.h>
</span><span class="cx"> #include <runtime/JSInternalPromiseDeferred.h>
</span><span class="cx"> #include <runtime/JSModuleRecord.h>
</span><ins>+#include <runtime/JSSourceCode.h>
</ins><span class="cx"> #include <runtime/JSString.h>
</span><span class="cx"> #include <runtime/Symbol.h>
</span><span class="cx">
</span><span class="lines">@@ -245,8 +246,10 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> m_requestURLToResponseURLMap.add(cachedScript.url(), cachedScript.response().url());
</span><del>- // FIXME: Let's wrap around ScriptSourceCode to propagate it directly through the module pipeline.
- promise->resolve<IDLDOMString>(ScriptSourceCode(&cachedScript, JSC::SourceProviderSourceType::Module).source().toString());
</del><ins>+ ScriptSourceCode scriptSourceCode(&cachedScript, JSC::SourceProviderSourceType::Module);
+ promise->resolveWithCallback([] (JSC::ExecState& state, JSDOMGlobalObject&, JSC::SourceCode sourceCode) {
+ return JSC::JSSourceCode::create(state.vm(), WTFMove(sourceCode));
+ }, scriptSourceCode.jsSourceCode());
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> }
</span></span></pre>
</div>
</div>
</body>
</html>