<!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>[211313] trunk/Source/WebCore</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/211313">211313</a></dd>
<dt>Author</dt> <dd>utatane.tea@gmail.com</dd>
<dt>Date</dt> <dd>2017-01-27 16:47:30 -0800 (Fri, 27 Jan 2017)</dd>
</dl>
<h3>Log Message</h3>
<pre>Merge CachedModuleScript and LoadableModuleScript
https://bugs.webkit.org/show_bug.cgi?id=167500
Reviewed by Darin Adler.
CachedModuleScript becomes duplicate with LoadableModuleScript.
And CachedModuleScript does not offer any meaningful functionality
to LoadableModuleScript.
This patch merges CachedModuleScript to LoadableModuleScript.
No behavior change.
* CMakeLists.txt:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/CachedModuleScript.cpp: Removed.
* bindings/js/CachedModuleScript.h: Removed.
* bindings/js/CachedModuleScriptClient.h: Removed.
* bindings/js/JSBindingsAllInOne.cpp:
* bindings/js/ScriptController.cpp:
(WebCore::ScriptController::loadModuleScriptInWorld):
(WebCore::ScriptController::loadModuleScript):
(WebCore::ScriptController::linkAndEvaluateModuleScriptInWorld):
(WebCore::ScriptController::linkAndEvaluateModuleScript):
(WebCore::ScriptController::setupModuleScriptHandlers):
* bindings/js/ScriptController.h:
* dom/LoadableModuleScript.cpp:
(WebCore::LoadableModuleScript::create):
(WebCore::LoadableModuleScript::LoadableModuleScript):
(WebCore::LoadableModuleScript::~LoadableModuleScript):
(WebCore::LoadableModuleScript::isLoaded):
(WebCore::LoadableModuleScript::error):
(WebCore::LoadableModuleScript::wasCanceled):
(WebCore::LoadableModuleScript::notifyLoadCompleted):
(WebCore::LoadableModuleScript::notifyLoadFailed):
(WebCore::LoadableModuleScript::notifyLoadWasCanceled):
(WebCore::LoadableModuleScript::execute):
(WebCore::LoadableModuleScript::load):
(WebCore::LoadableModuleScript::notifyFinished): Deleted.
* dom/LoadableModuleScript.h:
* dom/ScriptElement.cpp:
(WebCore::ScriptElement::executeModuleScript):
* dom/ScriptElement.h:</pre>
<h3>Modified Paths</h3>
<ul>
<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="#trunkSourceWebCorebindingsjsJSBindingsAllInOnecpp">trunk/Source/WebCore/bindings/js/JSBindingsAllInOne.cpp</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="#trunkSourceWebCoredomLoadableModuleScriptcpp">trunk/Source/WebCore/dom/LoadableModuleScript.cpp</a></li>
<li><a href="#trunkSourceWebCoredomLoadableModuleScripth">trunk/Source/WebCore/dom/LoadableModuleScript.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>
</ul>
<h3>Removed Paths</h3>
<ul>
<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>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreCMakeListstxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/CMakeLists.txt (211312 => 211313)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/CMakeLists.txt        2017-01-28 00:33:17 UTC (rev 211312)
+++ trunk/Source/WebCore/CMakeLists.txt        2017-01-28 00:47:30 UTC (rev 211313)
</span><span class="lines">@@ -1067,7 +1067,6 @@
</span><span class="cx"> animation/KeyframeEffect.cpp
</span><span class="cx"> animation/WebAnimation.cpp
</span><span class="cx">
</span><del>- bindings/js/CachedModuleScript.cpp
</del><span class="cx"> bindings/js/CachedModuleScriptLoader.cpp
</span><span class="cx"> bindings/js/CachedScriptFetcher.cpp
</span><span class="cx"> bindings/js/CallbackFunction.cpp
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (211312 => 211313)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2017-01-28 00:33:17 UTC (rev 211312)
+++ trunk/Source/WebCore/ChangeLog        2017-01-28 00:47:30 UTC (rev 211313)
</span><span class="lines">@@ -1,3 +1,48 @@
</span><ins>+2017-01-27 Yusuke Suzuki <utatane.tea@gmail.com>
+
+ Merge CachedModuleScript and LoadableModuleScript
+ https://bugs.webkit.org/show_bug.cgi?id=167500
+
+ Reviewed by Darin Adler.
+
+ CachedModuleScript becomes duplicate with LoadableModuleScript.
+ And CachedModuleScript does not offer any meaningful functionality
+ to LoadableModuleScript.
+ This patch merges CachedModuleScript to LoadableModuleScript.
+
+ No behavior change.
+
+ * CMakeLists.txt:
+ * WebCore.xcodeproj/project.pbxproj:
+ * bindings/js/CachedModuleScript.cpp: Removed.
+ * bindings/js/CachedModuleScript.h: Removed.
+ * bindings/js/CachedModuleScriptClient.h: Removed.
+ * bindings/js/JSBindingsAllInOne.cpp:
+ * bindings/js/ScriptController.cpp:
+ (WebCore::ScriptController::loadModuleScriptInWorld):
+ (WebCore::ScriptController::loadModuleScript):
+ (WebCore::ScriptController::linkAndEvaluateModuleScriptInWorld):
+ (WebCore::ScriptController::linkAndEvaluateModuleScript):
+ (WebCore::ScriptController::setupModuleScriptHandlers):
+ * bindings/js/ScriptController.h:
+ * dom/LoadableModuleScript.cpp:
+ (WebCore::LoadableModuleScript::create):
+ (WebCore::LoadableModuleScript::LoadableModuleScript):
+ (WebCore::LoadableModuleScript::~LoadableModuleScript):
+ (WebCore::LoadableModuleScript::isLoaded):
+ (WebCore::LoadableModuleScript::error):
+ (WebCore::LoadableModuleScript::wasCanceled):
+ (WebCore::LoadableModuleScript::notifyLoadCompleted):
+ (WebCore::LoadableModuleScript::notifyLoadFailed):
+ (WebCore::LoadableModuleScript::notifyLoadWasCanceled):
+ (WebCore::LoadableModuleScript::execute):
+ (WebCore::LoadableModuleScript::load):
+ (WebCore::LoadableModuleScript::notifyFinished): Deleted.
+ * dom/LoadableModuleScript.h:
+ * dom/ScriptElement.cpp:
+ (WebCore::ScriptElement::executeModuleScript):
+ * dom/ScriptElement.h:
+
</ins><span class="cx"> 2017-01-27 Michael Saboff <msaboff@apple.com>
</span><span class="cx">
</span><span class="cx"> JSCustomElementInterface::invokeCallback can be called with a null callback because Weak<>
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (211312 => 211313)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2017-01-28 00:33:17 UTC (rev 211312)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2017-01-28 00:47:30 UTC (rev 211313)
</span><span class="lines">@@ -6303,9 +6303,6 @@
</span><span class="cx">                 E30592641E27A3AD00D57C98 /* InlineClassicScript.h in Headers */ = {isa = PBXBuildFile; fileRef = E30592621E27A38C00D57C98 /* InlineClassicScript.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 E30592671E27A3D100D57C98 /* CachedScriptFetcher.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E30592651E27A3C600D57C98 /* CachedScriptFetcher.cpp */; };
</span><span class="cx">                 E30592681E27A3D100D57C98 /* CachedScriptFetcher.h in Headers */ = {isa = PBXBuildFile; fileRef = E30592661E27A3C600D57C98 /* CachedScriptFetcher.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><del>-                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, ); }; };
</del><span class="cx">                 E307DECF1D81E4C300141CAF /* CachedModuleScriptLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E307DEC61D81E44800141CAF /* CachedModuleScriptLoader.cpp */; };
</span><span class="cx">                 E307DED01D81E4C700141CAF /* CachedModuleScriptLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = E307DEC71D81E44800141CAF /* CachedModuleScriptLoader.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 E307DED11D81E4CB00141CAF /* CachedModuleScriptLoaderClient.h in Headers */ = {isa = PBXBuildFile; fileRef = E307DEC81D81E44800141CAF /* CachedModuleScriptLoaderClient.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="lines">@@ -14360,9 +14357,6 @@
</span><span class="cx">                 E307DEC61D81E44800141CAF /* CachedModuleScriptLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CachedModuleScriptLoader.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 E307DEC71D81E44800141CAF /* CachedModuleScriptLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CachedModuleScriptLoader.h; sourceTree = "<group>"; };
</span><span class="cx">                 E307DEC81D81E44800141CAF /* CachedModuleScriptLoaderClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CachedModuleScriptLoaderClient.h; sourceTree = "<group>"; };
</span><del>-                E307DEC91D81E46E00141CAF /* CachedModuleScript.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CachedModuleScript.cpp; sourceTree = "<group>"; };
-                E307DECA1D81E46E00141CAF /* CachedModuleScript.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CachedModuleScript.h; sourceTree = "<group>"; };
-                E307DECB1D81E49500141CAF /* CachedModuleScriptClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CachedModuleScriptClient.h; sourceTree = "<group>"; };
</del><span class="cx">                 E307DED21D81E4ED00141CAF /* LoadableModuleScript.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LoadableModuleScript.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 E307DED31D81E4ED00141CAF /* LoadableModuleScript.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LoadableModuleScript.h; sourceTree = "<group>"; };
</span><span class="cx">                 E3150EA51DA7218D00194012 /* DOMJITHelpers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMJITHelpers.h; sourceTree = "<group>"; };
</span><span class="lines">@@ -22134,9 +22128,6 @@
</span><span class="cx">                                 BC4EDEF70C08F414007EDD49 /* Custom */,
</span><span class="cx">                                 14DFB33F0A7DF7630018F769 /* Derived Sources */,
</span><span class="cx">                                 2DFA488E1DB541C200362B99 /* BufferSource.h */,
</span><del>-                                E307DEC91D81E46E00141CAF /* CachedModuleScript.cpp */,
-                                E307DECA1D81E46E00141CAF /* CachedModuleScript.h */,
-                                E307DECB1D81E49500141CAF /* CachedModuleScriptClient.h */,
</del><span class="cx">                                 E307DEC61D81E44800141CAF /* CachedModuleScriptLoader.cpp */,
</span><span class="cx">                                 E307DEC71D81E44800141CAF /* CachedModuleScriptLoader.h */,
</span><span class="cx">                                 E307DEC81D81E44800141CAF /* CachedModuleScriptLoaderClient.h */,
</span><span class="lines">@@ -25169,8 +25160,6 @@
</span><span class="cx">                                 830030F81B7D3B7800ED3AAC /* CachedHTMLCollection.h in Headers */,
</span><span class="cx">                                 BCB16C1C0979C3BD00467741 /* CachedImage.h in Headers */,
</span><span class="cx">                                 319FBD5F15D2F464009640A6 /* CachedImageClient.h in Headers */,
</span><del>-                                E307DECD1D81E4B600141CAF /* CachedModuleScript.h in Headers */,
-                                E307DECE1D81E4BA00141CAF /* CachedModuleScriptClient.h in Headers */,
</del><span class="cx">                                 E307DED01D81E4C700141CAF /* CachedModuleScriptLoader.h in Headers */,
</span><span class="cx">                                 E307DED11D81E4CB00141CAF /* CachedModuleScriptLoaderClient.h in Headers */,
</span><span class="cx">                                 510184690B08602A004A825F /* CachedPage.h in Headers */,
</span><span class="lines">@@ -29079,7 +29068,6 @@
</span><span class="cx">                                 BC64B4CB0CB4295D005F2B62 /* CachedFont.cpp in Sources */,
</span><span class="cx">                                 51C0AA410F2AA15E001648C2 /* CachedFrame.cpp in Sources */,
</span><span class="cx">                                 BCB16C1B0979C3BD00467741 /* CachedImage.cpp in Sources */,
</span><del>-                                E307DECC1D81E4B300141CAF /* CachedModuleScript.cpp in Sources */,
</del><span class="cx">                                 E307DECF1D81E4C300141CAF /* CachedModuleScriptLoader.cpp in Sources */,
</span><span class="cx">                                 5101846A0B08602A004A825F /* CachedPage.cpp in Sources */,
</span><span class="cx">                                 D0EDA774143E303C0028E383 /* CachedRawResource.cpp in Sources */,
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsCachedModuleScriptcpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/bindings/js/CachedModuleScript.cpp (211312 => 211313)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/CachedModuleScript.cpp        2017-01-28 00:33:17 UTC (rev 211312)
+++ trunk/Source/WebCore/bindings/js/CachedModuleScript.cpp        2017-01-28 00:47:30 UTC (rev 211313)
</span><span class="lines">@@ -1,102 +0,0 @@
</span><del>-/*
- * 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 "config.h"
-#include "CachedModuleScript.h"
-
-#include "CachedModuleScriptClient.h"
-#include "DOMWrapperWorld.h"
-#include "Document.h"
-#include "ExceptionCode.h"
-#include "Frame.h"
-#include "ScriptController.h"
-#include "ScriptModuleLoader.h"
-#include "ScriptRunner.h"
-#include "ScriptSourceCode.h"
-
-namespace WebCore {
-
-Ref<CachedModuleScript> CachedModuleScript::create()
-{
- return adoptRef(*new CachedModuleScript());
-}
-
-void CachedModuleScript::load(Document& document, const URL& rootURL, CachedScriptFetcher& scriptFetcher)
-{
- if (auto* frame = document.frame())
- frame->script().loadModuleScript(*this, rootURL.string(), scriptFetcher);
-}
-
-void CachedModuleScript::load(Document& document, const ScriptSourceCode& sourceCode, CachedScriptFetcher& scriptFetcher)
-{
- if (auto* frame = document.frame())
- frame->script().loadModuleScript(*this, sourceCode, scriptFetcher);
-}
-
-void CachedModuleScript::notifyLoadCompleted(UniquedStringImpl& moduleKey)
-{
- m_moduleKey = &moduleKey;
- notifyClientFinished();
-}
-
-void CachedModuleScript::notifyLoadFailed(LoadableScript::Error&& error)
-{
- m_error = WTFMove(error);
- notifyClientFinished();
-}
-
-void CachedModuleScript::notifyLoadWasCanceled()
-{
- m_wasCanceled = true;
- notifyClientFinished();
-}
-
-void CachedModuleScript::notifyClientFinished()
-{
- m_isLoaded = true;
-
- Ref<CachedModuleScript> protectedThis(*this);
-
- Vector<CachedModuleScriptClient*> clients;
- copyToVector(m_clients, clients);
- for (auto& client : clients)
- client->notifyFinished(*this);
-}
-
-void CachedModuleScript::addClient(CachedModuleScriptClient& client)
-{
- m_clients.add(&client);
- if (!isLoaded())
- return;
- Ref<CachedModuleScript> protectedThis(*this);
- client.notifyFinished(*this);
-}
-
-void CachedModuleScript::removeClient(CachedModuleScriptClient& client)
-{
- m_clients.remove(&client);
-}
-
-}
</del></span></pre></div>
<a id="trunkSourceWebCorebindingsjsCachedModuleScripth"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/bindings/js/CachedModuleScript.h (211312 => 211313)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/CachedModuleScript.h        2017-01-28 00:33:17 UTC (rev 211312)
+++ trunk/Source/WebCore/bindings/js/CachedModuleScript.h        2017-01-28 00:47:30 UTC (rev 211313)
</span><span class="lines">@@ -1,68 +0,0 @@
</span><del>-/*
- * 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 "CachedModuleScriptLoader.h"
-#include "LoadableScript.h"
-#include <runtime/JSInternalPromise.h>
-
-namespace WebCore {
-
-class CachedModuleScriptClient;
-class Document;
-class ScriptSourceCode;
-
-class CachedModuleScript : public RefCounted<CachedModuleScript> {
-public:
- UniquedStringImpl* moduleKey() { return m_moduleKey.get(); }
-
- void notifyLoadCompleted(UniquedStringImpl& moduleKey);
- void notifyLoadFailed(LoadableScript::Error&&);
- void notifyLoadWasCanceled();
-
- const std::optional<LoadableScript::Error>& error() const { return m_error; }
- bool wasCanceled() const { return m_wasCanceled; }
- bool isLoaded() const { return m_isLoaded; }
-
- void addClient(CachedModuleScriptClient&);
- void removeClient(CachedModuleScriptClient&);
-
- static Ref<CachedModuleScript> create();
-
- void load(Document&, const URL& rootURL, CachedScriptFetcher&);
- void load(Document&, const ScriptSourceCode&, CachedScriptFetcher&);
-
-private:
- void notifyClientFinished();
-
- RefPtr<UniquedStringImpl> m_moduleKey;
- HashCountedSet<CachedModuleScriptClient*> m_clients;
- std::optional<LoadableScript::Error> m_error;
- bool m_wasCanceled { false };
- bool m_isLoaded { false };
-};
-
-} // namespace WebCore
</del></span></pre></div>
<a id="trunkSourceWebCorebindingsjsCachedModuleScriptClienth"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/bindings/js/CachedModuleScriptClient.h (211312 => 211313)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/CachedModuleScriptClient.h        2017-01-28 00:33:17 UTC (rev 211312)
+++ trunk/Source/WebCore/bindings/js/CachedModuleScriptClient.h        2017-01-28 00:47:30 UTC (rev 211313)
</span><span class="lines">@@ -1,39 +0,0 @@
</span><del>-/*
- * 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&) = 0;
-};
-
-}
</del></span></pre></div>
<a id="trunkSourceWebCorebindingsjsJSBindingsAllInOnecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/JSBindingsAllInOne.cpp (211312 => 211313)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/JSBindingsAllInOne.cpp        2017-01-28 00:33:17 UTC (rev 211312)
+++ trunk/Source/WebCore/bindings/js/JSBindingsAllInOne.cpp        2017-01-28 00:47:30 UTC (rev 211313)
</span><span class="lines">@@ -25,7 +25,6 @@
</span><span class="cx">
</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><del>-#include "CachedModuleScript.cpp"
</del><span class="cx"> #include "CachedModuleScriptLoader.cpp"
</span><span class="cx"> #include "CallbackFunction.cpp"
</span><span class="cx"> #include "DOMWrapperWorld.cpp"
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsScriptControllercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/ScriptController.cpp (211312 => 211313)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/ScriptController.cpp        2017-01-28 00:33:17 UTC (rev 211312)
+++ trunk/Source/WebCore/bindings/js/ScriptController.cpp        2017-01-28 00:47:30 UTC (rev 211313)
</span><span class="lines">@@ -22,7 +22,6 @@
</span><span class="cx"> #include "ScriptController.h"
</span><span class="cx">
</span><span class="cx"> #include "BridgeJSC.h"
</span><del>-#include "CachedModuleScript.h"
</del><span class="cx"> #include "CachedScriptFetcher.h"
</span><span class="cx"> #include "CommonVM.h"
</span><span class="cx"> #include "ContentSecurityPolicy.h"
</span><span class="lines">@@ -36,6 +35,7 @@
</span><span class="cx"> #include "JSDOMWindow.h"
</span><span class="cx"> #include "JSDocument.h"
</span><span class="cx"> #include "JSMainThreadExecState.h"
</span><ins>+#include "LoadableModuleScript.h"
</ins><span class="cx"> #include "MainFrame.h"
</span><span class="cx"> #include "MemoryPressureHandler.h"
</span><span class="cx"> #include "NP_jsobject.h"
</span><span class="lines">@@ -186,7 +186,7 @@
</span><span class="cx"> return evaluateInWorld(sourceCode, mainThreadNormalWorld(), exceptionDetails);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void ScriptController::loadModuleScriptInWorld(CachedModuleScript& moduleScript, const String& moduleName, CachedScriptFetcher& scriptFetcher, DOMWrapperWorld& world)
</del><ins>+void ScriptController::loadModuleScriptInWorld(LoadableModuleScript& moduleScript, const String& moduleName, DOMWrapperWorld& world)
</ins><span class="cx"> {
</span><span class="cx"> JSLockHolder lock(world.vm());
</span><span class="cx">
</span><span class="lines">@@ -193,16 +193,16 @@
</span><span class="cx"> auto& shell = *windowShell(world);
</span><span class="cx"> auto& state = *shell.window()->globalExec();
</span><span class="cx">
</span><del>- auto& promise = JSMainThreadExecState::loadModule(state, moduleName, JSC::JSScriptFetcher::create(state.vm(), { &scriptFetcher }));
</del><ins>+ auto& promise = JSMainThreadExecState::loadModule(state, moduleName, JSC::JSScriptFetcher::create(state.vm(), { &moduleScript }));
</ins><span class="cx"> setupModuleScriptHandlers(moduleScript, promise, world);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void ScriptController::loadModuleScript(CachedModuleScript& moduleScript, const String& moduleName, CachedScriptFetcher& scriptFetcher)
</del><ins>+void ScriptController::loadModuleScript(LoadableModuleScript& moduleScript, const String& moduleName)
</ins><span class="cx"> {
</span><del>- loadModuleScriptInWorld(moduleScript, moduleName, scriptFetcher, mainThreadNormalWorld());
</del><ins>+ loadModuleScriptInWorld(moduleScript, moduleName, mainThreadNormalWorld());
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-void ScriptController::loadModuleScriptInWorld(CachedModuleScript& moduleScript, const ScriptSourceCode& sourceCode, CachedScriptFetcher& scriptFetcher, DOMWrapperWorld& world)
</del><ins>+void ScriptController::loadModuleScriptInWorld(LoadableModuleScript& moduleScript, const ScriptSourceCode& sourceCode, DOMWrapperWorld& world)
</ins><span class="cx"> {
</span><span class="cx"> JSLockHolder lock(world.vm());
</span><span class="cx">
</span><span class="lines">@@ -209,16 +209,16 @@
</span><span class="cx"> auto& shell = *windowShell(world);
</span><span class="cx"> auto& state = *shell.window()->globalExec();
</span><span class="cx">
</span><del>- auto& promise = JSMainThreadExecState::loadModule(state, sourceCode.jsSourceCode(), JSC::JSScriptFetcher::create(state.vm(), { &scriptFetcher }));
</del><ins>+ auto& promise = JSMainThreadExecState::loadModule(state, sourceCode.jsSourceCode(), JSC::JSScriptFetcher::create(state.vm(), { &moduleScript }));
</ins><span class="cx"> setupModuleScriptHandlers(moduleScript, promise, world);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void ScriptController::loadModuleScript(CachedModuleScript& moduleScript, const ScriptSourceCode& sourceCode, CachedScriptFetcher& scriptFetcher)
</del><ins>+void ScriptController::loadModuleScript(LoadableModuleScript& moduleScript, const ScriptSourceCode& sourceCode)
</ins><span class="cx"> {
</span><del>- loadModuleScriptInWorld(moduleScript, sourceCode, scriptFetcher, mainThreadNormalWorld());
</del><ins>+ loadModuleScriptInWorld(moduleScript, sourceCode, mainThreadNormalWorld());
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-JSC::JSValue ScriptController::linkAndEvaluateModuleScriptInWorld(CachedModuleScript& moduleScript, DOMWrapperWorld& world)
</del><ins>+JSC::JSValue ScriptController::linkAndEvaluateModuleScriptInWorld(LoadableModuleScript& moduleScript, DOMWrapperWorld& world)
</ins><span class="cx"> {
</span><span class="cx"> JSLockHolder lock(world.vm());
</span><span class="cx">
</span><span class="lines">@@ -240,7 +240,7 @@
</span><span class="cx"> return returnValue;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-JSC::JSValue ScriptController::linkAndEvaluateModuleScript(CachedModuleScript& moduleScript)
</del><ins>+JSC::JSValue ScriptController::linkAndEvaluateModuleScript(LoadableModuleScript& moduleScript)
</ins><span class="cx"> {
</span><span class="cx"> return linkAndEvaluateModuleScriptInWorld(moduleScript, mainThreadNormalWorld());
</span><span class="cx"> }
</span><span class="lines">@@ -368,7 +368,7 @@
</span><span class="cx"> return asString(value)->toIdentifier(exec);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void ScriptController::setupModuleScriptHandlers(CachedModuleScript& moduleScriptRef, JSInternalPromise& promise, DOMWrapperWorld& world)
</del><ins>+void ScriptController::setupModuleScriptHandlers(LoadableModuleScript& moduleScriptRef, JSInternalPromise& promise, DOMWrapperWorld& world)
</ins><span class="cx"> {
</span><span class="cx"> auto& shell = *windowShell(world);
</span><span class="cx"> auto& state = *shell.window()->globalExec();
</span><span class="lines">@@ -380,7 +380,7 @@
</span><span class="cx"> JSC::PrivateName moduleLoaderAlreadyReportedErrorSymbol = m_moduleLoaderAlreadyReportedErrorSymbol;
</span><span class="cx"> JSC::PrivateName moduleLoaderFetchingIsCanceledSymbol = m_moduleLoaderFetchingIsCanceledSymbol;
</span><span class="cx">
</span><del>- RefPtr<CachedModuleScript> moduleScript(&moduleScriptRef);
</del><ins>+ RefPtr<LoadableModuleScript> moduleScript(&moduleScriptRef);
</ins><span class="cx">
</span><span class="cx"> auto& fulfillHandler = *JSNativeStdFunction::create(state.vm(), shell.window(), 1, String(), [moduleScript](ExecState* exec) {
</span><span class="cx"> Identifier moduleKey = jsValueToModuleKey(exec, exec->argument(0));
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsScriptControllerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/ScriptController.h (211312 => 211313)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/ScriptController.h        2017-01-28 00:33:17 UTC (rev 211312)
+++ trunk/Source/WebCore/bindings/js/ScriptController.h        2017-01-28 00:47:30 UTC (rev 211313)
</span><span class="lines">@@ -51,11 +51,11 @@
</span><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><del>-class CachedModuleScript;
</del><span class="cx"> class CachedScriptFetcher;
</span><span class="cx"> class Frame;
</span><span class="cx"> class HTMLDocument;
</span><span class="cx"> class HTMLPlugInElement;
</span><ins>+class LoadableModuleScript;
</ins><span class="cx"> class SecurityOrigin;
</span><span class="cx"> class ScriptSourceCode;
</span><span class="cx"> class Widget;
</span><span class="lines">@@ -114,13 +114,13 @@
</span><span class="cx"> JSC::JSValue evaluate(const ScriptSourceCode&, ExceptionDetails* = nullptr);
</span><span class="cx"> JSC::JSValue evaluateInWorld(const ScriptSourceCode&, DOMWrapperWorld&, ExceptionDetails* = nullptr);
</span><span class="cx">
</span><del>- void loadModuleScriptInWorld(CachedModuleScript&, const String& moduleName, CachedScriptFetcher&, DOMWrapperWorld&);
- void loadModuleScript(CachedModuleScript&, const String& moduleName, CachedScriptFetcher&);
- void loadModuleScriptInWorld(CachedModuleScript&, const ScriptSourceCode&, CachedScriptFetcher&, DOMWrapperWorld&);
- void loadModuleScript(CachedModuleScript&, const ScriptSourceCode&, CachedScriptFetcher&);
</del><ins>+ void loadModuleScriptInWorld(LoadableModuleScript&, const String& moduleName, DOMWrapperWorld&);
+ void loadModuleScript(LoadableModuleScript&, const String& moduleName);
+ void loadModuleScriptInWorld(LoadableModuleScript&, const ScriptSourceCode&, DOMWrapperWorld&);
+ void loadModuleScript(LoadableModuleScript&, const ScriptSourceCode&);
</ins><span class="cx">
</span><del>- JSC::JSValue linkAndEvaluateModuleScriptInWorld(CachedModuleScript& , DOMWrapperWorld&);
- JSC::JSValue linkAndEvaluateModuleScript(CachedModuleScript&);
</del><ins>+ JSC::JSValue linkAndEvaluateModuleScriptInWorld(LoadableModuleScript& , DOMWrapperWorld&);
+ JSC::JSValue linkAndEvaluateModuleScript(LoadableModuleScript&);
</ins><span class="cx">
</span><span class="cx"> JSC::JSValue evaluateModule(const URL&, JSC::JSModuleRecord&, DOMWrapperWorld&);
</span><span class="cx"> JSC::JSValue evaluateModule(const URL&, JSC::JSModuleRecord&);
</span><span class="lines">@@ -181,7 +181,7 @@
</span><span class="cx">
</span><span class="cx"> private:
</span><span class="cx"> WEBCORE_EXPORT JSDOMWindowShell* initScript(DOMWrapperWorld&);
</span><del>- void setupModuleScriptHandlers(CachedModuleScript&, JSC::JSInternalPromise&, DOMWrapperWorld&);
</del><ins>+ void setupModuleScriptHandlers(LoadableModuleScript&, JSC::JSInternalPromise&, DOMWrapperWorld&);
</ins><span class="cx">
</span><span class="cx"> void disconnectPlatformScriptObjects();
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoredomLoadableModuleScriptcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/LoadableModuleScript.cpp (211312 => 211313)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/LoadableModuleScript.cpp        2017-01-28 00:33:17 UTC (rev 211312)
+++ trunk/Source/WebCore/dom/LoadableModuleScript.cpp        2017-01-28 00:47:30 UTC (rev 211313)
</span><span class="lines">@@ -26,6 +26,9 @@
</span><span class="cx"> #include "config.h"
</span><span class="cx"> #include "LoadableModuleScript.h"
</span><span class="cx">
</span><ins>+#include "Document.h"
+#include "Frame.h"
+#include "ScriptController.h"
</ins><span class="cx"> #include "ScriptElement.h"
</span><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="lines">@@ -32,54 +35,69 @@
</span><span class="cx">
</span><span class="cx"> Ref<LoadableModuleScript> LoadableModuleScript::create(const String& nonce, const String& crossOriginMode, const String& charset, const AtomicString& initiatorName, bool isInUserAgentShadowTree)
</span><span class="cx"> {
</span><del>- return adoptRef(*new LoadableModuleScript(nonce, crossOriginMode, charset, initiatorName, isInUserAgentShadowTree, CachedModuleScript::create()));
</del><ins>+ return adoptRef(*new LoadableModuleScript(nonce, crossOriginMode, charset, initiatorName, isInUserAgentShadowTree));
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-LoadableModuleScript::LoadableModuleScript(const String& nonce, const String& crossOriginMode, const String& charset, const AtomicString& initiatorName, bool isInUserAgentShadowTree, Ref<CachedModuleScript>&& moduleScript)
</del><ins>+LoadableModuleScript::LoadableModuleScript(const String& nonce, const String& crossOriginMode, const String& charset, const AtomicString& initiatorName, bool isInUserAgentShadowTree)
</ins><span class="cx"> : LoadableScript(nonce, crossOriginMode, charset, initiatorName, isInUserAgentShadowTree)
</span><del>- , m_moduleScript(WTFMove(moduleScript))
</del><span class="cx"> {
</span><del>- m_moduleScript->addClient(*this);
</del><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> LoadableModuleScript::~LoadableModuleScript()
</span><span class="cx"> {
</span><del>- m_moduleScript->removeClient(*this);
</del><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> bool LoadableModuleScript::isLoaded() const
</span><span class="cx"> {
</span><del>- return m_moduleScript->isLoaded();
</del><ins>+ return m_isLoaded;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> std::optional<LoadableScript::Error> LoadableModuleScript::error() const
</span><span class="cx"> {
</span><del>- return m_moduleScript->error();
</del><ins>+ return m_error;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> bool LoadableModuleScript::wasCanceled() const
</span><span class="cx"> {
</span><del>- return m_moduleScript->wasCanceled();
</del><ins>+ return m_wasCanceled;
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-void LoadableModuleScript::notifyFinished(CachedModuleScript&)
</del><ins>+void LoadableModuleScript::notifyLoadCompleted(UniquedStringImpl& moduleKey)
</ins><span class="cx"> {
</span><ins>+ m_moduleKey = &moduleKey;
+ m_isLoaded = true;
</ins><span class="cx"> notifyClientFinished();
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void LoadableModuleScript::notifyLoadFailed(LoadableScript::Error&& error)
+{
+ m_error = WTFMove(error);
+ m_isLoaded = true;
+ notifyClientFinished();
+}
+
+void LoadableModuleScript::notifyLoadWasCanceled()
+{
+ m_wasCanceled = true;
+ m_isLoaded = true;
+ notifyClientFinished();
+}
+
</ins><span class="cx"> void LoadableModuleScript::execute(ScriptElement& scriptElement)
</span><span class="cx"> {
</span><del>- scriptElement.executeModuleScript(m_moduleScript.get());
</del><ins>+ scriptElement.executeModuleScript(*this);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void LoadableModuleScript::load(Document& document, const URL& rootURL)
</span><span class="cx"> {
</span><del>- m_moduleScript->load(document, rootURL, *this);
</del><ins>+ if (auto* frame = document.frame())
+ frame->script().loadModuleScript(*this, rootURL.string());
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void LoadableModuleScript::load(Document& document, const ScriptSourceCode& sourceCode)
</span><span class="cx"> {
</span><del>- m_moduleScript->load(document, sourceCode, *this);
</del><ins>+ if (auto* frame = document.frame())
+ frame->script().loadModuleScript(*this, sourceCode);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoredomLoadableModuleScripth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/LoadableModuleScript.h (211312 => 211313)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/LoadableModuleScript.h        2017-01-28 00:33:17 UTC (rev 211312)
+++ trunk/Source/WebCore/dom/LoadableModuleScript.h        2017-01-28 00:47:30 UTC (rev 211313)
</span><span class="lines">@@ -25,14 +25,14 @@
</span><span class="cx">
</span><span class="cx"> #pragma once
</span><span class="cx">
</span><del>-#include "CachedModuleScript.h"
-#include "CachedModuleScriptClient.h"
</del><span class="cx"> #include "LoadableScript.h"
</span><span class="cx"> #include <wtf/TypeCasts.h>
</span><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><del>-class LoadableModuleScript final : public LoadableScript, private CachedModuleScriptClient {
</del><ins>+class ScriptSourceCode;
+
+class LoadableModuleScript final : public LoadableScript {
</ins><span class="cx"> public:
</span><span class="cx"> virtual ~LoadableModuleScript();
</span><span class="cx">
</span><span class="lines">@@ -42,8 +42,6 @@
</span><span class="cx"> std::optional<Error> error() const final;
</span><span class="cx"> bool wasCanceled() const final;
</span><span class="cx">
</span><del>- CachedModuleScript& moduleScript() { return m_moduleScript.get(); }
-
</del><span class="cx"> bool isClassicScript() const final { return false; }
</span><span class="cx"> bool isModuleScript() const final { return true; }
</span><span class="cx">
</span><span class="lines">@@ -54,12 +52,19 @@
</span><span class="cx"> void load(Document&, const URL& rootURL);
</span><span class="cx"> void load(Document&, const ScriptSourceCode&);
</span><span class="cx">
</span><ins>+ void notifyLoadCompleted(UniquedStringImpl&);
+ void notifyLoadFailed(LoadableScript::Error&&);
+ void notifyLoadWasCanceled();
+
+ UniquedStringImpl* moduleKey() const { return m_moduleKey.get(); }
+
</ins><span class="cx"> private:
</span><del>- LoadableModuleScript(const String& nonce, const String& crossOriginMode, const String& charset, const AtomicString& initiatorName, bool isInUserAgentShadowTree, Ref<CachedModuleScript>&&);
</del><ins>+ LoadableModuleScript(const String& nonce, const String& crossOriginMode, const String& charset, const AtomicString& initiatorName, bool isInUserAgentShadowTree);
</ins><span class="cx">
</span><del>- void notifyFinished(CachedModuleScript&) final;
-
- Ref<CachedModuleScript> m_moduleScript;
</del><ins>+ RefPtr<UniquedStringImpl> m_moduleKey;
+ std::optional<LoadableScript::Error> m_error;
+ bool m_wasCanceled { false };
+ bool m_isLoaded { false };
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoredomScriptElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/ScriptElement.cpp (211312 => 211313)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/ScriptElement.cpp        2017-01-28 00:33:17 UTC (rev 211312)
+++ trunk/Source/WebCore/dom/ScriptElement.cpp        2017-01-28 00:47:30 UTC (rev 211313)
</span><span class="lines">@@ -24,7 +24,6 @@
</span><span class="cx"> #include "config.h"
</span><span class="cx"> #include "ScriptElement.h"
</span><span class="cx">
</span><del>-#include "CachedModuleScript.h"
</del><span class="cx"> #include "CachedResourceLoader.h"
</span><span class="cx"> #include "CachedResourceRequest.h"
</span><span class="cx"> #include "CachedScript.h"
</span><span class="lines">@@ -390,11 +389,11 @@
</span><span class="cx"> frame->script().evaluate(sourceCode);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void ScriptElement::executeModuleScript(CachedModuleScript& moduleScript)
</del><ins>+void ScriptElement::executeModuleScript(LoadableModuleScript& loadableModuleScript)
</ins><span class="cx"> {
</span><span class="cx"> // https://html.spec.whatwg.org/multipage/scripting.html#execute-the-script-block
</span><span class="cx">
</span><del>- ASSERT(!moduleScript.error());
</del><ins>+ ASSERT(!loadableModuleScript.error());
</ins><span class="cx">
</span><span class="cx"> auto& document = m_element.document();
</span><span class="cx"> auto* frame = document.frame();
</span><span class="lines">@@ -404,7 +403,7 @@
</span><span class="cx"> IgnoreDestructiveWriteCountIncrementer ignoreDesctructiveWriteCountIncrementer(&document);
</span><span class="cx"> CurrentScriptIncrementer currentScriptIncrementer(document, m_element);
</span><span class="cx">
</span><del>- frame->script().linkAndEvaluateModuleScript(moduleScript);
</del><ins>+ frame->script().linkAndEvaluateModuleScript(loadableModuleScript);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void ScriptElement::executeScriptAndDispatchEvent(LoadableScript& loadableScript)
</span></span></pre></div>
<a id="trunkSourceWebCoredomScriptElementh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/ScriptElement.h (211312 => 211313)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/ScriptElement.h        2017-01-28 00:33:17 UTC (rev 211312)
+++ trunk/Source/WebCore/dom/ScriptElement.h        2017-01-28 00:47:30 UTC (rev 211313)
</span><span class="lines">@@ -30,10 +30,10 @@
</span><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><del>-class CachedModuleScript;
</del><span class="cx"> class CachedScript;
</span><span class="cx"> class ContainerNode;
</span><span class="cx"> class Element;
</span><ins>+class LoadableModuleScript;
</ins><span class="cx"> class PendingScript;
</span><span class="cx"> class ScriptSourceCode;
</span><span class="cx"> class URL;
</span><span class="lines">@@ -51,7 +51,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 executeClassicScript(const ScriptSourceCode&);
</span><del>- void executeModuleScript(CachedModuleScript&);
</del><ins>+ void executeModuleScript(LoadableModuleScript&);
</ins><span class="cx">
</span><span class="cx"> void executePendingScript(PendingScript&);
</span><span class="cx">
</span></span></pre>
</div>
</div>
</body>
</html>