<!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>[208788] 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/208788">208788</a></dd>
<dt>Author</dt> <dd>utatane.tea@gmail.com</dd>
<dt>Date</dt> <dd>2016-11-16 03:39:43 -0800 (Wed, 16 Nov 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>[ES6] Integrate ES6 Modules into WebCore
https://bugs.webkit.org/show_bug.cgi?id=148897

Reviewed by Ryosuke Niwa.

Source/WebCore:

This patch introduces ES6 Modules into WebCore. We integrate JSC's JSModuleLoader into WebCore.
JSC constructs the module loader pipeline by the chains of the promises. To handle this,
the following components are added.

    1. CachedModuleScript

        CachedModuleScript wraps the promise based JSModuleLoader pipeline and offers
        similar APIs to CachedScript. ScriptElement and PendingScript interact with
        CachedModuleScript when the script tag is the module tag instead of CachedScript.
        ScriptElement and PendingScript will receive the notification from
        CachedModuleScript by implementing CachedModuleScriptClient.

    2. ScriptModuleLoader

        This is the module loader instantiated per document. It manages fetching and
        offers the callbacks for the JSC's JSModuleLoader implementation. ScriptModuleLoader
        will fetch the resource by creating CachedModuleScriptLoader per resource. ScriptModuleLoader
        will receive the notification by implementing CachedModuleScriptLoaderClient. When the
        resource is fetched, the module loader will drive the promise resolve/reject chain.

    3. CachedModuleScriptLoader

        This fetches the resource by using CachedScript. Using CachedScript means that it
        automatically reports the resource to the inspector. CachedModuleScriptLoader notify to
        ScriptModuleLoader when the resource is fetched.

One tricky point is that the fetch requests issued from one module-graph should share the same
nonce, crossorigin attributes etc.

    Here, we wrote the module graph like `A -&gt; B (A depends on B)`.

    &lt;script tag&gt; -&gt; A -&gt; B -&gt; C -&gt; D

When fetching A, B, C, and D modules, we need to set the same nonce, crossorigin etc. configuration
derived from the original script tag. So per module-graph information should be shared throughout
the module loader pipeline. To do so, JSC's module loader implementation can take the value called
`initiator`. Since the loader will propagate &amp; share this `initiator` throughout the pipeline,
we can transfer and share some metadata. Currently, we pass the JSWrapper of the script tag as the
initiator. Each fetch request is created by using this initiator script element.

More integration into the inspector should be done in the subsequent patch.

* CMakeLists.txt:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/CachedModuleScript.cpp: Added.
CachedModuleScript offers similar interface to CachedScript to make ScriptElement things easier. It encapsulates the
detail of the JSC JSModuleLoader that this module loader is driven by the chain of the promises. CachedModuleScript's
callbacks are called from the promise's handlers configured in ScriptController::loadModuleScript.
(WebCore::CachedModuleScript::create):
(WebCore::CachedModuleScript::CachedModuleScript):
(WebCore::CachedModuleScript::load):
(WebCore::CachedModuleScript::notifyLoadCompleted):
(WebCore::CachedModuleScript::notifyLoadFailed):
(WebCore::CachedModuleScript::notifyLoadWasCanceled):
(WebCore::CachedModuleScript::notifyClientFinished):
(WebCore::CachedModuleScript::addClient):
(WebCore::CachedModuleScript::removeClient):
* bindings/js/CachedModuleScript.h: Added.
(WebCore::CachedModuleScript::moduleKey):
(WebCore::CachedModuleScript::error):
(WebCore::CachedModuleScript::wasCanceled):
(WebCore::CachedModuleScript::isLoaded):
(WebCore::CachedModuleScript::nonce):
(WebCore::CachedModuleScript::crossOriginMode):
Save nonce and crossorigin attributes when we start ScriptElement::prepareScript.
* bindings/js/CachedModuleScriptClient.h: Copied from Source/WebCore/dom/LoadableScript.h.
(WebCore::CachedModuleScriptClient::~CachedModuleScriptClient):
* bindings/js/CachedModuleScriptLoader.cpp: Added.
CachedModuleScriptLoader is responsible to fetching the resource for the module script. It uses propagated `initiator`
to create the request. This initiator is the JS wrapper of the script element issuing this fetching request. The name
`initiator` is derived from the request.setInitiator(). Once the resource is fetched, the fetcher will notify to the
client. Currently, ScriptModuleLoader implements this client interface.
(WebCore::CachedModuleScriptLoader::create):
(WebCore::CachedModuleScriptLoader::CachedModuleScriptLoader):
(WebCore::CachedModuleScriptLoader::~CachedModuleScriptLoader):
(WebCore::CachedModuleScriptLoader::load):
Create the request. We call ScriptElement::requestCachedScript to initiate a new fetching request. At that time,
nonce and crossorigin (and charset) attributes of this element are applied to the new request.
(WebCore::CachedModuleScriptLoader::notifyFinished):
* bindings/js/CachedModuleScriptLoader.h: Copied from Source/WebCore/bindings/js/ScriptModuleLoader.h.
* bindings/js/CachedModuleScriptLoaderClient.h: Copied from Source/WebCore/dom/LoadableScript.h.
(WebCore::CachedModuleScriptLoaderClient::~CachedModuleScriptLoaderClient):
* bindings/js/CachedScriptSourceProvider.h:
(WebCore::CachedScriptSourceProvider::create):
(WebCore::CachedScriptSourceProvider::CachedScriptSourceProvider):
(WebCore::makeSource):
* bindings/js/JSBindingsAllInOne.cpp:
* bindings/js/JSDOMBinding.cpp:
(WebCore::retrieveErrorMessage):
(WebCore::reportException):
* bindings/js/JSDOMBinding.h:
* bindings/js/JSMainThreadExecState.h:
(WebCore::JSMainThreadExecState::loadModule):
(WebCore::JSMainThreadExecState::linkAndEvaluateModule):
* bindings/js/ScriptController.cpp:
(WebCore::ScriptController::evaluateInWorld):
(WebCore::ScriptController::loadModuleScriptInWorld):
(WebCore::ScriptController::loadModuleScript):
This just performs loading and not executing the module graph. Once the module graph is loaded, it is notified to
the given CachedModuleScript.
(WebCore::ScriptController::linkAndEvaluateModuleScriptInWorld):
(WebCore::ScriptController::linkAndEvaluateModuleScript):
This executes the linking and evaluation of the already instantiated module graph. After loading the module graph,
we call this function for the module to evaluate it. This is called from ScriptElement::executeModuleScript.
(WebCore::ScriptController::evaluateModule):
Every time we evaluate the module, the ScriptModuleLoader::evaluate hook is called. So the loader calls this function
to actually evaluate the module.
(WebCore::jsValueToModuleKey):
(WebCore::ScriptController::setupModuleScriptHandlers):
The JSC's module loader is driven by the chain of the promise. So here, we convert this to CachedModuleScript /
CachedModuleScriptClient style and encapsulate the details. This encapsulation makes CachedModuleScript similar
to CachedScript and it makes things simple in the rest of WebCore. If the propagated error is already reported
to the inspector, we receive moduleLoaderAlreadyReportedErrorSymbol as the error value. So at that case, we
don't report it twice. If the rejection is caused due to the canceled fetching, moduleLoaderFetchingIsCanceledSymbol
appears as the error value. In that case, we will call CachedModuleScript::notifyLoadWasCanceled.
(WebCore::ScriptController::executeScript):
* bindings/js/ScriptController.h:
(WebCore::ScriptController::moduleLoaderAlreadyReportedErrorSymbol):
(WebCore::ScriptController::moduleLoaderFetchingIsCanceledSymbol):
* bindings/js/ScriptModuleLoader.cpp:
We use DeferredWrapper to resolve promises used for the module pipeline. Thus, once the active DOM objects are
suspended, the module loader propagation stops.
(WebCore::ScriptModuleLoader::~ScriptModuleLoader):
Clear the clients of the fetchers issued from this loader.
(WebCore::isRootModule):
(WebCore::ScriptModuleLoader::resolve):
Resolve the module specifier (that is written in `import from &quot;XXX&quot;`) to the unique module key. We use URL
string as module key. The edge case is that the module is inlined one. In that case, we don't have any URL
for that. Instead of URL, we use symbol at that time.
(WebCore::ScriptModuleLoader::fetch):
Start fetching for the requested module. It returns the promise that is resolved when the fetching is done.
The loader creates the fetcher, and the fetcher start loading the resource. Once the fetcher loads the resource,
it notify to the loader through CachedModuleScriptLoaderClient interface. Since we pass the original script
element as the `initiator` here, the fetcher can use this initiator to create the request. While the result of
CachedResource has 3 variations (loaded, canceled, error occurred), Promise only tells us whether it is resolved
or rejected. When CachedModuleScript gets the result from the promise chain, it needs to know which the result is.
To transfer the canceled information, we reject the promise with the special symbol `moduleLoaderAlreadyReportedErrorSymbol`.
This offers the way to distinguish the canceled error from the other errors.
(WebCore::ScriptModuleLoader::evaluate):
This is the hook function that is called when JSC's JSModuleLoader attempts to execute each module.
(WebCore::ScriptModuleLoader::notifyFinished):
This function is called when the fetcher completes. We will resolve the promise with the result of the fetching.
The module loader pipeline is constructed as a chain of promises.
Rejecting a promise when some error occurs is important because the execution flow of
the promise chain is driven by &quot;rejected&quot; or &quot;fulfilled&quot; events.
If the promise is not rejected while error occurs, reject handler won't be executed
and all the subsequent promise chain will wait the result forever.
As a result, even if the error is already reported to the inspector elsewhere,
it should be propagated in the pipeline. For example, the error of loading
CachedResource is already reported to the inspector by the loader. But we still need
to reject the promise to propagate this error to the script element.
At that time, we don't want to report the same error twice. When we propagate the error
that is already reported to the inspector, we throw moduleLoaderAlreadyReportedErrorSymbol
symbol instead. By comparing the thrown error with this symbol, we can distinguish errors raised
when checking syntax of a module script from errors reported already.
In the reject handler of the promise, we only report a error that is not this symbol.
And mime type checking is done here since the module script always require this check.
* bindings/js/ScriptModuleLoader.h:
(WebCore::ScriptModuleLoader::document): Deleted.
* bindings/js/ScriptSourceCode.h:
(WebCore::ScriptSourceCode::ScriptSourceCode):
* dom/CurrentScriptIncrementer.h:
(WebCore::CurrentScriptIncrementer::CurrentScriptIncrementer):
* dom/LoadableClassicScript.cpp:
(WebCore::LoadableClassicScript::error):
(WebCore::LoadableClassicScript::execute):
(WebCore::LoadableClassicScript::wasErrored): Deleted.
* dom/LoadableClassicScript.h:
* dom/LoadableModuleScript.cpp: Copied from Source/WebCore/dom/LoadableScript.h.
This is the derived class from LoadableScript. It is used for the script module graphs.
(WebCore::LoadableModuleScript::create):
(WebCore::LoadableModuleScript::LoadableModuleScript):
(WebCore::LoadableModuleScript::~LoadableModuleScript):
(WebCore::LoadableModuleScript::isLoaded):
(WebCore::LoadableModuleScript::error):
(WebCore::LoadableModuleScript::wasCanceled):
(WebCore::LoadableModuleScript::notifyFinished):
(WebCore::LoadableModuleScript::execute):
* dom/LoadableModuleScript.h: Copied from Source/WebCore/dom/LoadableScript.h.
(isType):
* dom/LoadableScript.h:
(WebCore::LoadableScript::isModuleScript):
(WebCore::LoadableScript::isModuleGraph): Deleted.
* dom/PendingScript.cpp:
(WebCore::PendingScript::error):
(WebCore::PendingScript::wasErrored): Deleted.
* dom/PendingScript.h:
* dom/ScriptElement.cpp:
(WebCore::ScriptElement::ScriptElement):
(WebCore::ScriptElement::determineScriptType):
(WebCore::ScriptElement::prepareScript):
prepareScript is aligned to whatwg spec: the last sequence to setup flags has one-on-one correspondence to
the spec now. And prepareScript recognizes the type=&quot;module&quot; case and call the requestModuleScript to setup
the CachedModuleScript.
(WebCore::ScriptElement::requestClassicScript):
(WebCore::ScriptElement::requestModuleScript):
We use the nonce and crossorigin attributes at the time of preparing the script tag. To do so, we store the
above values in CachedModuleScript.
Since inlined module scripts does not have &quot;src&quot; attribute, it is also affected by Content Security Policy's
inline script rules.
(WebCore::ScriptElement::requestScriptWithCacheForModuleScript):
The module loader will construct the fetching request by calling this function. This should be here since we
would like to set this Element to the initiator of the request. And nonce and crossorigin attributes of this
script tag will be used.
(WebCore::ScriptElement::requestScriptWithCache):
(WebCore::ScriptElement::executeScript):
(WebCore::ScriptElement::executeModuleScript):
The entry point to execute the module graph. Since the module graph is beyond the multiple CachedScript code,
we have the different entry point from ScriptElement::executeScript.
(WebCore::ScriptElement::executeScriptAndDispatchEvent):
(WebCore::ScriptElement::executeScriptForScriptRunner):
* dom/ScriptElement.h:
(WebCore::ScriptElement::scriptType):
* html/parser/CSSPreloadScanner.cpp:
(WebCore::CSSPreloadScanner::emitRule):
* html/parser/HTMLPreloadScanner.cpp:
(WebCore::TokenPreloadScanner::StartTagScanner::createPreloadRequest):
According to the spec, the module tag ignores the &quot;charset&quot; attribute as the same to the worker's
importScript. But WebKit supports the &quot;charset&quot; for importScript intentionally. So to be consistent,
even for the module tags, we handle the &quot;charset&quot; attribute. We explicitly note about it in the preloader.
(WebCore::TokenPreloadScanner::StartTagScanner::processAttribute):
* html/parser/HTMLResourcePreloader.cpp:
(WebCore::PreloadRequest::resourceRequest):
* html/parser/HTMLResourcePreloader.h:
(WebCore::PreloadRequest::PreloadRequest):
* html/parser/HTMLScriptRunner.h:
* loader/cache/CachedResourceRequest.cpp:
(WebCore::CachedResourceRequest::setAsPotentiallyCrossOrigin):
* xml/parser/XMLDocumentParser.cpp:
(WebCore::XMLDocumentParser::notifyFinished):

LayoutTests:

* TestExpectations:
* http/tests/misc/module-absolute-url-expected.txt: Added.
* http/tests/misc/module-absolute-url.html: Added.
* http/tests/misc/module-script-async-expected.txt: Added.
* http/tests/misc/module-script-async.html: Added.
* http/tests/misc/resources/module-absolute-url.js: Added.
* http/tests/misc/resources/module-absolute-url2.js: Added.
* http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-allowed-expected.txt: Added.
* http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-allowed.html: Added.
* http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-and-scripthash-expected.txt: Added.
* http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-and-scripthash.html: Added.
* http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-basic-blocked-expected.txt: Added.
* http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-basic-blocked.html: Added.
* http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-blocked-expected.txt: Added.
* http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-blocked.html: Added.
* http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-ignore-unsafeinline-expected.txt: Added.
* http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-ignore-unsafeinline.html: Added.
* http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-in-enforced-policy-and-not-in-report-only-expected.txt: Added.
* http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-in-enforced-policy-and-not-in-report-only.html: Added.
* http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-in-one-enforced-policy-neither-in-another-enforced-policy-nor-report-policy-expected.txt: Added.
* http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-in-one-enforced-policy-neither-in-another-enforced-policy-nor-report-policy.html: Added.
* http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-invalidnonce-expected.txt: Added.
* http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-invalidnonce.html: Added.
* http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-multiple-policies-expected.txt: Added.
* http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-multiple-policies.html: Added.
* http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-redirect-expected.txt: Added.
* http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-redirect-same-origin-expected.txt: Added.
* http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-redirect-same-origin.html: Added.
* http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-redirect.html: Added.
* http/tests/security/contentSecurityPolicy/1.1/resources/module-scriptnonce-in-enforced-policy-and-not-in-report-only.php: Added.
* http/tests/security/contentSecurityPolicy/1.1/resources/module-scriptnonce-in-one-enforced-policy-neither-in-another-enforced-policy-nor-report-policy.php: Added.
* http/tests/security/contentSecurityPolicy/module-eval-blocked-expected.txt: Added.
* http/tests/security/contentSecurityPolicy/module-eval-blocked-in-external-script-expected.txt: Added.
* http/tests/security/contentSecurityPolicy/module-eval-blocked-in-external-script.html: Added.
* http/tests/security/contentSecurityPolicy/module-eval-blocked.html: Added.
* http/tests/security/contentSecurityPolicy/resources/echo-module-script-src.pl: Added.
* http/tests/security/contentSecurityPolicy/resources/multiple-iframe-module-test.js: Added.
(testPreescapedPolicy):
(testExperimentalPolicy):
(test):
(iframe.onload):
(testImpl):
(finishTesting):
* http/tests/security/module-correct-mime-types-expected.txt: Added.
* http/tests/security/module-correct-mime-types.html: Added.
* http/tests/security/module-crossorigin-error-event-information-expected.txt: Added.
* http/tests/security/module-crossorigin-error-event-information.html: Added.
* http/tests/security/module-crossorigin-loads-correctly-credentials-expected.txt: Added.
* http/tests/security/module-crossorigin-loads-correctly-credentials.html: Added.
* http/tests/security/module-crossorigin-loads-omit-expected.txt: Added.
* http/tests/security/module-crossorigin-loads-omit.html: Added.
* http/tests/security/module-crossorigin-loads-same-origin-expected.txt: Added.
* http/tests/security/module-crossorigin-loads-same-origin.html: Added.
* http/tests/security/module-crossorigin-onerror-information-expected.txt: Added.
* http/tests/security/module-crossorigin-onerror-information.html: Added.
* http/tests/security/module-incorrect-mime-types-expected.txt: Added.
* http/tests/security/module-incorrect-mime-types.html: Added.
* http/tests/security/module-no-mime-type-expected.txt: Added.
* http/tests/security/module-no-mime-type.html: Added.
* http/tests/security/resources/cors-script.php:
* http/tests/security/resources/module-local-script.js: Added.
* js/dom/modules/module-and-dom-content-loaded-expected.txt: Added.
* js/dom/modules/module-and-dom-content-loaded.html: Added.
* js/dom/modules/module-and-window-load-expected.txt: Added.
* js/dom/modules/module-and-window-load.html: Added.
* js/dom/modules/module-async-and-window-load-expected.txt: Added.
* js/dom/modules/module-async-and-window-load.html: Added.
* js/dom/modules/module-document-write-expected.txt: Added.
* js/dom/modules/module-document-write-src-expected.txt: Added.
* js/dom/modules/module-document-write-src.html: Added.
* js/dom/modules/module-document-write.html: Added.
* js/dom/modules/module-execution-error-inside-dependent-module-should-be-propagated-to-onerror-expected.txt: Added.
* js/dom/modules/module-execution-error-inside-dependent-module-should-be-propagated-to-onerror.html: Added.
* js/dom/modules/module-execution-error-should-be-propagated-to-onerror-expected.txt: Added.
* js/dom/modules/module-execution-error-should-be-propagated-to-onerror.html: Added.
* js/dom/modules/module-execution-order-inline-expected.txt: Added.
* js/dom/modules/module-execution-order-inline.html: Added.
* js/dom/modules/module-execution-order-mixed-expected.txt: Added.
* js/dom/modules/module-execution-order-mixed-with-classic-scripts-expected.txt: Added.
* js/dom/modules/module-execution-order-mixed-with-classic-scripts.html: Added.
* js/dom/modules/module-execution-order-mixed.html: Added.
* js/dom/modules/module-incorrect-relative-specifier-expected.txt: Added.
* js/dom/modules/module-incorrect-relative-specifier.html: Added.
* js/dom/modules/module-incorrect-tag-expected.txt: Added.
* js/dom/modules/module-incorrect-tag.html: Added.
* js/dom/modules/module-inline-current-script-expected.txt: Added.
* js/dom/modules/module-inline-current-script.html: Added.
* js/dom/modules/module-inline-dynamic-expected.txt: Added.
* js/dom/modules/module-inline-dynamic.html: Added.
* js/dom/modules/module-inline-simple-expected.txt: Added.
* js/dom/modules/module-inline-simple.html: Added.
* js/dom/modules/module-load-event-expected.txt: Added.
* js/dom/modules/module-load-event-with-src-expected.txt: Added.
* js/dom/modules/module-load-event-with-src.html: Added.
* js/dom/modules/module-load-event.html: Added.
* js/dom/modules/module-load-same-module-from-different-entry-point-dynamic-expected.txt: Added.
* js/dom/modules/module-load-same-module-from-different-entry-point-dynamic.html: Added.
* js/dom/modules/module-load-same-module-from-different-entry-point-expected.txt: Added.
* js/dom/modules/module-load-same-module-from-different-entry-point.html: Added.
* js/dom/modules/module-not-found-error-event-expected.txt: Added.
* js/dom/modules/module-not-found-error-event-with-src-and-import-expected.txt: Added.
* js/dom/modules/module-not-found-error-event-with-src-and-import.html: Added.
* js/dom/modules/module-not-found-error-event-with-src-expected.txt: Added.
* js/dom/modules/module-not-found-error-event-with-src.html: Added.
* js/dom/modules/module-not-found-error-event.html: Added.
* js/dom/modules/module-src-current-script-expected.txt: Added.
* js/dom/modules/module-src-current-script.html: Added.
* js/dom/modules/module-src-dynamic-expected.txt: Added.
* js/dom/modules/module-src-dynamic.html: Added.
* js/dom/modules/module-src-simple-expected.txt: Added.
* js/dom/modules/module-src-simple.html: Added.
* js/dom/modules/module-type-case-insensitive-expected.txt: Added.
* js/dom/modules/module-type-case-insensitive.html: Added.
* js/dom/modules/module-will-fire-beforeload-expected.txt: Added.
* js/dom/modules/module-will-fire-beforeload.html: Added.
* js/dom/modules/script-tests/module-document-write-src.js: Added.
* js/dom/modules/script-tests/module-execution-error-inside-dependent-module-should-be-propagated-to-onerror-throw.js: Added.
* js/dom/modules/script-tests/module-execution-error-inside-dependent-module-should-be-propagated-to-onerror.js: Added.
* js/dom/modules/script-tests/module-execution-order-mixed-2.js: Added.
* js/dom/modules/script-tests/module-execution-order-mixed-cappuccino.js: Added.
* js/dom/modules/script-tests/module-execution-order-mixed-cocoa.js: Added.
* js/dom/modules/script-tests/module-execution-order-mixed-matcha.js: Added.
* js/dom/modules/script-tests/module-execution-order-mixed-with-classic-scripts-2.js: Added.
* js/dom/modules/script-tests/module-execution-order-mixed-with-classic-scripts-cappuccino.js: Added.
* js/dom/modules/script-tests/module-execution-order-mixed-with-classic-scripts-cocoa.js: Added.
* js/dom/modules/script-tests/module-execution-order-mixed-with-classic-scripts-matcha.js: Added.
* js/dom/modules/script-tests/module-execution-order-mixed-with-classic-scripts.js: Added.
* js/dom/modules/script-tests/module-execution-order-mixed.js: Added.
* js/dom/modules/script-tests/module-inline-dynamic.js: Added.
(export.default.Cocoa.prototype.taste):
(export.default.Cocoa):
* js/dom/modules/script-tests/module-inline-simple.js: Added.
(export.default.Cocoa.prototype.taste):
(export.default.Cocoa):
* js/dom/modules/script-tests/module-load-event-with-src.js: Added.
* js/dom/modules/script-tests/module-load-same-module-from-different-entry-point.js: Added.
* js/dom/modules/script-tests/module-not-found-error-event-with-src-and-import.js: Added.
* js/dom/modules/script-tests/module-src-current-script.js: Added.
* js/dom/modules/script-tests/module-src-dynamic-cocoa.js: Added.
(Cocoa.prototype.taste):
(Cocoa):
* js/dom/modules/script-tests/module-src-dynamic.js: Added.
* js/dom/modules/script-tests/module-src-simple-cocoa.js: Added.
(Cocoa.prototype.taste):
(Cocoa):
* js/dom/modules/script-tests/module-src-simple.js: Added.
* js/dom/modules/script-tests/module-will-fire-beforeload.js: Added.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsTestExpectations">trunk/LayoutTests/TestExpectations</a></li>
<li><a href="#trunkLayoutTestshttptestssecurityresourcescorsscriptphp">trunk/LayoutTests/http/tests/security/resources/cors-script.php</a></li>
<li><a href="#trunkSourceWebCoreCMakeListstxt">trunk/Source/WebCore/CMakeLists.txt</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreWebCorexcodeprojprojectpbxproj">trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebCorebindingsjsCachedScriptSourceProviderh">trunk/Source/WebCore/bindings/js/CachedScriptSourceProvider.h</a></li>
<li><a href="#trunkSourceWebCorebindingsjsJSBindingsAllInOnecpp">trunk/Source/WebCore/bindings/js/JSBindingsAllInOne.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsjsJSDOMBindingcpp">trunk/Source/WebCore/bindings/js/JSDOMBinding.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsjsJSDOMBindingh">trunk/Source/WebCore/bindings/js/JSDOMBinding.h</a></li>
<li><a href="#trunkSourceWebCorebindingsjsJSMainThreadExecStateh">trunk/Source/WebCore/bindings/js/JSMainThreadExecState.h</a></li>
<li><a href="#trunkSourceWebCorebindingsjsScriptControllercpp">trunk/Source/WebCore/bindings/js/ScriptController.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsjsScriptControllerh">trunk/Source/WebCore/bindings/js/ScriptController.h</a></li>
<li><a href="#trunkSourceWebCorebindingsjsScriptModuleLoadercpp">trunk/Source/WebCore/bindings/js/ScriptModuleLoader.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsjsScriptModuleLoaderh">trunk/Source/WebCore/bindings/js/ScriptModuleLoader.h</a></li>
<li><a href="#trunkSourceWebCorebindingsjsScriptSourceCodeh">trunk/Source/WebCore/bindings/js/ScriptSourceCode.h</a></li>
<li><a href="#trunkSourceWebCoredomCurrentScriptIncrementerh">trunk/Source/WebCore/dom/CurrentScriptIncrementer.h</a></li>
<li><a href="#trunkSourceWebCoredomLoadableClassicScriptcpp">trunk/Source/WebCore/dom/LoadableClassicScript.cpp</a></li>
<li><a href="#trunkSourceWebCoredomLoadableClassicScripth">trunk/Source/WebCore/dom/LoadableClassicScript.h</a></li>
<li><a href="#trunkSourceWebCoredomLoadableScripth">trunk/Source/WebCore/dom/LoadableScript.h</a></li>
<li><a href="#trunkSourceWebCoredomPendingScriptcpp">trunk/Source/WebCore/dom/PendingScript.cpp</a></li>
<li><a href="#trunkSourceWebCoredomPendingScripth">trunk/Source/WebCore/dom/PendingScript.h</a></li>
<li><a href="#trunkSourceWebCoredomScriptElementcpp">trunk/Source/WebCore/dom/ScriptElement.cpp</a></li>
<li><a href="#trunkSourceWebCoredomScriptElementh">trunk/Source/WebCore/dom/ScriptElement.h</a></li>
<li><a href="#trunkSourceWebCorehtmlparserCSSPreloadScannercpp">trunk/Source/WebCore/html/parser/CSSPreloadScanner.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlparserHTMLPreloadScannercpp">trunk/Source/WebCore/html/parser/HTMLPreloadScanner.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlparserHTMLResourcePreloadercpp">trunk/Source/WebCore/html/parser/HTMLResourcePreloader.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlparserHTMLResourcePreloaderh">trunk/Source/WebCore/html/parser/HTMLResourcePreloader.h</a></li>
<li><a href="#trunkSourceWebCorehtmlparserHTMLScriptRunnerh">trunk/Source/WebCore/html/parser/HTMLScriptRunner.h</a></li>
<li><a href="#trunkSourceWebCoreloadercacheCachedResourceRequestcpp">trunk/Source/WebCore/loader/cache/CachedResourceRequest.cpp</a></li>
<li><a href="#trunkSourceWebCorexmlparserXMLDocumentParsercpp">trunk/Source/WebCore/xml/parser/XMLDocumentParser.cpp</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestshttptestsmiscmoduleabsoluteurlexpectedtxt">trunk/LayoutTests/http/tests/misc/module-absolute-url-expected.txt</a></li>
<li><a href="#trunkLayoutTestshttptestsmiscmoduleabsoluteurlhtml">trunk/LayoutTests/http/tests/misc/module-absolute-url.html</a></li>
<li><a href="#trunkLayoutTestshttptestsmiscmodulescriptasyncexpectedtxt">trunk/LayoutTests/http/tests/misc/module-script-async-expected.txt</a></li>
<li><a href="#trunkLayoutTestshttptestsmiscmodulescriptasynchtml">trunk/LayoutTests/http/tests/misc/module-script-async.html</a></li>
<li><a href="#trunkLayoutTestshttptestsmiscresourcesmoduleabsoluteurljs">trunk/LayoutTests/http/tests/misc/resources/module-absolute-url.js</a></li>
<li><a href="#trunkLayoutTestshttptestsmiscresourcesmoduleabsoluteurl2js">trunk/LayoutTests/http/tests/misc/resources/module-absolute-url2.js</a></li>
<li><a href="#trunkLayoutTestshttptestssecuritycontentSecurityPolicy11modulescriptnonceallowedexpectedtxt">trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-allowed-expected.txt</a></li>
<li><a href="#trunkLayoutTestshttptestssecuritycontentSecurityPolicy11modulescriptnonceallowedhtml">trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-allowed.html</a></li>
<li><a href="#trunkLayoutTestshttptestssecuritycontentSecurityPolicy11modulescriptnonceandscripthashexpectedtxt">trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-and-scripthash-expected.txt</a></li>
<li><a href="#trunkLayoutTestshttptestssecuritycontentSecurityPolicy11modulescriptnonceandscripthashhtml">trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-and-scripthash.html</a></li>
<li><a href="#trunkLayoutTestshttptestssecuritycontentSecurityPolicy11modulescriptnoncebasicblockedexpectedtxt">trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-basic-blocked-expected.txt</a></li>
<li><a href="#trunkLayoutTestshttptestssecuritycontentSecurityPolicy11modulescriptnoncebasicblockedhtml">trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-basic-blocked.html</a></li>
<li><a href="#trunkLayoutTestshttptestssecuritycontentSecurityPolicy11modulescriptnonceblockedexpectedtxt">trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-blocked-expected.txt</a></li>
<li><a href="#trunkLayoutTestshttptestssecuritycontentSecurityPolicy11modulescriptnonceblockedhtml">trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-blocked.html</a></li>
<li><a href="#trunkLayoutTestshttptestssecuritycontentSecurityPolicy11modulescriptnonceignoreunsafeinlineexpectedtxt">trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-ignore-unsafeinline-expected.txt</a></li>
<li><a href="#trunkLayoutTestshttptestssecuritycontentSecurityPolicy11modulescriptnonceignoreunsafeinlinehtml">trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-ignore-unsafeinline.html</a></li>
<li><a href="#trunkLayoutTestshttptestssecuritycontentSecurityPolicy11modulescriptnonceinenforcedpolicyandnotinreportonlyexpectedtxt">trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-in-enforced-policy-and-not-in-report-only-expected.txt</a></li>
<li><a href="#trunkLayoutTestshttptestssecuritycontentSecurityPolicy11modulescriptnonceinenforcedpolicyandnotinreportonlyhtml">trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-in-enforced-policy-and-not-in-report-only.html</a></li>
<li><a href="#trunkLayoutTestshttptestssecuritycontentSecurityPolicy11modulescriptnonceinoneenforcedpolicyneitherinanotherenforcedpolicynorreportpolicyexpectedtxt">trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-in-one-enforced-policy-neither-in-another-enforced-policy-nor-report-policy-expected.txt</a></li>
<li><a href="#trunkLayoutTestshttptestssecuritycontentSecurityPolicy11modulescriptnonceinoneenforcedpolicyneitherinanotherenforcedpolicynorreportpolicyhtml">trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-in-one-enforced-policy-neither-in-another-enforced-policy-nor-report-policy.html</a></li>
<li><a href="#trunkLayoutTestshttptestssecuritycontentSecurityPolicy11modulescriptnonceinvalidnonceexpectedtxt">trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-invalidnonce-expected.txt</a></li>
<li><a href="#trunkLayoutTestshttptestssecuritycontentSecurityPolicy11modulescriptnonceinvalidnoncehtml">trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-invalidnonce.html</a></li>
<li><a href="#trunkLayoutTestshttptestssecuritycontentSecurityPolicy11modulescriptnoncemultiplepoliciesexpectedtxt">trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-multiple-policies-expected.txt</a></li>
<li><a href="#trunkLayoutTestshttptestssecuritycontentSecurityPolicy11modulescriptnoncemultiplepolicieshtml">trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-multiple-policies.html</a></li>
<li><a href="#trunkLayoutTestshttptestssecuritycontentSecurityPolicy11modulescriptnonceredirectexpectedtxt">trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-redirect-expected.txt</a></li>
<li><a href="#trunkLayoutTestshttptestssecuritycontentSecurityPolicy11modulescriptnonceredirectsameoriginexpectedtxt">trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-redirect-same-origin-expected.txt</a></li>
<li><a href="#trunkLayoutTestshttptestssecuritycontentSecurityPolicy11modulescriptnonceredirectsameoriginhtml">trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-redirect-same-origin.html</a></li>
<li><a href="#trunkLayoutTestshttptestssecuritycontentSecurityPolicy11modulescriptnonceredirecthtml">trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-redirect.html</a></li>
<li><a href="#trunkLayoutTestshttptestssecuritycontentSecurityPolicy11resourcesmodulescriptnonceinenforcedpolicyandnotinreportonlyphp">trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/resources/module-scriptnonce-in-enforced-policy-and-not-in-report-only.php</a></li>
<li><a href="#trunkLayoutTestshttptestssecuritycontentSecurityPolicy11resourcesmodulescriptnonceinoneenforcedpolicyneitherinanotherenforcedpolicynorreportpolicyphp">trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/resources/module-scriptnonce-in-one-enforced-policy-neither-in-another-enforced-policy-nor-report-policy.php</a></li>
<li><a href="#trunkLayoutTestshttptestssecuritycontentSecurityPolicymoduleevalblockedexpectedtxt">trunk/LayoutTests/http/tests/security/contentSecurityPolicy/module-eval-blocked-expected.txt</a></li>
<li><a href="#trunkLayoutTestshttptestssecuritycontentSecurityPolicymoduleevalblockedinexternalscriptexpectedtxt">trunk/LayoutTests/http/tests/security/contentSecurityPolicy/module-eval-blocked-in-external-script-expected.txt</a></li>
<li><a href="#trunkLayoutTestshttptestssecuritycontentSecurityPolicymoduleevalblockedinexternalscripthtml">trunk/LayoutTests/http/tests/security/contentSecurityPolicy/module-eval-blocked-in-external-script.html</a></li>
<li><a href="#trunkLayoutTestshttptestssecuritycontentSecurityPolicymoduleevalblockedhtml">trunk/LayoutTests/http/tests/security/contentSecurityPolicy/module-eval-blocked.html</a></li>
<li><a href="#trunkLayoutTestshttptestssecuritycontentSecurityPolicyresourcesechomodulescriptsrcpl">trunk/LayoutTests/http/tests/security/contentSecurityPolicy/resources/echo-module-script-src.pl</a></li>
<li><a href="#trunkLayoutTestshttptestssecuritycontentSecurityPolicyresourcesmultipleiframemoduletestjs">trunk/LayoutTests/http/tests/security/contentSecurityPolicy/resources/multiple-iframe-module-test.js</a></li>
<li><a href="#trunkLayoutTestshttptestssecuritymodulecorrectmimetypesexpectedtxt">trunk/LayoutTests/http/tests/security/module-correct-mime-types-expected.txt</a></li>
<li><a href="#trunkLayoutTestshttptestssecuritymodulecorrectmimetypeshtml">trunk/LayoutTests/http/tests/security/module-correct-mime-types.html</a></li>
<li><a href="#trunkLayoutTestshttptestssecuritymodulecrossoriginerroreventinformationexpectedtxt">trunk/LayoutTests/http/tests/security/module-crossorigin-error-event-information-expected.txt</a></li>
<li><a href="#trunkLayoutTestshttptestssecuritymodulecrossoriginerroreventinformationhtml">trunk/LayoutTests/http/tests/security/module-crossorigin-error-event-information.html</a></li>
<li><a href="#trunkLayoutTestshttptestssecuritymodulecrossoriginloadscorrectlycredentialsexpectedtxt">trunk/LayoutTests/http/tests/security/module-crossorigin-loads-correctly-credentials-expected.txt</a></li>
<li><a href="#trunkLayoutTestshttptestssecuritymodulecrossoriginloadscorrectlycredentialshtml">trunk/LayoutTests/http/tests/security/module-crossorigin-loads-correctly-credentials.html</a></li>
<li><a href="#trunkLayoutTestshttptestssecuritymodulecrossoriginloadsomitexpectedtxt">trunk/LayoutTests/http/tests/security/module-crossorigin-loads-omit-expected.txt</a></li>
<li><a href="#trunkLayoutTestshttptestssecuritymodulecrossoriginloadsomithtml">trunk/LayoutTests/http/tests/security/module-crossorigin-loads-omit.html</a></li>
<li><a href="#trunkLayoutTestshttptestssecuritymodulecrossoriginloadssameoriginexpectedtxt">trunk/LayoutTests/http/tests/security/module-crossorigin-loads-same-origin-expected.txt</a></li>
<li><a href="#trunkLayoutTestshttptestssecuritymodulecrossoriginloadssameoriginhtml">trunk/LayoutTests/http/tests/security/module-crossorigin-loads-same-origin.html</a></li>
<li><a href="#trunkLayoutTestshttptestssecuritymodulecrossoriginonerrorinformationexpectedtxt">trunk/LayoutTests/http/tests/security/module-crossorigin-onerror-information-expected.txt</a></li>
<li><a href="#trunkLayoutTestshttptestssecuritymodulecrossoriginonerrorinformationhtml">trunk/LayoutTests/http/tests/security/module-crossorigin-onerror-information.html</a></li>
<li><a href="#trunkLayoutTestshttptestssecuritymoduleincorrectmimetypesexpectedtxt">trunk/LayoutTests/http/tests/security/module-incorrect-mime-types-expected.txt</a></li>
<li><a href="#trunkLayoutTestshttptestssecuritymoduleincorrectmimetypeshtml">trunk/LayoutTests/http/tests/security/module-incorrect-mime-types.html</a></li>
<li><a href="#trunkLayoutTestshttptestssecuritymodulenomimetypeexpectedtxt">trunk/LayoutTests/http/tests/security/module-no-mime-type-expected.txt</a></li>
<li><a href="#trunkLayoutTestshttptestssecuritymodulenomimetypehtml">trunk/LayoutTests/http/tests/security/module-no-mime-type.html</a></li>
<li><a href="#trunkLayoutTestshttptestssecurityresourcesmodulelocalscriptjs">trunk/LayoutTests/http/tests/security/resources/module-local-script.js</a></li>
<li>trunk/LayoutTests/js/dom/modules/</li>
<li><a href="#trunkLayoutTestsjsdommodulesmoduleanddomcontentloadedexpectedtxt">trunk/LayoutTests/js/dom/modules/module-and-dom-content-loaded-expected.txt</a></li>
<li><a href="#trunkLayoutTestsjsdommodulesmoduleanddomcontentloadedhtml">trunk/LayoutTests/js/dom/modules/module-and-dom-content-loaded.html</a></li>
<li><a href="#trunkLayoutTestsjsdommodulesmoduleandwindowloadexpectedtxt">trunk/LayoutTests/js/dom/modules/module-and-window-load-expected.txt</a></li>
<li><a href="#trunkLayoutTestsjsdommodulesmoduleandwindowloadhtml">trunk/LayoutTests/js/dom/modules/module-and-window-load.html</a></li>
<li><a href="#trunkLayoutTestsjsdommodulesmoduleasyncandwindowloadexpectedtxt">trunk/LayoutTests/js/dom/modules/module-async-and-window-load-expected.txt</a></li>
<li><a href="#trunkLayoutTestsjsdommodulesmoduleasyncandwindowloadhtml">trunk/LayoutTests/js/dom/modules/module-async-and-window-load.html</a></li>
<li><a href="#trunkLayoutTestsjsdommodulesmoduledocumentwriteexpectedtxt">trunk/LayoutTests/js/dom/modules/module-document-write-expected.txt</a></li>
<li><a href="#trunkLayoutTestsjsdommodulesmoduledocumentwritesrcexpectedtxt">trunk/LayoutTests/js/dom/modules/module-document-write-src-expected.txt</a></li>
<li><a href="#trunkLayoutTestsjsdommodulesmoduledocumentwritesrchtml">trunk/LayoutTests/js/dom/modules/module-document-write-src.html</a></li>
<li><a href="#trunkLayoutTestsjsdommodulesmoduledocumentwritehtml">trunk/LayoutTests/js/dom/modules/module-document-write.html</a></li>
<li><a href="#trunkLayoutTestsjsdommodulesmoduleexecutionerrorinsidedependentmoduleshouldbepropagatedtoonerrorexpectedtxt">trunk/LayoutTests/js/dom/modules/module-execution-error-inside-dependent-module-should-be-propagated-to-onerror-expected.txt</a></li>
<li><a href="#trunkLayoutTestsjsdommodulesmoduleexecutionerrorinsidedependentmoduleshouldbepropagatedtoonerrorhtml">trunk/LayoutTests/js/dom/modules/module-execution-error-inside-dependent-module-should-be-propagated-to-onerror.html</a></li>
<li><a href="#trunkLayoutTestsjsdommodulesmoduleexecutionerrorshouldbepropagatedtoonerrorexpectedtxt">trunk/LayoutTests/js/dom/modules/module-execution-error-should-be-propagated-to-onerror-expected.txt</a></li>
<li><a href="#trunkLayoutTestsjsdommodulesmoduleexecutionerrorshouldbepropagatedtoonerrorhtml">trunk/LayoutTests/js/dom/modules/module-execution-error-should-be-propagated-to-onerror.html</a></li>
<li><a href="#trunkLayoutTestsjsdommodulesmoduleexecutionorderinlineexpectedtxt">trunk/LayoutTests/js/dom/modules/module-execution-order-inline-expected.txt</a></li>
<li><a href="#trunkLayoutTestsjsdommodulesmoduleexecutionorderinlinehtml">trunk/LayoutTests/js/dom/modules/module-execution-order-inline.html</a></li>
<li><a href="#trunkLayoutTestsjsdommodulesmoduleexecutionordermixedexpectedtxt">trunk/LayoutTests/js/dom/modules/module-execution-order-mixed-expected.txt</a></li>
<li><a href="#trunkLayoutTestsjsdommodulesmoduleexecutionordermixedwithclassicscriptsexpectedtxt">trunk/LayoutTests/js/dom/modules/module-execution-order-mixed-with-classic-scripts-expected.txt</a></li>
<li><a href="#trunkLayoutTestsjsdommodulesmoduleexecutionordermixedwithclassicscriptshtml">trunk/LayoutTests/js/dom/modules/module-execution-order-mixed-with-classic-scripts.html</a></li>
<li><a href="#trunkLayoutTestsjsdommodulesmoduleexecutionordermixedhtml">trunk/LayoutTests/js/dom/modules/module-execution-order-mixed.html</a></li>
<li><a href="#trunkLayoutTestsjsdommodulesmoduleincorrectrelativespecifierexpectedtxt">trunk/LayoutTests/js/dom/modules/module-incorrect-relative-specifier-expected.txt</a></li>
<li><a href="#trunkLayoutTestsjsdommodulesmoduleincorrectrelativespecifierhtml">trunk/LayoutTests/js/dom/modules/module-incorrect-relative-specifier.html</a></li>
<li><a href="#trunkLayoutTestsjsdommodulesmoduleincorrecttagexpectedtxt">trunk/LayoutTests/js/dom/modules/module-incorrect-tag-expected.txt</a></li>
<li><a href="#trunkLayoutTestsjsdommodulesmoduleincorrecttaghtml">trunk/LayoutTests/js/dom/modules/module-incorrect-tag.html</a></li>
<li><a href="#trunkLayoutTestsjsdommodulesmoduleinlinecurrentscriptexpectedtxt">trunk/LayoutTests/js/dom/modules/module-inline-current-script-expected.txt</a></li>
<li><a href="#trunkLayoutTestsjsdommodulesmoduleinlinecurrentscripthtml">trunk/LayoutTests/js/dom/modules/module-inline-current-script.html</a></li>
<li><a href="#trunkLayoutTestsjsdommodulesmoduleinlinedynamicexpectedtxt">trunk/LayoutTests/js/dom/modules/module-inline-dynamic-expected.txt</a></li>
<li><a href="#trunkLayoutTestsjsdommodulesmoduleinlinedynamichtml">trunk/LayoutTests/js/dom/modules/module-inline-dynamic.html</a></li>
<li><a href="#trunkLayoutTestsjsdommodulesmoduleinlinesimpleexpectedtxt">trunk/LayoutTests/js/dom/modules/module-inline-simple-expected.txt</a></li>
<li><a href="#trunkLayoutTestsjsdommodulesmoduleinlinesimplehtml">trunk/LayoutTests/js/dom/modules/module-inline-simple.html</a></li>
<li><a href="#trunkLayoutTestsjsdommodulesmoduleloadeventexpectedtxt">trunk/LayoutTests/js/dom/modules/module-load-event-expected.txt</a></li>
<li><a href="#trunkLayoutTestsjsdommodulesmoduleloadeventwithsrcexpectedtxt">trunk/LayoutTests/js/dom/modules/module-load-event-with-src-expected.txt</a></li>
<li><a href="#trunkLayoutTestsjsdommodulesmoduleloadeventwithsrchtml">trunk/LayoutTests/js/dom/modules/module-load-event-with-src.html</a></li>
<li><a href="#trunkLayoutTestsjsdommodulesmoduleloadeventhtml">trunk/LayoutTests/js/dom/modules/module-load-event.html</a></li>
<li><a href="#trunkLayoutTestsjsdommodulesmoduleloadsamemodulefromdifferententrypointdynamicexpectedtxt">trunk/LayoutTests/js/dom/modules/module-load-same-module-from-different-entry-point-dynamic-expected.txt</a></li>
<li><a href="#trunkLayoutTestsjsdommodulesmoduleloadsamemodulefromdifferententrypointdynamichtml">trunk/LayoutTests/js/dom/modules/module-load-same-module-from-different-entry-point-dynamic.html</a></li>
<li><a href="#trunkLayoutTestsjsdommodulesmoduleloadsamemodulefromdifferententrypointexpectedtxt">trunk/LayoutTests/js/dom/modules/module-load-same-module-from-different-entry-point-expected.txt</a></li>
<li><a href="#trunkLayoutTestsjsdommodulesmoduleloadsamemodulefromdifferententrypointhtml">trunk/LayoutTests/js/dom/modules/module-load-same-module-from-different-entry-point.html</a></li>
<li><a href="#trunkLayoutTestsjsdommodulesmodulenotfounderroreventexpectedtxt">trunk/LayoutTests/js/dom/modules/module-not-found-error-event-expected.txt</a></li>
<li><a href="#trunkLayoutTestsjsdommodulesmodulenotfounderroreventwithsrcandimportexpectedtxt">trunk/LayoutTests/js/dom/modules/module-not-found-error-event-with-src-and-import-expected.txt</a></li>
<li><a href="#trunkLayoutTestsjsdommodulesmodulenotfounderroreventwithsrcandimporthtml">trunk/LayoutTests/js/dom/modules/module-not-found-error-event-with-src-and-import.html</a></li>
<li><a href="#trunkLayoutTestsjsdommodulesmodulenotfounderroreventwithsrcexpectedtxt">trunk/LayoutTests/js/dom/modules/module-not-found-error-event-with-src-expected.txt</a></li>
<li><a href="#trunkLayoutTestsjsdommodulesmodulenotfounderroreventwithsrchtml">trunk/LayoutTests/js/dom/modules/module-not-found-error-event-with-src.html</a></li>
<li><a href="#trunkLayoutTestsjsdommodulesmodulenotfounderroreventhtml">trunk/LayoutTests/js/dom/modules/module-not-found-error-event.html</a></li>
<li><a href="#trunkLayoutTestsjsdommodulesmodulesrccurrentscriptexpectedtxt">trunk/LayoutTests/js/dom/modules/module-src-current-script-expected.txt</a></li>
<li><a href="#trunkLayoutTestsjsdommodulesmodulesrccurrentscripthtml">trunk/LayoutTests/js/dom/modules/module-src-current-script.html</a></li>
<li><a href="#trunkLayoutTestsjsdommodulesmodulesrcdynamicexpectedtxt">trunk/LayoutTests/js/dom/modules/module-src-dynamic-expected.txt</a></li>
<li><a href="#trunkLayoutTestsjsdommodulesmodulesrcdynamichtml">trunk/LayoutTests/js/dom/modules/module-src-dynamic.html</a></li>
<li><a href="#trunkLayoutTestsjsdommodulesmodulesrcsimpleexpectedtxt">trunk/LayoutTests/js/dom/modules/module-src-simple-expected.txt</a></li>
<li><a href="#trunkLayoutTestsjsdommodulesmodulesrcsimplehtml">trunk/LayoutTests/js/dom/modules/module-src-simple.html</a></li>
<li><a href="#trunkLayoutTestsjsdommodulesmoduletypecaseinsensitiveexpectedtxt">trunk/LayoutTests/js/dom/modules/module-type-case-insensitive-expected.txt</a></li>
<li><a href="#trunkLayoutTestsjsdommodulesmoduletypecaseinsensitivehtml">trunk/LayoutTests/js/dom/modules/module-type-case-insensitive.html</a></li>
<li><a href="#trunkLayoutTestsjsdommodulesmodulewillfirebeforeloadexpectedtxt">trunk/LayoutTests/js/dom/modules/module-will-fire-beforeload-expected.txt</a></li>
<li><a href="#trunkLayoutTestsjsdommodulesmodulewillfirebeforeloadhtml">trunk/LayoutTests/js/dom/modules/module-will-fire-beforeload.html</a></li>
<li>trunk/LayoutTests/js/dom/modules/script-tests/</li>
<li><a href="#trunkLayoutTestsjsdommodulesscripttestsmoduledocumentwritesrcjs">trunk/LayoutTests/js/dom/modules/script-tests/module-document-write-src.js</a></li>
<li><a href="#trunkLayoutTestsjsdommodulesscripttestsmoduleexecutionerrorinsidedependentmoduleshouldbepropagatedtoonerrorthrowjs">trunk/LayoutTests/js/dom/modules/script-tests/module-execution-error-inside-dependent-module-should-be-propagated-to-onerror-throw.js</a></li>
<li><a href="#trunkLayoutTestsjsdommodulesscripttestsmoduleexecutionerrorinsidedependentmoduleshouldbepropagatedtoonerrorjs">trunk/LayoutTests/js/dom/modules/script-tests/module-execution-error-inside-dependent-module-should-be-propagated-to-onerror.js</a></li>
<li><a href="#trunkLayoutTestsjsdommodulesscripttestsmoduleexecutionordermixed2js">trunk/LayoutTests/js/dom/modules/script-tests/module-execution-order-mixed-2.js</a></li>
<li><a href="#trunkLayoutTestsjsdommodulesscripttestsmoduleexecutionordermixedcappuccinojs">trunk/LayoutTests/js/dom/modules/script-tests/module-execution-order-mixed-cappuccino.js</a></li>
<li><a href="#trunkLayoutTestsjsdommodulesscripttestsmoduleexecutionordermixedcocoajs">trunk/LayoutTests/js/dom/modules/script-tests/module-execution-order-mixed-cocoa.js</a></li>
<li><a href="#trunkLayoutTestsjsdommodulesscripttestsmoduleexecutionordermixedmatchajs">trunk/LayoutTests/js/dom/modules/script-tests/module-execution-order-mixed-matcha.js</a></li>
<li><a href="#trunkLayoutTestsjsdommodulesscripttestsmoduleexecutionordermixedwithclassicscripts2js">trunk/LayoutTests/js/dom/modules/script-tests/module-execution-order-mixed-with-classic-scripts-2.js</a></li>
<li><a href="#trunkLayoutTestsjsdommodulesscripttestsmoduleexecutionordermixedwithclassicscriptscappuccinojs">trunk/LayoutTests/js/dom/modules/script-tests/module-execution-order-mixed-with-classic-scripts-cappuccino.js</a></li>
<li><a href="#trunkLayoutTestsjsdommodulesscripttestsmoduleexecutionordermixedwithclassicscriptscocoajs">trunk/LayoutTests/js/dom/modules/script-tests/module-execution-order-mixed-with-classic-scripts-cocoa.js</a></li>
<li><a href="#trunkLayoutTestsjsdommodulesscripttestsmoduleexecutionordermixedwithclassicscriptsmatchajs">trunk/LayoutTests/js/dom/modules/script-tests/module-execution-order-mixed-with-classic-scripts-matcha.js</a></li>
<li><a href="#trunkLayoutTestsjsdommodulesscripttestsmoduleexecutionordermixedwithclassicscriptsjs">trunk/LayoutTests/js/dom/modules/script-tests/module-execution-order-mixed-with-classic-scripts.js</a></li>
<li><a href="#trunkLayoutTestsjsdommodulesscripttestsmoduleexecutionordermixedjs">trunk/LayoutTests/js/dom/modules/script-tests/module-execution-order-mixed.js</a></li>
<li><a href="#trunkLayoutTestsjsdommodulesscripttestsmoduleinlinedynamicjs">trunk/LayoutTests/js/dom/modules/script-tests/module-inline-dynamic.js</a></li>
<li><a href="#trunkLayoutTestsjsdommodulesscripttestsmoduleinlinesimplejs">trunk/LayoutTests/js/dom/modules/script-tests/module-inline-simple.js</a></li>
<li><a href="#trunkLayoutTestsjsdommodulesscripttestsmoduleloadeventwithsrcjs">trunk/LayoutTests/js/dom/modules/script-tests/module-load-event-with-src.js</a></li>
<li><a href="#trunkLayoutTestsjsdommodulesscripttestsmoduleloadsamemodulefromdifferententrypointjs">trunk/LayoutTests/js/dom/modules/script-tests/module-load-same-module-from-different-entry-point.js</a></li>
<li><a href="#trunkLayoutTestsjsdommodulesscripttestsmodulenotfounderroreventwithsrcandimportjs">trunk/LayoutTests/js/dom/modules/script-tests/module-not-found-error-event-with-src-and-import.js</a></li>
<li><a href="#trunkLayoutTestsjsdommodulesscripttestsmodulesrccurrentscriptjs">trunk/LayoutTests/js/dom/modules/script-tests/module-src-current-script.js</a></li>
<li><a href="#trunkLayoutTestsjsdommodulesscripttestsmodulesrcdynamiccocoajs">trunk/LayoutTests/js/dom/modules/script-tests/module-src-dynamic-cocoa.js</a></li>
<li><a href="#trunkLayoutTestsjsdommodulesscripttestsmodulesrcdynamicjs">trunk/LayoutTests/js/dom/modules/script-tests/module-src-dynamic.js</a></li>
<li><a href="#trunkLayoutTestsjsdommodulesscripttestsmodulesrcsimplecocoajs">trunk/LayoutTests/js/dom/modules/script-tests/module-src-simple-cocoa.js</a></li>
<li><a href="#trunkLayoutTestsjsdommodulesscripttestsmodulesrcsimplejs">trunk/LayoutTests/js/dom/modules/script-tests/module-src-simple.js</a></li>
<li><a href="#trunkLayoutTestsjsdommodulesscripttestsmodulewillfirebeforeloadjs">trunk/LayoutTests/js/dom/modules/script-tests/module-will-fire-beforeload.js</a></li>
<li><a href="#trunkSourceWebCorebindingsjsCachedModuleScriptcpp">trunk/Source/WebCore/bindings/js/CachedModuleScript.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsjsCachedModuleScripth">trunk/Source/WebCore/bindings/js/CachedModuleScript.h</a></li>
<li><a href="#trunkSourceWebCorebindingsjsCachedModuleScriptClienth">trunk/Source/WebCore/bindings/js/CachedModuleScriptClient.h</a></li>
<li><a href="#trunkSourceWebCorebindingsjsCachedModuleScriptLoadercpp">trunk/Source/WebCore/bindings/js/CachedModuleScriptLoader.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsjsCachedModuleScriptLoaderh">trunk/Source/WebCore/bindings/js/CachedModuleScriptLoader.h</a></li>
<li><a href="#trunkSourceWebCorebindingsjsCachedModuleScriptLoaderClienth">trunk/Source/WebCore/bindings/js/CachedModuleScriptLoaderClient.h</a></li>
<li><a href="#trunkSourceWebCoredomLoadableModuleScriptcpp">trunk/Source/WebCore/dom/LoadableModuleScript.cpp</a></li>
<li><a href="#trunkSourceWebCoredomLoadableModuleScripth">trunk/Source/WebCore/dom/LoadableModuleScript.h</a></li>
</ul>

<h3>Property Changed</h3>
<ul>
<li><a href="#trunkLayoutTestshttptestssecurityresourcescorsscriptphp">trunk/LayoutTests/http/tests/security/resources/cors-script.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (208787 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2016-11-16 09:08:23 UTC (rev 208787)
+++ trunk/LayoutTests/ChangeLog        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -1,3 +1,158 @@
</span><ins>+2016-11-16  Yusuke Suzuki  &lt;utatane.tea@gmail.com&gt;
+
+        [ES6] Integrate ES6 Modules into WebCore
+        https://bugs.webkit.org/show_bug.cgi?id=148897
+
+        Reviewed by Ryosuke Niwa.
+
+        * TestExpectations:
+        * http/tests/misc/module-absolute-url-expected.txt: Added.
+        * http/tests/misc/module-absolute-url.html: Added.
+        * http/tests/misc/module-script-async-expected.txt: Added.
+        * http/tests/misc/module-script-async.html: Added.
+        * http/tests/misc/resources/module-absolute-url.js: Added.
+        * http/tests/misc/resources/module-absolute-url2.js: Added.
+        * http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-allowed-expected.txt: Added.
+        * http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-allowed.html: Added.
+        * http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-and-scripthash-expected.txt: Added.
+        * http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-and-scripthash.html: Added.
+        * http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-basic-blocked-expected.txt: Added.
+        * http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-basic-blocked.html: Added.
+        * http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-blocked-expected.txt: Added.
+        * http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-blocked.html: Added.
+        * http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-ignore-unsafeinline-expected.txt: Added.
+        * http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-ignore-unsafeinline.html: Added.
+        * http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-in-enforced-policy-and-not-in-report-only-expected.txt: Added.
+        * http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-in-enforced-policy-and-not-in-report-only.html: Added.
+        * http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-in-one-enforced-policy-neither-in-another-enforced-policy-nor-report-policy-expected.txt: Added.
+        * http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-in-one-enforced-policy-neither-in-another-enforced-policy-nor-report-policy.html: Added.
+        * http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-invalidnonce-expected.txt: Added.
+        * http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-invalidnonce.html: Added.
+        * http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-multiple-policies-expected.txt: Added.
+        * http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-multiple-policies.html: Added.
+        * http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-redirect-expected.txt: Added.
+        * http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-redirect-same-origin-expected.txt: Added.
+        * http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-redirect-same-origin.html: Added.
+        * http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-redirect.html: Added.
+        * http/tests/security/contentSecurityPolicy/1.1/resources/module-scriptnonce-in-enforced-policy-and-not-in-report-only.php: Added.
+        * http/tests/security/contentSecurityPolicy/1.1/resources/module-scriptnonce-in-one-enforced-policy-neither-in-another-enforced-policy-nor-report-policy.php: Added.
+        * http/tests/security/contentSecurityPolicy/module-eval-blocked-expected.txt: Added.
+        * http/tests/security/contentSecurityPolicy/module-eval-blocked-in-external-script-expected.txt: Added.
+        * http/tests/security/contentSecurityPolicy/module-eval-blocked-in-external-script.html: Added.
+        * http/tests/security/contentSecurityPolicy/module-eval-blocked.html: Added.
+        * http/tests/security/contentSecurityPolicy/resources/echo-module-script-src.pl: Added.
+        * http/tests/security/contentSecurityPolicy/resources/multiple-iframe-module-test.js: Added.
+        (testPreescapedPolicy):
+        (testExperimentalPolicy):
+        (test):
+        (iframe.onload):
+        (testImpl):
+        (finishTesting):
+        * http/tests/security/module-correct-mime-types-expected.txt: Added.
+        * http/tests/security/module-correct-mime-types.html: Added.
+        * http/tests/security/module-crossorigin-error-event-information-expected.txt: Added.
+        * http/tests/security/module-crossorigin-error-event-information.html: Added.
+        * http/tests/security/module-crossorigin-loads-correctly-credentials-expected.txt: Added.
+        * http/tests/security/module-crossorigin-loads-correctly-credentials.html: Added.
+        * http/tests/security/module-crossorigin-loads-omit-expected.txt: Added.
+        * http/tests/security/module-crossorigin-loads-omit.html: Added.
+        * http/tests/security/module-crossorigin-loads-same-origin-expected.txt: Added.
+        * http/tests/security/module-crossorigin-loads-same-origin.html: Added.
+        * http/tests/security/module-crossorigin-onerror-information-expected.txt: Added.
+        * http/tests/security/module-crossorigin-onerror-information.html: Added.
+        * http/tests/security/module-incorrect-mime-types-expected.txt: Added.
+        * http/tests/security/module-incorrect-mime-types.html: Added.
+        * http/tests/security/module-no-mime-type-expected.txt: Added.
+        * http/tests/security/module-no-mime-type.html: Added.
+        * http/tests/security/resources/cors-script.php:
+        * http/tests/security/resources/module-local-script.js: Added.
+        * js/dom/modules/module-and-dom-content-loaded-expected.txt: Added.
+        * js/dom/modules/module-and-dom-content-loaded.html: Added.
+        * js/dom/modules/module-and-window-load-expected.txt: Added.
+        * js/dom/modules/module-and-window-load.html: Added.
+        * js/dom/modules/module-async-and-window-load-expected.txt: Added.
+        * js/dom/modules/module-async-and-window-load.html: Added.
+        * js/dom/modules/module-document-write-expected.txt: Added.
+        * js/dom/modules/module-document-write-src-expected.txt: Added.
+        * js/dom/modules/module-document-write-src.html: Added.
+        * js/dom/modules/module-document-write.html: Added.
+        * js/dom/modules/module-execution-error-inside-dependent-module-should-be-propagated-to-onerror-expected.txt: Added.
+        * js/dom/modules/module-execution-error-inside-dependent-module-should-be-propagated-to-onerror.html: Added.
+        * js/dom/modules/module-execution-error-should-be-propagated-to-onerror-expected.txt: Added.
+        * js/dom/modules/module-execution-error-should-be-propagated-to-onerror.html: Added.
+        * js/dom/modules/module-execution-order-inline-expected.txt: Added.
+        * js/dom/modules/module-execution-order-inline.html: Added.
+        * js/dom/modules/module-execution-order-mixed-expected.txt: Added.
+        * js/dom/modules/module-execution-order-mixed-with-classic-scripts-expected.txt: Added.
+        * js/dom/modules/module-execution-order-mixed-with-classic-scripts.html: Added.
+        * js/dom/modules/module-execution-order-mixed.html: Added.
+        * js/dom/modules/module-incorrect-relative-specifier-expected.txt: Added.
+        * js/dom/modules/module-incorrect-relative-specifier.html: Added.
+        * js/dom/modules/module-incorrect-tag-expected.txt: Added.
+        * js/dom/modules/module-incorrect-tag.html: Added.
+        * js/dom/modules/module-inline-current-script-expected.txt: Added.
+        * js/dom/modules/module-inline-current-script.html: Added.
+        * js/dom/modules/module-inline-dynamic-expected.txt: Added.
+        * js/dom/modules/module-inline-dynamic.html: Added.
+        * js/dom/modules/module-inline-simple-expected.txt: Added.
+        * js/dom/modules/module-inline-simple.html: Added.
+        * js/dom/modules/module-load-event-expected.txt: Added.
+        * js/dom/modules/module-load-event-with-src-expected.txt: Added.
+        * js/dom/modules/module-load-event-with-src.html: Added.
+        * js/dom/modules/module-load-event.html: Added.
+        * js/dom/modules/module-load-same-module-from-different-entry-point-dynamic-expected.txt: Added.
+        * js/dom/modules/module-load-same-module-from-different-entry-point-dynamic.html: Added.
+        * js/dom/modules/module-load-same-module-from-different-entry-point-expected.txt: Added.
+        * js/dom/modules/module-load-same-module-from-different-entry-point.html: Added.
+        * js/dom/modules/module-not-found-error-event-expected.txt: Added.
+        * js/dom/modules/module-not-found-error-event-with-src-and-import-expected.txt: Added.
+        * js/dom/modules/module-not-found-error-event-with-src-and-import.html: Added.
+        * js/dom/modules/module-not-found-error-event-with-src-expected.txt: Added.
+        * js/dom/modules/module-not-found-error-event-with-src.html: Added.
+        * js/dom/modules/module-not-found-error-event.html: Added.
+        * js/dom/modules/module-src-current-script-expected.txt: Added.
+        * js/dom/modules/module-src-current-script.html: Added.
+        * js/dom/modules/module-src-dynamic-expected.txt: Added.
+        * js/dom/modules/module-src-dynamic.html: Added.
+        * js/dom/modules/module-src-simple-expected.txt: Added.
+        * js/dom/modules/module-src-simple.html: Added.
+        * js/dom/modules/module-type-case-insensitive-expected.txt: Added.
+        * js/dom/modules/module-type-case-insensitive.html: Added.
+        * js/dom/modules/module-will-fire-beforeload-expected.txt: Added.
+        * js/dom/modules/module-will-fire-beforeload.html: Added.
+        * js/dom/modules/script-tests/module-document-write-src.js: Added.
+        * js/dom/modules/script-tests/module-execution-error-inside-dependent-module-should-be-propagated-to-onerror-throw.js: Added.
+        * js/dom/modules/script-tests/module-execution-error-inside-dependent-module-should-be-propagated-to-onerror.js: Added.
+        * js/dom/modules/script-tests/module-execution-order-mixed-2.js: Added.
+        * js/dom/modules/script-tests/module-execution-order-mixed-cappuccino.js: Added.
+        * js/dom/modules/script-tests/module-execution-order-mixed-cocoa.js: Added.
+        * js/dom/modules/script-tests/module-execution-order-mixed-matcha.js: Added.
+        * js/dom/modules/script-tests/module-execution-order-mixed-with-classic-scripts-2.js: Added.
+        * js/dom/modules/script-tests/module-execution-order-mixed-with-classic-scripts-cappuccino.js: Added.
+        * js/dom/modules/script-tests/module-execution-order-mixed-with-classic-scripts-cocoa.js: Added.
+        * js/dom/modules/script-tests/module-execution-order-mixed-with-classic-scripts-matcha.js: Added.
+        * js/dom/modules/script-tests/module-execution-order-mixed-with-classic-scripts.js: Added.
+        * js/dom/modules/script-tests/module-execution-order-mixed.js: Added.
+        * js/dom/modules/script-tests/module-inline-dynamic.js: Added.
+        (export.default.Cocoa.prototype.taste):
+        (export.default.Cocoa):
+        * js/dom/modules/script-tests/module-inline-simple.js: Added.
+        (export.default.Cocoa.prototype.taste):
+        (export.default.Cocoa):
+        * js/dom/modules/script-tests/module-load-event-with-src.js: Added.
+        * js/dom/modules/script-tests/module-load-same-module-from-different-entry-point.js: Added.
+        * js/dom/modules/script-tests/module-not-found-error-event-with-src-and-import.js: Added.
+        * js/dom/modules/script-tests/module-src-current-script.js: Added.
+        * js/dom/modules/script-tests/module-src-dynamic-cocoa.js: Added.
+        (Cocoa.prototype.taste):
+        (Cocoa):
+        * js/dom/modules/script-tests/module-src-dynamic.js: Added.
+        * js/dom/modules/script-tests/module-src-simple-cocoa.js: Added.
+        (Cocoa.prototype.taste):
+        (Cocoa):
+        * js/dom/modules/script-tests/module-src-simple.js: Added.
+        * js/dom/modules/script-tests/module-will-fire-beforeload.js: Added.
+
</ins><span class="cx"> 2016-11-15  Joseph Pecoraro  &lt;pecoraro@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Web Inspector: Preview other CSS @media in browser window (print)
</span></span></pre></div>
<a id="trunkLayoutTestsTestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/TestExpectations (208787 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/TestExpectations        2016-11-16 09:08:23 UTC (rev 208787)
+++ trunk/LayoutTests/TestExpectations        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -984,3 +984,55 @@
</span><span class="cx"> 
</span><span class="cx"> webkit.org/b/164080 http/tests/websocket/tests/hybi/closed-when-entering-page-cache.html [ Pass Failure ]
</span><span class="cx"> webkit.org/b/164080 http/tests/websocket/tests/hybi/stop-on-resume-in-error-handler.html [ Pass Failure ]
</span><ins>+
+# ES6 Modules are not yet enabled by default: ENABLE(ES6_MODULES)
+http/tests/misc/module-absolute-url.html [ Skip ]
+http/tests/misc/module-script-async.html [ Skip ]
+http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-allowed.html [ Skip ]
+http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-and-scripthash.html [ Skip ]
+http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-basic-blocked.html [ Skip ]
+http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-blocked.html [ Skip ]
+http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-ignore-unsafeinline.html [ Skip ]
+http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-in-enforced-policy-and-not-in-report-only.html [ Skip ]
+http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-in-one-enforced-policy-neither-in-another-enforced-policy-nor-report-policy.html [ Skip ]
+http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-invalidnonce.html [ Skip ]
+http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-multiple-policies.html [ Skip ]
+http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-redirect-same-origin.html [ Skip ]
+http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-redirect.html [ Skip ]
+http/tests/security/contentSecurityPolicy/module-eval-blocked-in-external-script.html [ Skip ]
+http/tests/security/contentSecurityPolicy/module-eval-blocked.html [ Skip ]
+http/tests/security/module-correct-mime-types.html [ Skip ]
+http/tests/security/module-crossorigin-loads-correctly-credentials.html [ Skip ]
+http/tests/security/module-crossorigin-loads-omit.html [ Skip ]
+http/tests/security/module-crossorigin-loads-same-origin.html [ Skip ]
+http/tests/security/module-incorrect-mime-types.html [ Skip ]
+http/tests/security/module-no-mime-type.html [ Skip ]
+js/dom/modules/module-and-dom-content-loaded.html [ Skip ]
+js/dom/modules/module-and-window-load.html [ Skip ]
+js/dom/modules/module-async-and-window-load.html [ Skip ]
+js/dom/modules/module-document-write-src.html [ Skip ]
+js/dom/modules/module-document-write.html [ Skip ]
+js/dom/modules/module-execution-error-inside-dependent-module-should-be-propagated-to-onerror.html [ Skip ]
+js/dom/modules/module-execution-error-should-be-propagated-to-onerror.html [ Skip ]
+js/dom/modules/module-execution-order-inline.html [ Skip ]
+js/dom/modules/module-execution-order-mixed-with-classic-scripts.html [ Skip ]
+js/dom/modules/module-execution-order-mixed.html [ Skip ]
+js/dom/modules/module-incorrect-relative-specifier.html [ Skip ]
+js/dom/modules/module-incorrect-tag.html [ Skip ]
+js/dom/modules/module-inline-current-script.html [ Skip ]
+js/dom/modules/module-inline-dynamic.html [ Skip ]
+js/dom/modules/module-inline-simple.html [ Skip ]
+js/dom/modules/module-load-event-with-src.html [ Skip ]
+js/dom/modules/module-load-event.html [ Skip ]
+js/dom/modules/module-load-same-module-from-different-entry-point-dynamic.html [ Skip ]
+js/dom/modules/module-load-same-module-from-different-entry-point.html [ Skip ]
+js/dom/modules/module-not-found-error-event-with-src-and-import.html [ Skip ]
+js/dom/modules/module-not-found-error-event-with-src.html [ Skip ]
+js/dom/modules/module-not-found-error-event.html [ Skip ]
+js/dom/modules/module-src-current-script.html [ Skip ]
+js/dom/modules/module-src-dynamic.html [ Skip ]
+js/dom/modules/module-src-simple.html [ Skip ]
+js/dom/modules/module-type-case-insensitive.html [ Skip ]
+js/dom/modules/module-will-fire-beforeload.html [ Skip ]
+webkit.org/b/164539 http/tests/security/module-crossorigin-error-event-information.html [ Failure ]
+webkit.org/b/164539 http/tests/security/module-crossorigin-onerror-information.html [ Failure ]
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestsmiscmoduleabsoluteurlexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/misc/module-absolute-url-expected.txt (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/misc/module-absolute-url-expected.txt                                (rev 0)
+++ trunk/LayoutTests/http/tests/misc/module-absolute-url-expected.txt        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,7 @@
</span><ins>+Test modules with absolute URLs.
+http://127.0.0.1:8000/misc/resources/module-absolute-url2.js
+http://127.0.0.1:8000/misc/resources/module-absolute-url.js
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestsmiscmoduleabsoluteurlhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/misc/module-absolute-url.html (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/misc/module-absolute-url.html                                (rev 0)
+++ trunk/LayoutTests/http/tests/misc/module-absolute-url.html        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,19 @@
</span><ins>+&lt;!DOCTYPE HTML&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;meta charset=&quot;UTF-8&quot;&gt;
+&lt;script src=&quot;../../js-test-resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body onload=&quot;test()&quot;&gt;
+Test modules with absolute URLs.&lt;hr&gt;
+&lt;div id=&quot;console&quot;&gt;&lt;/div&gt;
+&lt;script&gt;
+var jsTestIsAsync = true;
+&lt;/script&gt;
+&lt;script type=&quot;module&quot;&gt;
+import &quot;http://127.0.0.1:8000/misc/resources/module-absolute-url.js&quot;;
+finishJSTest();
+&lt;/script&gt;
+&lt;script src=&quot;../../js-test-resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestsmiscmodulescriptasyncexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/misc/module-script-async-expected.txt (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/misc/module-script-async-expected.txt                                (rev 0)
+++ trunk/LayoutTests/http/tests/misc/module-script-async-expected.txt        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,2 @@
</span><ins>+This tests for proper execution order of module scripts with the async attribute.
+PASS
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestsmiscmodulescriptasynchtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/misc/module-script-async.html (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/misc/module-script-async.html                                (rev 0)
+++ trunk/LayoutTests/http/tests/misc/module-script-async.html        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,49 @@
</span><ins>+&lt;!DOCTYPE HTML&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;meta charset=&quot;UTF-8&quot;&gt;
+&lt;script src=&quot;../../js-test-resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body onload=&quot;test()&quot;&gt;
+This tests for proper execution order of module scripts with the async attribute.&lt;hr&gt;
+&lt;div id=&quot;console&quot;&gt;&lt;/div&gt;
+&lt;script type=&quot;text/javascript&quot;&gt;
+var jsTestIsAsync = true;
+var log = [];
+
+function debug(msg)
+{
+    log.push(msg);
+}
+
+document.addEventListener(&quot;DOMContentLoaded&quot;, function() {
+    debug('DOMContentLoaded');
+}, false);
+
+function test()
+{
+    var expectedOrderings = [
+        [ &quot;async&quot;, &quot;external&quot;, &quot;inline&quot;, &quot;DOMContentLoaded&quot;, &quot;slowAsync&quot; ],
+        [ &quot;external&quot;, &quot;async&quot;, &quot;inline&quot;, &quot;DOMContentLoaded&quot;, &quot;slowAsync&quot; ],
+        [ &quot;external&quot;, &quot;inline&quot;, &quot;async&quot;, &quot;DOMContentLoaded&quot;, &quot;slowAsync&quot; ],
+        [ &quot;external&quot;, &quot;inline&quot;, &quot;DOMContentLoaded&quot;, &quot;async&quot;, &quot;slowAsync&quot; ],
+    ];
+    var results = &quot;PASS&quot;;
+    if (!expectedOrderings.find((expected) =&gt; JSON.stringify(expected) == JSON.stringify(log)))
+        results = `FAIL: Expected one of ${JSON.stringify(expectedOrderings)}, Actual=${JSON.stringify(logs)}`;
+    document.getElementById(&quot;console&quot;).innerHTML = results;
+    finishJSTest();
+}
+
+&lt;/script&gt;
+&lt;script type=&quot;module&quot; src=&quot;http://127.0.0.1:8000/misc/resources/slow-async-script.cgi&quot; async=&quot;ASYNC&quot;&gt;&lt;/script&gt;
+&lt;script type=&quot;module&quot; src=&quot;http://127.0.0.1:8000/misc/resources/async-script.js&quot; async=&quot;ASYNC&quot;&gt;&lt;/script&gt;
+&lt;script src=&quot;http://127.0.0.1:8000/misc/resources/external-script.js&quot;&gt;&lt;/script&gt;
+&lt;script&gt;
+debug(&quot;inline&quot;);
+&lt;/script&gt;
+&lt;script src=&quot;../../js-test-resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
+
+
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestsmiscresourcesmoduleabsoluteurljs"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/misc/resources/module-absolute-url.js (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/misc/resources/module-absolute-url.js                                (rev 0)
+++ trunk/LayoutTests/http/tests/misc/resources/module-absolute-url.js        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,3 @@
</span><ins>+import &quot;http://127.0.0.1:8000/misc/resources/module-absolute-url2.js&quot;;
+
+debug(&quot;http://127.0.0.1:8000/misc/resources/module-absolute-url.js&quot;);
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestsmiscresourcesmoduleabsoluteurl2js"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/misc/resources/module-absolute-url2.js (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/misc/resources/module-absolute-url2.js                                (rev 0)
+++ trunk/LayoutTests/http/tests/misc/resources/module-absolute-url2.js        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+debug(&quot;http://127.0.0.1:8000/misc/resources/module-absolute-url2.js&quot;);
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestssecuritycontentSecurityPolicy11modulescriptnonceallowedexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-allowed-expected.txt (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-allowed-expected.txt                                (rev 0)
+++ trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-allowed-expected.txt        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,6 @@
</span><ins>+ALERT: PASS (1/3)
+ALERT: PASS (2/3)
+ALERT: PASS (3/3)
+This tests the effect of a valid module script-nonce value. It passes if no console warning is visible and the alerts are executed.
+
+PASS
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestssecuritycontentSecurityPolicy11modulescriptnonceallowedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-allowed.html (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-allowed.html                                (rev 0)
+++ trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-allowed.html        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,37 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+    &lt;head&gt;
+        &lt;meta http-equiv=&quot;Content-Security-Policy&quot; content=&quot;script-src 'nonce-noncynonce' 'nonce-noncy+/=nonce'&quot;&gt;
+        &lt;script nonce=&quot;noncynonce&quot;&gt;
+        if (window.testRunner) {
+            testRunner.dumpAsText();
+            testRunner.waitUntilDone();
+        }
+
+        function done(msg) {
+            document.querySelector(&quot;pre&quot;).innerHTML = msg;
+            if (window.testRunner)
+                testRunner.notifyDone();
+        }
+        &lt;/script&gt;
+        &lt;script type=&quot;module&quot; nonce=&quot;noncynonce&quot;&gt;
+            alert('PASS (1/3)');
+        &lt;/script&gt;
+        &lt;script type=&quot;module&quot; nonce=&quot;noncynonce&quot;&gt;
+            alert('PASS (2/3)');
+        &lt;/script&gt;
+        &lt;script type=&quot;module&quot; nonce=&quot;noncy+/=nonce&quot;&gt;
+            alert('PASS (3/3)');
+        &lt;/script&gt;
+        &lt;script type=&quot;module&quot; nonce=&quot;noncynonce&quot;&gt;
+            done(&quot;PASS&quot;);
+        &lt;/script&gt;
+    &lt;/head&gt;
+    &lt;body&gt;
+        &lt;p&gt;
+            This tests the effect of a valid module script-nonce value. It passes if
+            no console warning is visible and the alerts are executed.
+        &lt;/p&gt;
+        &lt;pre&gt;&lt;/pre&gt;
+    &lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestssecuritycontentSecurityPolicy11modulescriptnonceandscripthashexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-and-scripthash-expected.txt (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-and-scripthash-expected.txt                                (rev 0)
+++ trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-and-scripthash-expected.txt        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,8 @@
</span><ins>+ALERT: PASS (1/3)
+CONSOLE MESSAGE: line 18: Refused to execute a script because its hash, its nonce, or 'unsafe-inline' does not appear in the script-src directive of the Content Security Policy.
+CONSOLE MESSAGE: line 21: Refused to execute a script because its hash, its nonce, or 'unsafe-inline' does not appear in the script-src directive of the Content Security Policy.
+ALERT: PASS (2/3)
+ALERT: PASS (3/3)
+This tests the combined use of script hash and script nonce. It passes if two console warnings are visible and the three alerts show PASS.
+
+PASS
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestssecuritycontentSecurityPolicy11modulescriptnonceandscripthashhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-and-scripthash.html (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-and-scripthash.html                                (rev 0)
+++ trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-and-scripthash.html        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,40 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+    &lt;head&gt;
+        &lt;meta http-equiv=&quot;Content-Security-Policy&quot; content=&quot;script-src 'sha256-n8xN1Y8E6rPXuE8Iv++3Y3Smm6W4OGH6gqfZV7H8F1E=' 'nonce-nonceynonce'&quot;&gt;
+        &lt;script nonce=&quot;nonceynonce&quot;&gt;
+            if (window.testRunner) {
+                testRunner.dumpAsText();
+                testRunner.waitUntilDone();
+            }
+
+            function done(msg) {
+                document.querySelector(&quot;pre&quot;).innerHTML = msg;
+                if (window.testRunner)
+                    testRunner.notifyDone();
+            }
+            alert('PASS (1/3)');
+        &lt;/script&gt;
+        &lt;script type=&quot;module&quot;&gt;
+            alert('FAIL (1/2)');
+        &lt;/script&gt;
+        &lt;script type=&quot;module&quot; nonce=&quot;notanonce&quot;&gt;
+            alert('FAIL (2/2)');
+        &lt;/script&gt;
+        &lt;script type=&quot;module&quot;&gt;
+            alert('PASS (2/3)');
+        &lt;/script&gt;
+        &lt;script type=&quot;module&quot; nonce=&quot;nonceynonce&quot;&gt;
+            alert('PASS (3/3)');
+            done(&quot;PASS&quot;);
+        &lt;/script&gt;
+    &lt;/head&gt;
+    &lt;body&gt;
+        &lt;p&gt;
+            This tests the combined use of script hash and script nonce. It
+            passes if two console warnings are visible and the three alerts show
+            PASS.
+        &lt;/p&gt;
+        &lt;pre&gt;&lt;/pre&gt;
+    &lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestssecuritycontentSecurityPolicy11modulescriptnoncebasicblockedexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-basic-blocked-expected.txt (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-basic-blocked-expected.txt                                (rev 0)
+++ trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-basic-blocked-expected.txt        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,8 @@
</span><ins>+ALERT: PASS (1/2)
+CONSOLE MESSAGE: line 18: Refused to execute a script because its hash, its nonce, or 'unsafe-inline' does not appear in the script-src directive of the Content Security Policy.
+CONSOLE MESSAGE: line 21: Refused to execute a script because its hash, its nonce, or 'unsafe-inline' does not appear in the script-src directive of the Content Security Policy.
+CONSOLE MESSAGE: line 24: Refused to execute a script because its hash, its nonce, or 'unsafe-inline' does not appear in the script-src directive of the Content Security Policy.
+ALERT: PASS (2/2)
+This tests the effect of a valid script-nonce value. It passes if three console warnings are visible, and the two PASS alerts are executed.
+
+PASS
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestssecuritycontentSecurityPolicy11modulescriptnoncebasicblockedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-basic-blocked.html (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-basic-blocked.html                                (rev 0)
+++ trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-basic-blocked.html        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,40 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+    &lt;head&gt;
+        &lt;meta http-equiv=&quot;Content-Security-Policy&quot; content=&quot;script-src 'nonce-noncynonce'&quot;&gt;
+        &lt;script nonce=&quot;noncynonce&quot;&gt;
+            if (window.testRunner) {
+                testRunner.dumpAsText();
+                testRunner.waitUntilDone();
+            }
+
+            function done(msg) {
+                document.querySelector(&quot;pre&quot;).innerHTML = msg;
+                if (window.testRunner)
+                    testRunner.notifyDone();
+            }
+            alert('PASS (1/2)');
+        &lt;/script&gt;
+        &lt;script type=&quot;module&quot; nonce=&quot;noncynonce noncynonce&quot;&gt;
+            alert('FAIL (1/3)');
+        &lt;/script&gt;
+        &lt;script type=&quot;module&quot;&gt;
+            alert('FAIL (2/3)');
+        &lt;/script&gt;
+        &lt;script type=&quot;module&quot; nonce=&quot;noncynonceno?&quot;&gt;
+            alert('FAIL (3/3)');
+        &lt;/script&gt;
+        &lt;script type=&quot;module&quot; nonce=&quot;   noncynonce    &quot;&gt;
+            alert('PASS (2/2)');
+            done(&quot;PASS&quot;);
+        &lt;/script&gt;
+    &lt;/head&gt;
+    &lt;body&gt;
+        &lt;p&gt;
+            This tests the effect of a valid script-nonce value. It passes if
+            three console warnings are visible, and the two PASS alerts are
+            executed.
+        &lt;/p&gt;
+        &lt;pre&gt;&lt;/pre&gt;
+    &lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestssecuritycontentSecurityPolicy11modulescriptnonceblockedexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-blocked-expected.txt (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-blocked-expected.txt                                (rev 0)
+++ trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-blocked-expected.txt        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,30 @@
</span><ins>+CONSOLE MESSAGE: Refused to load http://127.0.0.1:8000/security/contentSecurityPolicy/resources/script.js because it does not appear in the script-src directive of the Content Security Policy.
+CONSOLE MESSAGE: Refused to load http://127.0.0.1:8000/security/contentSecurityPolicy/resources/script.js because it does not appear in the script-src directive of the Content Security Policy.
+Only the first two of these scripts should execute even though there are parse errors in the policy.
+
+
+
+--------
+Frame: '&lt;!--framePath //&lt;!--frame0--&gt;--&gt;'
+--------
+PASS
+
+--------
+Frame: '&lt;!--framePath //&lt;!--frame1--&gt;--&gt;'
+--------
+PASS
+
+--------
+Frame: '&lt;!--framePath //&lt;!--frame2--&gt;--&gt;'
+--------
+PASS
+
+--------
+Frame: '&lt;!--framePath //&lt;!--frame3--&gt;--&gt;'
+--------
+PASS
+
+--------
+Frame: '&lt;!--framePath //&lt;!--frame4--&gt;--&gt;'
+--------
+PASS
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestssecuritycontentSecurityPolicy11modulescriptnonceblockedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-blocked.html (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-blocked.html                                (rev 0)
+++ trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-blocked.html        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,18 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;script src='../resources/multiple-iframe-module-test.js'&gt;&lt;/script&gt;
+&lt;script&gt;
+var tests = [
+    ['yes', 'script-src 127.0.0.1:8000', 'resources/script.js', 'nonce'],
+    ['yes', 'script-src 127.0.0.1:8000 \'nonce-nonce\'', 'resources/script.js', 'nonce'],
+    ['yes', 'script-src 127.0.0.1:8000 \'nonce-base64has+and/characters\'', 'resources/script.js', 'base64has+and/characters'],
+    ['no', 'script-src \'nonce-nonce\'', 'resources/script.js', 'notnonce'],
+    ['no', 'script-src \'nonce-notnonce\'', 'resources/script.js', 'nonce'],
+];
+&lt;/script&gt;
+&lt;/head&gt;
+&lt;body onload=&quot;testExperimentalPolicy()&quot;&gt;
+  &lt;p&gt;
+    Only the first two of these scripts should execute even though there are parse errors in the policy.
+  &lt;/p&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestssecuritycontentSecurityPolicy11modulescriptnonceignoreunsafeinlineexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-ignore-unsafeinline-expected.txt (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-ignore-unsafeinline-expected.txt                                (rev 0)
+++ trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-ignore-unsafeinline-expected.txt        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,6 @@
</span><ins>+CONSOLE MESSAGE: line 17: Refused to execute a script because its hash, its nonce, or 'unsafe-inline' does not appear in the script-src directive of the Content Security Policy.
+ALERT: PASS (1/2)
+ALERT: PASS (2/2)
+This tests that a valid nonce disables inline JavaScript, even if 'unsafe-inline' is present.
+
+PASS
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestssecuritycontentSecurityPolicy11modulescriptnonceignoreunsafeinlinehtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-ignore-unsafeinline.html (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-ignore-unsafeinline.html                                (rev 0)
+++ trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-ignore-unsafeinline.html        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,34 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+    &lt;head&gt;
+        &lt;meta http-equiv=&quot;Content-Security-Policy&quot; content=&quot;script-src 'nonce-noncynonce' 'nonce-noncy+/=nonce' 'unsafe-inline'&quot;&gt;
+        &lt;script nonce=&quot;noncynonce&quot;&gt;
+        if (window.testRunner) {
+            testRunner.dumpAsText();
+            testRunner.waitUntilDone();
+        }
+
+        function done(msg) {
+            document.querySelector(&quot;pre&quot;).innerHTML = msg;
+            if (window.testRunner)
+                testRunner.notifyDone();
+        }
+        &lt;/script&gt;
+        &lt;script type=&quot;module&quot;&gt;
+            alert('FAIL (1/1)');
+        &lt;/script&gt;
+        &lt;script type=&quot;module&quot; nonce=&quot;noncynonce&quot;&gt;
+            alert('PASS (1/2)');
+        &lt;/script&gt;
+        &lt;script type=&quot;module&quot; nonce=&quot;noncy+/=nonce&quot;&gt;
+            alert('PASS (2/2)');
+            done(&quot;PASS&quot;);
+        &lt;/script&gt;
+    &lt;/head&gt;
+    &lt;body&gt;
+        &lt;p&gt;
+            This tests that a valid nonce disables inline JavaScript, even if 'unsafe-inline' is present.
+        &lt;/p&gt;
+        &lt;pre&gt;&lt;/pre&gt;
+    &lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestssecuritycontentSecurityPolicy11modulescriptnonceinenforcedpolicyandnotinreportonlyexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-in-enforced-policy-and-not-in-report-only-expected.txt (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-in-enforced-policy-and-not-in-report-only-expected.txt                                (rev 0)
+++ trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-in-enforced-policy-and-not-in-report-only-expected.txt        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,11 @@
</span><ins>+CONSOLE MESSAGE: The Content Security Policy 'script-src 'none'' was delivered in report-only mode, but does not specify a 'report-uri'; the policy will have no effect. Please either add a 'report-uri' directive, or deliver the policy via the 'Content-Security-Policy' header.
+CONSOLE MESSAGE: line 11: [Report Only] Refused to execute a script because its hash, its nonce, or 'unsafe-inline' does not appear in the script-src directive of the Content Security Policy.
+CONSOLE MESSAGE: line 11: Refused to execute a script because its hash, its nonce, or 'unsafe-inline' does not appear in the script-src directive of the Content Security Policy.
+
+
+--------
+Frame: '&lt;!--framePath //&lt;!--frame0--&gt;--&gt;'
+--------
+PASS did execute script with nonce.
+
+PASS did not execute script without nonce.
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestssecuritycontentSecurityPolicy11modulescriptnonceinenforcedpolicyandnotinreportonlyhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-in-enforced-policy-and-not-in-report-only.html (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-in-enforced-policy-and-not-in-report-only.html                                (rev 0)
+++ trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-in-enforced-policy-and-not-in-report-only.html        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,15 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;script&gt;
+if (window.testRunner) {
+    testRunner.dumpAsText();
+    testRunner.dumpChildFramesAsText();
+    testRunner.waitUntilDone();
+}
+&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;iframe src=&quot;resources/module-scriptnonce-in-enforced-policy-and-not-in-report-only.php&quot;&gt;&lt;/iframe&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestssecuritycontentSecurityPolicy11modulescriptnonceinoneenforcedpolicyneitherinanotherenforcedpolicynorreportpolicyexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-in-one-enforced-policy-neither-in-another-enforced-policy-nor-report-policy-expected.txt (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-in-one-enforced-policy-neither-in-another-enforced-policy-nor-report-policy-expected.txt                                (rev 0)
+++ trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-in-one-enforced-policy-neither-in-another-enforced-policy-nor-report-policy-expected.txt        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,7 @@
</span><ins>+CONSOLE MESSAGE: The Content Security Policy 'object-src 'none'' was delivered in report-only mode, but does not specify a 'report-uri'; the policy will have no effect. Please either add a 'report-uri' directive, or deliver the policy via the 'Content-Security-Policy' header.
+
+
+--------
+Frame: '&lt;!--framePath //&lt;!--frame0--&gt;--&gt;'
+--------
+PASS did execute script.
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestssecuritycontentSecurityPolicy11modulescriptnonceinoneenforcedpolicyneitherinanotherenforcedpolicynorreportpolicyhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-in-one-enforced-policy-neither-in-another-enforced-policy-nor-report-policy.html (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-in-one-enforced-policy-neither-in-another-enforced-policy-nor-report-policy.html                                (rev 0)
+++ trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-in-one-enforced-policy-neither-in-another-enforced-policy-nor-report-policy.html        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,15 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;script&gt;
+if (window.testRunner) {
+    testRunner.dumpAsText();
+    testRunner.dumpChildFramesAsText();
+    testRunner.waitUntilDone();
+}
+&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;iframe src=&quot;resources/module-scriptnonce-in-one-enforced-policy-neither-in-another-enforced-policy-nor-report-policy.php&quot;&gt;&lt;/iframe&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestssecuritycontentSecurityPolicy11modulescriptnonceinvalidnonceexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-invalidnonce-expected.txt (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-invalidnonce-expected.txt                                (rev 0)
+++ trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-invalidnonce-expected.txt        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,75 @@
</span><ins>+CONSOLE MESSAGE: The source list for Content Security Policy directive 'script-src' contains an invalid source: ''n'. It will be ignored.
+CONSOLE MESSAGE: Refused to load http://127.0.0.1:8000/security/contentSecurityPolicy/resources/script.js because it does not appear in the script-src directive of the Content Security Policy.
+CONSOLE MESSAGE: The source list for Content Security Policy directive 'script-src' contains an invalid source: ''nonce'. It will be ignored.
+CONSOLE MESSAGE: Refused to load http://127.0.0.1:8000/security/contentSecurityPolicy/resources/script.js because it does not appear in the script-src directive of the Content Security Policy.
+CONSOLE MESSAGE: The source list for Content Security Policy directive 'script-src' contains an invalid source: ''nonce-''. It will be ignored.
+CONSOLE MESSAGE: Refused to load http://127.0.0.1:8000/security/contentSecurityPolicy/resources/script.js because it does not appear in the script-src directive of the Content Security Policy.
+CONSOLE MESSAGE: The source list for Content Security Policy directive 'script-src' contains an invalid source: ''nonce-'. It will be ignored.
+CONSOLE MESSAGE: Refused to load http://127.0.0.1:8000/security/contentSecurityPolicy/resources/script.js because it does not appear in the script-src directive of the Content Security Policy.
+CONSOLE MESSAGE: Refused to load http://127.0.0.1:8000/security/contentSecurityPolicy/resources/script.js because it does not appear in the script-src directive of the Content Security Policy.
+CONSOLE MESSAGE: The source list for Content Security Policy directive 'script-src' contains an invalid source: ''nonce-'. It will be ignored.
+CONSOLE MESSAGE: The source list for Content Security Policy directive 'script-src' contains an invalid source: '''. It will be ignored.
+CONSOLE MESSAGE: Refused to load http://127.0.0.1:8000/security/contentSecurityPolicy/resources/script.js because it does not appear in the script-src directive of the Content Security Policy.
+CONSOLE MESSAGE: The source list for Content Security Policy directive 'script-src' contains an invalid source: ''nonce-'. It will be ignored.
+CONSOLE MESSAGE: The source list for Content Security Policy directive 'script-src' contains an invalid source: '''. It will be ignored.
+CONSOLE MESSAGE: Refused to load http://127.0.0.1:8000/security/contentSecurityPolicy/resources/script.js because it does not appear in the script-src directive of the Content Security Policy.
+CONSOLE MESSAGE: The source list for Content Security Policy directive 'script-src' contains an invalid source: ''nonce-'. It will be ignored.
+CONSOLE MESSAGE: The source list for Content Security Policy directive 'script-src' contains an invalid source: 'spaces''. It will be ignored.
+CONSOLE MESSAGE: Refused to load http://127.0.0.1:8000/security/contentSecurityPolicy/resources/script.js because it does not appear in the script-src directive of the Content Security Policy.
+CONSOLE MESSAGE: The source list for Content Security Policy directive 'script-src' contains an invalid source: ''nonce-{}''. It will be ignored.
+CONSOLE MESSAGE: Refused to load http://127.0.0.1:8000/security/contentSecurityPolicy/resources/script.js because it does not appear in the script-src directive of the Content Security Policy.
+CONSOLE MESSAGE: The source list for Content Security Policy directive 'script-src' contains an invalid source: ''nonce-/\''. It will be ignored.
+CONSOLE MESSAGE: Refused to load http://127.0.0.1:8000/security/contentSecurityPolicy/resources/script.js because it does not appear in the script-src directive of the Content Security Policy.
+None of these scripts should execute, as all the nonces are invalid.
+
+
+
+--------
+Frame: '&lt;!--framePath //&lt;!--frame0--&gt;--&gt;'
+--------
+PASS
+
+--------
+Frame: '&lt;!--framePath //&lt;!--frame1--&gt;--&gt;'
+--------
+PASS
+
+--------
+Frame: '&lt;!--framePath //&lt;!--frame2--&gt;--&gt;'
+--------
+PASS
+
+--------
+Frame: '&lt;!--framePath //&lt;!--frame3--&gt;--&gt;'
+--------
+PASS
+
+--------
+Frame: '&lt;!--framePath //&lt;!--frame4--&gt;--&gt;'
+--------
+PASS
+
+--------
+Frame: '&lt;!--framePath //&lt;!--frame5--&gt;--&gt;'
+--------
+PASS
+
+--------
+Frame: '&lt;!--framePath //&lt;!--frame6--&gt;--&gt;'
+--------
+PASS
+
+--------
+Frame: '&lt;!--framePath //&lt;!--frame7--&gt;--&gt;'
+--------
+PASS
+
+--------
+Frame: '&lt;!--framePath //&lt;!--frame8--&gt;--&gt;'
+--------
+PASS
+
+--------
+Frame: '&lt;!--framePath //&lt;!--frame9--&gt;--&gt;'
+--------
+PASS
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestssecuritycontentSecurityPolicy11modulescriptnonceinvalidnoncehtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-invalidnonce.html (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-invalidnonce.html                                (rev 0)
+++ trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-invalidnonce.html        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,23 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;script src='../resources/multiple-iframe-module-test.js'&gt;&lt;/script&gt;
+&lt;script&gt;
+var tests = [
+    ['no', 'script-src \'n', 'resources/script.js', ''],
+    ['no', 'script-src \'nonce', 'resources/script.js', ''],
+    ['no', 'script-src \'nonce-\'', 'resources/script.js', ''],
+    ['no', 'script-src \'nonce-', 'resources/script.js', ''],
+    ['no', 'script-src nonce-abcd', 'resources/script.js', ''],
+    ['no', 'script-src \'nonce- \'', 'resources/script.js', ''],
+    ['no', 'script-src \'nonce-     \'', 'resources/script.js', ''],
+    ['no', 'script-src \'nonce- nonces have no spaces\'', 'resources/script.js', ''],
+    ['no', 'script-src \'nonce-{}\'', 'resources/script.js', '{}'],
+    ['no', 'script-src \'nonce-/\\\'', 'resources/script.js', '/\\'],
+];
+&lt;/script&gt;
+&lt;/head&gt;
+&lt;body onload=&quot;testExperimentalPolicy()&quot;&gt;
+    &lt;p&gt;
+        None of these scripts should execute, as all the nonces are invalid.
+    &lt;/p&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestssecuritycontentSecurityPolicy11modulescriptnoncemultiplepoliciesexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-multiple-policies-expected.txt (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-multiple-policies-expected.txt                                (rev 0)
+++ trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-multiple-policies-expected.txt        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,6 @@
</span><ins>+CONSOLE MESSAGE: line 15: Refused to execute a script because its hash, its nonce, or 'unsafe-inline' does not appear in the script-src directive of the Content Security Policy.
+CONSOLE MESSAGE: line 15: Refused to execute a script because its hash, its nonce, or 'unsafe-inline' does not appear in the script-src directive of the Content Security Policy.
+CONSOLE MESSAGE: line 16: Refused to execute a script because its hash, its nonce, or 'unsafe-inline' does not appear in the script-src directive of the Content Security Policy.
+CONSOLE MESSAGE: line 16: Refused to execute a script because its hash, its nonce, or 'unsafe-inline' does not appear in the script-src directive of the Content Security Policy.
+ALERT: PASS
+Tests that an inline script is allowed to execute only if its nonce appears in all policies. This test PASSED if there are two console warnings and a JavaScript alert with message PASS. Otherwise, it FAILED.
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestssecuritycontentSecurityPolicy11modulescriptnoncemultiplepolicieshtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-multiple-policies.html (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-multiple-policies.html                                (rev 0)
+++ trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-multiple-policies.html        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,23 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;script&gt;
+if (window.testRunner) {
+    testRunner.dumpAsText();
+    testRunner.waitUntilDone();
+}
+&lt;/script&gt;
+&lt;meta http-equiv=&quot;Content-Security-Policy&quot; content=&quot;script-src 'nonce-A' 'nonce-C'&quot;&gt;
+&lt;meta http-equiv=&quot;Content-Security-Policy&quot; content=&quot;script-src 'nonce-B' 'nonce-C'&quot;&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;p&gt;Tests that an inline script is allowed to execute only if its nonce appears in all policies. This test PASSED if there are two console warnings and a JavaScript alert with message PASS. Otherwise, it FAILED.&lt;/p&gt;
+&lt;script type=&quot;module&quot; nonce=&quot;A&quot;&gt;alert(&quot;FAIL did execute first script&quot;)&lt;/script&gt;
+&lt;script type=&quot;module&quot; nonce=&quot;B&quot;&gt;alert(&quot;FAIL did execute second script&quot;)&lt;/script&gt;
+&lt;script type=&quot;module&quot; nonce=&quot;C&quot;&gt;
+alert(&quot;PASS&quot;);
+if (window.testRunner)
+    testRunner.notifyDone();
+&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestssecuritycontentSecurityPolicy11modulescriptnonceredirectexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-redirect-expected.txt (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-redirect-expected.txt                                (rev 0)
+++ trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-redirect-expected.txt        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,3 @@
</span><ins>+CONSOLE MESSAGE: Origin http://127.0.0.1:8000 is not allowed by Access-Control-Allow-Origin.
+CONSOLE MESSAGE: line 1: TypeError: Cross-origin script load denied by Cross-Origin Resource Sharing policy.
+This tests whether a deferred script load caused by a redirect is properly allowed by a nonce.
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestssecuritycontentSecurityPolicy11modulescriptnonceredirectsameoriginexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-redirect-same-origin-expected.txt (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-redirect-same-origin-expected.txt                                (rev 0)
+++ trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-redirect-same-origin-expected.txt        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,2 @@
</span><ins>+ALERT: PASS
+This tests whether a deferred script load caused by a redirect is properly allowed by a nonce.
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestssecuritycontentSecurityPolicy11modulescriptnonceredirectsameoriginhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-redirect-same-origin.html (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-redirect-same-origin.html                                (rev 0)
+++ trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-redirect-same-origin.html        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,20 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+    &lt;head&gt;
+        &lt;meta http-equiv=&quot;Content-Security-Policy&quot; content=&quot;script-src 'nonce-noncynonce'&quot;&gt;&lt;/meta&gt;
+    &lt;/head&gt;
+    &lt;body&gt;
+        &lt;script nonce=&quot;noncynonce&quot;&gt;
+            if (window.testRunner) {
+                testRunner.dumpAsText();
+                testRunner.waitUntilDone();
+            }
+        &lt;/script&gt;
+        This tests whether a deferred script load caused by a redirect is properly allowed by a nonce.
+        &lt;script type=&quot;module&quot; nonce='noncynonce' src='../resources/redir.php?url=http://127.0.0.1:8000/security/contentSecurityPolicy/resources/alert-pass.js'&gt;&lt;/script&gt;
+        &lt;script type=&quot;module&quot; nonce=&quot;noncynonce&quot;&gt;
+            if (window.testRunner)
+                testRunner.notifyDone();
+        &lt;/script&gt;
+    &lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestssecuritycontentSecurityPolicy11modulescriptnonceredirecthtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-redirect.html (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-redirect.html                                (rev 0)
+++ trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/module-scriptnonce-redirect.html        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,20 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+    &lt;head&gt;
+        &lt;meta http-equiv=&quot;Content-Security-Policy&quot; content=&quot;script-src 'nonce-noncynonce'&quot;&gt;&lt;/meta&gt;
+    &lt;/head&gt;
+    &lt;body&gt;
+        &lt;script nonce=&quot;noncynonce&quot;&gt;
+            if (window.testRunner) {
+                testRunner.dumpAsText();
+                testRunner.waitUntilDone();
+            }
+        &lt;/script&gt;
+        This tests whether a deferred script load caused by a redirect is properly allowed by a nonce.
+        &lt;script type=&quot;module&quot; nonce='noncynonce' src='../resources/redir.php?url=http://localhost:8000/security/contentSecurityPolicy/resources/alert-pass.js'&gt;&lt;/script&gt;
+        &lt;script type=&quot;module&quot; nonce=&quot;noncynonce&quot;&gt;
+            if (window.testRunner)
+                testRunner.notifyDone();
+        &lt;/script&gt;
+    &lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestssecuritycontentSecurityPolicy11resourcesmodulescriptnonceinenforcedpolicyandnotinreportonlyphp"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/resources/module-scriptnonce-in-enforced-policy-and-not-in-report-only.php (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/resources/module-scriptnonce-in-enforced-policy-and-not-in-report-only.php                                (rev 0)
+++ trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/resources/module-scriptnonce-in-enforced-policy-and-not-in-report-only.php        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,19 @@
</span><ins>+&lt;?
+    header(&quot;Content-Security-Policy: script-src 'nonce-test'&quot;);
+    header(&quot;Content-Security-Policy-Report-Only: script-src 'none'&quot;);
+?&gt;
+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;body&gt;
+&lt;p id=&quot;script-with-nonce-result&quot;&gt;FAIL did not execute script with nonce.&lt;/p&gt;
+&lt;p id=&quot;script-without-nonce-result&quot;&gt;PASS did not execute script without nonce.&lt;/p&gt;
+&lt;script type=&quot;module&quot; nonce=&quot;test&quot;&gt;
+document.getElementById(&quot;script-with-nonce-result&quot;).textContent = &quot;PASS did execute script with nonce.&quot;;
+if (window.testRunner)
+    testRunner.notifyDone();
+&lt;/script&gt;
+&lt;script type=&quot;module&quot; &gt;
+document.getElementById(&quot;script-without-nonce-result&quot;).textContent = &quot;FAIL did execute script without nonce.&quot;;
+&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">Property changes on: trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/resources/module-scriptnonce-in-enforced-policy-and-not-in-report-only.php
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="svnexecutable"></a>
<div class="addfile"><h4>Added: svn:executable</h4></div>
<ins>+*
</ins><span class="cx">\ No newline at end of property
</span><a id="trunkLayoutTestshttptestssecuritycontentSecurityPolicy11resourcesmodulescriptnonceinoneenforcedpolicyneitherinanotherenforcedpolicynorreportpolicyphp"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/resources/module-scriptnonce-in-one-enforced-policy-neither-in-another-enforced-policy-nor-report-policy.php (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/resources/module-scriptnonce-in-one-enforced-policy-neither-in-another-enforced-policy-nor-report-policy.php                                (rev 0)
+++ trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/resources/module-scriptnonce-in-one-enforced-policy-neither-in-another-enforced-policy-nor-report-policy.php        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,15 @@
</span><ins>+&lt;?php
+    header(&quot;Content-Security-Policy-Report-Only: object-src 'none'&quot;); // Arbitrary non-{script, img}-src directive
+    header(&quot;Content-Security-Policy: script-src 'nonce-test', img-src 'none'&quot;); // Two policies; second policy has arbitrary non-script-src directive
+?&gt;
+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;body&gt;
+&lt;p id=&quot;result&quot;&gt;FAIL did not execute script.&lt;/p&gt;
+&lt;script type=&quot;module&quot; nonce=&quot;test&quot;&gt;
+document.getElementById(&quot;result&quot;).textContent = &quot;PASS did execute script.&quot;;
+if (window.testRunner)
+    testRunner.notifyDone();
+&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">Property changes on: trunk/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/resources/module-scriptnonce-in-one-enforced-policy-neither-in-another-enforced-policy-nor-report-policy.php
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="svnexecutable"></a>
<div class="addfile"><h4>Added: svn:executable</h4></div>
<ins>+*
</ins><span class="cx">\ No newline at end of property
</span><a id="trunkLayoutTestshttptestssecuritycontentSecurityPolicymoduleevalblockedexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/security/contentSecurityPolicy/module-eval-blocked-expected.txt (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/security/contentSecurityPolicy/module-eval-blocked-expected.txt                                (rev 0)
+++ trunk/LayoutTests/http/tests/security/contentSecurityPolicy/module-eval-blocked-expected.txt        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,37 @@
</span><ins>+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: &quot;script-src 'unsafe-inline'&quot;.
+
+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: &quot;script-src 'unsafe-inline'&quot;.
+
+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: &quot;script-src 'unsafe-inline'&quot;.
+
+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: &quot;script-src 'unsafe-inline'&quot;.
+
+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: &quot;script-src 'unsafe-inline'&quot;.
+
+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: &quot;script-src 'unsafe-inline'&quot;.
+
+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: &quot;script-src 'unsafe-inline'&quot;.
+
+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: &quot;script-src 'unsafe-inline'&quot;.
+
+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: &quot;script-src 'unsafe-inline'&quot;.
+
+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: &quot;script-src 'unsafe-inline'&quot;.
+
+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: &quot;script-src 'unsafe-inline'&quot;.
+
+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: &quot;script-src 'unsafe-inline'&quot;.
+
+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: &quot;script-src 'unsafe-inline'&quot;.
+
+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: &quot;script-src 'unsafe-inline'&quot;.
+
+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: &quot;script-src 'unsafe-inline'&quot;.
+
+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: &quot;script-src 'unsafe-inline'&quot;.
+
+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: &quot;script-src 'unsafe-inline'&quot;.
+
+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: &quot;script-src 'unsafe-inline'&quot;.
+
+
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestssecuritycontentSecurityPolicymoduleevalblockedinexternalscriptexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/security/contentSecurityPolicy/module-eval-blocked-in-external-script-expected.txt (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/security/contentSecurityPolicy/module-eval-blocked-in-external-script-expected.txt                                (rev 0)
+++ trunk/LayoutTests/http/tests/security/contentSecurityPolicy/module-eval-blocked-in-external-script-expected.txt        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,3 @@
</span><ins>+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: &quot;script-src 'self' 'unsafe-inline'&quot;.
+
+
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestssecuritycontentSecurityPolicymoduleevalblockedinexternalscripthtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/security/contentSecurityPolicy/module-eval-blocked-in-external-script.html (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/security/contentSecurityPolicy/module-eval-blocked-in-external-script.html                                (rev 0)
+++ trunk/LayoutTests/http/tests/security/contentSecurityPolicy/module-eval-blocked-in-external-script.html        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,17 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;meta http-equiv=&quot;Content-Security-Policy&quot; content=&quot;script-src 'self' 'unsafe-inline'&quot;&gt;
+&lt;script&gt;
+if (window.testRunner) {
+    testRunner.dumpAsText();
+    testRunner.waitUntilDone();
+}
+&lt;/script&gt;
+&lt;script type=&quot;module&quot;src=&quot;resources/eval-blocked-in-external-script.js&quot;&gt;&lt;/script&gt;
+&lt;script type=&quot;module&quot;&gt;
+if (window.testRunner)
+    testRunner.notifyDone();
+&lt;/script&gt;
+&lt;/head&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestssecuritycontentSecurityPolicymoduleevalblockedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/security/contentSecurityPolicy/module-eval-blocked.html (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/security/contentSecurityPolicy/module-eval-blocked.html                                (rev 0)
+++ trunk/LayoutTests/http/tests/security/contentSecurityPolicy/module-eval-blocked.html        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,55 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;meta http-equiv=&quot;Content-Security-Policy&quot; content=&quot;script-src 'unsafe-inline'&quot;&gt;
+&lt;script&gt;
+if (window.testRunner) {
+    testRunner.dumpAsText();
+    testRunner.waitUntilDone();
+}
+
+var dummy = 79;
+&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;!-- eval() string literal &quot;alert()&quot; --&gt;
+&lt;script type=&quot;module&quot;&gt;eval(&quot;alert('FAIL')&quot;)&lt;/script&gt;
+&lt;script type=&quot;module&quot;&gt;window.eval(&quot;alert('FAIL')&quot;)&lt;/script&gt;
+&lt;!-- eval() non-string literal (should be allowed) --&gt;
+&lt;script type=&quot;module&quot;&gt;eval(0)&lt;/script&gt;
+&lt;script type=&quot;module&quot;&gt;window.eval(0)&lt;/script&gt;
+&lt;script type=&quot;module&quot;&gt;eval(1)&lt;/script&gt;
+&lt;script type=&quot;module&quot;&gt;window.eval(1)&lt;/script&gt;
+&lt;script type=&quot;module&quot;&gt;eval(7)&lt;/script&gt;
+&lt;script type=&quot;module&quot;&gt;window.eval(7)&lt;/script&gt;
+&lt;script type=&quot;module&quot;&gt;eval(3.14)&lt;/script&gt;
+&lt;script type=&quot;module&quot;&gt;window.eval(3.14)&lt;/script&gt;
+&lt;script type=&quot;module&quot;&gt;eval(true)&lt;/script&gt;
+&lt;script type=&quot;module&quot;&gt;window.eval(true)&lt;/script&gt;
+&lt;script type=&quot;module&quot;&gt;eval(false)&lt;/script&gt;
+&lt;script type=&quot;module&quot;&gt;window.eval(false)&lt;/script&gt;
+&lt;script type=&quot;module&quot;&gt;eval(Function)&lt;/script&gt;
+&lt;script type=&quot;module&quot;&gt;window.eval(Function)&lt;/script&gt;
+&lt;!-- eval() string literal --&gt;
+&lt;script type=&quot;module&quot;&gt;eval(&quot;&quot;)&lt;/script&gt;
+&lt;script type=&quot;module&quot;&gt;window.eval(&quot;&quot;)&lt;/script&gt;
+&lt;script type=&quot;module&quot;&gt;eval(&quot;0&quot;)&lt;/script&gt;
+&lt;script type=&quot;module&quot;&gt;window.eval(&quot;0&quot;)&lt;/script&gt;
+&lt;script type=&quot;module&quot;&gt;eval(&quot;1&quot;)&lt;/script&gt;
+&lt;script type=&quot;module&quot;&gt;window.eval(&quot;1&quot;)&lt;/script&gt;
+&lt;script type=&quot;module&quot;&gt;eval(&quot;2.73&quot;)&lt;/script&gt;
+&lt;script type=&quot;module&quot;&gt;window.eval(&quot;2.73&quot;)&lt;/script&gt;
+&lt;script type=&quot;module&quot;&gt;eval(&quot;true&quot;)&lt;/script&gt;
+&lt;script type=&quot;module&quot;&gt;window.eval(&quot;true&quot;)&lt;/script&gt;
+&lt;script type=&quot;module&quot;&gt;eval(&quot;false&quot;)&lt;/script&gt;
+&lt;script type=&quot;module&quot;&gt;window.eval(&quot;false&quot;)&lt;/script&gt;
+&lt;script type=&quot;module&quot;&gt;eval(&quot;Object&quot;)&lt;/script&gt;
+&lt;script type=&quot;module&quot;&gt;window.eval(&quot;Object&quot;)&lt;/script&gt;
+&lt;script type=&quot;module&quot;&gt;eval(&quot;dummy&quot;)&lt;/script&gt;
+&lt;script type=&quot;module&quot;&gt;window.eval(&quot;dummy&quot;)&lt;/script&gt;
+&lt;script type=&quot;module&quot;&gt;
+if (window.testRunner)
+    testRunner.notifyDone();
+&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestssecuritycontentSecurityPolicyresourcesechomodulescriptsrcpl"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/security/contentSecurityPolicy/resources/echo-module-script-src.pl (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/security/contentSecurityPolicy/resources/echo-module-script-src.pl                                (rev 0)
+++ trunk/LayoutTests/http/tests/security/contentSecurityPolicy/resources/echo-module-script-src.pl        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,32 @@
</span><ins>+#!/usr/bin/perl -wT
+use strict;
+use CGI;
+
+my $cgi = new CGI;
+
+print &quot;Content-Type: text/html; charset=UTF-8\n&quot;;
+my $experimental = $cgi-&gt;param('experimental') || &quot;&quot;;
+if ($experimental eq 'true') {
+    print &quot;X-WebKit-CSP: &quot; . $cgi-&gt;param('csp') . &quot;\n\n&quot;;
+} else {
+    print &quot;Content-Security-Policy: &quot; . $cgi-&gt;param('csp') . &quot;\n\n&quot;;
+}
+
+my ($text, $replacement) = (&quot;FAIL&quot;, &quot;PASS&quot;);
+($text, $replacement) = ($replacement, $text) if $cgi-&gt;param('should_run') eq 'no';
+
+my $nonce = $cgi-&gt;param('nonce') || &quot;&quot;;
+if ($nonce ne &quot;&quot;) {
+    $nonce = &quot;nonce='&quot; . $nonce . &quot;'&quot;;
+}
+
+
+print &quot;&lt;!DOCTYPE html&gt;\n&quot;;
+print &quot;&lt;html&gt;\n&quot;;
+print &quot;&lt;body&gt;\n&quot;;
+print &quot;&lt;div id=\&quot;result\&quot; text=\&quot;$replacement\&quot;&gt;\n&quot;;
+print &quot;$text\n&quot;;
+print &quot;&lt;/div&gt;\n&quot;;
+print &quot;&lt;script $nonce type=\&quot;module\&quot; src=\&quot;&quot; . $cgi-&gt;param('q') . &quot;\&quot;&gt;&lt;/script&gt;\n&quot;;
+print &quot;&lt;/body&gt;\n&quot;;
+print &quot;&lt;/html&gt;\n&quot;;
</ins><span class="cx">Property changes on: trunk/LayoutTests/http/tests/security/contentSecurityPolicy/resources/echo-module-script-src.pl
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="svnexecutable"></a>
<div class="addfile"><h4>Added: svn:executable</h4></div>
<ins>+*
</ins><span class="cx">\ No newline at end of property
</span><a id="trunkLayoutTestshttptestssecuritycontentSecurityPolicyresourcesmultipleiframemoduletestjs"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/security/contentSecurityPolicy/resources/multiple-iframe-module-test.js (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/security/contentSecurityPolicy/resources/multiple-iframe-module-test.js                                (rev 0)
+++ trunk/LayoutTests/http/tests/security/contentSecurityPolicy/resources/multiple-iframe-module-test.js        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,55 @@
</span><ins>+if (window.testRunner) {
+    testRunner.waitUntilDone();
+    testRunner.dumpAsText();
+    testRunner.dumpChildFramesAsText();
+}
+
+function testPreescapedPolicy() {
+    testImpl(false, true);
+}
+
+function testExperimentalPolicy() {
+    testImpl(true, false);
+}
+
+function test() {
+    testImpl(false, false);
+}
+
+function testImpl(experimental, preescapedPolicy) {
+    if (tests.length === 0)
+        return finishTesting();
+
+    var baseURL = &quot;/security/contentSecurityPolicy/&quot;;
+    var current = tests.shift();
+    var iframe = document.createElement(&quot;iframe&quot;);
+
+    var queries = {
+        should_run: encodeURIComponent(current[0])
+    };
+
+    var policy = current[1];
+    if (!preescapedPolicy)
+        policy = encodeURIComponent(policy);
+    queries[&quot;csp&quot;] = policy;
+
+    var scriptToLoad = baseURL + encodeURIComponent(current[2]);
+    if (current[2].match(/^data:/) || current[2].match(/^https?:/))
+        scriptToLoad = encodeURIComponent(current[2]);
+    queries[&quot;q&quot;] = scriptToLoad;
+    queries[&quot;experimental&quot;] = experimental ? &quot;true&quot; : &quot;false&quot;;
+    if (current[3] !== undefined)
+        queries[&quot;nonce&quot;] = encodeURIComponent(current[3]);
+
+    iframe.src = `${baseURL}resources/echo-module-script-src.pl?` + Object.getOwnPropertyNames(queries).map((key) =&gt; key + '=' + queries[key]).join('&amp;');
+
+    iframe.onload = function() { testImpl(experimental, preescapedPolicy); };
+    document.body.appendChild(iframe);
+}
+
+function finishTesting() {
+    if (window.testRunner) {
+        setTimeout(&quot;testRunner.notifyDone()&quot;, 0);
+    }
+    return true;
+}
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestssecuritymodulecorrectmimetypesexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/security/module-correct-mime-types-expected.txt (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/security/module-correct-mime-types-expected.txt                                (rev 0)
+++ trunk/LayoutTests/http/tests/security/module-correct-mime-types-expected.txt        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,27 @@
</span><ins>+CONSOLE MESSAGE: line 1: Executed script with MIME type: 'application/ecmascript'.
+CONSOLE MESSAGE: line 1: Executed script with MIME type: 'application/javascript'.
+CONSOLE MESSAGE: line 1: Executed script with MIME type: 'application/x-ecmascript'.
+CONSOLE MESSAGE: line 1: Executed script with MIME type: 'application/x-javascript'.
+CONSOLE MESSAGE: line 1: Executed script with MIME type: 'text/ecmascript'.
+CONSOLE MESSAGE: line 1: Executed script with MIME type: 'text/javascript'.
+CONSOLE MESSAGE: line 1: Executed script with MIME type: 'text/javascript1.0'.
+CONSOLE MESSAGE: line 1: Executed script with MIME type: 'text/javascript1.1'.
+CONSOLE MESSAGE: line 1: Executed script with MIME type: 'text/javascript1.2'.
+CONSOLE MESSAGE: line 1: Executed script with MIME type: 'text/javascript1.3'.
+CONSOLE MESSAGE: line 1: Executed script with MIME type: 'text/javascript1.4'.
+CONSOLE MESSAGE: line 1: Executed script with MIME type: 'text/javascript1.5'.
+CONSOLE MESSAGE: line 1: Executed script with MIME type: 'text/jscript'.
+CONSOLE MESSAGE: line 1: Executed script with MIME type: 'text/livescript'.
+CONSOLE MESSAGE: line 1: Executed script with MIME type: 'text/x-ecmascript'.
+CONSOLE MESSAGE: line 1: Executed script with MIME type: 'text/x-javascript'.
+Test module scripts run with correct mime types.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+Module is not executed yet.
+Module scripts run with correct mime types.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestssecuritymodulecorrectmimetypeshtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/security/module-correct-mime-types.html (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/security/module-correct-mime-types.html                                (rev 0)
+++ trunk/LayoutTests/http/tests/security/module-correct-mime-types.html        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,58 @@
</span><ins>+&lt;!DOCTYPE HTML&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;script src=&quot;../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;script&gt;
+description('Test module scripts run with correct mime types.');
+
+// Module will be executed asynchronously.
+window.jsTestIsAsync = true;
+&lt;/script&gt;
+&lt;script&gt;
+let unscriptyMimeTypes = [
+    'application/ecmascript',
+    'application/javascript',
+    'application/x-ecmascript',
+    'application/x-javascript',
+    'text/ecmascript',
+    'text/javascript',
+    'text/javascript1.0',
+    'text/javascript1.1',
+    'text/javascript1.2',
+    'text/javascript1.3',
+    'text/javascript1.4',
+    'text/javascript1.5',
+    'text/jscript',
+    'text/livescript',
+    'text/x-ecmascript',
+    'text/x-javascript',
+];
+
+debug('Module is not executed yet.');
+
+let current = Promise.resolve();
+for (let mimeType of unscriptyMimeTypes) {
+    current = current.then(() =&gt; {
+        return new Promise((resolve, reject) =&gt; {
+            let script = document.createElement('script');
+            script.addEventListener('load', (ev) =&gt; resolve(ev), false);
+            script.type = 'module'
+            script.src = `./contentTypeOptions/resources/script-with-header.pl?mime=${mimeType}`;
+            document.body.appendChild(script);
+        });
+    });
+}
+
+current.then(done);
+
+function done()
+{
+    debug('Module scripts run with correct mime types.');
+    finishJSTest();
+}
+&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="trunkLayoutTestshttptestssecuritymodulecrossoriginerroreventinformationexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/security/module-crossorigin-error-event-information-expected.txt (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/security/module-crossorigin-error-event-information-expected.txt                                (rev 0)
+++ trunk/LayoutTests/http/tests/security/module-crossorigin-error-event-information-expected.txt        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,15 @@
</span><ins>+CONSOLE MESSAGE: line 1: SomeError
+The test passes if error event gets unsanitized information about the module script error.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+PASS event.message.match(/SomeError/)[0] is &quot;SomeError&quot;
+PASS event.filename is &quot;http://localhost:8000/security/resources/cors-script.php?fail=true&quot;
+PASS event.lineno is 1
+PASS event.colno is 52
+PASS event.error.toString() is &quot;SomeError&quot;
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestssecuritymodulecrossoriginerroreventinformationhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/security/module-crossorigin-error-event-information.html (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/security/module-crossorigin-error-event-information.html                                (rev 0)
+++ trunk/LayoutTests/http/tests/security/module-crossorigin-error-event-information.html        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,22 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;head&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;script src=&quot;../../js-test-resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;script&gt;
+window.jsTestIsAsync = true;
+description(&quot;The test passes if error event gets unsanitized information about the module script error.&quot;);
+
+window.addEventListener('error', function() {
+    shouldBeEqualToString(&quot;event.message.match(/SomeError/)[0]&quot;, &quot;SomeError&quot;);
+    shouldBeEqualToString(&quot;event.filename&quot;, &quot;http://localhost:8000/security/resources/cors-script.php?fail=true&quot;);
+    shouldBe(&quot;event.lineno&quot;, &quot;1&quot;);
+    shouldBe(&quot;event.colno&quot;, &quot;52&quot;);
+    shouldBeEqualToString(&quot;event.error.toString()&quot;, &quot;SomeError&quot;);
+    finishJSTest();
+});
+
+successfullyParsed = true;
+&lt;/script&gt;
+&lt;script type=&quot;module&quot; crossorigin=&quot;anonymous&quot; src=&quot;http://localhost:8000/security/resources/cors-script.php?fail=true&quot;&gt;&lt;/script&gt;
+&lt;script src=&quot;../../js-test-resources/js-test-post.js&quot;&gt;&lt;/script&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestssecuritymodulecrossoriginloadscorrectlycredentialsexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/security/module-crossorigin-loads-correctly-credentials-expected.txt (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/security/module-crossorigin-loads-correctly-credentials-expected.txt                                (rev 0)
+++ trunk/LayoutTests/http/tests/security/module-crossorigin-loads-correctly-credentials-expected.txt        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,4 @@
</span><ins>+ALERT: script ran.
+This test passes if the module script loads correctly.
+
+PASS
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestssecuritymodulecrossoriginloadscorrectlycredentialshtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/security/module-crossorigin-loads-correctly-credentials.html (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/security/module-crossorigin-loads-correctly-credentials.html                                (rev 0)
+++ trunk/LayoutTests/http/tests/security/module-crossorigin-loads-correctly-credentials.html        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,23 @@
</span><ins>+&lt;body&gt;
+&lt;p&gt;This test passes if the module script loads correctly.&lt;/p&gt;
+&lt;pre&gt;&lt;/pre&gt;
+&lt;script&gt;
+if (window.testRunner) {
+    testRunner.dumpAsText();
+    testRunner.waitUntilDone();
+}
+
+function done(msg) {
+    document.querySelector(&quot;pre&quot;).innerHTML = msg;
+    if (window.testRunner)
+        testRunner.notifyDone();
+}
+
+var script = document.createElement(&quot;script&quot;);
+script.type = &quot;module&quot;;
+script.crossOrigin = &quot;use-credentials&quot;;
+script.src = &quot;http://localhost:8000/security/resources/cors-script.php?credentials=true&quot;;
+script.onload = function() { done(&quot;PASS&quot;); }
+script.onerror = function() { done(&quot;FAIL&quot;);}
+document.body.appendChild(script);
+&lt;/script&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestssecuritymodulecrossoriginloadsomitexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/security/module-crossorigin-loads-omit-expected.txt (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/security/module-crossorigin-loads-omit-expected.txt                                (rev 0)
+++ trunk/LayoutTests/http/tests/security/module-crossorigin-loads-omit-expected.txt        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,4 @@
</span><ins>+ALERT: script ran.
+This test passes if the module script loads correctly.
+
+PASS
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestssecuritymodulecrossoriginloadsomithtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/security/module-crossorigin-loads-omit.html (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/security/module-crossorigin-loads-omit.html                                (rev 0)
+++ trunk/LayoutTests/http/tests/security/module-crossorigin-loads-omit.html        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,22 @@
</span><ins>+&lt;body&gt;
+&lt;p&gt;This test passes if the module script loads correctly.&lt;/p&gt;
+&lt;pre&gt;&lt;/pre&gt;
+&lt;script&gt;
+if (window.testRunner) {
+    testRunner.dumpAsText();
+    testRunner.waitUntilDone();
+}
+
+function done(msg) {
+    document.querySelector(&quot;pre&quot;).innerHTML = msg;
+    if (window.testRunner)
+        testRunner.notifyDone();
+}
+
+var script = document.createElement(&quot;script&quot;);
+script.type = &quot;module&quot;;
+script.src = &quot;http://localhost:8000/security/resources/cors-script.php?credentials=false&quot;;
+script.onload = function() { done(&quot;PASS&quot;); }
+script.onerror = function() { done(&quot;FAIL&quot;);}
+document.body.appendChild(script);
+&lt;/script&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestssecuritymodulecrossoriginloadssameoriginexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/security/module-crossorigin-loads-same-origin-expected.txt (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/security/module-crossorigin-loads-same-origin-expected.txt                                (rev 0)
+++ trunk/LayoutTests/http/tests/security/module-crossorigin-loads-same-origin-expected.txt        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,3 @@
</span><ins>+Test that a module script element with a crossorigin attribute loads same-origin scripts correctly when there's no access control headers in the response.
+
+PASS
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestssecuritymodulecrossoriginloadssameoriginhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/security/module-crossorigin-loads-same-origin.html (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/security/module-crossorigin-loads-same-origin.html                                (rev 0)
+++ trunk/LayoutTests/http/tests/security/module-crossorigin-loads-same-origin.html        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,17 @@
</span><ins>+&lt;p&gt;Test that a module script element with a crossorigin attribute loads same-origin scripts correctly when there's no access control headers in the response.&lt;/p&gt;
+&lt;pre&gt;FAIL&lt;/pre&gt;
+&lt;script&gt;
+if (window.testRunner) {
+    testRunner.dumpAsText();
+    testRunner.waitUntilDone();
+}
+&lt;/script&gt;
+&lt;!-- This script should load --&gt;
+&lt;script type=&quot;module&quot; crossorigin=&quot;anonymous&quot; src=&quot;resources/module-local-script.js&quot;&gt;&lt;/script&gt;
+&lt;script type=&quot;module&quot;&gt;
+if (window.secretness === 13) {
+    document.querySelector(&quot;pre&quot;).innerHTML = &quot;PASS&quot;;
+}
+if (window.testRunner)
+    testRunner.notifyDone();
+&lt;/script&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestssecuritymodulecrossoriginonerrorinformationexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/security/module-crossorigin-onerror-information-expected.txt (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/security/module-crossorigin-onerror-information-expected.txt                                (rev 0)
+++ trunk/LayoutTests/http/tests/security/module-crossorigin-onerror-information-expected.txt        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,15 @@
</span><ins>+CONSOLE MESSAGE: line 1: SomeError
+The test passes if window.onerror gets unsanitized information about the module script error.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+PASS msg.match(/SomeError/)[0] is &quot;SomeError&quot;
+PASS url is &quot;http://localhost:8000/security/resources/cors-script.php?fail=true&quot;
+PASS line is 1
+PASS column is 52
+PASS error.toString() is &quot;SomeError&quot;
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestssecuritymodulecrossoriginonerrorinformationhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/security/module-crossorigin-onerror-information.html (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/security/module-crossorigin-onerror-information.html                                (rev 0)
+++ trunk/LayoutTests/http/tests/security/module-crossorigin-onerror-information.html        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,25 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;head&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;script src=&quot;../../js-test-resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;script&gt;
+window.jsTestIsAsync = true;
+description(&quot;The test passes if window.onerror gets unsanitized information about the module script error.&quot;);
+
+window.onerror = function(msg, url, line, column, error) {
+    window.msg = msg;
+    window.url = url;
+    window.line = line;
+    window.column = column;
+    window.error = error;
+    shouldBeEqualToString(&quot;msg.match(/SomeError/)[0]&quot;, &quot;SomeError&quot;);
+    shouldBeEqualToString(&quot;url&quot;, &quot;http://localhost:8000/security/resources/cors-script.php?fail=true&quot;);
+    shouldBe(&quot;line&quot;, &quot;1&quot;);
+    shouldBe(&quot;column&quot;, &quot;52&quot;);
+    shouldBeEqualToString(&quot;error.toString()&quot;, &quot;SomeError&quot;);
+    finishJSTest();
+}
+&lt;/script&gt;
+&lt;script type=&quot;module&quot; crossorigin=&quot;    anonymous &quot; src=&quot;http://localhost:8000/security/resources/cors-script.php?fail=true&quot;&gt;&lt;/script&gt;
+&lt;script src=&quot;../../js-test-resources/js-test-post.js&quot;&gt;&lt;/script&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestssecuritymoduleincorrectmimetypesexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/security/module-incorrect-mime-types-expected.txt (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/security/module-incorrect-mime-types-expected.txt                                (rev 0)
+++ trunk/LayoutTests/http/tests/security/module-incorrect-mime-types-expected.txt        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,20 @@
</span><ins>+CONSOLE MESSAGE: TypeError: 'application/json' is not a valid JavaScript MIME type.
+CONSOLE MESSAGE: TypeError: 'application/octet-stream' is not a valid JavaScript MIME type.
+CONSOLE MESSAGE: TypeError: 'application/xml' is not a valid JavaScript MIME type.
+CONSOLE MESSAGE: TypeError: 'image/png' is not a valid JavaScript MIME type.
+CONSOLE MESSAGE: TypeError: 'text/html' is not a valid JavaScript MIME type.
+CONSOLE MESSAGE: TypeError: 'text/plain' is not a valid JavaScript MIME type.
+CONSOLE MESSAGE: TypeError: 'text/vbs' is not a valid JavaScript MIME type.
+CONSOLE MESSAGE: TypeError: 'text/vbscript' is not a valid JavaScript MIME type.
+CONSOLE MESSAGE: TypeError: 'text/xml' is not a valid JavaScript MIME type.
+Test module rejects scripts with incorrect mime types.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+Module is not executed yet.
+Module rejects scripts with incorrect mime types.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestssecuritymoduleincorrectmimetypeshtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/security/module-incorrect-mime-types.html (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/security/module-incorrect-mime-types.html                                (rev 0)
+++ trunk/LayoutTests/http/tests/security/module-incorrect-mime-types.html        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,51 @@
</span><ins>+&lt;!DOCTYPE HTML&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;script src=&quot;../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;script&gt;
+description('Test module rejects scripts with incorrect mime types.');
+
+// Module will be executed asynchronously.
+window.jsTestIsAsync = true;
+&lt;/script&gt;
+&lt;script&gt;
+let unscriptyMimeTypes = [
+    'application/json',
+    'application/octet-stream',
+    'application/xml',
+    'image/png',
+    'text/html',
+    'text/plain',
+    'text/vbs',
+    'text/vbscript',
+    'text/xml',
+];
+
+debug('Module is not executed yet.');
+
+let current = Promise.resolve();
+for (let mimeType of unscriptyMimeTypes) {
+    current = current.then(() =&gt; {
+        return new Promise((resolve, reject) =&gt; {
+            let script = document.createElement('script');
+            script.addEventListener('error', (ev) =&gt; resolve(ev), false);
+            script.type = 'module'
+            script.src = `./contentTypeOptions/resources/script-with-header.pl?mime=${mimeType}`;
+            document.body.appendChild(script);
+        });
+    });
+}
+
+current.then(done);
+
+function done()
+{
+    debug('Module rejects scripts with incorrect mime types.');
+    finishJSTest();
+}
+&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="trunkLayoutTestshttptestssecuritymodulenomimetypeexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/security/module-no-mime-type-expected.txt (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/security/module-no-mime-type-expected.txt                                (rev 0)
+++ trunk/LayoutTests/http/tests/security/module-no-mime-type-expected.txt        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,13 @@
</span><ins>+CONSOLE MESSAGE: line 1: TypeError: 'application/octet-stream' is not a valid JavaScript MIME type.
+Test module rejects scripts with no mime type.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+Module is not executed yet.
+Module rejects a script with no mime type.
+PASS window.scriptsSuccessfullyLoaded is 0
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestssecuritymodulenomimetypehtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/security/module-no-mime-type.html (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/security/module-no-mime-type.html                                (rev 0)
+++ trunk/LayoutTests/http/tests/security/module-no-mime-type.html        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,28 @@
</span><ins>+&lt;!DOCTYPE HTML&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;script src=&quot;../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;script&gt;
+description('Test module rejects scripts with no mime type.');
+
+// Module will be executed asynchronously.
+window.jsTestIsAsync = true;
+&lt;/script&gt;
+&lt;script&gt;
+debug('Module is not executed yet.');
+function done()
+{
+    debug('Module rejects a script with no mime type.');
+}
+window.scriptsSuccessfullyLoaded = 0;
+&lt;/script&gt;
+&lt;script src=&quot;../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;script type=&quot;module&quot; src=&quot;./contentTypeOptions/resources/script-with-header.pl&quot; onerror=&quot;done()&quot;&gt;&lt;/script&gt;
+&lt;script type=&quot;module&quot;&gt;
+shouldBe(`window.scriptsSuccessfullyLoaded`, `0`);
+finishJSTest();
+&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestssecurityresourcescorsscriptphp"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/http/tests/security/resources/cors-script.php (208787 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/security/resources/cors-script.php        2016-11-16 09:08:23 UTC (rev 208787)
+++ trunk/LayoutTests/http/tests/security/resources/cors-script.php        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -2,8 +2,12 @@
</span><span class="cx"> header(&quot;Access-Control-Allow-Origin: http://127.0.0.1:8000&quot;);
</span><span class="cx"> header(&quot;Content-Type: application/javascript&quot;);
</span><span class="cx"> 
</span><del>-if (strtolower($_GET[&quot;credentials&quot;]) == &quot;true&quot;) {
-    header(&quot;Access-Control-Allow-Credentials: true&quot;);
</del><ins>+if (isset($_GET[&quot;credentials&quot;])) {
+    if (strtolower($_GET[&quot;credentials&quot;]) == &quot;true&quot;) {
+        header(&quot;Access-Control-Allow-Credentials: true&quot;);
+    } else {
+        header(&quot;Access-Control-Allow-Credentials: false&quot;);
+    }
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> if (strtolower($_GET[&quot;fail&quot;]) == &quot;true&quot;)
</span><span class="cx">Property changes on: trunk/LayoutTests/http/tests/security/resources/cors-script.php
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="svnexecutable"></a>
<div class="addfile"><h4>Added: svn:executable</h4></div>
<ins>+*
</ins><span class="cx">\ No newline at end of property
</span><a id="trunkLayoutTestshttptestssecurityresourcesmodulelocalscriptjs"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/security/resources/module-local-script.js (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/security/resources/module-local-script.js                                (rev 0)
+++ trunk/LayoutTests/http/tests/security/resources/module-local-script.js        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+window.secretness = 13;
</ins></span></pre></div>
<a id="trunkLayoutTestsjsdommodulesmoduleanddomcontentloadedexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/dom/modules/module-and-dom-content-loaded-expected.txt (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/dom/modules/module-and-dom-content-loaded-expected.txt                                (rev 0)
+++ trunk/LayoutTests/js/dom/modules/module-and-dom-content-loaded-expected.txt        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,13 @@
</span><ins>+Test window DOMContentLoaded event is fired after module is executed.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+Module is not executed yet.
+PASS document.readyState is &quot;loading&quot;
+PASS document.readyState is &quot;interactive&quot;
+PASS domContentLoadedIsExecuted is false
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsjsdommodulesmoduleanddomcontentloadedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/dom/modules/module-and-dom-content-loaded.html (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/dom/modules/module-and-dom-content-loaded.html                                (rev 0)
+++ trunk/LayoutTests/js/dom/modules/module-and-dom-content-loaded.html        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,30 @@
</span><ins>+&lt;!DOCTYPE HTML&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;script src=&quot;../../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;script&gt;
+description('Test window DOMContentLoaded event is fired after module is executed.');
+
+// Module will be executed asynchronously.
+window.jsTestIsAsync = true;
+&lt;/script&gt;
+&lt;script&gt;
+debug('Module is not executed yet.');
+window.domContentLoadedIsExecuted = false;
+window.addEventListener('DOMContentLoaded', function () {
+    window.domContentLoadedIsExecuted = true;
+}, false);
+shouldBe(`document.readyState`, `&quot;loading&quot;`);
+&lt;/script&gt;
+&lt;script src=&quot;../../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;script type=&quot;module&quot;&gt;
+shouldBe(`document.readyState`, `&quot;interactive&quot;`);
+shouldBe(`domContentLoadedIsExecuted`, `false`);
+window.addEventListener('DOMContentLoaded', function () {
+    finishJSTest();
+}, false);
+&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsjsdommodulesmoduleandwindowloadexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/dom/modules/module-and-window-load-expected.txt (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/dom/modules/module-and-window-load-expected.txt                                (rev 0)
+++ trunk/LayoutTests/js/dom/modules/module-and-window-load-expected.txt        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,11 @@
</span><ins>+Test window.load is fired after module is executed.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+Module is not executed yet.
+PASS moduleIsExecuted is true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsjsdommodulesmoduleandwindowloadhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/dom/modules/module-and-window-load.html (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/dom/modules/module-and-window-load.html                                (rev 0)
+++ trunk/LayoutTests/js/dom/modules/module-and-window-load.html        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,29 @@
</span><ins>+&lt;!DOCTYPE HTML&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;script src=&quot;../../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;script&gt;
+description('Test window.load is fired after module is executed.');
+
+// Module will be executed asynchronously.
+window.jsTestIsAsync = true;
+&lt;/script&gt;
+&lt;script&gt;
+debug('Module is not executed yet.');
+&lt;/script&gt;
+&lt;script src=&quot;../../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;script&gt;
+window.moduleIsExecuted = false;
+window.onload = function ()
+{
+    shouldBe(`moduleIsExecuted`, `true`);
+    finishJSTest();
+}
+&lt;/script&gt;
+&lt;script type=&quot;module&quot;&gt;
+window.moduleIsExecuted = true;
+&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsjsdommodulesmoduleasyncandwindowloadexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/dom/modules/module-async-and-window-load-expected.txt (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/dom/modules/module-async-and-window-load-expected.txt                                (rev 0)
+++ trunk/LayoutTests/js/dom/modules/module-async-and-window-load-expected.txt        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,11 @@
</span><ins>+Test window.load is fired after module is executed.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+Module is not executed yet.
+PASS moduleIsExecuted is true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsjsdommodulesmoduleasyncandwindowloadhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/dom/modules/module-async-and-window-load.html (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/dom/modules/module-async-and-window-load.html                                (rev 0)
+++ trunk/LayoutTests/js/dom/modules/module-async-and-window-load.html        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,29 @@
</span><ins>+&lt;!DOCTYPE HTML&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;script src=&quot;../../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;script&gt;
+description('Test window.load is fired after module is executed.');
+
+// Module will be executed asynchronously.
+window.jsTestIsAsync = true;
+&lt;/script&gt;
+&lt;script&gt;
+debug('Module is not executed yet.');
+&lt;/script&gt;
+&lt;script src=&quot;../../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;script&gt;
+window.moduleIsExecuted = false;
+window.onload = function ()
+{
+    shouldBe(`moduleIsExecuted`, `true`);
+    finishJSTest();
+}
+&lt;/script&gt;
+&lt;script type=&quot;module&quot; async&gt;
+window.moduleIsExecuted = true;
+&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsjsdommodulesmoduledocumentwriteexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/dom/modules/module-document-write-expected.txt (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/dom/modules/module-document-write-expected.txt                                (rev 0)
+++ trunk/LayoutTests/js/dom/modules/module-document-write-expected.txt        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+Test that document.write does not work inside module.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+Module is not executed yet.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsjsdommodulesmoduledocumentwritesrcexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/dom/modules/module-document-write-src-expected.txt (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/dom/modules/module-document-write-src-expected.txt                                (rev 0)
+++ trunk/LayoutTests/js/dom/modules/module-document-write-src-expected.txt        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+Test that document.write does not work inside module.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+Module is not executed yet.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsjsdommodulesmoduledocumentwritesrchtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/dom/modules/module-document-write-src.html (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/dom/modules/module-document-write-src.html                                (rev 0)
+++ trunk/LayoutTests/js/dom/modules/module-document-write-src.html        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,19 @@
</span><ins>+&lt;!DOCTYPE HTML&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;script src=&quot;../../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;script&gt;
+description('Test that document.write does not work inside module.');
+
+// Module will be executed asynchronously.
+window.jsTestIsAsync = true;
+&lt;/script&gt;
+&lt;script&gt;
+debug('Module is not executed yet.');
+&lt;/script&gt;
+&lt;script src=&quot;../../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;script type=&quot;module&quot; src=&quot;script-tests/module-document-write-src.js&quot;&gt;&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsjsdommodulesmoduledocumentwritehtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/dom/modules/module-document-write.html (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/dom/modules/module-document-write.html                                (rev 0)
+++ trunk/LayoutTests/js/dom/modules/module-document-write.html        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,22 @@
</span><ins>+&lt;!DOCTYPE HTML&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;script src=&quot;../../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;script&gt;
+description('Test that document.write does not work inside module.');
+
+// Module will be executed asynchronously.
+window.jsTestIsAsync = true;
+&lt;/script&gt;
+&lt;script&gt;
+debug('Module is not executed yet.');
+&lt;/script&gt;
+&lt;script src=&quot;../../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;script type=&quot;module&quot;&gt;
+document.write(&quot;TEST FAILED&quot;);
+finishJSTest();
+&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsjsdommodulesmoduleexecutionerrorinsidedependentmoduleshouldbepropagatedtoonerrorexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/dom/modules/module-execution-error-inside-dependent-module-should-be-propagated-to-onerror-expected.txt (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/dom/modules/module-execution-error-inside-dependent-module-should-be-propagated-to-onerror-expected.txt                                (rev 0)
+++ trunk/LayoutTests/js/dom/modules/module-execution-error-inside-dependent-module-should-be-propagated-to-onerror-expected.txt        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,11 @@
</span><ins>+Test window.onerror will be fired when the dependent module throw an error.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+Module is not executed yet.
+Executing the dependent module
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsjsdommodulesmoduleexecutionerrorinsidedependentmoduleshouldbepropagatedtoonerrorhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/dom/modules/module-execution-error-inside-dependent-module-should-be-propagated-to-onerror.html (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/dom/modules/module-execution-error-inside-dependent-module-should-be-propagated-to-onerror.html                                (rev 0)
+++ trunk/LayoutTests/js/dom/modules/module-execution-error-inside-dependent-module-should-be-propagated-to-onerror.html        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,22 @@
</span><ins>+&lt;!DOCTYPE HTML&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;script src=&quot;../../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;script&gt;
+description('Test window.onerror will be fired when the dependent module throw an error.');
+// Module will be executed asynchronously.
+window.jsTestIsAsync = true;
+debug('Module is not executed yet.');
+window.onerror = function () {
+    finishJSTest();
+}
+&lt;/script&gt;
+&lt;script src=&quot;../../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;script type=&quot;module&quot;&gt;
+import &quot;./script-tests/module-execution-error-inside-dependent-module-should-be-propagated-to-onerror.js&quot;
+testFailed(&quot;executed&quot;);
+&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsjsdommodulesmoduleexecutionerrorshouldbepropagatedtoonerrorexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/dom/modules/module-execution-error-should-be-propagated-to-onerror-expected.txt (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/dom/modules/module-execution-error-should-be-propagated-to-onerror-expected.txt                                (rev 0)
+++ trunk/LayoutTests/js/dom/modules/module-execution-error-should-be-propagated-to-onerror-expected.txt        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,11 @@
</span><ins>+Test window.onerror will be fired when the inlined module throws an error.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+Module is not executed yet.
+Executing the module.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsjsdommodulesmoduleexecutionerrorshouldbepropagatedtoonerrorhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/dom/modules/module-execution-error-should-be-propagated-to-onerror.html (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/dom/modules/module-execution-error-should-be-propagated-to-onerror.html                                (rev 0)
+++ trunk/LayoutTests/js/dom/modules/module-execution-error-should-be-propagated-to-onerror.html        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,22 @@
</span><ins>+&lt;!DOCTYPE HTML&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;script src=&quot;../../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;script&gt;
+description('Test window.onerror will be fired when the inlined module throws an error.');
+// Module will be executed asynchronously.
+window.jsTestIsAsync = true;
+debug('Module is not executed yet.');
+window.onerror = function () {
+    finishJSTest();
+}
+&lt;/script&gt;
+&lt;script src=&quot;../../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;script type=&quot;module&quot;&gt;
+debug('Executing the module.');
+throw new Error(&quot;module is executed.&quot;);
+&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsjsdommodulesmoduleexecutionorderinlineexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/dom/modules/module-execution-order-inline-expected.txt (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/dom/modules/module-execution-order-inline-expected.txt                                (rev 0)
+++ trunk/LayoutTests/js/dom/modules/module-execution-order-inline-expected.txt        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,14 @@
</span><ins>+Test module execution order between inlined module tags.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+Module is not executed yet.
+PASS count++ is 0
+PASS count++ is 1
+PASS count++ is 2
+PASS count++ is 3
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsjsdommodulesmoduleexecutionorderinlinehtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/dom/modules/module-execution-order-inline.html (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/dom/modules/module-execution-order-inline.html                                (rev 0)
+++ trunk/LayoutTests/js/dom/modules/module-execution-order-inline.html        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,27 @@
</span><ins>+&lt;!DOCTYPE HTML&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;script src=&quot;../../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;script&gt;
+description('Test module execution order between inlined module tags.');
+window.count = 0;
+// Module will be executed asynchronously.
+window.jsTestIsAsync = true;
+debug('Module is not executed yet.');
+shouldBe(&quot;count++&quot;, &quot;0&quot;);
+&lt;/script&gt;
+&lt;script src=&quot;../../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;script type=&quot;module&quot;&gt;
+shouldBe(&quot;count++&quot;, &quot;1&quot;);
+&lt;/script&gt;
+&lt;script type=&quot;module&quot;&gt;
+shouldBe(&quot;count++&quot;, &quot;2&quot;);
+&lt;/script&gt;
+&lt;script type=&quot;module&quot;&gt;
+shouldBe(&quot;count++&quot;, &quot;3&quot;);
+finishJSTest();
+&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsjsdommodulesmoduleexecutionordermixedexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/dom/modules/module-execution-order-mixed-expected.txt (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/dom/modules/module-execution-order-mixed-expected.txt                                (rev 0)
+++ trunk/LayoutTests/js/dom/modules/module-execution-order-mixed-expected.txt        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,18 @@
</span><ins>+Test module execution order between mixed tags.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+We keep the execution order between modules.
+Module is not executed yet.
+PASS count++ is 0
+PASS count++ is 1
+PASS count++ is 2
+PASS count++ is 3
+PASS count++ is 4
+PASS count++ is 5
+PASS count++ is 6
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsjsdommodulesmoduleexecutionordermixedwithclassicscriptsexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/dom/modules/module-execution-order-mixed-with-classic-scripts-expected.txt (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/dom/modules/module-execution-order-mixed-with-classic-scripts-expected.txt                                (rev 0)
+++ trunk/LayoutTests/js/dom/modules/module-execution-order-mixed-with-classic-scripts-expected.txt        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,24 @@
</span><ins>+Test module execution order between mixed tags.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+We keep the execution order between modules.
+Module is not executed yet.
+PASS count++ is 0
+PASS count++ is 1
+PASS count++ is 2
+PASS count++ is 3
+PASS count++ is 4
+PASS count++ is 5
+PASS count++ is 6
+PASS count++ is 7
+PASS count++ is 8
+PASS count++ is 9
+PASS count++ is 10
+PASS count++ is 11
+PASS count++ is 12
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsjsdommodulesmoduleexecutionordermixedwithclassicscriptshtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/dom/modules/module-execution-order-mixed-with-classic-scripts.html (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/dom/modules/module-execution-order-mixed-with-classic-scripts.html                                (rev 0)
+++ trunk/LayoutTests/js/dom/modules/module-execution-order-mixed-with-classic-scripts.html        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,45 @@
</span><ins>+&lt;!DOCTYPE HTML&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;script src=&quot;../../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;script&gt;
+description('Test module execution order between mixed tags.');
+debug('We keep the execution order between modules.');
+window.count = 0;
+
+// Module will be executed asynchronously.
+window.jsTestIsAsync = true;
+debug('Module is not executed yet.');
+&lt;/script&gt;
+&lt;script src=&quot;../../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;script&gt;
+shouldBe(&quot;count++&quot;, &quot;0&quot;);
+&lt;/script&gt;
+&lt;script&gt;
+shouldBe(&quot;count++&quot;, &quot;1&quot;);
+&lt;/script&gt;
+&lt;script type=&quot;module&quot; src=&quot;script-tests/module-execution-order-mixed-with-classic-scripts.js&quot;&gt;&lt;/script&gt;
+&lt;script&gt;
+shouldBe(&quot;count++&quot;, &quot;2&quot;);
+&lt;/script&gt;
+&lt;script type=&quot;module&quot;&gt;
+shouldBe(&quot;count++&quot;, &quot;10&quot;);
+&lt;/script&gt;
+&lt;script&gt;
+shouldBe(&quot;count++&quot;, &quot;3&quot;);
+&lt;/script&gt;
+&lt;script type=&quot;module&quot; src=&quot;script-tests/module-execution-order-mixed-with-classic-scripts-2.js&quot;&gt;&lt;/script&gt;
+&lt;script&gt;
+shouldBe(&quot;count++&quot;, &quot;4&quot;);
+&lt;/script&gt;
+&lt;script type=&quot;module&quot;&gt;
+shouldBe(&quot;count++&quot;, &quot;12&quot;);
+finishJSTest();
+&lt;/script&gt;
+&lt;script&gt;
+shouldBe(&quot;count++&quot;, &quot;5&quot;);
+&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsjsdommodulesmoduleexecutionordermixedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/dom/modules/module-execution-order-mixed.html (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/dom/modules/module-execution-order-mixed.html                                (rev 0)
+++ trunk/LayoutTests/js/dom/modules/module-execution-order-mixed.html        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,27 @@
</span><ins>+&lt;!DOCTYPE HTML&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;script src=&quot;../../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;script&gt;
+description('Test module execution order between mixed tags.');
+debug('We keep the execution order between modules.');
+window.count = 0;
+
+// Module will be executed asynchronously.
+window.jsTestIsAsync = true;
+debug('Module is not executed yet.');
+&lt;/script&gt;
+&lt;script src=&quot;../../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;script type=&quot;module&quot; src=&quot;script-tests/module-execution-order-mixed.js&quot;&gt;&lt;/script&gt;
+&lt;script type=&quot;module&quot;&gt;
+shouldBe(&quot;count++&quot;, &quot;4&quot;);
+&lt;/script&gt;
+&lt;script type=&quot;module&quot; src=&quot;script-tests/module-execution-order-mixed-2.js&quot;&gt;&lt;/script&gt;
+&lt;script type=&quot;module&quot;&gt;
+shouldBe(&quot;count++&quot;, &quot;6&quot;);
+finishJSTest();
+&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsjsdommodulesmoduleincorrectrelativespecifierexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/dom/modules/module-incorrect-relative-specifier-expected.txt (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/dom/modules/module-incorrect-relative-specifier-expected.txt                                (rev 0)
+++ trunk/LayoutTests/js/dom/modules/module-incorrect-relative-specifier-expected.txt        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,19 @@
</span><ins>+CONSOLE MESSAGE: line 1: TypeError: Module specifier does not start with &quot;/&quot;, &quot;./&quot;, or &quot;../&quot;.
+CONSOLE MESSAGE: line 1: TypeError: Module specifier does not start with &quot;/&quot;, &quot;./&quot;, or &quot;../&quot;.
+CONSOLE MESSAGE: line 1: TypeError: Module specifier does not start with &quot;/&quot;, &quot;./&quot;, or &quot;../&quot;.
+Test script.onerror will be fired when the incorrect relative specifier is specified.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+Module is not executed yet.
+0
+1
+2
+PASS scripts.has(document.getElementById(&quot;s0&quot;)) is true
+PASS scripts.has(document.getElementById(&quot;s1&quot;)) is true
+PASS scripts.has(document.getElementById(&quot;s2&quot;)) is true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsjsdommodulesmoduleincorrectrelativespecifierhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/dom/modules/module-incorrect-relative-specifier.html (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/dom/modules/module-incorrect-relative-specifier.html                                (rev 0)
+++ trunk/LayoutTests/js/dom/modules/module-incorrect-relative-specifier.html        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,41 @@
</span><ins>+&lt;!DOCTYPE HTML&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;script src=&quot;../../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;script&gt;
+description('Test script.onerror will be fired when the incorrect relative specifier is specified.');
+// Module will be executed asynchronously.
+window.jsTestIsAsync = true;
+debug('Module is not executed yet.');
+var count = 0;
+var scripts = new Set();
+function errorHandler(script) {
+    var current = count++;
+    debug(`${current}`);
+    scripts.add(script);
+    if (count === 3) {
+        shouldBeTrue(`scripts.has(document.getElementById(&quot;s0&quot;))`);
+        shouldBeTrue(`scripts.has(document.getElementById(&quot;s1&quot;))`);
+        shouldBeTrue(`scripts.has(document.getElementById(&quot;s2&quot;))`);
+        finishJSTest();
+    }
+}
+&lt;/script&gt;
+&lt;script src=&quot;../../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+
+&lt;script type=&quot;module&quot; id=&quot;s0&quot; onerror=&quot;errorHandler(this)&quot;&gt;
+import Incorrect from &quot;incorrect&quot;
+&lt;/script&gt;
+
+&lt;script type=&quot;module&quot; id=&quot;s1&quot; onerror=&quot;errorHandler(this)&quot;&gt;
+import Incorrect from &quot;$hello&quot;
+&lt;/script&gt;
+
+&lt;script type=&quot;module&quot; id=&quot;s2&quot; onerror=&quot;errorHandler(this)&quot;&gt;
+import Incorrect from &quot;.../test&quot;
+&lt;/script&gt;
+
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsjsdommodulesmoduleincorrecttagexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/dom/modules/module-incorrect-tag-expected.txt (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/dom/modules/module-incorrect-tag-expected.txt                                (rev 0)
+++ trunk/LayoutTests/js/dom/modules/module-incorrect-tag-expected.txt        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+Test incorrect module tags.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+Module is not executed yet.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsjsdommodulesmoduleincorrecttaghtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/dom/modules/module-incorrect-tag.html (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/dom/modules/module-incorrect-tag.html                                (rev 0)
+++ trunk/LayoutTests/js/dom/modules/module-incorrect-tag.html        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,33 @@
</span><ins>+&lt;!DOCTYPE HTML&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;script src=&quot;../../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;script&gt;
+description('Test incorrect module tags.');
+
+// Module will be executed asynchronously.
+window.jsTestIsAsync = true;
+&lt;/script&gt;
+&lt;script&gt;
+debug('Module is not executed yet.');
+&lt;/script&gt;
+&lt;script src=&quot;../../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;script type=&quot;module &quot;&gt;
+testFail(&quot;This is not a module&quot;);
+&lt;/script&gt;
+&lt;script type=&quot; module &quot;&gt;
+testFail(&quot;This is not a module&quot;);
+&lt;/script&gt;
+&lt;script type=&quot; module&quot;&gt;
+testFail(&quot;This is not a module&quot;);
+&lt;/script&gt;
+&lt;script type=&quot; moduleXXX&quot;&gt;
+testFail(&quot;This is not a module&quot;);
+&lt;/script&gt;
+&lt;script type=&quot;module&quot;&gt;
+finishJSTest();
+&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsjsdommodulesmoduleinlinecurrentscriptexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/dom/modules/module-inline-current-script-expected.txt (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/dom/modules/module-inline-current-script-expected.txt                                (rev 0)
+++ trunk/LayoutTests/js/dom/modules/module-inline-current-script-expected.txt        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,12 @@
</span><ins>+Test document.currentScript should be null when executing the inlined module.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+Module is not executed yet.
+Module execution is confined in the module environment.
+PASS document.currentScript is null
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsjsdommodulesmoduleinlinecurrentscripthtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/dom/modules/module-inline-current-script.html (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/dom/modules/module-inline-current-script.html                                (rev 0)
+++ trunk/LayoutTests/js/dom/modules/module-inline-current-script.html        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,25 @@
</span><ins>+&lt;!DOCTYPE HTML&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;script src=&quot;../../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;script&gt;
+description('Test document.currentScript should be null when executing the inlined module.');
+
+// Module will be executed asynchronously.
+window.jsTestIsAsync = true;
+&lt;/script&gt;
+&lt;script&gt;
+debug('Module is not executed yet.');
+&lt;/script&gt;
+&lt;script src=&quot;../../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;script type=&quot;module&quot;&gt;
+
+debug(&quot;Module execution is confined in the module environment.&quot;);
+shouldBe(&quot;document.currentScript&quot;, &quot;null&quot;);
+
+finishJSTest();
+&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsjsdommodulesmoduleinlinedynamicexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/dom/modules/module-inline-dynamic-expected.txt (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/dom/modules/module-inline-dynamic-expected.txt                                (rev 0)
+++ trunk/LayoutTests/js/dom/modules/module-inline-dynamic-expected.txt        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,14 @@
</span><ins>+Test inlined module.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+Module is not executed yet.
+Module execution is confined in the module environment.
+PASS typeof cocoa is &quot;undefined&quot;
+PASS typeof exportedCocoa is &quot;object&quot;
+PASS exportedCocoa.taste() is &quot;awesome&quot;
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsjsdommodulesmoduleinlinedynamichtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/dom/modules/module-inline-dynamic.html (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/dom/modules/module-inline-dynamic.html                                (rev 0)
+++ trunk/LayoutTests/js/dom/modules/module-inline-dynamic.html        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,35 @@
</span><ins>+&lt;!DOCTYPE HTML&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;script src=&quot;../../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;script&gt;
+description('Test inlined module.');
+
+// Module will be executed asynchronously.
+window.jsTestIsAsync = true;
+&lt;/script&gt;
+&lt;script src=&quot;../../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;script&gt;
+debug('Module is not executed yet.');
+(function () {
+    var element = document.createElement(&quot;script&quot;);
+    element.textContent = `
+        import Cocoa from &quot;./script-tests/module-inline-dynamic.js&quot;;
+        var cocoa = new Cocoa();
+
+        debug(&quot;Module execution is confined in the module environment.&quot;);
+        shouldBeEqualToString(&quot;typeof cocoa&quot;, &quot;undefined&quot;);
+
+        window.exportedCocoa = cocoa;
+        shouldBeEqualToString(&quot;typeof exportedCocoa&quot;, &quot;object&quot;);
+        shouldBeEqualToString(&quot;exportedCocoa.taste()&quot;, &quot;awesome&quot;);
+        finishJSTest();
+    `;
+    element.type = &quot;module&quot;;
+    document.body.appendChild(element);
+} ());
+&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsjsdommodulesmoduleinlinesimpleexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/dom/modules/module-inline-simple-expected.txt (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/dom/modules/module-inline-simple-expected.txt                                (rev 0)
+++ trunk/LayoutTests/js/dom/modules/module-inline-simple-expected.txt        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,14 @@
</span><ins>+Test inlined module.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+Module is not executed yet.
+Module execution is confined in the module environment.
+PASS typeof cocoa is &quot;undefined&quot;
+PASS typeof exportedCocoa is &quot;object&quot;
+PASS exportedCocoa.taste() is &quot;awesome&quot;
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsjsdommodulesmoduleinlinesimplehtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/dom/modules/module-inline-simple.html (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/dom/modules/module-inline-simple.html                                (rev 0)
+++ trunk/LayoutTests/js/dom/modules/module-inline-simple.html        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,30 @@
</span><ins>+&lt;!DOCTYPE HTML&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;script src=&quot;../../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;script&gt;
+description('Test inlined module.');
+
+// Module will be executed asynchronously.
+window.jsTestIsAsync = true;
+&lt;/script&gt;
+&lt;script&gt;
+debug('Module is not executed yet.');
+&lt;/script&gt;
+&lt;script src=&quot;../../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;script type=&quot;module&quot;&gt;
+import Cocoa from &quot;./script-tests/module-inline-simple.js&quot;;
+var cocoa = new Cocoa();
+
+debug(&quot;Module execution is confined in the module environment.&quot;);
+shouldBeEqualToString(&quot;typeof cocoa&quot;, &quot;undefined&quot;);
+
+window.exportedCocoa = cocoa;
+shouldBeEqualToString(&quot;typeof exportedCocoa&quot;, &quot;object&quot;);
+shouldBeEqualToString(&quot;exportedCocoa.taste()&quot;, &quot;awesome&quot;);
+finishJSTest();
+&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsjsdommodulesmoduleloadeventexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/dom/modules/module-load-event-expected.txt (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/dom/modules/module-load-event-expected.txt                                (rev 0)
+++ trunk/LayoutTests/js/dom/modules/module-load-event-expected.txt        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,12 @@
</span><ins>+Test module execution order between tags.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+Module is not executed yet.
+Executing an inlined module.
+PASS moduleExecuted is true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsjsdommodulesmoduleloadeventwithsrcexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/dom/modules/module-load-event-with-src-expected.txt (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/dom/modules/module-load-event-with-src-expected.txt                                (rev 0)
+++ trunk/LayoutTests/js/dom/modules/module-load-event-with-src-expected.txt        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,12 @@
</span><ins>+Test script.onload will be fired when the module tag with src loads and executes.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+Module is not executed yet.
+Executing a module with src attribute.
+PASS moduleExecuted is true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsjsdommodulesmoduleloadeventwithsrchtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/dom/modules/module-load-event-with-src.html (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/dom/modules/module-load-event-with-src.html                                (rev 0)
+++ trunk/LayoutTests/js/dom/modules/module-load-event-with-src.html        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,21 @@
</span><ins>+&lt;!DOCTYPE HTML&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;script src=&quot;../../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;script&gt;
+description('Test script.onload will be fired when the module tag with src loads and executes.');
+// Module will be executed asynchronously.
+window.jsTestIsAsync = true;
+debug('Module is not executed yet.');
+function onLoad()
+{
+    shouldBeTrue(`moduleExecuted`);
+    finishJSTest();
+}
+&lt;/script&gt;
+&lt;script src=&quot;../../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;script type=&quot;module&quot; onload=&quot;onLoad()&quot; src=&quot;script-tests/module-load-event-with-src.js&quot;&gt;&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsjsdommodulesmoduleloadeventhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/dom/modules/module-load-event.html (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/dom/modules/module-load-event.html                                (rev 0)
+++ trunk/LayoutTests/js/dom/modules/module-load-event.html        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,24 @@
</span><ins>+&lt;!DOCTYPE HTML&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;script src=&quot;../../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;script&gt;
+description('Test module execution order between tags.');
+// Module will be executed asynchronously.
+window.jsTestIsAsync = true;
+debug('Module is not executed yet.');
+function onLoad()
+{
+    shouldBeTrue(`moduleExecuted`);
+    finishJSTest();
+}
+&lt;/script&gt;
+&lt;script src=&quot;../../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;script type=&quot;module&quot; onload=&quot;onLoad()&quot;&gt;
+debug('Executing an inlined module.');
+window.moduleExecuted = true;
+&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsjsdommodulesmoduleloadsamemodulefromdifferententrypointdynamicexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/dom/modules/module-load-same-module-from-different-entry-point-dynamic-expected.txt (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/dom/modules/module-load-same-module-from-different-entry-point-dynamic-expected.txt                                (rev 0)
+++ trunk/LayoutTests/js/dom/modules/module-load-same-module-from-different-entry-point-dynamic-expected.txt        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,16 @@
</span><ins>+2 different module tag will attempt to load the same module from a dynamically generated tag
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+Currently, this is not defined in the spec. This issue should be fixed in the future.
+Module is not executed yet.
+PASS window.moduleExecutedCount is 0
+Executing module-load-same-module-from-different-entry-point.js.
+Executing the module.
+PASS window.moduleExecutedCount is 1
+PASS window.moduleExecutedCount is 1
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsjsdommodulesmoduleloadsamemodulefromdifferententrypointdynamichtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/dom/modules/module-load-same-module-from-different-entry-point-dynamic.html (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/dom/modules/module-load-same-module-from-different-entry-point-dynamic.html                                (rev 0)
+++ trunk/LayoutTests/js/dom/modules/module-load-same-module-from-different-entry-point-dynamic.html        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,33 @@
</span><ins>+&lt;!DOCTYPE HTML&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;script src=&quot;../../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;script&gt;
+description('2 different module tag will attempt to load the same module from a dynamically generated tag');
+debug('Currently, this is not defined in the spec. This issue should be fixed in the future.');
+// Module will be executed asynchronously.
+window.jsTestIsAsync = true;
+window.moduleExecutedCount = 0;
+debug('Module is not executed yet.');
+shouldBe(`window.moduleExecutedCount`, `0`);
+function onLoad()
+{
+    shouldBe(`window.moduleExecutedCount`, `1`);
+    finishJSTest();
+}
+&lt;/script&gt;
+&lt;script src=&quot;../../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;script type=&quot;module&quot;&gt;
+import &quot;./script-tests/module-load-same-module-from-different-entry-point.js&quot;
+debug('Executing the module.');
+shouldBe(`window.moduleExecutedCount`, `1`);
+var element = document.createElement(&quot;script&quot;);
+element.type = &quot;module&quot;;
+element.innerText = `import &quot;./script-tests/module-load-same-module-from-different-entry-point.js&quot;`;
+element.onload = onLoad;
+document.body.appendChild(element);
+&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsjsdommodulesmoduleloadsamemodulefromdifferententrypointexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/dom/modules/module-load-same-module-from-different-entry-point-expected.txt (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/dom/modules/module-load-same-module-from-different-entry-point-expected.txt                                (rev 0)
+++ trunk/LayoutTests/js/dom/modules/module-load-same-module-from-different-entry-point-expected.txt        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,19 @@
</span><ins>+2 different module tag will attempt to load the same module
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+Currently, this is not defined in the spec. This issue should be fixed in the future.
+Module is not executed yet.
+PASS window.moduleExecutedCount is 0
+Executing module-load-same-module-from-different-entry-point.js.
+Executing the module.
+PASS window.moduleExecutedCount is 1
+Executing the module.
+PASS window.moduleExecutedCount is 1
+PASS window.firstModuleIsExecuted is true
+PASS window.secondModuleIsExecuted is true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsjsdommodulesmoduleloadsamemodulefromdifferententrypointhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/dom/modules/module-load-same-module-from-different-entry-point.html (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/dom/modules/module-load-same-module-from-different-entry-point.html                                (rev 0)
+++ trunk/LayoutTests/js/dom/modules/module-load-same-module-from-different-entry-point.html        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,37 @@
</span><ins>+&lt;!DOCTYPE HTML&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;script src=&quot;../../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;script&gt;
+description('2 different module tag will attempt to load the same module');
+debug('Currently, this is not defined in the spec. This issue should be fixed in the future.');
+// Module will be executed asynchronously.
+window.jsTestIsAsync = true;
+window.moduleExecutedCount = 0;
+debug('Module is not executed yet.');
+shouldBe(`window.moduleExecutedCount`, `0`);
+var counter = 0;
+function onLoad() {
+    shouldBe(`window.moduleExecutedCount`, `1`);
+    if (++counter === 2) {
+        shouldBeTrue(`window.firstModuleIsExecuted`);
+        shouldBeTrue(`window.secondModuleIsExecuted`);
+        finishJSTest();
+    }
+}
+&lt;/script&gt;
+&lt;script src=&quot;../../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;script type=&quot;module&quot; onload=&quot;onLoad()&quot;&gt;
+import &quot;./script-tests/module-load-same-module-from-different-entry-point.js&quot;
+debug('Executing the module.');
+window.firstModuleIsExecuted = true;
+&lt;/script&gt;
+&lt;script type=&quot;module&quot; onload=&quot;onLoad()&quot;&gt;
+import &quot;./script-tests/module-load-same-module-from-different-entry-point.js&quot;
+debug('Executing the module.');
+window.secondModuleIsExecuted = true;
+&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsjsdommodulesmodulenotfounderroreventexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/dom/modules/module-not-found-error-event-expected.txt (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/dom/modules/module-not-found-error-event-expected.txt                                (rev 0)
+++ trunk/LayoutTests/js/dom/modules/module-not-found-error-event-expected.txt        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,12 @@
</span><ins>+Test script.onerror will be fired when the resource specified by the import declaration in the inlined module is not found.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+Module is not executed yet.
+PASS error is not null
+PASS error.type is &quot;error&quot;
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsjsdommodulesmodulenotfounderroreventwithsrcandimportexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/dom/modules/module-not-found-error-event-with-src-and-import-expected.txt (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/dom/modules/module-not-found-error-event-with-src-and-import-expected.txt                                (rev 0)
+++ trunk/LayoutTests/js/dom/modules/module-not-found-error-event-with-src-and-import-expected.txt        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,12 @@
</span><ins>+Test script.onerror will be fired when the resource specified by the import declaration in the dependent module is not found.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+Module is not executed yet.
+PASS error is not null
+PASS error.type is &quot;error&quot;
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsjsdommodulesmodulenotfounderroreventwithsrcandimporthtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/dom/modules/module-not-found-error-event-with-src-and-import.html (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/dom/modules/module-not-found-error-event-with-src-and-import.html                                (rev 0)
+++ trunk/LayoutTests/js/dom/modules/module-not-found-error-event-with-src-and-import.html        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,26 @@
</span><ins>+&lt;!DOCTYPE HTML&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;script src=&quot;../../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;script&gt;
+description('Test script.onerror will be fired when the resource specified by the import declaration in the dependent module is not found.');
+// Module will be executed asynchronously.
+window.jsTestIsAsync = true;
+debug('Module is not executed yet.');
+var error = null;
+function onError()
+{
+    error = window.event;
+}
+&lt;/script&gt;
+&lt;script src=&quot;../../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;script type=&quot;module&quot; src=&quot;script-tests/module-not-found-error-event-with-src-and-import.js&quot; onerror=&quot;onError()&quot;&gt;&lt;/script&gt;
+&lt;script type=&quot;module&quot;&gt;
+shouldNotBe(`error`, `null`);
+shouldBe(`error.type`, `&quot;error&quot;`);
+finishJSTest()
+&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsjsdommodulesmodulenotfounderroreventwithsrcexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/dom/modules/module-not-found-error-event-with-src-expected.txt (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/dom/modules/module-not-found-error-event-with-src-expected.txt                                (rev 0)
+++ trunk/LayoutTests/js/dom/modules/module-not-found-error-event-with-src-expected.txt        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,12 @@
</span><ins>+Test script.onerror will be fired when the resource specified by &quot;src&quot; is not found.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+Module is not executed yet.
+PASS error is not null
+PASS error.type is &quot;error&quot;
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsjsdommodulesmodulenotfounderroreventwithsrchtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/dom/modules/module-not-found-error-event-with-src.html (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/dom/modules/module-not-found-error-event-with-src.html                                (rev 0)
+++ trunk/LayoutTests/js/dom/modules/module-not-found-error-event-with-src.html        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,26 @@
</span><ins>+&lt;!DOCTYPE HTML&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;script src=&quot;../../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;script&gt;
+description('Test script.onerror will be fired when the resource specified by &quot;src&quot; is not found.');
+// Module will be executed asynchronously.
+window.jsTestIsAsync = true;
+debug('Module is not executed yet.');
+var error = null;
+function onError()
+{
+    error = window.event;
+}
+&lt;/script&gt;
+&lt;script src=&quot;../../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;script type=&quot;module&quot; src=&quot;not-found.js&quot; onerror=&quot;onError()&quot;&gt;&lt;/script&gt;
+&lt;script type=&quot;module&quot;&gt;
+shouldNotBe(`error`, `null`);
+shouldBe(`error.type`, `&quot;error&quot;`);
+finishJSTest()
+&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsjsdommodulesmodulenotfounderroreventhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/dom/modules/module-not-found-error-event.html (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/dom/modules/module-not-found-error-event.html                                (rev 0)
+++ trunk/LayoutTests/js/dom/modules/module-not-found-error-event.html        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,29 @@
</span><ins>+&lt;!DOCTYPE HTML&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;script src=&quot;../../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;script&gt;
+description('Test script.onerror will be fired when the resource specified by the import declaration in the inlined module is not found.');
+// Module will be executed asynchronously.
+window.jsTestIsAsync = true;
+debug('Module is not executed yet.');
+var error = null;
+function onError()
+{
+    error = window.event;
+}
+&lt;/script&gt;
+&lt;script src=&quot;../../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;script type=&quot;module&quot; onerror=&quot;onError()&quot;&gt;
+import &quot;./not-found.js&quot;;
+testFailed('executed');
+&lt;/script&gt;
+&lt;script type=&quot;module&quot;&gt;
+shouldNotBe(`error`, `null`);
+shouldBe(`error.type`, `&quot;error&quot;`);
+finishJSTest()
+&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsjsdommodulesmodulesrccurrentscriptexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/dom/modules/module-src-current-script-expected.txt (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/dom/modules/module-src-current-script-expected.txt                                (rev 0)
+++ trunk/LayoutTests/js/dom/modules/module-src-current-script-expected.txt        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,12 @@
</span><ins>+Test document.currentScript should be null when executing the module with the src attribute.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+Module is not executed yet.
+Module execution is confined in the module environment.
+PASS document.currentScript is null
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsjsdommodulesmodulesrccurrentscripthtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/dom/modules/module-src-current-script.html (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/dom/modules/module-src-current-script.html                                (rev 0)
+++ trunk/LayoutTests/js/dom/modules/module-src-current-script.html        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,19 @@
</span><ins>+&lt;!DOCTYPE HTML&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;script src=&quot;../../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;script&gt;
+description('Test document.currentScript should be null when executing the module with the src attribute.');
+
+// Module will be executed asynchronously.
+window.jsTestIsAsync = true;
+&lt;/script&gt;
+&lt;script&gt;
+debug('Module is not executed yet.');
+&lt;/script&gt;
+&lt;script src=&quot;../../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;script type=&quot;module&quot; src=&quot;./script-tests/module-src-current-script.js&quot;&gt;&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsjsdommodulesmodulesrcdynamicexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/dom/modules/module-src-dynamic-expected.txt (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/dom/modules/module-src-dynamic-expected.txt                                (rev 0)
+++ trunk/LayoutTests/js/dom/modules/module-src-dynamic-expected.txt        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,14 @@
</span><ins>+Test module with &quot;src&quot; attribute.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+Module is not executed yet.
+Module execution is confined in the module environment.
+PASS typeof cocoa is &quot;undefined&quot;
+PASS typeof exportedCocoa is &quot;object&quot;
+PASS exportedCocoa.taste() is &quot;nice&quot;
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsjsdommodulesmodulesrcdynamichtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/dom/modules/module-src-dynamic.html (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/dom/modules/module-src-dynamic.html                                (rev 0)
+++ trunk/LayoutTests/js/dom/modules/module-src-dynamic.html        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,24 @@
</span><ins>+&lt;!DOCTYPE HTML&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;script src=&quot;../../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;script&gt;
+description('Test module with &quot;src&quot; attribute.');
+
+// Module will be executed asynchronously.
+window.jsTestIsAsync = true;
+&lt;/script&gt;
+&lt;script src=&quot;../../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;script&gt;
+debug('Module is not executed yet.');
+(function () {
+    var element = document.createElement('script');
+    element.type = 'module';
+    element.src = './script-tests/module-src-dynamic.js';
+    document.body.appendChild(element);
+}());
+&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsjsdommodulesmodulesrcsimpleexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/dom/modules/module-src-simple-expected.txt (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/dom/modules/module-src-simple-expected.txt                                (rev 0)
+++ trunk/LayoutTests/js/dom/modules/module-src-simple-expected.txt        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,14 @@
</span><ins>+Test module with &quot;src&quot; attribute.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+Module is not executed yet.
+Module execution is confined in the module environment.
+PASS typeof cocoa is &quot;undefined&quot;
+PASS typeof exportedCocoa is &quot;object&quot;
+PASS exportedCocoa.taste() is &quot;nice&quot;
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsjsdommodulesmodulesrcsimplehtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/dom/modules/module-src-simple.html (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/dom/modules/module-src-simple.html                                (rev 0)
+++ trunk/LayoutTests/js/dom/modules/module-src-simple.html        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,19 @@
</span><ins>+&lt;!DOCTYPE HTML&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;script src=&quot;../../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;script&gt;
+description('Test module with &quot;src&quot; attribute.');
+
+// Module will be executed asynchronously.
+window.jsTestIsAsync = true;
+&lt;/script&gt;
+&lt;script&gt;
+debug('Module is not executed yet.');
+&lt;/script&gt;
+&lt;script src=&quot;../../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;script type=&quot;module&quot; src=&quot;./script-tests/module-src-simple.js&quot;&gt;&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsjsdommodulesmoduletypecaseinsensitiveexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/dom/modules/module-type-case-insensitive-expected.txt (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/dom/modules/module-type-case-insensitive-expected.txt                                (rev 0)
+++ trunk/LayoutTests/js/dom/modules/module-type-case-insensitive-expected.txt        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,11 @@
</span><ins>+Test that type=&quot;module&quot; should be case-insensitive.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+Module is not executed yet.
+Module is loaded.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsjsdommodulesmoduletypecaseinsensitivehtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/dom/modules/module-type-case-insensitive.html (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/dom/modules/module-type-case-insensitive.html                                (rev 0)
+++ trunk/LayoutTests/js/dom/modules/module-type-case-insensitive.html        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,39 @@
</span><ins>+&lt;!DOCTYPE HTML&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;script src=&quot;../../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;script&gt;
+description('Test that type=&quot;module&quot; should be case-insensitive.');
+
+// Module will be executed asynchronously.
+window.jsTestIsAsync = true;
+
+Promise.all([
+    new Promise(function (resolve) {
+        window.resolve1 = resolve;
+    }),
+    new Promise(function (resolve) {
+        window.resolve2 = resolve;
+    }),
+]).then(function () {
+    debug('Module is loaded.');
+    finishJSTest();
+});
+debug('Module is not executed yet.');
+&lt;/script&gt;
+&lt;script src=&quot;../../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+
+&lt;script type=&quot;MoDuLe&quot;&gt;
+import Cocoa from &quot;./script-tests/module-inline-simple.js&quot;;
+window.resolve1();
+&lt;/script&gt;
+
+&lt;script type=&quot;MODULE&quot;&gt;
+import Cocoa from &quot;./script-tests/module-inline-simple.js&quot;;
+window.resolve2();
+&lt;/script&gt;
+
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsjsdommodulesmodulewillfirebeforeloadexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/dom/modules/module-will-fire-beforeload-expected.txt (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/dom/modules/module-will-fire-beforeload-expected.txt                                (rev 0)
+++ trunk/LayoutTests/js/dom/modules/module-will-fire-beforeload-expected.txt        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+Test script.beforeload will be fired when the module tag with src is prepared.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+Module is not executed yet.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsjsdommodulesmodulewillfirebeforeloadhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/dom/modules/module-will-fire-beforeload.html (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/dom/modules/module-will-fire-beforeload.html                                (rev 0)
+++ trunk/LayoutTests/js/dom/modules/module-will-fire-beforeload.html        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,16 @@
</span><ins>+&lt;!DOCTYPE HTML&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;script src=&quot;../../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;script&gt;
+description('Test script.beforeload will be fired when the module tag with src is prepared.');
+// Module will be executed asynchronously.
+window.jsTestIsAsync = true;
+debug('Module is not executed yet.');
+&lt;/script&gt;
+&lt;script src=&quot;../../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;script type=&quot;module&quot; onbeforeload=&quot;finishJSTest()&quot; src=&quot;script-tests/module-will-fire-beforeload.js&quot;&gt;&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsjsdommodulesscripttestsmoduledocumentwritesrcjs"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/dom/modules/script-tests/module-document-write-src.js (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/dom/modules/script-tests/module-document-write-src.js                                (rev 0)
+++ trunk/LayoutTests/js/dom/modules/script-tests/module-document-write-src.js        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,2 @@
</span><ins>+document.write(&quot;TEST FAILED&quot;);
+finishJSTest();
</ins></span></pre></div>
<a id="trunkLayoutTestsjsdommodulesscripttestsmoduleexecutionerrorinsidedependentmoduleshouldbepropagatedtoonerrorthrowjs"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/dom/modules/script-tests/module-execution-error-inside-dependent-module-should-be-propagated-to-onerror-throw.js (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/dom/modules/script-tests/module-execution-error-inside-dependent-module-should-be-propagated-to-onerror-throw.js                                (rev 0)
+++ trunk/LayoutTests/js/dom/modules/script-tests/module-execution-error-inside-dependent-module-should-be-propagated-to-onerror-throw.js        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,2 @@
</span><ins>+debug(&quot;Executing the dependent module&quot;);
+throw new Error(&quot;out&quot;);
</ins></span></pre></div>
<a id="trunkLayoutTestsjsdommodulesscripttestsmoduleexecutionerrorinsidedependentmoduleshouldbepropagatedtoonerrorjs"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/dom/modules/script-tests/module-execution-error-inside-dependent-module-should-be-propagated-to-onerror.js (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/dom/modules/script-tests/module-execution-error-inside-dependent-module-should-be-propagated-to-onerror.js                                (rev 0)
+++ trunk/LayoutTests/js/dom/modules/script-tests/module-execution-error-inside-dependent-module-should-be-propagated-to-onerror.js        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,2 @@
</span><ins>+import &quot;./module-execution-error-inside-dependent-module-should-be-propagated-to-onerror-throw.js&quot;
+testFailed(&quot;executed&quot;);
</ins></span></pre></div>
<a id="trunkLayoutTestsjsdommodulesscripttestsmoduleexecutionordermixed2js"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/dom/modules/script-tests/module-execution-order-mixed-2.js (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/dom/modules/script-tests/module-execution-order-mixed-2.js                                (rev 0)
+++ trunk/LayoutTests/js/dom/modules/script-tests/module-execution-order-mixed-2.js        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+shouldBe(&quot;count++&quot;, &quot;5&quot;);
</ins></span></pre></div>
<a id="trunkLayoutTestsjsdommodulesscripttestsmoduleexecutionordermixedcappuccinojs"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/dom/modules/script-tests/module-execution-order-mixed-cappuccino.js (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/dom/modules/script-tests/module-execution-order-mixed-cappuccino.js                                (rev 0)
+++ trunk/LayoutTests/js/dom/modules/script-tests/module-execution-order-mixed-cappuccino.js        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,3 @@
</span><ins>+import &quot;./module-execution-order-mixed-matcha.js&quot;
+
+shouldBe(&quot;count++&quot;, &quot;2&quot;);
</ins></span></pre></div>
<a id="trunkLayoutTestsjsdommodulesscripttestsmoduleexecutionordermixedcocoajs"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/dom/modules/script-tests/module-execution-order-mixed-cocoa.js (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/dom/modules/script-tests/module-execution-order-mixed-cocoa.js                                (rev 0)
+++ trunk/LayoutTests/js/dom/modules/script-tests/module-execution-order-mixed-cocoa.js        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,3 @@
</span><ins>+import &quot;./module-execution-order-mixed-matcha.js&quot;;
+
+shouldBe(&quot;count++&quot;, &quot;1&quot;);
</ins></span></pre></div>
<a id="trunkLayoutTestsjsdommodulesscripttestsmoduleexecutionordermixedmatchajs"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/dom/modules/script-tests/module-execution-order-mixed-matcha.js (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/dom/modules/script-tests/module-execution-order-mixed-matcha.js                                (rev 0)
+++ trunk/LayoutTests/js/dom/modules/script-tests/module-execution-order-mixed-matcha.js        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+shouldBe(&quot;count++&quot;, &quot;0&quot;);
</ins></span></pre></div>
<a id="trunkLayoutTestsjsdommodulesscripttestsmoduleexecutionordermixedwithclassicscripts2js"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/dom/modules/script-tests/module-execution-order-mixed-with-classic-scripts-2.js (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/dom/modules/script-tests/module-execution-order-mixed-with-classic-scripts-2.js                                (rev 0)
+++ trunk/LayoutTests/js/dom/modules/script-tests/module-execution-order-mixed-with-classic-scripts-2.js        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+shouldBe(&quot;count++&quot;, &quot;11&quot;);
</ins></span></pre></div>
<a id="trunkLayoutTestsjsdommodulesscripttestsmoduleexecutionordermixedwithclassicscriptscappuccinojs"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/dom/modules/script-tests/module-execution-order-mixed-with-classic-scripts-cappuccino.js (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/dom/modules/script-tests/module-execution-order-mixed-with-classic-scripts-cappuccino.js                                (rev 0)
+++ trunk/LayoutTests/js/dom/modules/script-tests/module-execution-order-mixed-with-classic-scripts-cappuccino.js        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,3 @@
</span><ins>+import &quot;./module-execution-order-mixed-with-classic-scripts-matcha.js&quot;
+
+shouldBe(&quot;count++&quot;, &quot;8&quot;);
</ins></span></pre></div>
<a id="trunkLayoutTestsjsdommodulesscripttestsmoduleexecutionordermixedwithclassicscriptscocoajs"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/dom/modules/script-tests/module-execution-order-mixed-with-classic-scripts-cocoa.js (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/dom/modules/script-tests/module-execution-order-mixed-with-classic-scripts-cocoa.js                                (rev 0)
+++ trunk/LayoutTests/js/dom/modules/script-tests/module-execution-order-mixed-with-classic-scripts-cocoa.js        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,3 @@
</span><ins>+import &quot;./module-execution-order-mixed-with-classic-scripts-matcha.js&quot;;
+
+shouldBe(&quot;count++&quot;, &quot;7&quot;);
</ins></span></pre></div>
<a id="trunkLayoutTestsjsdommodulesscripttestsmoduleexecutionordermixedwithclassicscriptsmatchajs"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/dom/modules/script-tests/module-execution-order-mixed-with-classic-scripts-matcha.js (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/dom/modules/script-tests/module-execution-order-mixed-with-classic-scripts-matcha.js                                (rev 0)
+++ trunk/LayoutTests/js/dom/modules/script-tests/module-execution-order-mixed-with-classic-scripts-matcha.js        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+shouldBe(&quot;count++&quot;, &quot;6&quot;);
</ins></span></pre></div>
<a id="trunkLayoutTestsjsdommodulesscripttestsmoduleexecutionordermixedwithclassicscriptsjs"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/dom/modules/script-tests/module-execution-order-mixed-with-classic-scripts.js (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/dom/modules/script-tests/module-execution-order-mixed-with-classic-scripts.js                                (rev 0)
+++ trunk/LayoutTests/js/dom/modules/script-tests/module-execution-order-mixed-with-classic-scripts.js        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,4 @@
</span><ins>+import &quot;./module-execution-order-mixed-with-classic-scripts-cocoa.js&quot;
+import &quot;./module-execution-order-mixed-with-classic-scripts-cappuccino.js&quot;
+
+shouldBe(&quot;count++&quot;, &quot;9&quot;);
</ins></span></pre></div>
<a id="trunkLayoutTestsjsdommodulesscripttestsmoduleexecutionordermixedjs"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/dom/modules/script-tests/module-execution-order-mixed.js (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/dom/modules/script-tests/module-execution-order-mixed.js                                (rev 0)
+++ trunk/LayoutTests/js/dom/modules/script-tests/module-execution-order-mixed.js        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,4 @@
</span><ins>+import &quot;./module-execution-order-mixed-cocoa.js&quot;
+import &quot;./module-execution-order-mixed-cappuccino.js&quot;
+
+shouldBe(&quot;count++&quot;, &quot;3&quot;);
</ins></span></pre></div>
<a id="trunkLayoutTestsjsdommodulesscripttestsmoduleinlinedynamicjs"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/dom/modules/script-tests/module-inline-dynamic.js (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/dom/modules/script-tests/module-inline-dynamic.js                                (rev 0)
+++ trunk/LayoutTests/js/dom/modules/script-tests/module-inline-dynamic.js        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,5 @@
</span><ins>+export default class Cocoa {
+    taste() {
+        return &quot;awesome&quot;;
+    }
+};
</ins></span></pre></div>
<a id="trunkLayoutTestsjsdommodulesscripttestsmoduleinlinesimplejs"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/dom/modules/script-tests/module-inline-simple.js (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/dom/modules/script-tests/module-inline-simple.js                                (rev 0)
+++ trunk/LayoutTests/js/dom/modules/script-tests/module-inline-simple.js        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,5 @@
</span><ins>+export default class Cocoa {
+    taste() {
+        return &quot;awesome&quot;;
+    }
+};
</ins></span></pre></div>
<a id="trunkLayoutTestsjsdommodulesscripttestsmoduleloadeventwithsrcjs"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/dom/modules/script-tests/module-load-event-with-src.js (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/dom/modules/script-tests/module-load-event-with-src.js                                (rev 0)
+++ trunk/LayoutTests/js/dom/modules/script-tests/module-load-event-with-src.js        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,2 @@
</span><ins>+debug('Executing a module with src attribute.');
+window.moduleExecuted = true;
</ins></span></pre></div>
<a id="trunkLayoutTestsjsdommodulesscripttestsmoduleloadsamemodulefromdifferententrypointjs"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/dom/modules/script-tests/module-load-same-module-from-different-entry-point.js (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/dom/modules/script-tests/module-load-same-module-from-different-entry-point.js                                (rev 0)
+++ trunk/LayoutTests/js/dom/modules/script-tests/module-load-same-module-from-different-entry-point.js        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,2 @@
</span><ins>+debug('Executing module-load-same-module-from-different-entry-point.js.');
+window.moduleExecutedCount++;
</ins></span></pre></div>
<a id="trunkLayoutTestsjsdommodulesscripttestsmodulenotfounderroreventwithsrcandimportjs"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/dom/modules/script-tests/module-not-found-error-event-with-src-and-import.js (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/dom/modules/script-tests/module-not-found-error-event-with-src-and-import.js                                (rev 0)
+++ trunk/LayoutTests/js/dom/modules/script-tests/module-not-found-error-event-with-src-and-import.js        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+import &quot;./not-found.js&quot;
</ins></span></pre></div>
<a id="trunkLayoutTestsjsdommodulesscripttestsmodulesrccurrentscriptjs"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/dom/modules/script-tests/module-src-current-script.js (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/dom/modules/script-tests/module-src-current-script.js                                (rev 0)
+++ trunk/LayoutTests/js/dom/modules/script-tests/module-src-current-script.js        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,3 @@
</span><ins>+debug(&quot;Module execution is confined in the module environment.&quot;);
+shouldBe(&quot;document.currentScript&quot;, &quot;null&quot;);
+finishJSTest();
</ins></span></pre></div>
<a id="trunkLayoutTestsjsdommodulesscripttestsmodulesrcdynamiccocoajs"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/dom/modules/script-tests/module-src-dynamic-cocoa.js (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/dom/modules/script-tests/module-src-dynamic-cocoa.js                                (rev 0)
+++ trunk/LayoutTests/js/dom/modules/script-tests/module-src-dynamic-cocoa.js        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,7 @@
</span><ins>+class Cocoa {
+    taste() {
+        return &quot;nice&quot;;
+    }
+}
+
+export default Cocoa;
</ins></span></pre></div>
<a id="trunkLayoutTestsjsdommodulesscripttestsmodulesrcdynamicjs"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/dom/modules/script-tests/module-src-dynamic.js (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/dom/modules/script-tests/module-src-dynamic.js                                (rev 0)
+++ trunk/LayoutTests/js/dom/modules/script-tests/module-src-dynamic.js        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+import Cocoa from &quot;./module-src-dynamic-cocoa.js&quot;;
+var cocoa = new Cocoa();
+
+debug(&quot;Module execution is confined in the module environment.&quot;);
+shouldBeEqualToString(&quot;typeof cocoa&quot;, &quot;undefined&quot;);
+
+window.exportedCocoa = cocoa;
+shouldBeEqualToString(&quot;typeof exportedCocoa&quot;, &quot;object&quot;);
+shouldBeEqualToString(&quot;exportedCocoa.taste()&quot;, &quot;nice&quot;);
+finishJSTest();
</ins></span></pre></div>
<a id="trunkLayoutTestsjsdommodulesscripttestsmodulesrcsimplecocoajs"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/dom/modules/script-tests/module-src-simple-cocoa.js (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/dom/modules/script-tests/module-src-simple-cocoa.js                                (rev 0)
+++ trunk/LayoutTests/js/dom/modules/script-tests/module-src-simple-cocoa.js        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,7 @@
</span><ins>+class Cocoa {
+    taste() {
+        return &quot;nice&quot;;
+    }
+}
+
+export default Cocoa;
</ins></span></pre></div>
<a id="trunkLayoutTestsjsdommodulesscripttestsmodulesrcsimplejs"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/dom/modules/script-tests/module-src-simple.js (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/dom/modules/script-tests/module-src-simple.js                                (rev 0)
+++ trunk/LayoutTests/js/dom/modules/script-tests/module-src-simple.js        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+import Cocoa from &quot;./module-src-simple-cocoa.js&quot;;
+var cocoa = new Cocoa();
+
+debug(&quot;Module execution is confined in the module environment.&quot;);
+shouldBeEqualToString(&quot;typeof cocoa&quot;, &quot;undefined&quot;);
+
+window.exportedCocoa = cocoa;
+shouldBeEqualToString(&quot;typeof exportedCocoa&quot;, &quot;object&quot;);
+shouldBeEqualToString(&quot;exportedCocoa.taste()&quot;, &quot;nice&quot;);
+finishJSTest();
</ins></span></pre></div>
<a id="trunkLayoutTestsjsdommodulesscripttestsmodulewillfirebeforeloadjs"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/dom/modules/script-tests/module-will-fire-beforeload.js (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/dom/modules/script-tests/module-will-fire-beforeload.js                                (rev 0)
+++ trunk/LayoutTests/js/dom/modules/script-tests/module-will-fire-beforeload.js        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+testFailed(&quot;executed&quot;);
</ins></span></pre></div>
<a id="trunkSourceWebCoreCMakeListstxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/CMakeLists.txt (208787 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/CMakeLists.txt        2016-11-16 09:08:23 UTC (rev 208787)
+++ trunk/Source/WebCore/CMakeLists.txt        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -1068,6 +1068,8 @@
</span><span class="cx">     bindings/generic/RuntimeEnabledFeatures.cpp
</span><span class="cx"> 
</span><span class="cx">     bindings/js/ArrayValue.cpp
</span><ins>+    bindings/js/CachedModuleScript.cpp
+    bindings/js/CachedModuleScriptLoader.cpp
</ins><span class="cx">     bindings/js/CallbackFunction.cpp
</span><span class="cx">     bindings/js/DOMWrapperWorld.cpp
</span><span class="cx">     bindings/js/Dictionary.cpp
</span><span class="lines">@@ -1465,6 +1467,7 @@
</span><span class="cx">     dom/KeyboardEvent.cpp
</span><span class="cx">     dom/LiveNodeList.cpp
</span><span class="cx">     dom/LoadableClassicScript.cpp
</span><ins>+    dom/LoadableModuleScript.cpp
</ins><span class="cx">     dom/LoadableScript.cpp
</span><span class="cx">     dom/MessageChannel.cpp
</span><span class="cx">     dom/MessageEvent.cpp
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (208787 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-11-16 09:08:23 UTC (rev 208787)
+++ trunk/Source/WebCore/ChangeLog        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -1,3 +1,241 @@
</span><ins>+2016-11-16  Yusuke Suzuki  &lt;utatane.tea@gmail.com&gt;
+
+        [ES6] Integrate ES6 Modules into WebCore
+        https://bugs.webkit.org/show_bug.cgi?id=148897
+
+        Reviewed by Ryosuke Niwa.
+
+        This patch introduces ES6 Modules into WebCore. We integrate JSC's JSModuleLoader into WebCore.
+        JSC constructs the module loader pipeline by the chains of the promises. To handle this,
+        the following components are added.
+
+            1. CachedModuleScript
+
+                CachedModuleScript wraps the promise based JSModuleLoader pipeline and offers
+                similar APIs to CachedScript. ScriptElement and PendingScript interact with
+                CachedModuleScript when the script tag is the module tag instead of CachedScript.
+                ScriptElement and PendingScript will receive the notification from
+                CachedModuleScript by implementing CachedModuleScriptClient.
+
+            2. ScriptModuleLoader
+
+                This is the module loader instantiated per document. It manages fetching and
+                offers the callbacks for the JSC's JSModuleLoader implementation. ScriptModuleLoader
+                will fetch the resource by creating CachedModuleScriptLoader per resource. ScriptModuleLoader
+                will receive the notification by implementing CachedModuleScriptLoaderClient. When the
+                resource is fetched, the module loader will drive the promise resolve/reject chain.
+
+            3. CachedModuleScriptLoader
+
+                This fetches the resource by using CachedScript. Using CachedScript means that it
+                automatically reports the resource to the inspector. CachedModuleScriptLoader notify to
+                ScriptModuleLoader when the resource is fetched.
+
+        One tricky point is that the fetch requests issued from one module-graph should share the same
+        nonce, crossorigin attributes etc.
+
+            Here, we wrote the module graph like `A -&gt; B (A depends on B)`.
+
+            &lt;script tag&gt; -&gt; A -&gt; B -&gt; C -&gt; D
+
+        When fetching A, B, C, and D modules, we need to set the same nonce, crossorigin etc. configuration
+        derived from the original script tag. So per module-graph information should be shared throughout
+        the module loader pipeline. To do so, JSC's module loader implementation can take the value called
+        `initiator`. Since the loader will propagate &amp; share this `initiator` throughout the pipeline,
+        we can transfer and share some metadata. Currently, we pass the JSWrapper of the script tag as the
+        initiator. Each fetch request is created by using this initiator script element.
+
+        More integration into the inspector should be done in the subsequent patch.
+
+        * CMakeLists.txt:
+        * WebCore.xcodeproj/project.pbxproj:
+        * bindings/js/CachedModuleScript.cpp: Added.
+        CachedModuleScript offers similar interface to CachedScript to make ScriptElement things easier. It encapsulates the
+        detail of the JSC JSModuleLoader that this module loader is driven by the chain of the promises. CachedModuleScript's
+        callbacks are called from the promise's handlers configured in ScriptController::loadModuleScript.
+        (WebCore::CachedModuleScript::create):
+        (WebCore::CachedModuleScript::CachedModuleScript):
+        (WebCore::CachedModuleScript::load):
+        (WebCore::CachedModuleScript::notifyLoadCompleted):
+        (WebCore::CachedModuleScript::notifyLoadFailed):
+        (WebCore::CachedModuleScript::notifyLoadWasCanceled):
+        (WebCore::CachedModuleScript::notifyClientFinished):
+        (WebCore::CachedModuleScript::addClient):
+        (WebCore::CachedModuleScript::removeClient):
+        * bindings/js/CachedModuleScript.h: Added.
+        (WebCore::CachedModuleScript::moduleKey):
+        (WebCore::CachedModuleScript::error):
+        (WebCore::CachedModuleScript::wasCanceled):
+        (WebCore::CachedModuleScript::isLoaded):
+        (WebCore::CachedModuleScript::nonce):
+        (WebCore::CachedModuleScript::crossOriginMode):
+        Save nonce and crossorigin attributes when we start ScriptElement::prepareScript.
+        * bindings/js/CachedModuleScriptClient.h: Copied from Source/WebCore/dom/LoadableScript.h.
+        (WebCore::CachedModuleScriptClient::~CachedModuleScriptClient):
+        * bindings/js/CachedModuleScriptLoader.cpp: Added.
+        CachedModuleScriptLoader is responsible to fetching the resource for the module script. It uses propagated `initiator`
+        to create the request. This initiator is the JS wrapper of the script element issuing this fetching request. The name
+        `initiator` is derived from the request.setInitiator(). Once the resource is fetched, the fetcher will notify to the
+        client. Currently, ScriptModuleLoader implements this client interface.
+        (WebCore::CachedModuleScriptLoader::create):
+        (WebCore::CachedModuleScriptLoader::CachedModuleScriptLoader):
+        (WebCore::CachedModuleScriptLoader::~CachedModuleScriptLoader):
+        (WebCore::CachedModuleScriptLoader::load):
+        Create the request. We call ScriptElement::requestCachedScript to initiate a new fetching request. At that time,
+        nonce and crossorigin (and charset) attributes of this element are applied to the new request.
+        (WebCore::CachedModuleScriptLoader::notifyFinished):
+        * bindings/js/CachedModuleScriptLoader.h: Copied from Source/WebCore/bindings/js/ScriptModuleLoader.h.
+        * bindings/js/CachedModuleScriptLoaderClient.h: Copied from Source/WebCore/dom/LoadableScript.h.
+        (WebCore::CachedModuleScriptLoaderClient::~CachedModuleScriptLoaderClient):
+        * bindings/js/CachedScriptSourceProvider.h:
+        (WebCore::CachedScriptSourceProvider::create):
+        (WebCore::CachedScriptSourceProvider::CachedScriptSourceProvider):
+        (WebCore::makeSource):
+        * bindings/js/JSBindingsAllInOne.cpp:
+        * bindings/js/JSDOMBinding.cpp:
+        (WebCore::retrieveErrorMessage):
+        (WebCore::reportException):
+        * bindings/js/JSDOMBinding.h:
+        * bindings/js/JSMainThreadExecState.h:
+        (WebCore::JSMainThreadExecState::loadModule):
+        (WebCore::JSMainThreadExecState::linkAndEvaluateModule):
+        * bindings/js/ScriptController.cpp:
+        (WebCore::ScriptController::evaluateInWorld):
+        (WebCore::ScriptController::loadModuleScriptInWorld):
+        (WebCore::ScriptController::loadModuleScript):
+        This just performs loading and not executing the module graph. Once the module graph is loaded, it is notified to
+        the given CachedModuleScript.
+        (WebCore::ScriptController::linkAndEvaluateModuleScriptInWorld):
+        (WebCore::ScriptController::linkAndEvaluateModuleScript):
+        This executes the linking and evaluation of the already instantiated module graph. After loading the module graph,
+        we call this function for the module to evaluate it. This is called from ScriptElement::executeModuleScript.
+        (WebCore::ScriptController::evaluateModule):
+        Every time we evaluate the module, the ScriptModuleLoader::evaluate hook is called. So the loader calls this function
+        to actually evaluate the module.
+        (WebCore::jsValueToModuleKey):
+        (WebCore::ScriptController::setupModuleScriptHandlers):
+        The JSC's module loader is driven by the chain of the promise. So here, we convert this to CachedModuleScript /
+        CachedModuleScriptClient style and encapsulate the details. This encapsulation makes CachedModuleScript similar
+        to CachedScript and it makes things simple in the rest of WebCore. If the propagated error is already reported
+        to the inspector, we receive moduleLoaderAlreadyReportedErrorSymbol as the error value. So at that case, we
+        don't report it twice. If the rejection is caused due to the canceled fetching, moduleLoaderFetchingIsCanceledSymbol
+        appears as the error value. In that case, we will call CachedModuleScript::notifyLoadWasCanceled.
+        (WebCore::ScriptController::executeScript):
+        * bindings/js/ScriptController.h:
+        (WebCore::ScriptController::moduleLoaderAlreadyReportedErrorSymbol):
+        (WebCore::ScriptController::moduleLoaderFetchingIsCanceledSymbol):
+        * bindings/js/ScriptModuleLoader.cpp:
+        We use DeferredWrapper to resolve promises used for the module pipeline. Thus, once the active DOM objects are
+        suspended, the module loader propagation stops.
+        (WebCore::ScriptModuleLoader::~ScriptModuleLoader):
+        Clear the clients of the fetchers issued from this loader.
+        (WebCore::isRootModule):
+        (WebCore::ScriptModuleLoader::resolve):
+        Resolve the module specifier (that is written in `import from &quot;XXX&quot;`) to the unique module key. We use URL
+        string as module key. The edge case is that the module is inlined one. In that case, we don't have any URL
+        for that. Instead of URL, we use symbol at that time.
+        (WebCore::ScriptModuleLoader::fetch):
+        Start fetching for the requested module. It returns the promise that is resolved when the fetching is done.
+        The loader creates the fetcher, and the fetcher start loading the resource. Once the fetcher loads the resource,
+        it notify to the loader through CachedModuleScriptLoaderClient interface. Since we pass the original script
+        element as the `initiator` here, the fetcher can use this initiator to create the request. While the result of
+        CachedResource has 3 variations (loaded, canceled, error occurred), Promise only tells us whether it is resolved
+        or rejected. When CachedModuleScript gets the result from the promise chain, it needs to know which the result is.
+        To transfer the canceled information, we reject the promise with the special symbol `moduleLoaderAlreadyReportedErrorSymbol`.
+        This offers the way to distinguish the canceled error from the other errors.
+        (WebCore::ScriptModuleLoader::evaluate):
+        This is the hook function that is called when JSC's JSModuleLoader attempts to execute each module.
+        (WebCore::ScriptModuleLoader::notifyFinished):
+        This function is called when the fetcher completes. We will resolve the promise with the result of the fetching.
+        The module loader pipeline is constructed as a chain of promises.
+        Rejecting a promise when some error occurs is important because the execution flow of
+        the promise chain is driven by &quot;rejected&quot; or &quot;fulfilled&quot; events.
+        If the promise is not rejected while error occurs, reject handler won't be executed
+        and all the subsequent promise chain will wait the result forever.
+        As a result, even if the error is already reported to the inspector elsewhere,
+        it should be propagated in the pipeline. For example, the error of loading
+        CachedResource is already reported to the inspector by the loader. But we still need
+        to reject the promise to propagate this error to the script element.
+        At that time, we don't want to report the same error twice. When we propagate the error
+        that is already reported to the inspector, we throw moduleLoaderAlreadyReportedErrorSymbol
+        symbol instead. By comparing the thrown error with this symbol, we can distinguish errors raised
+        when checking syntax of a module script from errors reported already.
+        In the reject handler of the promise, we only report a error that is not this symbol.
+        And mime type checking is done here since the module script always require this check.
+        * bindings/js/ScriptModuleLoader.h:
+        (WebCore::ScriptModuleLoader::document): Deleted.
+        * bindings/js/ScriptSourceCode.h:
+        (WebCore::ScriptSourceCode::ScriptSourceCode):
+        * dom/CurrentScriptIncrementer.h:
+        (WebCore::CurrentScriptIncrementer::CurrentScriptIncrementer):
+        * dom/LoadableClassicScript.cpp:
+        (WebCore::LoadableClassicScript::error):
+        (WebCore::LoadableClassicScript::execute):
+        (WebCore::LoadableClassicScript::wasErrored): Deleted.
+        * dom/LoadableClassicScript.h:
+        * dom/LoadableModuleScript.cpp: Copied from Source/WebCore/dom/LoadableScript.h.
+        This is the derived class from LoadableScript. It is used for the script module graphs.
+        (WebCore::LoadableModuleScript::create):
+        (WebCore::LoadableModuleScript::LoadableModuleScript):
+        (WebCore::LoadableModuleScript::~LoadableModuleScript):
+        (WebCore::LoadableModuleScript::isLoaded):
+        (WebCore::LoadableModuleScript::error):
+        (WebCore::LoadableModuleScript::wasCanceled):
+        (WebCore::LoadableModuleScript::notifyFinished):
+        (WebCore::LoadableModuleScript::execute):
+        * dom/LoadableModuleScript.h: Copied from Source/WebCore/dom/LoadableScript.h.
+        (isType):
+        * dom/LoadableScript.h:
+        (WebCore::LoadableScript::isModuleScript):
+        (WebCore::LoadableScript::isModuleGraph): Deleted.
+        * dom/PendingScript.cpp:
+        (WebCore::PendingScript::error):
+        (WebCore::PendingScript::wasErrored): Deleted.
+        * dom/PendingScript.h:
+        * dom/ScriptElement.cpp:
+        (WebCore::ScriptElement::ScriptElement):
+        (WebCore::ScriptElement::determineScriptType):
+        (WebCore::ScriptElement::prepareScript):
+        prepareScript is aligned to whatwg spec: the last sequence to setup flags has one-on-one correspondence to
+        the spec now. And prepareScript recognizes the type=&quot;module&quot; case and call the requestModuleScript to setup
+        the CachedModuleScript.
+        (WebCore::ScriptElement::requestClassicScript):
+        (WebCore::ScriptElement::requestModuleScript):
+        We use the nonce and crossorigin attributes at the time of preparing the script tag. To do so, we store the
+        above values in CachedModuleScript.
+        Since inlined module scripts does not have &quot;src&quot; attribute, it is also affected by Content Security Policy's
+        inline script rules.
+        (WebCore::ScriptElement::requestScriptWithCacheForModuleScript):
+        The module loader will construct the fetching request by calling this function. This should be here since we
+        would like to set this Element to the initiator of the request. And nonce and crossorigin attributes of this
+        script tag will be used.
+        (WebCore::ScriptElement::requestScriptWithCache):
+        (WebCore::ScriptElement::executeScript):
+        (WebCore::ScriptElement::executeModuleScript):
+        The entry point to execute the module graph. Since the module graph is beyond the multiple CachedScript code,
+        we have the different entry point from ScriptElement::executeScript.
+        (WebCore::ScriptElement::executeScriptAndDispatchEvent):
+        (WebCore::ScriptElement::executeScriptForScriptRunner):
+        * dom/ScriptElement.h:
+        (WebCore::ScriptElement::scriptType):
+        * html/parser/CSSPreloadScanner.cpp:
+        (WebCore::CSSPreloadScanner::emitRule):
+        * html/parser/HTMLPreloadScanner.cpp:
+        (WebCore::TokenPreloadScanner::StartTagScanner::createPreloadRequest):
+        According to the spec, the module tag ignores the &quot;charset&quot; attribute as the same to the worker's
+        importScript. But WebKit supports the &quot;charset&quot; for importScript intentionally. So to be consistent,
+        even for the module tags, we handle the &quot;charset&quot; attribute. We explicitly note about it in the preloader.
+        (WebCore::TokenPreloadScanner::StartTagScanner::processAttribute):
+        * html/parser/HTMLResourcePreloader.cpp:
+        (WebCore::PreloadRequest::resourceRequest):
+        * html/parser/HTMLResourcePreloader.h:
+        (WebCore::PreloadRequest::PreloadRequest):
+        * html/parser/HTMLScriptRunner.h:
+        * loader/cache/CachedResourceRequest.cpp:
+        (WebCore::CachedResourceRequest::setAsPotentiallyCrossOrigin):
+        * xml/parser/XMLDocumentParser.cpp:
+        (WebCore::XMLDocumentParser::notifyFinished):
+
</ins><span class="cx"> 2016-11-15  Alejandro G. Castro  &lt;alex@igalia.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Warning added in r208542
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (208787 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2016-11-16 09:08:23 UTC (rev 208787)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -6258,6 +6258,14 @@
</span><span class="cx">                 E1FF57A60F01256B00891EBB /* ThreadGlobalData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1FF57A50F01256B00891EBB /* ThreadGlobalData.cpp */; };
</span><span class="cx">                 E1FF8F6C180DB5BE00132674 /* CryptoAlgorithmRegistry.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1FF8F6A180DB5BE00132674 /* CryptoAlgorithmRegistry.cpp */; };
</span><span class="cx">                 E1FF8F6D180DB5BE00132674 /* CryptoAlgorithmRegistry.h in Headers */ = {isa = PBXBuildFile; fileRef = E1FF8F6B180DB5BE00132674 /* CryptoAlgorithmRegistry.h */; };
</span><ins>+                E307DECC1D81E4B300141CAF /* CachedModuleScript.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E307DEC91D81E46E00141CAF /* CachedModuleScript.cpp */; };
+                E307DECD1D81E4B600141CAF /* CachedModuleScript.h in Headers */ = {isa = PBXBuildFile; fileRef = E307DECA1D81E46E00141CAF /* CachedModuleScript.h */; settings = {ATTRIBUTES = (Private, ); }; };
+                E307DECE1D81E4BA00141CAF /* CachedModuleScriptClient.h in Headers */ = {isa = PBXBuildFile; fileRef = E307DECB1D81E49500141CAF /* CachedModuleScriptClient.h */; settings = {ATTRIBUTES = (Private, ); }; };
+                E307DECF1D81E4C300141CAF /* CachedModuleScriptLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E307DEC61D81E44800141CAF /* CachedModuleScriptLoader.cpp */; };
+                E307DED01D81E4C700141CAF /* CachedModuleScriptLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = E307DEC71D81E44800141CAF /* CachedModuleScriptLoader.h */; settings = {ATTRIBUTES = (Private, ); }; };
+                E307DED11D81E4CB00141CAF /* CachedModuleScriptLoaderClient.h in Headers */ = {isa = PBXBuildFile; fileRef = E307DEC81D81E44800141CAF /* CachedModuleScriptLoaderClient.h */; settings = {ATTRIBUTES = (Private, ); }; };
+                E307DED41D81E4F000141CAF /* LoadableModuleScript.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E307DED21D81E4ED00141CAF /* LoadableModuleScript.cpp */; };
+                E307DED51D81E4F200141CAF /* LoadableModuleScript.h in Headers */ = {isa = PBXBuildFile; fileRef = E307DED31D81E4ED00141CAF /* LoadableModuleScript.h */; settings = {ATTRIBUTES = (Private, ); }; };
</ins><span class="cx">                 E3150EA61DA7219000194012 /* JSNodeDOMJIT.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E3AFA9641DA6E908002861BD /* JSNodeDOMJIT.cpp */; };
</span><span class="cx">                 E3150EA71DA7219300194012 /* DOMJITHelpers.h in Headers */ = {isa = PBXBuildFile; fileRef = E3150EA51DA7218D00194012 /* DOMJITHelpers.h */; };
</span><span class="cx">                 E318039D1DC40099009932C2 /* JSDynamicDowncast.h in Headers */ = {isa = PBXBuildFile; fileRef = E3A5872E1DC3F52600F607A6 /* JSDynamicDowncast.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="lines">@@ -14201,6 +14209,14 @@
</span><span class="cx">                 E1FF8F661807460800132674 /* JSWebKitSubtleCryptoCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSWebKitSubtleCryptoCustom.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 E1FF8F6A180DB5BE00132674 /* CryptoAlgorithmRegistry.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CryptoAlgorithmRegistry.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 E1FF8F6B180DB5BE00132674 /* CryptoAlgorithmRegistry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CryptoAlgorithmRegistry.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                E307DEC61D81E44800141CAF /* CachedModuleScriptLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CachedModuleScriptLoader.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                E307DEC71D81E44800141CAF /* CachedModuleScriptLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CachedModuleScriptLoader.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                E307DEC81D81E44800141CAF /* CachedModuleScriptLoaderClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CachedModuleScriptLoaderClient.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                E307DEC91D81E46E00141CAF /* CachedModuleScript.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CachedModuleScript.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                E307DECA1D81E46E00141CAF /* CachedModuleScript.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CachedModuleScript.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                E307DECB1D81E49500141CAF /* CachedModuleScriptClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CachedModuleScriptClient.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                E307DED21D81E4ED00141CAF /* LoadableModuleScript.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LoadableModuleScript.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                E307DED31D81E4ED00141CAF /* LoadableModuleScript.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LoadableModuleScript.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 E3150EA51DA7218D00194012 /* DOMJITHelpers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMJITHelpers.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 E334825E1DC93AA0009C9544 /* DOMJITAbstractHeapRepository.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMJITAbstractHeapRepository.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 E34EE49F1DC2D57500EAA9D3 /* JSEventCustom.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSEventCustom.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -21781,6 +21797,9 @@
</span><span class="cx">                                 49B3760A15C6C6840059131D /* ArrayValue.cpp */,
</span><span class="cx">                                 49B3760B15C6C6840059131D /* ArrayValue.h */,
</span><span class="cx">                                 2DFA488E1DB541C200362B99 /* BufferSource.h */,
</span><ins>+                                E307DEC61D81E44800141CAF /* CachedModuleScriptLoader.cpp */,
+                                E307DEC71D81E44800141CAF /* CachedModuleScriptLoader.h */,
+                                E307DEC81D81E44800141CAF /* CachedModuleScriptLoaderClient.h */,
</ins><span class="cx">                                 BCD533630ED6848900887468 /* CachedScriptSourceProvider.h */,
</span><span class="cx">                                 93F8B3060A300FEA00F61AB8 /* CodeGeneratorJS.pm */,
</span><span class="cx">                                 312D67B01535691F00563D0D /* Dictionary.cpp */,
</span><span class="lines">@@ -21861,6 +21880,9 @@
</span><span class="cx">                                 41F066E20F64BCF600A07EAC /* ScriptGlobalObject.h */,
</span><span class="cx">                                 E38838941BAD145F00D62EE3 /* ScriptModuleLoader.cpp */,
</span><span class="cx">                                 E38838951BAD145F00D62EE3 /* ScriptModuleLoader.h */,
</span><ins>+                                E307DEC91D81E46E00141CAF /* CachedModuleScript.cpp */,
+                                E307DECA1D81E46E00141CAF /* CachedModuleScript.h */,
+                                E307DECB1D81E49500141CAF /* CachedModuleScriptClient.h */,
</ins><span class="cx">                                 934CC1090EDB223900A658F2 /* ScriptSourceCode.h */,
</span><span class="cx">                                 4127D5360F8AAB1D00E424F5 /* ScriptState.cpp */,
</span><span class="cx">                                 41C760B00EDE03D300C1655F /* ScriptState.h */,
</span><span class="lines">@@ -24003,6 +24025,8 @@
</span><span class="cx">                                 E3B2F0E41D7F35EC00B0C9D1 /* LoadableClassicScript.h */,
</span><span class="cx">                                 E3B2F0E91D7F3D3C00B0C9D1 /* LoadableScript.cpp */,
</span><span class="cx">                                 E3B2F0E71D7F35EC00B0C9D1 /* LoadableScript.h */,
</span><ins>+                                E307DED21D81E4ED00141CAF /* LoadableModuleScript.cpp */,
+                                E307DED31D81E4ED00141CAF /* LoadableModuleScript.h */,
</ins><span class="cx">                                 E3B2F0E81D7F35EC00B0C9D1 /* LoadableScriptClient.h */,
</span><span class="cx">                                 BC9A6144146859D9006057FD /* make_dom_exceptions.pl */,
</span><span class="cx">                                 BC9A6145146859D9006057FD /* make_event_factory.pl */,
</span><span class="lines">@@ -24910,6 +24934,7 @@
</span><span class="cx">                                 BCC065810F3CE1B700CD2D87 /* ClientRectList.h in Headers */,
</span><span class="cx">                                 7C3A91E61C963B8800D1A7E3 /* ClipboardAccessPolicy.h in Headers */,
</span><span class="cx">                                 85031B400A44EFC700F992E0 /* ClipboardEvent.h in Headers */,
</span><ins>+                                E307DED01D81E4C700141CAF /* CachedModuleScriptLoader.h in Headers */,
</ins><span class="cx">                                 FB92DF4B15FED08700994433 /* ClipPathOperation.h in Headers */,
</span><span class="cx">                                 580371621A66F00A00BAF519 /* ClipRect.h in Headers */,
</span><span class="cx">                                 97AABD1314FA09D5007457AE /* CloseEvent.h in Headers */,
</span><span class="lines">@@ -25724,6 +25749,7 @@
</span><span class="cx">                                 514129991C6976900059E714 /* IDBRequestCompletionEvent.h in Headers */,
</span><span class="cx">                                 510A58FA1BACC7F200C19282 /* IDBRequestData.h in Headers */,
</span><span class="cx">                                 5145B10A1BC48E2E00E86219 /* IDBResourceIdentifier.h in Headers */,
</span><ins>+                                E307DED11D81E4CB00141CAF /* CachedModuleScriptLoaderClient.h in Headers */,
</ins><span class="cx">                                 51D7236D1BB6174900478CA3 /* IDBResultData.h in Headers */,
</span><span class="cx">                                 511EC1281C50AACA0032F983 /* IDBSerialization.h in Headers */,
</span><span class="cx">                                 5185FCBB1BB4CBF80012898F /* IDBServer.h in Headers */,
</span><span class="lines">@@ -25973,6 +25999,7 @@
</span><span class="cx">                                 7694563D1214D97C0007CBAE /* JSDOMTokenList.h in Headers */,
</span><span class="cx">                                 2E37E00612DBC5A400A6B233 /* JSDOMURL.h in Headers */,
</span><span class="cx">                                 BC6932740D7E293900AE44D1 /* JSDOMWindowBase.h in Headers */,
</span><ins>+                                E307DECE1D81E4BA00141CAF /* CachedModuleScriptClient.h in Headers */,
</ins><span class="cx">                                 652FBBBC0DE27CB60001D386 /* JSDOMWindowCustom.h in Headers */,
</span><span class="cx">                                 460CBF361D4BCD0E0092E88E /* JSDOMWindowProperties.h in Headers */,
</span><span class="cx">                                 BCBFB53D0DCD29CF0019B3E5 /* JSDOMWindowShell.h in Headers */,
</span><span class="lines">@@ -26853,6 +26880,7 @@
</span><span class="cx">                                 A5F8CD121D18F32E00AC0E53 /* PageHeapAgent.h in Headers */,
</span><span class="cx">                                 2D5C9D0019C7B52E00B3C5C1 /* PageOverlay.h in Headers */,
</span><span class="cx">                                 2D5C9D0219C7B52E00B3C5C1 /* PageOverlayController.h in Headers */,
</span><ins>+                                E307DED51D81E4F200141CAF /* LoadableModuleScript.h in Headers */,
</ins><span class="cx">                                 FBDB61A116D6037E00BB3394 /* PageRuleCollector.h in Headers */,
</span><span class="cx">                                 F3820895147D35F90010BC06 /* PageRuntimeAgent.h in Headers */,
</span><span class="cx">                                 A5F36D3B18F758720054C024 /* PageScriptDebugServer.h in Headers */,
</span><span class="lines">@@ -27494,6 +27522,7 @@
</span><span class="cx">                                 A80E6DFC0A199067007FB8C5 /* StyleProperties.h in Headers */,
</span><span class="cx">                                 E1B25107152A0BB00069B779 /* StylePropertyShorthand.h in Headers */,
</span><span class="cx">                                 83C05A5B1A686212007E5DEA /* StylePropertyShorthandFunctions.h in Headers */,
</span><ins>+                                E307DECD1D81E4B600141CAF /* CachedModuleScript.h in Headers */,
</ins><span class="cx">                                 BC2272E40E82EE9B00E7F975 /* StyleRareInheritedData.h in Headers */,
</span><span class="cx">                                 BC2272BD0E82EAAE00E7F975 /* StyleRareNonInheritedData.h in Headers */,
</span><span class="cx">                                 BC2272870E82E70700E7F975 /* StyleReflection.h in Headers */,
</span><span class="lines">@@ -28940,6 +28969,7 @@
</span><span class="cx">                                 BC1790BD1BBB36A80006D13E /* CSSVariableDependentValue.cpp in Sources */,
</span><span class="cx">                                 9444CBD91D88483A0073A074 /* CSSVariableParser.cpp in Sources */,
</span><span class="cx">                                 9444CBE91D8861CA0073A074 /* CSSVariableReferenceValue.cpp in Sources */,
</span><ins>+                                E307DECF1D81E4C300141CAF /* CachedModuleScriptLoader.cpp in Sources */,
</ins><span class="cx">                                 BC1790C01BBF2C430006D13E /* CSSVariableValue.cpp in Sources */,
</span><span class="cx">                                 E11AF15111B9A1A300805103 /* Cursor.cpp in Sources */,
</span><span class="cx">                                 265541521489B233000DFC5D /* CursorIOS.cpp in Sources */,
</span><span class="lines">@@ -29441,6 +29471,7 @@
</span><span class="cx">                                 5160712E1BD8307800DBC4F2 /* IDBObjectStoreInfo.cpp in Sources */,
</span><span class="cx">                                 5185FCA31BB4C4E80012898F /* IDBOpenDBRequest.cpp in Sources */,
</span><span class="cx">                                 5185FCA81BB4C4E80012898F /* IDBRequest.cpp in Sources */,
</span><ins>+                                E307DECC1D81E4B300141CAF /* CachedModuleScript.cpp in Sources */,
</ins><span class="cx">                                 514129981C6976900059E714 /* IDBRequestCompletionEvent.cpp in Sources */,
</span><span class="cx">                                 510A58F91BACC7F200C19282 /* IDBRequestData.cpp in Sources */,
</span><span class="cx">                                 5145B1091BC48E2E00E86219 /* IDBResourceIdentifier.cpp in Sources */,
</span><span class="lines">@@ -30084,6 +30115,7 @@
</span><span class="cx">                                 B222F69C0AB771B80022EFAD /* JSSVGElement.cpp in Sources */,
</span><span class="cx">                                 8542A79A0AE5C94400DF58DF /* JSSVGElementWrapperFactory.cpp in Sources */,
</span><span class="cx">                                 B2FA3D680AB75A6F000E5AC4 /* JSSVGEllipseElement.cpp in Sources */,
</span><ins>+                                E307DED41D81E4F000141CAF /* LoadableModuleScript.cpp in Sources */,
</ins><span class="cx">                                 B266CD4D0C3AEC6500EB08D2 /* JSSVGException.cpp in Sources */,
</span><span class="cx">                                 B2FA3D6A0AB75A6F000E5AC4 /* JSSVGFEBlendElement.cpp in Sources */,
</span><span class="cx">                                 B2FA3D6C0AB75A6F000E5AC4 /* JSSVGFEColorMatrixElement.cpp in Sources */,
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsCachedModuleScriptcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/bindings/js/CachedModuleScript.cpp (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/CachedModuleScript.cpp                                (rev 0)
+++ trunk/Source/WebCore/bindings/js/CachedModuleScript.cpp        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,110 @@
</span><ins>+/*
+ * Copyright (C) 2015-2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``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 ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include &quot;config.h&quot;
+#include &quot;CachedModuleScript.h&quot;
+
+#include &quot;CachedModuleScriptClient.h&quot;
+#include &quot;DOMWrapperWorld.h&quot;
+#include &quot;Document.h&quot;
+#include &quot;Element.h&quot;
+#include &quot;ExceptionCode.h&quot;
+#include &quot;Frame.h&quot;
+#include &quot;ScriptController.h&quot;
+#include &quot;ScriptElement.h&quot;
+#include &quot;ScriptModuleLoader.h&quot;
+#include &quot;ScriptRunner.h&quot;
+#include &quot;ScriptSourceCode.h&quot;
+
+namespace WebCore {
+
+Ref&lt;CachedModuleScript&gt; CachedModuleScript::create(const String&amp; nonce, const String&amp; crossOriginMode)
+{
+    return adoptRef(*new CachedModuleScript(nonce, crossOriginMode));
+}
+
+CachedModuleScript::CachedModuleScript(const String&amp; nonce, const String&amp; crossOriginMode)
+    : m_nonce(nonce)
+    , m_crossOriginMode(crossOriginMode)
+{
+}
+
+void CachedModuleScript::load(Element&amp; initiator, const URL&amp; rootURL)
+{
+    if (auto* frame = initiator.document().frame())
+        frame-&gt;script().loadModuleScript(*this, rootURL.string(), initiator);
+}
+
+void CachedModuleScript::load(Element&amp; initiator, const ScriptSourceCode&amp; sourceCode)
+{
+    if (auto* frame = initiator.document().frame())
+        frame-&gt;script().loadModuleScript(*this, sourceCode, initiator);
+}
+
+void CachedModuleScript::notifyLoadCompleted(UniquedStringImpl&amp; moduleKey)
+{
+    m_moduleKey = &amp;moduleKey;
+    notifyClientFinished();
+}
+
+void CachedModuleScript::notifyLoadFailed(LoadableScript::Error&amp;&amp; error)
+{
+    m_error = WTFMove(error);
+    notifyClientFinished();
+}
+
+void CachedModuleScript::notifyLoadWasCanceled()
+{
+    m_wasCanceled = true;
+    notifyClientFinished();
+}
+
+void CachedModuleScript::notifyClientFinished()
+{
+    m_isLoaded = true;
+
+    Ref&lt;CachedModuleScript&gt; protectedThis(*this);
+
+    Vector&lt;CachedModuleScriptClient*&gt; clients;
+    copyToVector(m_clients, clients);
+    for (auto&amp; client : clients)
+        client-&gt;notifyFinished(*this);
+}
+
+void CachedModuleScript::addClient(CachedModuleScriptClient&amp; client)
+{
+    m_clients.add(&amp;client);
+    if (!isLoaded())
+        return;
+    Ref&lt;CachedModuleScript&gt; protectedThis(*this);
+    client.notifyFinished(*this);
+}
+
+void CachedModuleScript::removeClient(CachedModuleScriptClient&amp; client)
+{
+    m_clients.remove(&amp;client);
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceWebCorebindingsjsCachedModuleScripth"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/bindings/js/CachedModuleScript.h (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/CachedModuleScript.h                                (rev 0)
+++ trunk/Source/WebCore/bindings/js/CachedModuleScript.h        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,77 @@
</span><ins>+/*
+ * Copyright (C) 2015, 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``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 ITS 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 &quot;CachedModuleScriptLoader.h&quot;
+#include &quot;LoadableScript.h&quot;
+#include &lt;runtime/JSInternalPromise.h&gt;
+
+namespace WebCore {
+
+class CachedModuleScriptClient;
+class Element;
+class ScriptSourceCode;
+
+class CachedModuleScript : public RefCounted&lt;CachedModuleScript&gt; {
+public:
+    UniquedStringImpl* moduleKey() { return m_moduleKey.get(); }
+
+    void evaluate(Element&amp;);
+
+    void notifyLoadCompleted(UniquedStringImpl&amp; moduleKey);
+    void notifyLoadFailed(LoadableScript::Error&amp;&amp;);
+    void notifyLoadWasCanceled();
+
+    const Optional&lt;LoadableScript::Error&gt;&amp; error() const { return m_error; }
+    bool wasCanceled() const { return m_wasCanceled; }
+    bool isLoaded() const { return m_isLoaded; }
+
+    void addClient(CachedModuleScriptClient&amp;);
+    void removeClient(CachedModuleScriptClient&amp;);
+
+    static Ref&lt;CachedModuleScript&gt; create(const String&amp; nonce, const String&amp; crossOriginMode);
+
+    void load(Element&amp; initiator, const URL&amp; rootURL);
+    void load(Element&amp; initiator, const ScriptSourceCode&amp;);
+
+    const String&amp; nonce() const { return m_nonce; }
+    const String&amp; crossOriginMode() const { return m_crossOriginMode; }
+
+private:
+    CachedModuleScript(const String&amp; nonce, const String&amp; crossOriginMode);
+
+    void notifyClientFinished();
+
+    RefPtr&lt;UniquedStringImpl&gt; m_moduleKey;
+    HashCountedSet&lt;CachedModuleScriptClient*&gt; m_clients;
+    String m_nonce;
+    String m_crossOriginMode;
+    Optional&lt;LoadableScript::Error&gt; m_error;
+    bool m_wasCanceled { false };
+    bool m_isLoaded { false };
+};
+
+} // namespace WebCore
</ins></span></pre></div>
<a id="trunkSourceWebCorebindingsjsCachedModuleScriptClienthfromrev208787trunkSourceWebCoredomLoadableScripth"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebCore/bindings/js/CachedModuleScriptClient.h (from rev 208787, trunk/Source/WebCore/dom/LoadableScript.h) (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/CachedModuleScriptClient.h                                (rev 0)
+++ trunk/Source/WebCore/bindings/js/CachedModuleScriptClient.h        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,39 @@
</span><ins>+/*
+ * Copyright (C) 2016 Apple, Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE 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
+
+namespace WebCore {
+
+class CachedModuleScript;
+
+class CachedModuleScriptClient {
+public:
+    virtual ~CachedModuleScriptClient() { }
+
+    virtual void notifyFinished(CachedModuleScript&amp;) = 0;
+};
+
+}
</ins></span></pre></div>
<a id="trunkSourceWebCorebindingsjsCachedModuleScriptLoadercpp"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/bindings/js/CachedModuleScriptLoader.cpp (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/CachedModuleScriptLoader.cpp                                (rev 0)
+++ trunk/Source/WebCore/bindings/js/CachedModuleScriptLoader.cpp        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,89 @@
</span><ins>+/*
+ * Copyright (C) 2015-2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``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 ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include &quot;config.h&quot;
+#include &quot;CachedModuleScriptLoader.h&quot;
+
+#include &quot;CachedResourceLoader.h&quot;
+#include &quot;CachedScript.h&quot;
+#include &quot;DOMWrapperWorld.h&quot;
+#include &quot;Frame.h&quot;
+#include &quot;JSDOMBinding.h&quot;
+#include &quot;ResourceLoaderOptions.h&quot;
+#include &quot;ScriptController.h&quot;
+#include &quot;ScriptElement.h&quot;
+#include &quot;ScriptModuleLoader.h&quot;
+#include &quot;ScriptSourceCode.h&quot;
+
+namespace WebCore {
+
+Ref&lt;CachedModuleScriptLoader&gt; CachedModuleScriptLoader::create(CachedModuleScriptLoaderClient&amp; client, DeferredPromise&amp; promise)
+{
+    return adoptRef(*new CachedModuleScriptLoader(client, promise));
+}
+
+CachedModuleScriptLoader::CachedModuleScriptLoader(CachedModuleScriptLoaderClient&amp; client, DeferredPromise&amp; promise)
+    : m_client(&amp;client)
+    , m_promise(&amp;promise)
+{
+}
+
+CachedModuleScriptLoader::~CachedModuleScriptLoader()
+{
+    if (m_cachedScript) {
+        m_cachedScript-&gt;removeClient(*this);
+        m_cachedScript = nullptr;
+    }
+}
+
+bool CachedModuleScriptLoader::load(ScriptElement&amp; scriptElement, const URL&amp; sourceURL)
+{
+    ASSERT(!m_cachedScript);
+    m_cachedScript = scriptElement.requestScriptWithCacheForModuleScript(sourceURL);
+    if (!m_cachedScript)
+        return false;
+
+    // If the content is already cached, this immediately calls notifyFinished.
+    m_cachedScript-&gt;addClient(*this);
+    return true;
+}
+
+void CachedModuleScriptLoader::notifyFinished(CachedResource&amp; resource)
+{
+    ASSERT_UNUSED(resource, &amp;resource == m_cachedScript);
+    ASSERT(m_cachedScript);
+    ASSERT(m_promise);
+
+    Ref&lt;CachedModuleScriptLoader&gt; protectedThis(*this);
+    if (m_client)
+        m_client-&gt;notifyFinished(*this, WTFMove(m_promise));
+
+    // Remove the client after calling notifyFinished to keep the data buffer in
+    // CachedResource alive while notifyFinished processes the resource.
+    m_cachedScript-&gt;removeClient(*this);
+    m_cachedScript = nullptr;
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceWebCorebindingsjsCachedModuleScriptLoaderhfromrev208787trunkSourceWebCorebindingsjsScriptModuleLoaderh"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebCore/bindings/js/CachedModuleScriptLoader.h (from rev 208787, trunk/Source/WebCore/bindings/js/ScriptModuleLoader.h) (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/CachedModuleScriptLoader.h                                (rev 0)
+++ trunk/Source/WebCore/bindings/js/CachedModuleScriptLoader.h        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,69 @@
</span><ins>+/*
+ * Copyright (C) 2015, 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``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 ITS 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 &quot;CachedResourceClient.h&quot;
+#include &quot;CachedResourceHandle.h&quot;
+#include &lt;wtf/Ref.h&gt;
+#include &lt;wtf/RefCounted.h&gt;
+#include &lt;wtf/RefPtr.h&gt;
+
+namespace WebCore {
+
+class CachedModuleScriptLoaderClient;
+class CachedScript;
+class DeferredPromise;
+class JSDOMGlobalObject;
+class ScriptElement;
+class URL;
+
+class CachedModuleScriptLoader final : public RefCounted&lt;CachedModuleScriptLoader&gt;, private CachedResourceClient {
+public:
+    static Ref&lt;CachedModuleScriptLoader&gt; create(CachedModuleScriptLoaderClient&amp;, DeferredPromise&amp;);
+
+    virtual ~CachedModuleScriptLoader();
+
+    bool load(ScriptElement&amp;, const URL&amp; sourceURL);
+
+    CachedScript* cachedScript() { return m_cachedScript.get(); }
+
+    void clearClient()
+    {
+        ASSERT(m_client);
+        m_client = nullptr;
+    }
+
+private:
+    CachedModuleScriptLoader(CachedModuleScriptLoaderClient&amp;, DeferredPromise&amp;);
+
+    void notifyFinished(CachedResource&amp;) final;
+
+    CachedModuleScriptLoaderClient* m_client { nullptr };
+    RefPtr&lt;DeferredPromise&gt; m_promise;
+    CachedResourceHandle&lt;CachedScript&gt; m_cachedScript;
+};
+
+} // namespace WebCore
</ins></span></pre></div>
<a id="trunkSourceWebCorebindingsjsCachedModuleScriptLoaderClienthfromrev208787trunkSourceWebCoredomLoadableScripth"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebCore/bindings/js/CachedModuleScriptLoaderClient.h (from rev 208787, trunk/Source/WebCore/dom/LoadableScript.h) (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/CachedModuleScriptLoaderClient.h                                (rev 0)
+++ trunk/Source/WebCore/bindings/js/CachedModuleScriptLoaderClient.h        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,41 @@
</span><ins>+/*
+ * Copyright (C) 2016 Apple, Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE 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 &quot;JSDOMPromise.h&quot;
+
+namespace WebCore {
+
+class CachedModuleScriptLoader;
+
+class CachedModuleScriptLoaderClient {
+public:
+    virtual ~CachedModuleScriptLoaderClient() { }
+
+    virtual void notifyFinished(CachedModuleScriptLoader&amp;, RefPtr&lt;DeferredPromise&gt;) = 0;
+};
+
+}
</ins></span></pre></div>
<a id="trunkSourceWebCorebindingsjsCachedScriptSourceProviderh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/CachedScriptSourceProvider.h (208787 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/CachedScriptSourceProvider.h        2016-11-16 09:08:23 UTC (rev 208787)
+++ trunk/Source/WebCore/bindings/js/CachedScriptSourceProvider.h        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -36,7 +36,7 @@
</span><span class="cx"> class CachedScriptSourceProvider : public JSC::SourceProvider, public CachedResourceClient {
</span><span class="cx">     WTF_MAKE_FAST_ALLOCATED;
</span><span class="cx"> public:
</span><del>-    static Ref&lt;CachedScriptSourceProvider&gt; create(CachedScript* cachedScript) { return adoptRef(*new CachedScriptSourceProvider(cachedScript)); }
</del><ins>+    static Ref&lt;CachedScriptSourceProvider&gt; create(CachedScript* cachedScript, JSC::SourceProviderSourceType sourceType) { return adoptRef(*new CachedScriptSourceProvider(cachedScript, sourceType)); }
</ins><span class="cx"> 
</span><span class="cx">     virtual ~CachedScriptSourceProvider()
</span><span class="cx">     {
</span><span class="lines">@@ -47,8 +47,8 @@
</span><span class="cx">     StringView source() const override { return m_cachedScript-&gt;script(); }
</span><span class="cx"> 
</span><span class="cx"> private:
</span><del>-    CachedScriptSourceProvider(CachedScript* cachedScript)
-        : SourceProvider(cachedScript-&gt;response().url(), TextPosition::minimumPosition(), JSC::SourceProviderSourceType::Program)
</del><ins>+    CachedScriptSourceProvider(CachedScript* cachedScript, JSC::SourceProviderSourceType sourceType)
+        : SourceProvider(cachedScript-&gt;response().url(), TextPosition::minimumPosition(), sourceType)
</ins><span class="cx">         , m_cachedScript(cachedScript)
</span><span class="cx">     {
</span><span class="cx">         m_cachedScript-&gt;addClient(*this);
</span><span class="lines">@@ -59,7 +59,7 @@
</span><span class="cx"> 
</span><span class="cx"> inline JSC::SourceCode makeSource(CachedScript* cachedScript)
</span><span class="cx"> {
</span><del>-    return JSC::SourceCode(CachedScriptSourceProvider::create(cachedScript));
</del><ins>+    return JSC::SourceCode(CachedScriptSourceProvider::create(cachedScript, JSC::SourceProviderSourceType::Program));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsJSBindingsAllInOnecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/JSBindingsAllInOne.cpp (208787 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/JSBindingsAllInOne.cpp        2016-11-16 09:08:23 UTC (rev 208787)
+++ trunk/Source/WebCore/bindings/js/JSBindingsAllInOne.cpp        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -26,6 +26,8 @@
</span><span class="cx"> // This all-in-one cpp file cuts down on template bloat to allow us to build our Windows release build.
</span><span class="cx"> 
</span><span class="cx"> #include &quot;ArrayValue.cpp&quot;
</span><ins>+#include &quot;CachedModuleScript.cpp&quot;
+#include &quot;CachedModuleScriptLoader.cpp&quot;
</ins><span class="cx"> #include &quot;CallbackFunction.cpp&quot;
</span><span class="cx"> #include &quot;DOMWrapperWorld.cpp&quot;
</span><span class="cx"> #include &quot;Dictionary.cpp&quot;
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsJSDOMBindingcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/JSDOMBinding.cpp (208787 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/JSDOMBinding.cpp        2016-11-16 09:08:23 UTC (rev 208787)
+++ trunk/Source/WebCore/bindings/js/JSDOMBinding.cpp        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -156,6 +156,26 @@
</span><span class="cx">     reportException(exec, exception, cachedScript);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+String retrieveErrorMessage(ExecState&amp; state, VM&amp; vm, JSValue exception, CatchScope&amp; catchScope)
+{
+    if (auto* exceptionBase = toExceptionBase(exception))
+        return exceptionBase-&gt;toString();
+
+    // FIXME: &lt;http://webkit.org/b/115087&gt; Web Inspector: WebCore::reportException should not evaluate JavaScript handling exceptions
+    // If this is a custom exception object, call toString on it to try and get a nice string representation for the exception.
+    String errorMessage;
+    if (auto* error = jsDynamicDowncast&lt;ErrorInstance*&gt;(exception))
+        errorMessage = error-&gt;sanitizedToString(&amp;state);
+    else
+        errorMessage = exception.toWTFString(&amp;state);
+
+    // We need to clear any new exception that may be thrown in the toString() call above.
+    // reportException() is not supposed to be making new exceptions.
+    catchScope.clearException();
+    vm.clearLastException();
+    return errorMessage;
+}
+
</ins><span class="cx"> void reportException(ExecState* exec, JSC::Exception* exception, CachedScript* cachedScript, ExceptionDetails* exceptionDetails)
</span><span class="cx"> {
</span><span class="cx">     VM&amp; vm = exec-&gt;vm();
</span><span class="lines">@@ -186,24 +206,7 @@
</span><span class="cx">         exceptionSourceURL = callFrame-&gt;sourceURL();
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    String errorMessage;
-    JSValue exceptionValue = exception-&gt;value();
-    if (ExceptionBase* exceptionBase = toExceptionBase(exceptionValue))
-        errorMessage = exceptionBase-&gt;toString();
-    else {
-        // FIXME: &lt;http://webkit.org/b/115087&gt; Web Inspector: WebCore::reportException should not evaluate JavaScript handling exceptions
-        // If this is a custom exception object, call toString on it to try and get a nice string representation for the exception.
-        if (ErrorInstance* error = jsDynamicDowncast&lt;ErrorInstance*&gt;(exceptionValue))
-            errorMessage = error-&gt;sanitizedToString(exec);
-        else
-            errorMessage = exceptionValue.toString(exec)-&gt;value(exec);
-
-        // We need to clear any new exception that may be thrown in the toString() call above.
-        // reportException() is not supposed to be making new exceptions.
-        scope.clearException();
-        vm.clearLastException();
-    }
-
</del><ins>+    String errorMessage = retrieveErrorMessage(*exec, vm, exception-&gt;value(), scope);
</ins><span class="cx">     ScriptExecutionContext* scriptExecutionContext = globalObject-&gt;scriptExecutionContext();
</span><span class="cx">     scriptExecutionContext-&gt;reportException(errorMessage, lineNumber, columnNumber, exceptionSourceURL, exception, callStack-&gt;size() ? callStack : nullptr, cachedScript);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsJSDOMBindingh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/JSDOMBinding.h (208787 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/JSDOMBinding.h        2016-11-16 09:08:23 UTC (rev 208787)
+++ trunk/Source/WebCore/bindings/js/JSDOMBinding.h        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -182,6 +182,7 @@
</span><span class="cx"> 
</span><span class="cx"> const JSC::HashTable&amp; getHashTableForGlobalData(JSC::VM&amp;, const JSC::HashTable&amp; staticTable);
</span><span class="cx"> 
</span><ins>+String retrieveErrorMessage(JSC::ExecState&amp;, JSC::VM&amp;, JSC::JSValue exception, JSC::CatchScope&amp;);
</ins><span class="cx"> WEBCORE_EXPORT void reportException(JSC::ExecState*, JSC::JSValue exception, CachedScript* = nullptr);
</span><span class="cx"> WEBCORE_EXPORT void reportException(JSC::ExecState*, JSC::Exception*, CachedScript* = nullptr, ExceptionDetails* = nullptr);
</span><span class="cx"> void reportCurrentException(JSC::ExecState*);
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsJSMainThreadExecStateh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/JSMainThreadExecState.h (208787 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/JSMainThreadExecState.h        2016-11-16 09:08:23 UTC (rev 208787)
+++ trunk/Source/WebCore/bindings/js/JSMainThreadExecState.h        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -93,25 +93,25 @@
</span><span class="cx">         task.run(exec);
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    static JSC::JSInternalPromise* loadModule(JSC::ExecState* exec, const String&amp; moduleName, JSC::JSValue initiator)
</del><ins>+    static JSC::JSInternalPromise&amp; loadModule(JSC::ExecState&amp; state, const String&amp; moduleName, JSC::JSValue initiator)
</ins><span class="cx">     {
</span><del>-        JSMainThreadExecState currentState(exec);
-        return JSC::loadModule(exec, moduleName, initiator);
</del><ins>+        JSMainThreadExecState currentState(&amp;state);
+        return *JSC::loadModule(&amp;state, moduleName, initiator);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><del>-    static JSC::JSInternalPromise* loadModule(JSC::ExecState* exec, const JSC::SourceCode&amp; sourceCode, JSC::JSValue initiator)
</del><ins>+    static JSC::JSInternalPromise&amp; loadModule(JSC::ExecState&amp; state, const JSC::SourceCode&amp; sourceCode, JSC::JSValue initiator)
</ins><span class="cx">     {
</span><del>-        JSMainThreadExecState currentState(exec);
-        return JSC::loadModule(exec, sourceCode, initiator);
</del><ins>+        JSMainThreadExecState currentState(&amp;state);
+        return *JSC::loadModule(&amp;state, sourceCode, initiator);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><del>-    static JSC::JSValue linkAndEvaluateModule(JSC::ExecState* exec, const JSC::Identifier&amp; moduleKey, JSC::JSValue initiator, NakedPtr&lt;JSC::Exception&gt;&amp; returnedException)
</del><ins>+    static JSC::JSValue linkAndEvaluateModule(JSC::ExecState&amp; state, const JSC::Identifier&amp; moduleKey, JSC::JSValue initiator, NakedPtr&lt;JSC::Exception&gt;&amp; returnedException)
</ins><span class="cx">     {
</span><del>-        JSC::VM&amp; vm = exec-&gt;vm();
</del><ins>+        JSC::VM&amp; vm = state.vm();
</ins><span class="cx">         auto scope = DECLARE_CATCH_SCOPE(vm);
</span><span class="cx">     
</span><del>-        JSMainThreadExecState currentState(exec);
-        JSC::JSValue returnValue = JSC::linkAndEvaluateModule(exec, moduleKey, initiator);
</del><ins>+        JSMainThreadExecState currentState(&amp;state);
+        auto returnValue = JSC::linkAndEvaluateModule(&amp;state, moduleKey, initiator);
</ins><span class="cx">         if (UNLIKELY(scope.exception())) {
</span><span class="cx">             returnedException = scope.exception();
</span><span class="cx">             scope.clearException();
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsScriptControllercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/ScriptController.cpp (208787 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/ScriptController.cpp        2016-11-16 09:08:23 UTC (rev 208787)
+++ trunk/Source/WebCore/bindings/js/ScriptController.cpp        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -22,6 +22,7 @@
</span><span class="cx"> #include &quot;ScriptController.h&quot;
</span><span class="cx"> 
</span><span class="cx"> #include &quot;BridgeJSC.h&quot;
</span><ins>+#include &quot;CachedModuleScript.h&quot;
</ins><span class="cx"> #include &quot;ContentSecurityPolicy.h&quot;
</span><span class="cx"> #include &quot;DocumentLoader.h&quot;
</span><span class="cx"> #include &quot;Event.h&quot;
</span><span class="lines">@@ -41,6 +42,7 @@
</span><span class="cx"> #include &quot;PageConsoleClient.h&quot;
</span><span class="cx"> #include &quot;PageGroup.h&quot;
</span><span class="cx"> #include &quot;PluginViewBase.h&quot;
</span><ins>+#include &quot;ScriptElement.h&quot;
</ins><span class="cx"> #include &quot;ScriptSourceCode.h&quot;
</span><span class="cx"> #include &quot;ScriptableDocumentParser.h&quot;
</span><span class="cx"> #include &quot;Settings.h&quot;
</span><span class="lines">@@ -52,7 +54,12 @@
</span><span class="cx"> #include &lt;heap/StrongInlines.h&gt;
</span><span class="cx"> #include &lt;inspector/ScriptCallStack.h&gt;
</span><span class="cx"> #include &lt;runtime/InitializeThreading.h&gt;
</span><ins>+#include &lt;runtime/JSFunction.h&gt;
+#include &lt;runtime/JSInternalPromise.h&gt;
</ins><span class="cx"> #include &lt;runtime/JSLock.h&gt;
</span><ins>+#include &lt;runtime/JSModuleRecord.h&gt;
+#include &lt;runtime/JSNativeStdFunction.h&gt;
+#include &lt;wtf/TemporaryChange.h&gt;
</ins><span class="cx"> #include &lt;wtf/Threading.h&gt;
</span><span class="cx"> #include &lt;wtf/text/TextPosition.h&gt;
</span><span class="cx"> 
</span><span class="lines">@@ -154,7 +161,7 @@
</span><span class="cx">     const String* savedSourceURL = m_sourceURL;
</span><span class="cx">     m_sourceURL = &amp;sourceURL;
</span><span class="cx"> 
</span><del>-    Ref&lt;Frame&gt; protect(m_frame);
</del><ins>+    Ref&lt;Frame&gt; protector(m_frame);
</ins><span class="cx"> 
</span><span class="cx">     InspectorInstrumentationCookie cookie = InspectorInstrumentation::willEvaluateScript(m_frame, sourceURL, sourceCode.startLine());
</span><span class="cx"> 
</span><span class="lines">@@ -178,6 +185,90 @@
</span><span class="cx">     return evaluateInWorld(sourceCode, mainThreadNormalWorld(), exceptionDetails);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void ScriptController::loadModuleScriptInWorld(CachedModuleScript&amp; moduleScript, const String&amp; moduleName, DOMWrapperWorld&amp; world, Element&amp; element)
+{
+    JSLockHolder lock(world.vm());
+
+    auto&amp; shell = *windowShell(world);
+    auto&amp; state = *shell.window()-&gt;globalExec();
+
+    auto&amp; promise = JSMainThreadExecState::loadModule(state, moduleName, toJS(&amp;state, shell.window(), &amp;element));
+    setupModuleScriptHandlers(moduleScript, promise, world);
+}
+
+void ScriptController::loadModuleScript(CachedModuleScript&amp; moduleScript, const String&amp; moduleName, Element&amp; element)
+{
+    loadModuleScriptInWorld(moduleScript, moduleName, mainThreadNormalWorld(), element);
+}
+
+void ScriptController::loadModuleScriptInWorld(CachedModuleScript&amp; moduleScript, const ScriptSourceCode&amp; sourceCode, DOMWrapperWorld&amp; world, Element&amp; element)
+{
+    JSLockHolder lock(world.vm());
+
+    auto&amp; shell = *windowShell(world);
+    auto&amp; state = *shell.window()-&gt;globalExec();
+
+    auto&amp; promise = JSMainThreadExecState::loadModule(state, sourceCode.jsSourceCode(), toJS(&amp;state, shell.window(), &amp;element));
+    setupModuleScriptHandlers(moduleScript, promise, world);
+}
+
+void ScriptController::loadModuleScript(CachedModuleScript&amp; moduleScript, const ScriptSourceCode&amp; sourceCode, Element&amp; element)
+{
+    loadModuleScriptInWorld(moduleScript, sourceCode, mainThreadNormalWorld(), element);
+}
+
+JSC::JSValue ScriptController::linkAndEvaluateModuleScriptInWorld(CachedModuleScript&amp; moduleScript, DOMWrapperWorld&amp; world, Element&amp; element)
+{
+    JSLockHolder lock(world.vm());
+
+    auto&amp; shell = *windowShell(world);
+    auto&amp; state = *shell.window()-&gt;globalExec();
+
+    // FIXME: Preventing Frame from being destroyed is essentially unnecessary.
+    // https://bugs.webkit.org/show_bug.cgi?id=164763
+    Ref&lt;Frame&gt; protector(m_frame);
+
+    NakedPtr&lt;JSC::Exception&gt; evaluationException;
+    auto returnValue = JSMainThreadExecState::linkAndEvaluateModule(state, Identifier::fromUid(&amp;state.vm(), moduleScript.moduleKey()), toJS(&amp;state, shell.window(), &amp;element), evaluationException);
+    if (evaluationException) {
+        // FIXME: Give a chance to dump the stack trace if the &quot;crossorigin&quot; attribute allows.
+        // https://bugs.webkit.org/show_bug.cgi?id=164539
+        reportException(&amp;state, evaluationException, nullptr);
+        return jsUndefined();
+    }
+    return returnValue;
+}
+
+JSC::JSValue ScriptController::linkAndEvaluateModuleScript(CachedModuleScript&amp; moduleScript, Element&amp; element)
+{
+    return linkAndEvaluateModuleScriptInWorld(moduleScript, mainThreadNormalWorld(), element);
+}
+
+JSC::JSValue ScriptController::evaluateModule(const URL&amp; sourceURL, JSModuleRecord&amp; moduleRecord, DOMWrapperWorld&amp; world)
+{
+    JSLockHolder lock(world.vm());
+
+    const auto&amp; jsSourceCode = moduleRecord.sourceCode();
+
+    auto&amp; shell = *windowShell(world);
+    auto&amp; state = *shell.window()-&gt;globalExec();
+    TemporaryChange&lt;const String*&gt; sourceURLScope(m_sourceURL, &amp;sourceURL.string());
+
+    Ref&lt;Frame&gt; protector(m_frame);
+
+    auto cookie = InspectorInstrumentation::willEvaluateScript(m_frame, sourceURL, jsSourceCode.firstLine());
+
+    auto returnValue = moduleRecord.evaluate(&amp;state);
+    InspectorInstrumentation::didEvaluateScript(cookie, m_frame);
+
+    return returnValue;
+}
+
+JSC::JSValue ScriptController::evaluateModule(const URL&amp; sourceURL, JSModuleRecord&amp; moduleRecord)
+{
+    return evaluateModule(sourceURL, moduleRecord, mainThreadNormalWorld());
+}
+
</ins><span class="cx"> Ref&lt;DOMWrapperWorld&gt; ScriptController::createWorld()
</span><span class="cx"> {
</span><span class="cx">     return DOMWrapperWorld::create(JSDOMWindow::commonVM());
</span><span class="lines">@@ -258,6 +349,67 @@
</span><span class="cx">     return &amp;windowShell;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+static Identifier jsValueToModuleKey(ExecState* exec, JSValue value)
+{
+    if (value.isSymbol())
+        return Identifier::fromUid(jsCast&lt;Symbol*&gt;(value)-&gt;privateName());
+    ASSERT(value.isString());
+    return Identifier::fromString(exec, jsCast&lt;JSString*&gt;(value)-&gt;value(exec));
+}
+
+void ScriptController::setupModuleScriptHandlers(CachedModuleScript&amp; moduleScriptRef, JSInternalPromise&amp; promise, DOMWrapperWorld&amp; world)
+{
+    auto&amp; shell = *windowShell(world);
+    auto&amp; state = *shell.window()-&gt;globalExec();
+
+    // It is not guaranteed that either fulfillHandler or rejectHandler is eventually called.
+    // For example, if the page load is canceled, the DeferredPromise used in the module loader pipeline will stop executing JS code.
+    // Thus the promise returned from this function could remain unresolved.
+
+    JSC::PrivateName moduleLoaderAlreadyReportedErrorSymbol = m_moduleLoaderAlreadyReportedErrorSymbol;
+    JSC::PrivateName moduleLoaderFetchingIsCanceledSymbol = m_moduleLoaderFetchingIsCanceledSymbol;
+
+    RefPtr&lt;CachedModuleScript&gt; moduleScript(&amp;moduleScriptRef);
+
+    auto&amp; fulfillHandler = *JSNativeStdFunction::create(state.vm(), shell.window(), 1, String(), [moduleScript](ExecState* exec) {
+        Identifier moduleKey = jsValueToModuleKey(exec, exec-&gt;argument(0));
+        moduleScript-&gt;notifyLoadCompleted(*moduleKey.impl());
+        return JSValue::encode(jsUndefined());
+    });
+
+    auto&amp; rejectHandler = *JSNativeStdFunction::create(state.vm(), shell.window(), 1, String(), [moduleScript, moduleLoaderAlreadyReportedErrorSymbol, moduleLoaderFetchingIsCanceledSymbol](ExecState* exec) {
+        JSValue error = exec-&gt;argument(0);
+        if (auto* symbol = jsDynamicCast&lt;Symbol*&gt;(error)) {
+            if (symbol-&gt;privateName() == moduleLoaderAlreadyReportedErrorSymbol) {
+                moduleScript-&gt;notifyLoadFailed(LoadableScript::Error {
+                    LoadableScript::ErrorType::CachedScript,
+                    Nullopt
+                });
+                return JSValue::encode(jsUndefined());
+            }
+
+            if (symbol-&gt;privateName() == moduleLoaderFetchingIsCanceledSymbol) {
+                moduleScript-&gt;notifyLoadWasCanceled();
+                return JSValue::encode(jsUndefined());
+            }
+        }
+
+        VM&amp; vm = exec-&gt;vm();
+        auto scope = DECLARE_CATCH_SCOPE(vm);
+        moduleScript-&gt;notifyLoadFailed(LoadableScript::Error {
+            LoadableScript::ErrorType::CachedScript,
+            LoadableScript::ConsoleMessage {
+                MessageSource::JS,
+                MessageLevel::Error,
+                retrieveErrorMessage(*exec, vm, error, scope),
+            }
+        });
+        return JSValue::encode(jsUndefined());
+    });
+
+    promise.then(&amp;state, &amp;fulfillHandler, &amp;rejectHandler);
+}
+
</ins><span class="cx"> TextPosition ScriptController::eventHandlerPosition() const
</span><span class="cx"> {
</span><span class="cx">     // FIXME: If we are not currently parsing, we should use our current location
</span><span class="lines">@@ -520,7 +672,9 @@
</span><span class="cx">     if (!canExecuteScripts(AboutToExecuteScript) || isPaused())
</span><span class="cx">         return { }; // FIXME: Would jsNull be better?
</span><span class="cx"> 
</span><del>-    Ref&lt;Frame&gt; protect(m_frame); // Script execution can destroy the frame, and thus the ScriptController.
</del><ins>+    // FIXME: Preventing Frame from being destroyed is essentially unnecessary.
+    // https://bugs.webkit.org/show_bug.cgi?id=164763
+    Ref&lt;Frame&gt; protector(m_frame); // Script execution can destroy the frame, and thus the ScriptController.
</ins><span class="cx"> 
</span><span class="cx">     return evaluate(sourceCode, exceptionDetails);
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsScriptControllerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/ScriptController.h (208787 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/ScriptController.h        2016-11-16 09:08:23 UTC (rev 208787)
+++ trunk/Source/WebCore/bindings/js/ScriptController.h        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -42,8 +42,10 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> namespace JSC {
</span><ins>+class ExecState;
</ins><span class="cx"> class JSGlobalObject;
</span><del>-class ExecState;
</del><ins>+class JSInternalPromise;
+class JSModuleRecord;
</ins><span class="cx"> 
</span><span class="cx"> namespace Bindings {
</span><span class="cx"> class Instance;
</span><span class="lines">@@ -53,11 +55,12 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><ins>+class CachedModuleScript;
</ins><span class="cx"> class Frame;
</span><span class="cx"> class HTMLDocument;
</span><span class="cx"> class HTMLPlugInElement;
</span><ins>+class SecurityOrigin;
</ins><span class="cx"> class ScriptSourceCode;
</span><del>-class SecurityOrigin;
</del><span class="cx"> class Widget;
</span><span class="cx"> 
</span><span class="cx"> typedef HashMap&lt;void*, RefPtr&lt;JSC::Bindings::RootObject&gt;&gt; RootObjectMap;
</span><span class="lines">@@ -114,6 +117,17 @@
</span><span class="cx">     JSC::JSValue evaluate(const ScriptSourceCode&amp;, ExceptionDetails* = nullptr);
</span><span class="cx">     JSC::JSValue evaluateInWorld(const ScriptSourceCode&amp;, DOMWrapperWorld&amp;, ExceptionDetails* = nullptr);
</span><span class="cx"> 
</span><ins>+    void loadModuleScriptInWorld(CachedModuleScript&amp;, const String&amp; moduleName, DOMWrapperWorld&amp;, Element&amp;);
+    void loadModuleScript(CachedModuleScript&amp;, const String&amp; moduleName, Element&amp;);
+    void loadModuleScriptInWorld(CachedModuleScript&amp;, const ScriptSourceCode&amp;, DOMWrapperWorld&amp;, Element&amp;);
+    void loadModuleScript(CachedModuleScript&amp;, const ScriptSourceCode&amp;, Element&amp;);
+
+    JSC::JSValue linkAndEvaluateModuleScriptInWorld(CachedModuleScript&amp; , DOMWrapperWorld&amp;, Element&amp;);
+    JSC::JSValue linkAndEvaluateModuleScript(CachedModuleScript&amp;, Element&amp;);
+
+    JSC::JSValue evaluateModule(const URL&amp;, JSC::JSModuleRecord&amp;, DOMWrapperWorld&amp;);
+    JSC::JSValue evaluateModule(const URL&amp;, JSC::JSModuleRecord&amp;);
+
</ins><span class="cx">     WTF::TextPosition eventHandlerPosition() const;
</span><span class="cx"> 
</span><span class="cx">     void enableEval();
</span><span class="lines">@@ -134,6 +148,9 @@
</span><span class="cx"> 
</span><span class="cx">     const String* sourceURL() const { return m_sourceURL; } // 0 if we are not evaluating any script
</span><span class="cx"> 
</span><ins>+    const JSC::PrivateName&amp; moduleLoaderAlreadyReportedErrorSymbol() const { return m_moduleLoaderAlreadyReportedErrorSymbol; }
+    const JSC::PrivateName&amp; moduleLoaderFetchingIsCanceledSymbol() const { return m_moduleLoaderFetchingIsCanceledSymbol; }
+
</ins><span class="cx">     void clearWindowShell(DOMWindow* newDOMWindow, bool goingIntoPageCache);
</span><span class="cx">     void updateDocument();
</span><span class="cx"> 
</span><span class="lines">@@ -166,6 +183,7 @@
</span><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx">     WEBCORE_EXPORT JSDOMWindowShell* initScript(DOMWrapperWorld&amp;);
</span><ins>+    void setupModuleScriptHandlers(CachedModuleScript&amp;, JSC::JSInternalPromise&amp;, DOMWrapperWorld&amp;);
</ins><span class="cx"> 
</span><span class="cx">     void disconnectPlatformScriptObjects();
</span><span class="cx"> 
</span><span class="lines">@@ -174,6 +192,8 @@
</span><span class="cx">     const String* m_sourceURL;
</span><span class="cx"> 
</span><span class="cx">     bool m_paused;
</span><ins>+    JSC::PrivateName m_moduleLoaderAlreadyReportedErrorSymbol;
+    JSC::PrivateName m_moduleLoaderFetchingIsCanceledSymbol;
</ins><span class="cx"> 
</span><span class="cx">     // The root object used for objects bound outside the context of a plugin, such
</span><span class="cx">     // as NPAPI plugins. The plugins using these objects prevent a page from being cached so they
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsScriptModuleLoadercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/ScriptModuleLoader.cpp (208787 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/ScriptModuleLoader.cpp        2016-11-16 09:08:23 UTC (rev 208787)
+++ trunk/Source/WebCore/bindings/js/ScriptModuleLoader.cpp        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -26,9 +26,18 @@
</span><span class="cx"> #include &quot;config.h&quot;
</span><span class="cx"> #include &quot;ScriptModuleLoader.h&quot;
</span><span class="cx"> 
</span><ins>+#include &quot;CachedModuleScriptLoader.h&quot;
+#include &quot;CachedScript.h&quot;
</ins><span class="cx"> #include &quot;Document.h&quot;
</span><span class="cx"> #include &quot;Frame.h&quot;
</span><span class="cx"> #include &quot;JSDOMBinding.h&quot;
</span><ins>+#include &quot;JSElement.h&quot;
+#include &quot;LoadableModuleScript.h&quot;
+#include &quot;MIMETypeRegistry.h&quot;
+#include &quot;ScriptController.h&quot;
+#include &quot;ScriptElement.h&quot;
+#include &quot;ScriptSourceCode.h&quot;
+#include &lt;runtime/JSInternalPromise.h&gt;
</ins><span class="cx"> #include &lt;runtime/JSInternalPromiseDeferred.h&gt;
</span><span class="cx"> #include &lt;runtime/JSModuleRecord.h&gt;
</span><span class="cx"> #include &lt;runtime/JSString.h&gt;
</span><span class="lines">@@ -41,63 +50,129 @@
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-JSC::JSInternalPromise* ScriptModuleLoader::resolve(JSC::JSGlobalObject* globalObject, JSC::ExecState* exec, JSC::JSModuleLoader*, JSC::JSValue moduleNameValue, JSC::JSValue importerModuleKey, JSC::JSValue)
</del><ins>+ScriptModuleLoader::~ScriptModuleLoader()
</ins><span class="cx"> {
</span><del>-    JSC::JSInternalPromiseDeferred* deferred = JSC::JSInternalPromiseDeferred::create(exec, globalObject);
</del><ins>+    for (auto&amp; loader : m_loaders)
+        const_cast&lt;CachedModuleScriptLoader&amp;&gt;(loader.get()).clearClient();
+}
</ins><span class="cx"> 
</span><ins>+
+static bool isRootModule(JSC::JSValue importerModuleKey)
+{
+    return importerModuleKey.isSymbol() || importerModuleKey.isUndefined();
+}
+
+JSC::JSInternalPromise* ScriptModuleLoader::resolve(JSC::JSGlobalObject* jsGlobalObject, JSC::ExecState* exec, JSC::JSModuleLoader*, JSC::JSValue moduleNameValue, JSC::JSValue importerModuleKey, JSC::JSValue)
+{
+    auto&amp; globalObject = *JSC::jsCast&lt;JSDOMGlobalObject*&gt;(jsGlobalObject);
+    auto&amp; jsPromise = *JSC::JSInternalPromiseDeferred::create(exec, &amp;globalObject);
+    auto promise = DeferredPromise::create(globalObject, jsPromise);
+
</ins><span class="cx">     // We use a Symbol as a special purpose; It means this module is an inline module.
</span><span class="cx">     // So there is no correct URL to retrieve the module source code. If the module name
</span><span class="cx">     // value is a Symbol, it is used directly as a module key.
</span><del>-    //
-    // FIXME: Using symbols for an inline module is a current implementation details of WebKit.
-    // Once the spec of this part is specified, we will recast these part.
-    if (moduleNameValue.isSymbol())
-        return deferred-&gt;resolve(exec, moduleNameValue);
</del><ins>+    if (moduleNameValue.isSymbol()) {
+        promise-&gt;resolve(asSymbol(moduleNameValue)-&gt;privateName());
+        return jsPromise.promise();
+    }
</ins><span class="cx"> 
</span><del>-    if (!moduleNameValue.isString())
-        return deferred-&gt;reject(exec, JSC::createTypeError(exec, &quot;Module name is not Symbol or String.&quot;));
</del><ins>+    // https://html.spec.whatwg.org/multipage/webappapis.html#resolve-a-module-specifier
</ins><span class="cx"> 
</span><del>-    String moduleName = asString(moduleNameValue)-&gt;value(exec);
</del><ins>+    if (!moduleNameValue.isString()) {
+        promise-&gt;reject(TypeError, ASCIILiteral(&quot;Module specifier is not Symbol or String.&quot;));
+        return jsPromise.promise();
+    }
</ins><span class="cx"> 
</span><del>-    // Now, we consider the given moduleName as the same to the `import &quot;...&quot;` in the module code.
-    // We use the completed URL as the unique module key.
-    URL completedUrl;
</del><ins>+    String specifier = asString(moduleNameValue)-&gt;value(exec);
</ins><span class="cx"> 
</span><del>-    if (importerModuleKey.isSymbol())
-        completedUrl = m_document.completeURL(moduleName);
-    else if (importerModuleKey.isUndefined())
-        completedUrl = m_document.completeURL(moduleName);
</del><ins>+    // 1. Apply the URL parser to specifier. If the result is not failure, return the result.
+    URL absoluteURL(URL(), specifier);
+    if (absoluteURL.isValid()) {
+        promise-&gt;resolve(absoluteURL.string());
+        return jsPromise.promise();
+    }
+
+    // 2. If specifier does not start with the character U+002F SOLIDUS (/), the two-character sequence U+002E FULL STOP, U+002F SOLIDUS (./),
+    //    or the three-character sequence U+002E FULL STOP, U+002E FULL STOP, U+002F SOLIDUS (../), return failure and abort these steps.
+    if (!specifier.startsWith('/') &amp;&amp; !specifier.startsWith(&quot;./&quot;) &amp;&amp; !specifier.startsWith(&quot;../&quot;)) {
+        promise-&gt;reject(TypeError, ASCIILiteral(&quot;Module specifier does not start with \&quot;/\&quot;, \&quot;./\&quot;, or \&quot;../\&quot;.&quot;));
+        return jsPromise.promise();
+    }
+
+    // 3. Return the result of applying the URL parser to specifier with script's base URL as the base URL.
+
+    URL completedURL;
+
+    if (isRootModule(importerModuleKey))
+        completedURL = m_document.completeURL(specifier);
</ins><span class="cx">     else if (importerModuleKey.isString()) {
</span><del>-        URL importerModuleUrl(URL(), asString(importerModuleKey)-&gt;value(exec));
-        if (!importerModuleUrl.isValid())
-            return deferred-&gt;reject(exec, JSC::createTypeError(exec, &quot;Importer module key is an invalid URL.&quot;));
-        completedUrl = m_document.completeURL(moduleName, importerModuleUrl);
-    } else
-        return deferred-&gt;reject(exec, JSC::createTypeError(exec, &quot;Importer module key is not Symbol or String.&quot;));
</del><ins>+        URL importerModuleRequestURL(URL(), asString(importerModuleKey)-&gt;value(exec));
+        if (!importerModuleRequestURL.isValid()) {
+            promise-&gt;reject(TypeError, ASCIILiteral(&quot;Importer module key is an invalid URL.&quot;));
+            return jsPromise.promise();
+        }
</ins><span class="cx"> 
</span><del>-    if (!completedUrl.isValid())
-        return deferred-&gt;reject(exec, JSC::createTypeError(exec, &quot;Module name constructs an invalid URL.&quot;));
</del><ins>+        URL importerModuleResponseURL = m_requestURLToResponseURLMap.get(importerModuleRequestURL);
+        if (!importerModuleResponseURL.isValid()) {
+            promise-&gt;reject(TypeError, ASCIILiteral(&quot;Importer module has an invalid response URL.&quot;));
+            return jsPromise.promise();
+        }
</ins><span class="cx"> 
</span><del>-    return deferred-&gt;resolve(exec, jsString(exec, completedUrl.string()));
</del><ins>+        completedURL = m_document.completeURL(specifier, importerModuleResponseURL);
+    } else {
+        promise-&gt;reject(TypeError, ASCIILiteral(&quot;Importer module key is not Symbol or String.&quot;));
+        return jsPromise.promise();
+    }
+
+    if (!completedURL.isValid()) {
+        promise-&gt;reject(TypeError, ASCIILiteral(&quot;Module name constructs an invalid URL.&quot;));
+        return jsPromise.promise();
+    }
+
+    promise-&gt;resolve(completedURL.string());
+    return jsPromise.promise();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-JSC::JSInternalPromise* ScriptModuleLoader::fetch(JSC::JSGlobalObject* globalObject, JSC::ExecState* exec, JSC::JSModuleLoader*, JSC::JSValue moduleKeyValue, JSC::JSValue)
</del><ins>+JSC::JSInternalPromise* ScriptModuleLoader::fetch(JSC::JSGlobalObject* jsGlobalObject, JSC::ExecState* exec, JSC::JSModuleLoader*, JSC::JSValue moduleKeyValue, JSC::JSValue initiator)
</ins><span class="cx"> {
</span><del>-    JSC::JSInternalPromiseDeferred* deferred = JSC::JSInternalPromiseDeferred::create(exec, globalObject);
</del><ins>+    auto&amp; globalObject = *JSC::jsCast&lt;JSDOMGlobalObject*&gt;(jsGlobalObject);
+    auto&amp; jsPromise = *JSC::JSInternalPromiseDeferred::create(exec, &amp;globalObject);
+    auto deferred = DeferredPromise::create(globalObject, jsPromise);
+    if (moduleKeyValue.isSymbol()) {
+        deferred-&gt;reject(TypeError, ASCIILiteral(&quot;Symbol module key should be already fulfilled with the inlined resource.&quot;));
+        return jsPromise.promise();
+    }
</ins><span class="cx"> 
</span><del>-    if (moduleKeyValue.isSymbol())
-        return deferred-&gt;reject(exec, JSC::createTypeError(exec, &quot;Symbol module key should be already fulfilled with the inlined resource.&quot;));
</del><ins>+    if (!moduleKeyValue.isString()) {
+        deferred-&gt;reject(TypeError, ASCIILiteral(&quot;Module key is not Symbol or String.&quot;));
+        return jsPromise.promise();
+    }
</ins><span class="cx"> 
</span><del>-    if (!moduleKeyValue.isString())
-        return deferred-&gt;reject(exec, JSC::createTypeError(exec, &quot;Module key is not Symbol or String.&quot;));
</del><ins>+    // https://html.spec.whatwg.org/multipage/webappapis.html#fetch-a-single-module-script
</ins><span class="cx"> 
</span><del>-    URL completedUrl(URL(), asString(moduleKeyValue)-&gt;value(exec));
-    if (!completedUrl.isValid())
-        return deferred-&gt;reject(exec, JSC::createTypeError(exec, &quot;Module key is an invalid URL.&quot;));
</del><ins>+    URL completedURL(URL(), asString(moduleKeyValue)-&gt;value(exec));
+    if (!completedURL.isValid()) {
+        deferred-&gt;reject(TypeError, ASCIILiteral(&quot;Module key is a valid URL.&quot;));
+        return jsPromise.promise();
+    }
</ins><span class="cx"> 
</span><del>-    // FIXME: Implement the module fetcher.
</del><ins>+    ASSERT_WITH_MESSAGE(JSC::jsDynamicCast&lt;JSElement*&gt;(initiator), &quot;Initiator should be an JSElement&quot;);
+    auto* scriptElement = toScriptElementIfPossible(&amp;JSC::jsCast&lt;JSElement*&gt;(initiator)-&gt;wrapped());
+    ASSERT_WITH_MESSAGE(scriptElement, &quot;Initiator should be ScriptElement.&quot;);
</ins><span class="cx"> 
</span><del>-    return deferred-&gt;promise();
</del><ins>+    if (auto* frame = m_document.frame()) {
+        auto loader = CachedModuleScriptLoader::create(*this, deferred.get());
+        m_loaders.add(loader.copyRef());
+        if (!loader-&gt;load(*scriptElement, completedURL)) {
+            loader-&gt;clearClient();
+            m_loaders.remove(WTFMove(loader));
+
+            deferred-&gt;reject(frame-&gt;script().moduleLoaderAlreadyReportedErrorSymbol());
+            return jsPromise.promise();
+        }
+    }
+
+    return jsPromise.promise();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> JSC::JSValue ScriptModuleLoader::evaluate(JSC::JSGlobalObject*, JSC::ExecState* exec, JSC::JSModuleLoader*, JSC::JSValue moduleKeyValue, JSC::JSValue moduleRecordValue, JSC::JSValue)
</span><span class="lines">@@ -108,24 +183,71 @@
</span><span class="cx">     // FIXME: Currently, we only support JSModuleRecord.
</span><span class="cx">     // Once the reflective part of the module loader is supported, we will handle arbitrary values.
</span><span class="cx">     // https://whatwg.github.io/loader/#registry-prototype-provide
</span><del>-    JSC::JSModuleRecord* moduleRecord = jsDynamicDowncast&lt;JSC::JSModuleRecord*&gt;(moduleRecordValue);
</del><ins>+    auto* moduleRecord = jsDynamicDowncast&lt;JSC::JSModuleRecord*&gt;(moduleRecordValue);
</ins><span class="cx">     if (!moduleRecord)
</span><span class="cx">         return JSC::jsUndefined();
</span><span class="cx"> 
</span><del>-    URL sourceUrl;
</del><ins>+    URL sourceURL;
</ins><span class="cx">     if (moduleKeyValue.isSymbol())
</span><del>-        sourceUrl = m_document.url();
</del><ins>+        sourceURL = m_document.url();
</ins><span class="cx">     else if (moduleKeyValue.isString())
</span><del>-        sourceUrl = URL(URL(), asString(moduleKeyValue)-&gt;value(exec));
</del><ins>+        sourceURL = URL(URL(), asString(moduleKeyValue)-&gt;value(exec));
</ins><span class="cx">     else
</span><span class="cx">         return JSC::throwTypeError(exec, scope, ASCIILiteral(&quot;Module key is not Symbol or String.&quot;));
</span><span class="cx"> 
</span><del>-    if (!sourceUrl.isValid())
</del><ins>+    if (!sourceURL.isValid())
</ins><span class="cx">         return JSC::throwTypeError(exec, scope, ASCIILiteral(&quot;Module key is an invalid URL.&quot;));
</span><span class="cx"> 
</span><del>-    // FIXME: Implement evaluating module code.
-
</del><ins>+    if (auto* frame = m_document.frame())
+        return frame-&gt;script().evaluateModule(sourceURL, *moduleRecord);
</ins><span class="cx">     return JSC::jsUndefined();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void ScriptModuleLoader::notifyFinished(CachedModuleScriptLoader&amp; loader, RefPtr&lt;DeferredPromise&gt; promise)
+{
+    // https://html.spec.whatwg.org/multipage/webappapis.html#fetch-a-single-module-script
+
+    if (!m_loaders.remove(&amp;loader))
+        return;
+    loader.clearClient();
+
+    auto&amp; cachedScript = *loader.cachedScript();
+
+    bool failed = false;
+
+    if (cachedScript.resourceError().isAccessControl()) {
+        promise-&gt;reject(TypeError, ASCIILiteral(&quot;Cross-origin script load denied by Cross-Origin Resource Sharing policy.&quot;));
+        return;
+    }
+
+    if (cachedScript.errorOccurred())
+        failed = true;
+    else if (!MIMETypeRegistry::isSupportedJavaScriptMIMEType(cachedScript.response().mimeType())) {
+        // https://html.spec.whatwg.org/multipage/webappapis.html#fetch-a-single-module-script
+        // The result of extracting a MIME type from response's header list (ignoring parameters) is not a JavaScript MIME type.
+        // For historical reasons, fetching a classic script does not include MIME type checking. In contrast, module scripts will fail to load if they are not of a correct MIME type.
+        promise-&gt;reject(TypeError, makeString(&quot;'&quot;, cachedScript.response().mimeType(), &quot;' is not a valid JavaScript MIME type.&quot;));
+        return;
+    }
+
+    auto* frame = m_document.frame();
+    if (!frame)
+        return;
+
+    if (failed) {
+        // Reject a promise to propagate the error back all the way through module promise chains to the script element.
+        promise-&gt;reject(frame-&gt;script().moduleLoaderAlreadyReportedErrorSymbol());
+        return;
+    }
+
+    if (cachedScript.wasCanceled()) {
+        promise-&gt;reject(frame-&gt;script().moduleLoaderFetchingIsCanceledSymbol());
+        return;
+    }
+
+    m_requestURLToResponseURLMap.add(cachedScript.url(), cachedScript.response().url());
+    // FIXME: Let's wrap around ScriptSourceCode to propagate it directly through the module pipeline.
+    promise-&gt;resolve(ScriptSourceCode(&amp;cachedScript, JSC::SourceProviderSourceType::Module).source().toString());
</ins><span class="cx"> }
</span><ins>+
+}
</ins></span></pre></div>
<a id="trunkSourceWebCorebindingsjsScriptModuleLoaderh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/ScriptModuleLoader.h (208787 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/ScriptModuleLoader.h        2016-11-16 09:08:23 UTC (rev 208787)
+++ trunk/Source/WebCore/bindings/js/ScriptModuleLoader.h        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -25,6 +25,10 @@
</span><span class="cx"> 
</span><span class="cx"> #pragma once
</span><span class="cx"> 
</span><ins>+#include &quot;CachedModuleScriptLoader.h&quot;
+#include &quot;CachedModuleScriptLoaderClient.h&quot;
+#include &quot;URL.h&quot;
+#include &quot;URLHash.h&quot;
</ins><span class="cx"> #include &lt;runtime/JSCJSValue.h&gt;
</span><span class="cx"> #include &lt;wtf/Noncopyable.h&gt;
</span><span class="cx"> 
</span><span class="lines">@@ -40,11 +44,13 @@
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="cx"> class Document;
</span><ins>+class JSDOMGlobalObject;
</ins><span class="cx"> 
</span><del>-class ScriptModuleLoader {
</del><ins>+class ScriptModuleLoader final : private CachedModuleScriptLoaderClient {
</ins><span class="cx">     WTF_MAKE_NONCOPYABLE(ScriptModuleLoader); WTF_MAKE_FAST_ALLOCATED;
</span><span class="cx"> public:
</span><span class="cx">     explicit ScriptModuleLoader(Document&amp;);
</span><ins>+    ~ScriptModuleLoader();
</ins><span class="cx"> 
</span><span class="cx">     Document&amp; document() { return m_document; }
</span><span class="cx"> 
</span><span class="lines">@@ -53,7 +59,11 @@
</span><span class="cx">     JSC::JSValue evaluate(JSC::JSGlobalObject*, JSC::ExecState*, JSC::JSModuleLoader*, JSC::JSValue moduleKey, JSC::JSValue moduleRecord, JSC::JSValue initiator);
</span><span class="cx"> 
</span><span class="cx"> private:
</span><ins>+    void notifyFinished(CachedModuleScriptLoader&amp;, RefPtr&lt;DeferredPromise&gt;) final;
+
</ins><span class="cx">     Document&amp; m_document;
</span><ins>+    HashMap&lt;URL, URL&gt; m_requestURLToResponseURLMap;
+    HashSet&lt;Ref&lt;CachedModuleScriptLoader&gt;&gt; m_loaders;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsScriptSourceCodeh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/ScriptSourceCode.h (208787 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/ScriptSourceCode.h        2016-11-16 09:08:23 UTC (rev 208787)
+++ trunk/Source/WebCore/bindings/js/ScriptSourceCode.h        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -42,15 +42,15 @@
</span><span class="cx"> 
</span><span class="cx"> class ScriptSourceCode {
</span><span class="cx"> public:
</span><del>-    ScriptSourceCode(const String&amp; source, const URL&amp; url = URL(), const TextPosition&amp; startPosition = TextPosition::minimumPosition())
-        : m_provider(JSC::StringSourceProvider::create(source, url.isNull() ? String() : url.string(), startPosition))
</del><ins>+    ScriptSourceCode(const String&amp; source, const URL&amp; url = URL(), const TextPosition&amp; startPosition = TextPosition::minimumPosition(), JSC::SourceProviderSourceType sourceType = JSC::SourceProviderSourceType::Program)
+        : m_provider(JSC::StringSourceProvider::create(source, url.isNull() ? String() : url.string(), startPosition, sourceType))
</ins><span class="cx">         , m_code(m_provider, startPosition.m_line.oneBasedInt(), startPosition.m_column.oneBasedInt())
</span><span class="cx">         , m_url(url)
</span><span class="cx">     {
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    explicit ScriptSourceCode(CachedScript* cachedScript)
-        : m_provider(CachedScriptSourceProvider::create(cachedScript))
</del><ins>+    explicit ScriptSourceCode(CachedScript* cachedScript, JSC::SourceProviderSourceType sourceType)
+        : m_provider(CachedScriptSourceProvider::create(cachedScript, sourceType))
</ins><span class="cx">         , m_code(m_provider)
</span><span class="cx">         , m_cachedScript(cachedScript)
</span><span class="cx">     {
</span></span></pre></div>
<a id="trunkSourceWebCoredomCurrentScriptIncrementerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/CurrentScriptIncrementer.h (208787 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/CurrentScriptIncrementer.h        2016-11-16 09:08:23 UTC (rev 208787)
+++ trunk/Source/WebCore/dom/CurrentScriptIncrementer.h        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -43,7 +43,8 @@
</span><span class="cx">         if (!m_isHTMLScriptElement)
</span><span class="cx">             return;
</span><span class="cx">         auto&amp; scriptElement = downcast&lt;HTMLScriptElement&gt;(element);
</span><del>-        m_document.pushCurrentScript(scriptElement.isInShadowTree() ? nullptr : &amp;scriptElement);
</del><ins>+        bool shouldPushNullForCurrentScript = scriptElement.isInShadowTree() || scriptElement.scriptType() == ScriptElement::ScriptType::Module;
+        m_document.pushCurrentScript(shouldPushNullForCurrentScript ? nullptr : &amp;scriptElement);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     ~CurrentScriptIncrementer()
</span></span></pre></div>
<a id="trunkSourceWebCoredomLoadableClassicScriptcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/LoadableClassicScript.cpp (208787 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/LoadableClassicScript.cpp        2016-11-16 09:08:23 UTC (rev 208787)
+++ trunk/Source/WebCore/dom/LoadableClassicScript.cpp        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -51,7 +51,7 @@
</span><span class="cx">     return m_cachedScript-&gt;isLoaded();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-Optional&lt;LoadableScript::Error&gt; LoadableClassicScript::wasErrored() const
</del><ins>+Optional&lt;LoadableScript::Error&gt; LoadableClassicScript::error() const
</ins><span class="cx"> {
</span><span class="cx">     if (m_error)
</span><span class="cx">         return m_error;
</span><span class="lines">@@ -101,8 +101,8 @@
</span><span class="cx"> 
</span><span class="cx"> void LoadableClassicScript::execute(ScriptElement&amp; scriptElement)
</span><span class="cx"> {
</span><del>-    ASSERT(!wasErrored());
-    scriptElement.executeScript(ScriptSourceCode(m_cachedScript.get()));
</del><ins>+    ASSERT(!error());
+    scriptElement.executeScript(ScriptSourceCode(m_cachedScript.get(), JSC::SourceProviderSourceType::Program));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoredomLoadableClassicScripth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/LoadableClassicScript.h (208787 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/LoadableClassicScript.h        2016-11-16 09:08:23 UTC (rev 208787)
+++ trunk/Source/WebCore/dom/LoadableClassicScript.h        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -40,17 +40,17 @@
</span><span class="cx"> // destroyed in order to guarantee that the data buffer will not be purged.
</span><span class="cx"> class LoadableClassicScript final : public LoadableScript, private CachedResourceClient {
</span><span class="cx"> public:
</span><del>-    ~LoadableClassicScript();
</del><ins>+    virtual ~LoadableClassicScript();
</ins><span class="cx"> 
</span><span class="cx">     static Ref&lt;LoadableClassicScript&gt; create(CachedResourceHandle&lt;CachedScript&gt;&amp;&amp;);
</span><del>-    bool isLoaded() const override;
-    Optional&lt;Error&gt; wasErrored() const override;
-    bool wasCanceled() const override;
</del><ins>+    bool isLoaded() const final;
+    Optional&lt;Error&gt; error() const final;
+    bool wasCanceled() const final;
</ins><span class="cx"> 
</span><span class="cx">     CachedScript&amp; cachedScript() { return *m_cachedScript; }
</span><span class="cx">     bool isClassicScript() const final { return true; }
</span><span class="cx"> 
</span><del>-    void execute(ScriptElement&amp;) override;
</del><ins>+    void execute(ScriptElement&amp;) final;
</ins><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx">     LoadableClassicScript(CachedResourceHandle&lt;CachedScript&gt;&amp;&amp; cachedScript) : m_cachedScript(WTFMove(cachedScript)) { }
</span></span></pre></div>
<a id="trunkSourceWebCoredomLoadableModuleScriptcppfromrev208787trunkSourceWebCoredomLoadableScripth"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebCore/dom/LoadableModuleScript.cpp (from rev 208787, trunk/Source/WebCore/dom/LoadableScript.h) (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/LoadableModuleScript.cpp                                (rev 0)
+++ trunk/Source/WebCore/dom/LoadableModuleScript.cpp        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,75 @@
</span><ins>+/*
+ * Copyright (C) 2016 Apple, Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE 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 &quot;config.h&quot;
+#include &quot;LoadableModuleScript.h&quot;
+
+#include &quot;ScriptElement.h&quot;
+
+namespace WebCore {
+
+Ref&lt;LoadableModuleScript&gt; LoadableModuleScript::create(CachedModuleScript&amp; moduleScript)
+{
+    auto script = adoptRef(*new LoadableModuleScript(moduleScript));
+    moduleScript.addClient(script.get());
+    return script;
+}
+
+LoadableModuleScript::LoadableModuleScript(CachedModuleScript&amp; moduleScript)
+    : m_moduleScript(moduleScript)
+{
+}
+
+LoadableModuleScript::~LoadableModuleScript()
+{
+    m_moduleScript-&gt;removeClient(*this);
+}
+
+bool LoadableModuleScript::isLoaded() const
+{
+    return m_moduleScript-&gt;isLoaded();
+}
+
+Optional&lt;LoadableScript::Error&gt; LoadableModuleScript::error() const
+{
+    return m_moduleScript-&gt;error();
+}
+
+bool LoadableModuleScript::wasCanceled() const
+{
+    return m_moduleScript-&gt;wasCanceled();
+}
+
+void LoadableModuleScript::notifyFinished(CachedModuleScript&amp;)
+{
+    notifyClientFinished();
+}
+
+void LoadableModuleScript::execute(ScriptElement&amp; scriptElement)
+{
+    scriptElement.executeModuleScript(m_moduleScript.get());
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceWebCoredomLoadableModuleScripthfromrev208787trunkSourceWebCoredomLoadableScripth"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebCore/dom/LoadableModuleScript.h (from rev 208787, trunk/Source/WebCore/dom/LoadableScript.h) (0 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/LoadableModuleScript.h                                (rev 0)
+++ trunk/Source/WebCore/dom/LoadableModuleScript.h        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -0,0 +1,64 @@
</span><ins>+/*
+ * Copyright (C) 2016 Apple, Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE 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 &quot;CachedModuleScript.h&quot;
+#include &quot;CachedModuleScriptClient.h&quot;
+#include &quot;LoadableScript.h&quot;
+#include &lt;wtf/TypeCasts.h&gt;
+
+namespace WebCore {
+
+class LoadableModuleScript final : public LoadableScript, private CachedModuleScriptClient {
+public:
+    virtual ~LoadableModuleScript();
+
+    static Ref&lt;LoadableModuleScript&gt; create(CachedModuleScript&amp;);
+
+    bool isLoaded() const final;
+    Optional&lt;Error&gt; error() const final;
+    bool wasCanceled() const final;
+
+    CachedModuleScript&amp; moduleScript() { return m_moduleScript.get(); }
+    bool isModuleScript() const final { return true; }
+
+    void execute(ScriptElement&amp;) final;
+
+    void setError(Error&amp;&amp;);
+
+private:
+    LoadableModuleScript(CachedModuleScript&amp;);
+
+    void notifyFinished(CachedModuleScript&amp;) final;
+
+    Ref&lt;CachedModuleScript&gt; m_moduleScript;
+};
+
+}
+
+SPECIALIZE_TYPE_TRAITS_BEGIN(WebCore::LoadableModuleScript)
+    static bool isType(const WebCore::LoadableScript&amp; script) { return script.isModuleScript(); }
+SPECIALIZE_TYPE_TRAITS_END()
</ins></span></pre></div>
<a id="trunkSourceWebCoredomLoadableScripth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/LoadableScript.h (208787 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/LoadableScript.h        2016-11-16 09:08:23 UTC (rev 208787)
+++ trunk/Source/WebCore/dom/LoadableScript.h        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -57,7 +57,7 @@
</span><span class="cx">     virtual ~LoadableScript() { }
</span><span class="cx"> 
</span><span class="cx">     virtual bool isLoaded() const = 0;
</span><del>-    virtual Optional&lt;Error&gt; wasErrored() const = 0;
</del><ins>+    virtual Optional&lt;Error&gt; error() const = 0;
</ins><span class="cx">     virtual bool wasCanceled() const = 0;
</span><span class="cx"> 
</span><span class="cx">     virtual void execute(ScriptElement&amp;) = 0;
</span><span class="lines">@@ -66,7 +66,7 @@
</span><span class="cx">     void removeClient(LoadableScriptClient&amp;);
</span><span class="cx"> 
</span><span class="cx">     virtual bool isClassicScript() const { return false; }
</span><del>-    virtual bool isModuleGraph() const { return false; }
</del><ins>+    virtual bool isModuleScript() const { return false; }
</ins><span class="cx"> 
</span><span class="cx"> protected:
</span><span class="cx">     void notifyClientFinished();
</span></span></pre></div>
<a id="trunkSourceWebCoredomPendingScriptcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/PendingScript.cpp (208787 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/PendingScript.cpp        2016-11-16 09:08:23 UTC (rev 208787)
+++ trunk/Source/WebCore/dom/PendingScript.cpp        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -83,9 +83,9 @@
</span><span class="cx">     return m_loadableScript &amp;&amp; m_loadableScript-&gt;isLoaded();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool PendingScript::wasErrored() const
</del><ins>+bool PendingScript::error() const
</ins><span class="cx"> {
</span><del>-    return m_loadableScript &amp;&amp; m_loadableScript-&gt;wasErrored();
</del><ins>+    return m_loadableScript &amp;&amp; m_loadableScript-&gt;error();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void PendingScript::setClient(PendingScriptClient* client)
</span></span></pre></div>
<a id="trunkSourceWebCoredomPendingScripth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/PendingScript.h (208787 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/PendingScript.h        2016-11-16 09:08:23 UTC (rev 208787)
+++ trunk/Source/WebCore/dom/PendingScript.h        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -58,7 +58,7 @@
</span><span class="cx">     bool needsLoading() const { return loadableScript(); }
</span><span class="cx"> 
</span><span class="cx">     bool isLoaded() const;
</span><del>-    bool wasErrored() const;
</del><ins>+    bool error() const;
</ins><span class="cx"> 
</span><span class="cx">     void notifyFinished(LoadableScript&amp;) override;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoredomScriptElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/ScriptElement.cpp (208787 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/ScriptElement.cpp        2016-11-16 09:08:23 UTC (rev 208787)
+++ trunk/Source/WebCore/dom/ScriptElement.cpp        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -24,6 +24,7 @@
</span><span class="cx"> #include &quot;config.h&quot;
</span><span class="cx"> #include &quot;ScriptElement.h&quot;
</span><span class="cx"> 
</span><ins>+#include &quot;CachedModuleScript.h&quot;
</ins><span class="cx"> #include &quot;CachedResourceLoader.h&quot;
</span><span class="cx"> #include &quot;CachedResourceRequest.h&quot;
</span><span class="cx"> #include &quot;CachedScript.h&quot;
</span><span class="lines">@@ -38,6 +39,7 @@
</span><span class="cx"> #include &quot;HTMLParserIdioms.h&quot;
</span><span class="cx"> #include &quot;IgnoreDestructiveWriteCountIncrementer.h&quot;
</span><span class="cx"> #include &quot;LoadableClassicScript.h&quot;
</span><ins>+#include &quot;LoadableModuleScript.h&quot;
</ins><span class="cx"> #include &quot;MIMETypeRegistry.h&quot;
</span><span class="cx"> #include &quot;Page.h&quot;
</span><span class="cx"> #include &quot;PendingScript.h&quot;
</span><span class="lines">@@ -68,6 +70,7 @@
</span><span class="cx">     , m_willExecuteWhenDocumentFinishedParsing(false)
</span><span class="cx">     , m_forceAsync(!parserInserted)
</span><span class="cx">     , m_willExecuteInOrder(false)
</span><ins>+    , m_isModuleScript(false)
</ins><span class="cx"> {
</span><span class="cx">     if (parserInserted &amp;&amp; m_element.document().scriptableDocumentParser() &amp;&amp; !m_element.document().isInDocumentWrite())
</span><span class="cx">         m_startLineNumber = m_element.document().scriptableDocumentParser()-&gt;textPosition().m_line;
</span><span class="lines">@@ -191,8 +194,12 @@
</span><span class="cx">     if (!m_element.inDocument())
</span><span class="cx">         return false;
</span><span class="cx"> 
</span><del>-    if (!determineScriptType(supportLegacyTypes))
</del><ins>+    ScriptType scriptType = ScriptType::Classic;
+    if (Optional&lt;ScriptType&gt; result = determineScriptType(supportLegacyTypes))
+        scriptType = result.value();
+    else
</ins><span class="cx">         return false;
</span><ins>+    m_isModuleScript = scriptType == ScriptType::Module;
</ins><span class="cx"> 
</span><span class="cx">     if (wasParserInserted) {
</span><span class="cx">         m_parserInserted = true;
</span><span class="lines">@@ -213,38 +220,56 @@
</span><span class="cx">     if (!document.frame()-&gt;script().canExecuteScripts(AboutToExecuteScript))
</span><span class="cx">         return false;
</span><span class="cx"> 
</span><del>-    if (!isScriptForEventSupported())
</del><ins>+    if (scriptType == ScriptType::Classic &amp;&amp; !isScriptForEventSupported())
</ins><span class="cx">         return false;
</span><span class="cx"> 
</span><ins>+    // According to the spec, the module tag ignores the &quot;charset&quot; attribute as the same to the worker's
+    // importScript. But WebKit supports the &quot;charset&quot; for importScript intentionally. So to be consistent,
+    // even for the module tags, we handle the &quot;charset&quot; attribute.
</ins><span class="cx">     if (!charsetAttributeValue().isEmpty())
</span><span class="cx">         m_characterEncoding = charsetAttributeValue();
</span><span class="cx">     else
</span><span class="cx">         m_characterEncoding = document.charset();
</span><span class="cx"> 
</span><del>-    if (hasSourceAttribute()) {
-        if (!requestClassicScript(sourceAttributeValue()))
</del><ins>+    if (scriptType == ScriptType::Classic) {
+        if (hasSourceAttribute()) {
+            if (!requestClassicScript(sourceAttributeValue()))
+                return false;
+        }
+    } else {
+        ASSERT(scriptType == ScriptType::Module);
+        if (!requestModuleScript(scriptStartPosition))
</ins><span class="cx">             return false;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    if (hasSourceAttribute() &amp;&amp; deferAttributeValue() &amp;&amp; m_parserInserted &amp;&amp; !asyncAttributeValue()) {
</del><ins>+    // All the inlined module script is handled by requestModuleScript. It produces LoadableModuleScript and inlined module script
+    // is handled as the same to the external module script.
+
+    bool isClassicExternalScript = scriptType == ScriptType::Classic &amp;&amp; hasSourceAttribute();
+    bool isParserInsertedDeferredScript = ((isClassicExternalScript &amp;&amp; deferAttributeValue()) || scriptType == ScriptType::Module)
+        &amp;&amp; m_parserInserted &amp;&amp; !asyncAttributeValue();
+    if (isParserInsertedDeferredScript) {
</ins><span class="cx">         m_willExecuteWhenDocumentFinishedParsing = true;
</span><span class="cx">         m_willBeParserExecuted = true;
</span><del>-    } else if (hasSourceAttribute() &amp;&amp; m_parserInserted &amp;&amp; !asyncAttributeValue())
</del><ins>+    } else if (isClassicExternalScript &amp;&amp; m_parserInserted &amp;&amp; !asyncAttributeValue()) {
+        ASSERT(scriptType == ScriptType::Classic);
</ins><span class="cx">         m_willBeParserExecuted = true;
</span><del>-    else if (!hasSourceAttribute() &amp;&amp; m_parserInserted &amp;&amp; !document.haveStylesheetsLoaded()) {
-        m_willBeParserExecuted = true;
-        m_readyToBeParserExecuted = true;
-    } else if (hasSourceAttribute() &amp;&amp; !asyncAttributeValue() &amp;&amp; !m_forceAsync) {
</del><ins>+    } else if ((isClassicExternalScript || scriptType == ScriptType::Module) &amp;&amp; !asyncAttributeValue() &amp;&amp; !m_forceAsync) {
+        m_willExecuteInOrder = true;
</ins><span class="cx">         ASSERT(m_loadableScript);
</span><del>-        m_willExecuteInOrder = true;
</del><span class="cx">         document.scriptRunner()-&gt;queueScriptForExecution(this, *m_loadableScript, ScriptRunner::IN_ORDER_EXECUTION);
</span><del>-    } else if (hasSourceAttribute()) {
</del><ins>+    } else if (hasSourceAttribute() || scriptType == ScriptType::Module) {
</ins><span class="cx">         ASSERT(m_loadableScript);
</span><del>-        m_element.document().scriptRunner()-&gt;queueScriptForExecution(this, *m_loadableScript, ScriptRunner::ASYNC_EXECUTION);
</del><ins>+        ASSERT(asyncAttributeValue() || m_forceAsync);
+        document.scriptRunner()-&gt;queueScriptForExecution(this, *m_loadableScript, ScriptRunner::ASYNC_EXECUTION);
+    } else if (!hasSourceAttribute() &amp;&amp; m_parserInserted &amp;&amp; !document.haveStylesheetsLoaded()) {
+        ASSERT(scriptType == ScriptType::Classic);
+        m_willBeParserExecuted = true;
+        m_readyToBeParserExecuted = true;
</ins><span class="cx">     } else {
</span><del>-        // Reset line numbering for nested writes.
</del><ins>+        ASSERT(scriptType == ScriptType::Classic);
</ins><span class="cx">         TextPosition position = document.isInDocumentWrite() ? TextPosition() : scriptStartPosition;
</span><del>-        executeScript(ScriptSourceCode(scriptContent(), document.url(), position));
</del><ins>+        executeScript(ScriptSourceCode(scriptContent(), document.url(), position, JSC::SourceProviderSourceType::Program));
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     return true;
</span><span class="lines">@@ -261,7 +286,9 @@
</span><span class="cx"> 
</span><span class="cx">     ASSERT(!m_loadableScript);
</span><span class="cx">     if (!stripLeadingAndTrailingHTMLSpaces(sourceURL).isEmpty()) {
</span><del>-        auto request = requestScriptWithCache(m_element.document().completeURL(sourceURL), m_element.attributeWithoutSynchronization(HTMLNames::nonceAttr));
</del><ins>+        String nonceAttribute = m_element.attributeWithoutSynchronization(HTMLNames::nonceAttr);
+        String crossOriginMode = m_element.attributeWithoutSynchronization(HTMLNames::crossoriginAttr);
+        auto request = requestScriptWithCache(m_element.document().completeURL(sourceURL), nonceAttribute, crossOriginMode);
</ins><span class="cx">         if (request) {
</span><span class="cx">             m_loadableScript = LoadableClassicScript::create(WTFMove(request));
</span><span class="cx">             m_isExternalScript = true;
</span><span class="lines">@@ -277,8 +304,66 @@
</span><span class="cx">     return false;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-CachedResourceHandle&lt;CachedScript&gt; ScriptElement::requestScriptWithCache(const URL&amp; sourceURL, const String&amp; nonceAttribute)
</del><ins>+bool ScriptElement::requestModuleScript(const TextPosition&amp; scriptStartPosition)
</ins><span class="cx"> {
</span><ins>+    String nonce = m_element.attributeWithoutSynchronization(HTMLNames::nonceAttr);
+    String crossOriginMode = m_element.attributeWithoutSynchronization(HTMLNames::crossoriginAttr);
+    if (crossOriginMode.isNull())
+        crossOriginMode = ASCIILiteral(&quot;omit&quot;);
+
+    if (hasSourceAttribute()) {
+        String sourceURL = sourceAttributeValue();
+        Ref&lt;Document&gt; originalDocument(m_element.document());
+        if (!m_element.dispatchBeforeLoadEvent(sourceURL))
+            return false;
+
+        bool didEventListenerDisconnectThisElement = !m_element.inDocument() || &amp;m_element.document() != originalDocument.ptr();
+        if (didEventListenerDisconnectThisElement)
+            return false;
+
+        if (stripLeadingAndTrailingHTMLSpaces(sourceURL).isEmpty()) {
+            dispatchErrorEvent();
+            return false;
+        }
+
+        auto moduleScriptRootURL = m_element.document().completeURL(sourceURL);
+        if (!moduleScriptRootURL.isValid()) {
+            dispatchErrorEvent();
+            return false;
+        }
+
+        m_isExternalScript = true;
+        auto moduleScript = CachedModuleScript::create(nonce, crossOriginMode);
+        m_loadableScript = LoadableModuleScript::create(moduleScript.get());
+        moduleScript-&gt;load(m_element, moduleScriptRootURL);
+        return true;
+    }
+
+    TextPosition position = m_element.document().isInDocumentWrite() ? TextPosition() : scriptStartPosition;
+    ScriptSourceCode sourceCode(scriptContent(), m_element.document().url(), position, JSC::SourceProviderSourceType::Module);
+
+    ASSERT(m_element.document().contentSecurityPolicy());
+    const auto&amp; contentSecurityPolicy = *m_element.document().contentSecurityPolicy();
+    bool hasKnownNonce = contentSecurityPolicy.allowScriptWithNonce(nonce, m_element.isInUserAgentShadowTree());
+    if (!contentSecurityPolicy.allowInlineScript(m_element.document().url(), m_startLineNumber, sourceCode.source().toStringWithoutCopying(), hasKnownNonce))
+        return false;
+
+    auto moduleScript = CachedModuleScript::create(nonce, crossOriginMode);
+    m_loadableScript = LoadableModuleScript::create(moduleScript.get());
+    moduleScript-&gt;load(m_element, sourceCode);
+    return true;
+}
+
+CachedResourceHandle&lt;CachedScript&gt; ScriptElement::requestScriptWithCacheForModuleScript(const URL&amp; sourceURL)
+{
+    ASSERT(m_loadableScript);
+    ASSERT(is&lt;LoadableModuleScript&gt;(*m_loadableScript));
+    auto&amp; moduleScript = downcast&lt;LoadableModuleScript&gt;(*m_loadableScript);
+    return requestScriptWithCache(sourceURL, moduleScript.moduleScript().nonce(), moduleScript.moduleScript().crossOriginMode());
+}
+
+CachedResourceHandle&lt;CachedScript&gt; ScriptElement::requestScriptWithCache(const URL&amp; sourceURL, const String&amp; nonceAttribute, const String&amp; crossOriginMode)
+{
</ins><span class="cx">     Document&amp; document = m_element.document();
</span><span class="cx">     auto* settings = document.settings();
</span><span class="cx">     if (settings &amp;&amp; !settings-&gt;isScriptEnabled())
</span><span class="lines">@@ -290,7 +375,7 @@
</span><span class="cx">     options.contentSecurityPolicyImposition = hasKnownNonce ? ContentSecurityPolicyImposition::SkipPolicyCheck : ContentSecurityPolicyImposition::DoPolicyCheck;
</span><span class="cx"> 
</span><span class="cx">     CachedResourceRequest request(ResourceRequest(sourceURL), options);
</span><del>-    request.setAsPotentiallyCrossOrigin(m_element.attributeWithoutSynchronization(HTMLNames::crossoriginAttr), document);
</del><ins>+    request.setAsPotentiallyCrossOrigin(crossOriginMode, document);
</ins><span class="cx">     request.upgradeInsecureRequestIfNeeded(document);
</span><span class="cx"> 
</span><span class="cx">     request.setCharset(scriptCharset());
</span><span class="lines">@@ -314,26 +399,42 @@
</span><span class="cx">             return;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    Ref&lt;Document&gt; document(m_element.document());
-    if (Frame* frame = document-&gt;frame()) {
-        IgnoreDestructiveWriteCountIncrementer ignoreDesctructiveWriteCountIncrementer(m_isExternalScript ? document.ptr() : nullptr);
-        CurrentScriptIncrementer currentScriptIncrementer(document, m_element);
</del><ins>+    auto&amp; document = m_element.document();
+    auto* frame = document.frame();
+    if (!frame)
+        return;
</ins><span class="cx"> 
</span><del>-        // Create a script from the script element node, using the script
-        // block's source and the script block's type.
-        // Note: This is where the script is compiled and actually executed.
-        frame-&gt;script().evaluate(sourceCode);
-    }
</del><ins>+    IgnoreDestructiveWriteCountIncrementer ignoreDesctructiveWriteCountIncrementer(m_isExternalScript ? &amp;document : nullptr);
+    CurrentScriptIncrementer currentScriptIncrementer(document, m_element);
+
+    frame-&gt;script().evaluate(sourceCode);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void ScriptElement::executeModuleScript(CachedModuleScript&amp; moduleScript)
+{
+    // https://html.spec.whatwg.org/multipage/scripting.html#execute-the-script-block
+
+    ASSERT(!moduleScript.error());
+
+    auto&amp; document = m_element.document();
+    auto* frame = document.frame();
+    if (!frame)
+        return;
+
+    IgnoreDestructiveWriteCountIncrementer ignoreDesctructiveWriteCountIncrementer(&amp;document);
+    CurrentScriptIncrementer currentScriptIncrementer(document, m_element);
+
+    frame-&gt;script().linkAndEvaluateModuleScript(moduleScript, element());
+}
+
</ins><span class="cx"> void ScriptElement::executeScriptAndDispatchEvent(LoadableScript&amp; loadableScript)
</span><span class="cx"> {
</span><del>-    if (Optional&lt;LoadableScript::Error&gt; error = loadableScript.wasErrored()) {
</del><ins>+    if (Optional&lt;LoadableScript::Error&gt; error = loadableScript.error()) {
</ins><span class="cx">         if (Optional&lt;LoadableScript::ConsoleMessage&gt; message = error-&gt;consoleMessage)
</span><span class="cx">             m_element.document().addConsoleMessage(message-&gt;source, message-&gt;level, message-&gt;message);
</span><span class="cx">         dispatchErrorEvent();
</span><span class="cx">     } else if (!loadableScript.wasCanceled()) {
</span><del>-        ASSERT(!loadableScript.wasErrored());
</del><ins>+        ASSERT(!loadableScript.error());
</ins><span class="cx">         loadableScript.execute(*this);
</span><span class="cx">         dispatchLoadEvent();
</span><span class="cx">     }
</span><span class="lines">@@ -344,8 +445,9 @@
</span><span class="cx">     if (auto* loadableScript = pendingScript.loadableScript())
</span><span class="cx">         executeScriptAndDispatchEvent(*loadableScript);
</span><span class="cx">     else {
</span><del>-        ASSERT(!pendingScript.wasErrored());
-        executeScript(ScriptSourceCode(scriptContent(), m_element.document().url(), pendingScript.startingPosition()));
</del><ins>+        ASSERT(!pendingScript.error());
+        JSC::SourceProviderSourceType sourceType = scriptType() == ScriptType::Module ? JSC::SourceProviderSourceType::Module : JSC::SourceProviderSourceType::Program;
+        executeScript(ScriptSourceCode(scriptContent(), m_element.document().url(), pendingScript.startingPosition(), sourceType));
</ins><span class="cx">         dispatchLoadEvent();
</span><span class="cx">     }
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoredomScriptElementh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/ScriptElement.h (208787 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/ScriptElement.h        2016-11-16 09:08:23 UTC (rev 208787)
+++ trunk/Source/WebCore/dom/ScriptElement.h        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -37,6 +37,7 @@
</span><span class="cx"> class PendingScript;
</span><span class="cx"> class ScriptElement;
</span><span class="cx"> class ScriptSourceCode;
</span><ins>+class CachedModuleScript;
</ins><span class="cx"> 
</span><span class="cx"> class ScriptElement {
</span><span class="cx"> public:
</span><span class="lines">@@ -51,6 +52,7 @@
</span><span class="cx">     String scriptCharset() const { return m_characterEncoding; }
</span><span class="cx">     WEBCORE_EXPORT String scriptContent() const;
</span><span class="cx">     void executeScript(const ScriptSourceCode&amp;);
</span><ins>+    void executeModuleScript(CachedModuleScript&amp;);
</ins><span class="cx"> 
</span><span class="cx">     void executeScriptForScriptRunner(PendingScript&amp;);
</span><span class="cx"> 
</span><span class="lines">@@ -65,6 +67,12 @@
</span><span class="cx">     bool willExecuteInOrder() const { return m_willExecuteInOrder; }
</span><span class="cx">     LoadableScript* loadableScript() { return m_loadableScript.get(); }
</span><span class="cx"> 
</span><ins>+    CachedResourceHandle&lt;CachedScript&gt; requestScriptWithCacheForModuleScript(const URL&amp;);
+
+    // https://html.spec.whatwg.org/multipage/scripting.html#concept-script-type
+    enum class ScriptType { Classic, Module };
+    ScriptType scriptType() const { return m_isModuleScript ? ScriptType::Module : ScriptType::Classic; }
+
</ins><span class="cx"> protected:
</span><span class="cx">     ScriptElement(Element&amp;, bool createdByParser, bool isEvaluated);
</span><span class="cx"> 
</span><span class="lines">@@ -83,15 +91,14 @@
</span><span class="cx"> private:
</span><span class="cx">     void executeScriptAndDispatchEvent(LoadableScript&amp;);
</span><span class="cx"> 
</span><del>-    // https://html.spec.whatwg.org/multipage/scripting.html#concept-script-type
-    enum class ScriptType { Classic, Module };
</del><span class="cx">     Optional&lt;ScriptType&gt; determineScriptType(LegacyTypeSupport) const;
</span><span class="cx">     bool ignoresLoadRequest() const;
</span><span class="cx">     bool isScriptForEventSupported() const;
</span><span class="cx"> 
</span><del>-    CachedResourceHandle&lt;CachedScript&gt; requestScriptWithCache(const URL&amp;, const String&amp;);
</del><ins>+    CachedResourceHandle&lt;CachedScript&gt; requestScriptWithCache(const URL&amp;, const String&amp; nonceAttribute, const String&amp; crossoriginAttribute);
</ins><span class="cx"> 
</span><span class="cx">     bool requestClassicScript(const String&amp; sourceURL);
</span><ins>+    bool requestModuleScript(const TextPosition&amp; scriptStartPosition);
</ins><span class="cx"> 
</span><span class="cx">     virtual String sourceAttributeValue() const = 0;
</span><span class="cx">     virtual String charsetAttributeValue() const = 0;
</span><span class="lines">@@ -114,6 +121,7 @@
</span><span class="cx">     bool m_willExecuteWhenDocumentFinishedParsing : 1;
</span><span class="cx">     bool m_forceAsync : 1;
</span><span class="cx">     bool m_willExecuteInOrder : 1;
</span><ins>+    bool m_isModuleScript : 1;
</ins><span class="cx">     String m_characterEncoding;
</span><span class="cx">     String m_fallbackCharacterEncoding;
</span><span class="cx">     RefPtr&lt;LoadableScript&gt; m_loadableScript;
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlparserCSSPreloadScannercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/parser/CSSPreloadScanner.cpp (208787 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/parser/CSSPreloadScanner.cpp        2016-11-16 09:08:23 UTC (rev 208787)
+++ trunk/Source/WebCore/html/parser/CSSPreloadScanner.cpp        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -203,7 +203,7 @@
</span><span class="cx">         if (!url.isEmpty()) {
</span><span class="cx">             URL baseElementURL; // FIXME: This should be passed in from the HTMLPreloadScanner via scan(): without it we will get relative URLs wrong.
</span><span class="cx">             // FIXME: Should this be including the charset in the preload request?
</span><del>-            m_requests-&gt;append(std::make_unique&lt;PreloadRequest&gt;(&quot;css&quot;, url, baseElementURL, CachedResource::CSSStyleSheet, String()));
</del><ins>+            m_requests-&gt;append(std::make_unique&lt;PreloadRequest&gt;(&quot;css&quot;, url, baseElementURL, CachedResource::CSSStyleSheet, String(), PreloadRequest::ModuleScript::No));
</ins><span class="cx">         }
</span><span class="cx">         m_state = Initial;
</span><span class="cx">     } else if (equalLettersIgnoringASCIICase(rule, &quot;charset&quot;))
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlparserHTMLPreloadScannercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/parser/HTMLPreloadScanner.cpp (208787 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/parser/HTMLPreloadScanner.cpp        2016-11-16 09:08:23 UTC (rev 208787)
+++ trunk/Source/WebCore/html/parser/HTMLPreloadScanner.cpp        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -144,8 +144,12 @@
</span><span class="cx">         if (!shouldPreload())
</span><span class="cx">             return nullptr;
</span><span class="cx"> 
</span><del>-        auto request = std::make_unique&lt;PreloadRequest&gt;(initiatorFor(m_tagId), m_urlToLoad, predictedBaseURL, resourceType(), m_mediaAttribute);
</del><ins>+        auto request = std::make_unique&lt;PreloadRequest&gt;(initiatorFor(m_tagId), m_urlToLoad, predictedBaseURL, resourceType(), m_mediaAttribute, m_moduleScript);
</ins><span class="cx">         request-&gt;setCrossOriginMode(m_crossOriginMode);
</span><ins>+
+        // According to the spec, the module tag ignores the &quot;charset&quot; attribute as the same to the worker's
+        // importScript. But WebKit supports the &quot;charset&quot; for importScript intentionally. So to be consistent,
+        // even for the module tags, we handle the &quot;charset&quot; attribute.
</ins><span class="cx">         request-&gt;setCharset(charset());
</span><span class="cx">         return request;
</span><span class="cx">     }
</span><span class="lines">@@ -205,6 +209,10 @@
</span><span class="cx">             }
</span><span class="cx">             break;
</span><span class="cx">         case TagId::Script:
</span><ins>+            if (match(attributeName, typeAttr)) {
+                m_moduleScript = equalLettersIgnoringASCIICase(attributeValue, &quot;module&quot;) ? PreloadRequest::ModuleScript::Yes : PreloadRequest::ModuleScript::No;
+                break;
+            }
</ins><span class="cx">             processImageAndScriptAttribute(attributeName, attributeValue);
</span><span class="cx">             break;
</span><span class="cx">         case TagId::Link:
</span><span class="lines">@@ -318,6 +326,7 @@
</span><span class="cx">     bool m_metaIsViewport;
</span><span class="cx">     bool m_inputIsImage;
</span><span class="cx">     float m_deviceScaleFactor;
</span><ins>+    PreloadRequest::ModuleScript m_moduleScript { PreloadRequest::ModuleScript::No };
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> TokenPreloadScanner::TokenPreloadScanner(const URL&amp; documentURL, float deviceScaleFactor)
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlparserHTMLResourcePreloadercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/parser/HTMLResourcePreloader.cpp (208787 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/parser/HTMLResourcePreloader.cpp        2016-11-16 09:08:23 UTC (rev 208787)
+++ trunk/Source/WebCore/html/parser/HTMLResourcePreloader.cpp        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -45,7 +45,12 @@
</span><span class="cx">     ASSERT(isMainThread());
</span><span class="cx">     CachedResourceRequest request(completeURL(document), CachedResourceLoader::defaultCachedResourceOptions());
</span><span class="cx">     request.setInitiator(m_initiator);
</span><del>-    request.setAsPotentiallyCrossOrigin(m_crossOriginMode, document);
</del><ins>+    String crossOriginMode = m_crossOriginMode;
+    if (m_moduleScript == ModuleScript::Yes) {
+        if (crossOriginMode.isNull())
+            crossOriginMode = ASCIILiteral(&quot;omit&quot;);
+    }
+    request.setAsPotentiallyCrossOrigin(crossOriginMode, document);
</ins><span class="cx">     return request;
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlparserHTMLResourcePreloaderh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/parser/HTMLResourcePreloader.h (208787 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/parser/HTMLResourcePreloader.h        2016-11-16 09:08:23 UTC (rev 208787)
+++ trunk/Source/WebCore/html/parser/HTMLResourcePreloader.h        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -33,12 +33,17 @@
</span><span class="cx"> class PreloadRequest {
</span><span class="cx">     WTF_MAKE_FAST_ALLOCATED;
</span><span class="cx"> public:
</span><del>-    PreloadRequest(const String&amp; initiator, const String&amp; resourceURL, const URL&amp; baseURL, CachedResource::Type resourceType, const String&amp; mediaAttribute)
</del><ins>+    enum class ModuleScript {
+        Yes,
+        No,
+    };
+    PreloadRequest(const String&amp; initiator, const String&amp; resourceURL, const URL&amp; baseURL, CachedResource::Type resourceType, const String&amp; mediaAttribute, ModuleScript moduleScript)
</ins><span class="cx">         : m_initiator(initiator)
</span><span class="cx">         , m_resourceURL(resourceURL)
</span><span class="cx">         , m_baseURL(baseURL.isolatedCopy())
</span><span class="cx">         , m_resourceType(resourceType)
</span><span class="cx">         , m_mediaAttribute(mediaAttribute)
</span><ins>+        , m_moduleScript(moduleScript)
</ins><span class="cx">     {
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -60,6 +65,7 @@
</span><span class="cx">     CachedResource::Type m_resourceType;
</span><span class="cx">     String m_mediaAttribute;
</span><span class="cx">     String m_crossOriginMode;
</span><ins>+    ModuleScript m_moduleScript;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> typedef Vector&lt;std::unique_ptr&lt;PreloadRequest&gt;&gt; PreloadRequestStream;
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlparserHTMLScriptRunnerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/parser/HTMLScriptRunner.h (208787 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/parser/HTMLScriptRunner.h        2016-11-16 09:08:23 UTC (rev 208787)
+++ trunk/Source/WebCore/html/parser/HTMLScriptRunner.h        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -72,7 +72,6 @@
</span><span class="cx">     void watchForLoad(PendingScript&amp;);
</span><span class="cx">     void stopWatchingForLoad(PendingScript&amp;);
</span><span class="cx">     bool isPendingScriptReady(const PendingScript&amp;);
</span><del>-    ScriptSourceCode sourceFromPendingScript(const PendingScript&amp;, bool&amp; errorOccurred) const;
</del><span class="cx"> 
</span><span class="cx">     Document* m_document;
</span><span class="cx">     HTMLScriptRunnerHost&amp; m_host;
</span></span></pre></div>
<a id="trunkSourceWebCoreloadercacheCachedResourceRequestcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/cache/CachedResourceRequest.cpp (208787 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/cache/CachedResourceRequest.cpp        2016-11-16 09:08:23 UTC (rev 208787)
+++ trunk/Source/WebCore/loader/cache/CachedResourceRequest.cpp        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -91,10 +91,14 @@
</span><span class="cx"> 
</span><span class="cx">     if (mode.isNull())
</span><span class="cx">         return;
</span><ins>+
</ins><span class="cx">     m_options.mode = FetchOptions::Mode::Cors;
</span><del>-    m_options.credentials = equalLettersIgnoringASCIICase(mode, &quot;use-credentials&quot;) ? FetchOptions::Credentials::Include : FetchOptions::Credentials::SameOrigin;
-    m_options.allowCredentials = equalLettersIgnoringASCIICase(mode, &quot;use-credentials&quot;) ? AllowStoredCredentials : DoNotAllowStoredCredentials;
</del><span class="cx"> 
</span><ins>+    FetchOptions::Credentials credentials = equalLettersIgnoringASCIICase(mode, &quot;omit&quot;)
+        ? FetchOptions::Credentials::Omit : equalLettersIgnoringASCIICase(mode, &quot;use-credentials&quot;)
+        ? FetchOptions::Credentials::Include : FetchOptions::Credentials::SameOrigin;
+    m_options.credentials = credentials;
+    m_options.allowCredentials = credentials == FetchOptions::Credentials::Include ? AllowStoredCredentials : DoNotAllowStoredCredentials;
</ins><span class="cx">     WebCore::updateRequestForAccessControl(m_resourceRequest, *document.securityOrigin(), m_options.allowCredentials);
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorexmlparserXMLDocumentParsercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/xml/parser/XMLDocumentParser.cpp (208787 => 208788)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/xml/parser/XMLDocumentParser.cpp        2016-11-16 09:08:23 UTC (rev 208787)
+++ trunk/Source/WebCore/xml/parser/XMLDocumentParser.cpp        2016-11-16 11:39:43 UTC (rev 208788)
</span><span class="lines">@@ -232,7 +232,9 @@
</span><span class="cx">     ASSERT_UNUSED(unusedResource, &amp;unusedResource == m_pendingScript);
</span><span class="cx">     ASSERT(m_pendingScript-&gt;accessCount() &gt; 0);
</span><span class="cx"> 
</span><del>-    ScriptSourceCode sourceCode(m_pendingScript.get());
</del><ins>+    // FIXME: Support ES6 modules in XML document.
+    // https://bugs.webkit.org/show_bug.cgi?id=161651
+    ScriptSourceCode sourceCode(m_pendingScript.get(), JSC::SourceProviderSourceType::Program);
</ins><span class="cx">     bool errorOccurred = m_pendingScript-&gt;errorOccurred();
</span><span class="cx">     bool wasCanceled = m_pendingScript-&gt;wasCanceled();
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>