Changeset 205278 in webkit


Ignore:
Timestamp:
Aug 31, 2016 8:48:34 PM (8 years ago)
Author:
Yusuke Suzuki
Message:

[JSC] Add initiator parameter to module pipeline
https://bugs.webkit.org/show_bug.cgi?id=161470

Reviewed by Saam Barati.

Source/JavaScriptCore:

The fetching semantics of the <script type="module"> tag has per module-tag context.
For example, "nonce", "crossorigin" etc. attributes are shared in the fetching requests
issued from the module-tag. To transfer this information, we add a new parameter "initiator"
to the module loader pipeline. We are planning to transfer information by this parameter.

At the same time, we also perform some clean up.

  • Use arrow function in ModuleLoaderPrototype.js.
  • Rename "ResolveDependencies" to "Satisfy" to align to the loader spec.
  • builtins/ModuleLoaderPrototype.js:

(newRegistryEntry):
(commitInstantiated):
(requestFetch):
(requestTranslate):
(requestInstantiate):
(requestSatisfy):
(requestInstantiateAll):
(requestLink):
(moduleEvaluation):
(provide):
(loadAndEvaluateModule):
(requestResolveDependencies.): Deleted.
(requestResolveDependencies): Deleted.
(requestReady): Deleted.
(link): Deleted.
(loadModule): Deleted.
(linkAndEvaluateModule): Deleted.

  • bytecode/BytecodeIntrinsicRegistry.cpp:

(JSC::BytecodeIntrinsicRegistry::BytecodeIntrinsicRegistry):

  • bytecode/BytecodeIntrinsicRegistry.h:
  • jsc.cpp:

(GlobalObject::moduleLoaderResolve):
(GlobalObject::moduleLoaderFetch):

  • runtime/Completion.cpp:

(JSC::loadAndEvaluateModule):
(JSC::loadModule):
(JSC::linkAndEvaluateModule):

  • runtime/Completion.h:
  • runtime/JSGlobalObject.h:
  • runtime/JSModuleLoader.cpp:

(JSC::JSModuleLoader::loadAndEvaluateModule):
(JSC::JSModuleLoader::loadModule):
(JSC::JSModuleLoader::linkAndEvaluateModule):
(JSC::JSModuleLoader::resolve):
(JSC::JSModuleLoader::fetch):
(JSC::JSModuleLoader::translate):
(JSC::JSModuleLoader::instantiate):
(JSC::JSModuleLoader::evaluate):

  • runtime/JSModuleLoader.h:
  • runtime/ModuleLoaderPrototype.cpp:

(JSC::moduleLoaderPrototypeResolve):
(JSC::moduleLoaderPrototypeFetch):
(JSC::moduleLoaderPrototypeTranslate):
(JSC::moduleLoaderPrototypeInstantiate):
(JSC::moduleLoaderPrototypeEvaluate):

Source/WebCore:

No user-observable behavior change.

We rename JSModuleLoader to ScriptModuleLoader.
The name "JSModuleLoader" is misleading since it seems like this is a JS object.
"ModuleLoader" is not good since there is CSS modules.

  • CMakeLists.txt:
  • WebCore.xcodeproj/project.pbxproj:
  • bindings/js/JSBindingsAllInOne.cpp:
  • bindings/js/JSDOMWindowBase.cpp:

(WebCore::JSDOMWindowBase::moduleLoaderResolve):
(WebCore::JSDOMWindowBase::moduleLoaderFetch):
(WebCore::JSDOMWindowBase::moduleLoaderEvaluate):

  • bindings/js/JSDOMWindowBase.h:
  • bindings/js/JSMainThreadExecState.h:

(WebCore::JSMainThreadExecState::loadModule):
(WebCore::JSMainThreadExecState::linkAndEvaluateModule):

  • bindings/js/JSModuleLoader.cpp:

(WebCore::JSModuleLoader::JSModuleLoader): Deleted.
(WebCore::JSModuleLoader::resolve): Deleted.
(WebCore::JSModuleLoader::fetch): Deleted.
(WebCore::JSModuleLoader::evaluate): Deleted.

  • bindings/js/JSModuleLoader.h:

(WebCore::JSModuleLoader::document): Deleted.

  • bindings/js/ScriptModuleLoader.cpp: Renamed from Source/WebCore/bindings/js/JSModuleLoader.cpp.

(WebCore::ScriptModuleLoader::ScriptModuleLoader):
(WebCore::ScriptModuleLoader::resolve):
(WebCore::ScriptModuleLoader::fetch):
(WebCore::ScriptModuleLoader::evaluate):

  • bindings/js/ScriptModuleLoader.h: Renamed from Source/WebCore/bindings/js/JSModuleLoader.h.

(WebCore::ScriptModuleLoader::document):

  • dom/Document.cpp:

(WebCore::Document::Document):

  • dom/Document.h:

(WebCore::Document::moduleLoader):

Location:
trunk/Source
Files:
20 edited
2 moved

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r205276 r205278  
     12016-08-31  Yusuke Suzuki  <utatane.tea@gmail.com>
     2
     3        [JSC] Add initiator parameter to module pipeline
     4        https://bugs.webkit.org/show_bug.cgi?id=161470
     5
     6        Reviewed by Saam Barati.
     7
     8        The fetching semantics of the <script type="module"> tag has per module-tag context.
     9        For example, "nonce", "crossorigin" etc. attributes are shared in the fetching requests
     10        issued from the module-tag. To transfer this information, we add a new parameter "initiator"
     11        to the module loader pipeline. We are planning to transfer information by this parameter.
     12
     13        At the same time, we also perform some clean up.
     14
     15        - Use arrow function in ModuleLoaderPrototype.js.
     16        - Rename "ResolveDependencies" to "Satisfy" to align to the loader spec.
     17
     18        * builtins/ModuleLoaderPrototype.js:
     19        (newRegistryEntry):
     20        (commitInstantiated):
     21        (requestFetch):
     22        (requestTranslate):
     23        (requestInstantiate):
     24        (requestSatisfy):
     25        (requestInstantiateAll):
     26        (requestLink):
     27        (moduleEvaluation):
     28        (provide):
     29        (loadAndEvaluateModule):
     30        (requestResolveDependencies.): Deleted.
     31        (requestResolveDependencies): Deleted.
     32        (requestReady): Deleted.
     33        (link): Deleted.
     34        (loadModule): Deleted.
     35        (linkAndEvaluateModule): Deleted.
     36        * bytecode/BytecodeIntrinsicRegistry.cpp:
     37        (JSC::BytecodeIntrinsicRegistry::BytecodeIntrinsicRegistry):
     38        * bytecode/BytecodeIntrinsicRegistry.h:
     39        * jsc.cpp:
     40        (GlobalObject::moduleLoaderResolve):
     41        (GlobalObject::moduleLoaderFetch):
     42        * runtime/Completion.cpp:
     43        (JSC::loadAndEvaluateModule):
     44        (JSC::loadModule):
     45        (JSC::linkAndEvaluateModule):
     46        * runtime/Completion.h:
     47        * runtime/JSGlobalObject.h:
     48        * runtime/JSModuleLoader.cpp:
     49        (JSC::JSModuleLoader::loadAndEvaluateModule):
     50        (JSC::JSModuleLoader::loadModule):
     51        (JSC::JSModuleLoader::linkAndEvaluateModule):
     52        (JSC::JSModuleLoader::resolve):
     53        (JSC::JSModuleLoader::fetch):
     54        (JSC::JSModuleLoader::translate):
     55        (JSC::JSModuleLoader::instantiate):
     56        (JSC::JSModuleLoader::evaluate):
     57        * runtime/JSModuleLoader.h:
     58        * runtime/ModuleLoaderPrototype.cpp:
     59        (JSC::moduleLoaderPrototypeResolve):
     60        (JSC::moduleLoaderPrototypeFetch):
     61        (JSC::moduleLoaderPrototypeTranslate):
     62        (JSC::moduleLoaderPrototypeInstantiate):
     63        (JSC::moduleLoaderPrototypeEvaluate):
     64
    1652016-08-31  Yusuke Suzuki  <utatane.tea@gmail.com>
    266
  • trunk/Source/JavaScriptCore/builtins/ModuleLoaderPrototype.js

    r205276 r205278  
    11/*
    2  * Copyright (C) 2015 Apple Inc. All rights reserved.
     2 * Copyright (C) 2015, 2016 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    7070    //        the module record.
    7171    //
    72     // 4. ResolveDependencies (not in the draft) https://github.com/whatwg/loader/issues/68
     72    // 4. Satisfy
    7373    //     Ready to request the dependent modules (or now requesting & resolving).
    7474    //     Without this state, the current draft causes infinite recursion when there is circular dependency.
    75     //     a. If the status is ResolveDependencies and there is no entry.resolveDependencies promise, the entry is ready to resolve the dependencies.
    76     //     b. If the status is ResolveDependencies and there is the entry.resolveDependencies promise, the entry is just resolving
     75    //     a. If the status is Satisfy and there is no entry.satisfy promise, the entry is ready to resolve the dependencies.
     76    //     b. If the status is Satisfy and there is the entry.satisfy promise, the entry is just resolving
    7777    //        the dependencies.
    7878    //
     
    8484    //     The module is linked, so the module is ready to be executed.
    8585    //
    86     // Each registry entry has the 4 promises; "fetch", "translate", "instantiate" and "resolveDependencies".
     86    // Each registry entry has the 4 promises; "fetch", "translate", "instantiate" and "satisfy".
    8787    // They are assigned when starting the each phase. And they are fulfilled when the each phase is completed.
    8888    //
     
    103103        translate: @undefined,
    104104        instantiate: @undefined,
    105         resolveDependencies: @undefined,
     105        satisfy: @undefined,
    106106        dependencies: [], // To keep the module order, we store the module keys in the array.
    107107        dependenciesMap: @undefined,
     
    202202            value: @undefined
    203203        };
    204         @putByValDirect(dependencies, i, pair);
     204        dependencies.@push(pair);
    205205        dependenciesMap.@set(depKey, pair);
    206206    }
     
    208208    entry.dependenciesMap = dependenciesMap;
    209209    entry.module = moduleRecord;
    210     this.setStateToMax(entry, @ModuleResolveDependencies);
     210    this.setStateToMax(entry, @ModuleSatisfy);
    211211}
    212212
     
    224224// Loader.
    225225
    226 function requestFetch(key)
     226function requestFetch(key, initiator)
    227227{
    228228    // https://whatwg.github.io/loader/#request-fetch
     
    239239    if (entry.fetch)
    240240        return entry.fetch;
    241 
    242     var loader = this;
    243241
    244242    // Hook point.
     
    248246    //     For example, JavaScriptCore shell can provide the hook fetching the resource
    249247    //     from the local file system.
    250     var fetchPromise = this.fetch(key).then(function (payload) {
    251         loader.setStateToMax(entry, @ModuleTranslate);
     248    var fetchPromise = this.fetch(key, initiator).then((payload) => {
     249        this.setStateToMax(entry, @ModuleTranslate);
    252250        return payload;
    253251    });
     
    256254}
    257255
    258 function requestTranslate(key)
     256function requestTranslate(key, initiator)
    259257{
    260258    // https://whatwg.github.io/loader/#request-translate
     
    272270        return entry.translate;
    273271
    274     var loader = this;
    275     var translatePromise = this.requestFetch(key).then(function (payload) {
     272    var translatePromise = this.requestFetch(key, initiator).then((payload) => {
    276273        // Hook point.
    277274        // 3. Loader.translate
     
    279276        //     Take the key and the fetched source code and translate it to the ES6 source code.
    280277        //     Typically it is used by the transpilers.
    281         return loader.translate(key, payload).then(function (source) {
    282             loader.setStateToMax(entry, @ModuleInstantiate);
     278        return this.translate(key, payload, initiator).then((source) => {
     279            this.setStateToMax(entry, @ModuleInstantiate);
    283280            return source;
    284281        });
     
    288285}
    289286
    290 function requestInstantiate(key)
     287function requestInstantiate(key, initiator)
    291288{
    292289    // https://whatwg.github.io/loader/#request-instantiate
     
    304301        return entry.instantiate;
    305302
    306     var loader = this;
    307     var instantiatePromise = this.requestTranslate(key).then(function (source) {
     303    var instantiatePromise = this.requestTranslate(key, initiator).then((source) => {
    308304        // Hook point.
    309305        // 4. Loader.instantiate
     
    313309        //     It has the chance to provide the optional module instance that is different from
    314310        //     the ordinary one.
    315         return loader.instantiate(key, source).then(function (optionalInstance) {
    316             loader.commitInstantiated(entry, optionalInstance, source);
     311        return this.instantiate(key, source, initiator).then((optionalInstance) => {
     312            this.commitInstantiated(entry, optionalInstance, source);
    317313            return entry;
    318314        });
     
    322318}
    323319
    324 function requestResolveDependencies(key)
    325 {
    326     // FIXME: In the spec, after requesting instantiation, we will resolve
    327     // the dependencies without any status change. As a result, when there
    328     // is circular dependencies, instantiation is done only once, but
    329     // repeatedly resolving the dependencies. This means that infinite
    330     // recursion occur when the given modules have circular dependency. To
    331     // avoid this situation, we introduce new state, "ResolveDependencies". This means
    332     // "Now the module is instantiated, so ready to resolve the dependencies
    333     // or now resolving them".
    334     // https://github.com/whatwg/loader/issues/68
     320function requestSatisfy(key, initiator)
     321{
     322    // https://whatwg.github.io/loader/#satisfy-instance
    335323
    336324    "use strict";
     
    343331    }
    344332
    345     if (entry.resolveDependencies)
    346         return entry.resolveDependencies;
    347 
    348     var loader = this;
    349     var resolveDependenciesPromise = this.requestInstantiate(key).then(function (entry) {
     333    if (entry.satisfy)
     334        return entry.satisfy;
     335
     336    var satisfyPromise = this.requestInstantiate(key, initiator).then((entry) => {
    350337        var depLoads = [];
    351338        for (var i = 0, length = entry.dependencies.length; i < length; ++i) {
     
    357344            //     Take the name and resolve it to the unique identifier for the resource location.
    358345            //     For example, take the "jquery" and return the URL for the resource.
    359             var promise = loader.resolve(pair.key, key).then(function (depKey) {
    360                 var depEntry = loader.ensureRegistered(depKey);
     346            var promise = this.resolve(pair.key, key, initiator).then((depKey) => {
     347                var depEntry = this.ensureRegistered(depKey);
    361348
    362349                // Recursive resolving. The dependencies of this entry is being resolved or already resolved.
     
    366353                // For example, reaching here, the module is starting resolving the dependencies.
    367354                // But the module may or may not reach the instantiation phase in the loader's pipeline.
    368                 // If we wait for the ResolveDependencies for this module, it construct the circular promise chain and
     355                // If we wait for the Satisfy for this module, it construct the circular promise chain and
    369356                // rejected by the Promises runtime. Since only we need is the instantiated module, instead of waiting
    370                 // the ResolveDependencies for this module, we just wait Instantiate for this.
    371                 if (depEntry.resolveDependencies) {
    372                     return depEntry.instantiate.then(function (entry) {
     357                // the Satisfy for this module, we just wait Instantiate for this.
     358                if (depEntry.satisfy) {
     359                    return depEntry.instantiate.then((entry) => {
    373360                        pair.value = entry.module;
    374361                        return entry;
     
    376363                }
    377364
    378                 return loader.requestResolveDependencies(depKey).then(function (entry) {
     365                return this.requestSatisfy(depKey, initiator).then((entry) => {
    379366                    pair.value = entry.module;
    380367                    return entry;
    381368                });
    382369            });
    383             @putByValDirect(depLoads, i, promise);
     370            depLoads.@push(promise);
    384371        }
    385372
    386         return @InternalPromise.internalAll(depLoads).then(function (modules) {
    387             loader.setStateToMax(entry, @ModuleLink);
     373        return @InternalPromise.internalAll(depLoads).then((modules) => {
     374            this.setStateToMax(entry, @ModuleLink);
    388375            return entry;
    389376        });
    390377    });
    391378
    392     entry.resolveDependencies = resolveDependenciesPromise;
    393     return resolveDependenciesPromise;
    394 }
    395 
    396 function requestInstantiateAll(key)
     379    entry.satisfy = satisfyPromise;
     380    return satisfyPromise;
     381}
     382
     383function requestInstantiateAll(key, initiator)
    397384{
    398385    // https://whatwg.github.io/loader/#request-instantiate-all
     
    400387    "use strict";
    401388
    402     return this.requestResolveDependencies(key);
    403 }
    404 
    405 function requestLink(key)
     389    return this.requestSatisfy(key, initiator);
     390}
     391
     392function requestLink(key, initiator)
    406393{
    407394    // https://whatwg.github.io/loader/#request-link
     
    412399    if (entry.state > @ModuleLink) {
    413400        var deferred = @newPromiseCapability(@InternalPromise);
    414         deferred.@resolve.@call(@undefined, entry.module);
     401        deferred.@resolve.@call(@undefined, entry);
    415402        return deferred.@promise;
    416403    }
    417404
    418     var loader = this;
    419     return this.requestInstantiateAll(key).then(function (entry) {
    420         loader.link(entry);
     405    return this.requestInstantiateAll(key, initiator).then((entry) => {
     406        this.link(entry, initiator);
    421407        return entry;
    422408    });
    423409}
    424410
    425 function requestReady(key)
     411function requestReady(key, initiator)
    426412{
    427413    // https://whatwg.github.io/loader/#request-ready
     
    429415    "use strict";
    430416
    431     var loader = this;
    432     return this.requestLink(key).then(function (entry) {
    433         loader.moduleEvaluation(entry.module);
     417    return this.requestLink(key, initiator).then((entry) => {
     418        this.moduleEvaluation(entry.module, initiator);
    434419    });
    435420}
     
    437422// Linking semantics.
    438423
    439 function link(entry)
     424function link(entry, initiator)
    440425{
    441426    // https://whatwg.github.io/loader/#link
     
    457442    for (var i = 0, length = dependencies.length; i < length; ++i) {
    458443        var pair = dependencies[i];
    459         this.link(pair.value.registryEntry);
    460     }
    461 
    462     this.moduleDeclarationInstantiation(entry.module);
     444        this.link(pair.value.registryEntry, initiator);
     445    }
     446
     447    this.moduleDeclarationInstantiation(entry.module, initiator);
    463448}
    464449
    465450// Module semantics.
    466451
    467 function moduleEvaluation(moduleRecord)
     452function moduleEvaluation(moduleRecord, initiator)
    468453{
    469454    // http://www.ecma-international.org/ecma-262/6.0/#sec-moduleevaluation
     
    482467        var pair = dependencies[i];
    483468        var requiredModuleRecord = pair.value;
    484         this.moduleEvaluation(requiredModuleRecord);
    485     }
    486     this.evaluate(entry.key, moduleRecord);
     469        this.moduleEvaluation(requiredModuleRecord, initiator);
     470    }
     471    this.evaluate(entry.key, moduleRecord, initiator);
    487472}
    488473
     
    496481
    497482    if (stage === @ModuleFetch) {
    498         if (entry.status > @ModuleFetch)
     483        if (entry.state > @ModuleFetch)
    499484            throw new @TypeError("Requested module is already fetched.");
    500485        this.fulfillFetch(entry, value);
     
    503488
    504489    if (stage === @ModuleTranslate) {
    505         if (entry.status > @ModuleTranslate)
     490        if (entry.state > @ModuleTranslate)
    506491            throw new @TypeError("Requested module is already translated.");
    507492        this.fulfillFetch(entry, @undefined);
     
    511496
    512497    if (stage === @ModuleInstantiate) {
    513         if (entry.status > @ModuleInstantiate)
     498        if (entry.state > @ModuleInstantiate)
    514499            throw new @TypeError("Requested module is already instantiated.");
    515500        this.fulfillFetch(entry, @undefined);
    516501        this.fulfillTranslate(entry, value);
    517         var loader = this;
    518         entry.translate.then(function (source) {
    519             loader.fulfillInstantiate(entry, value, source);
     502        entry.translate.then((source) => {
     503            this.fulfillInstantiate(entry, value, source);
    520504        });
    521505        return;
     
    525509}
    526510
    527 function loadAndEvaluateModule(moduleName, referrer)
    528 {
    529     "use strict";
    530 
    531     var loader = this;
     511function loadAndEvaluateModule(moduleName, referrer, initiator)
     512{
     513    "use strict";
     514
    532515    // Loader.resolve hook point.
    533516    // resolve: moduleName => Promise(moduleKey)
    534517    // Take the name and resolve it to the unique identifier for the resource location.
    535518    // For example, take the "jquery" and return the URL for the resource.
    536     return this.resolve(moduleName, referrer).then(function (key) {
    537         return loader.requestReady(key);
    538     });
    539 }
    540 
    541 function loadModule(moduleName, referrer)
    542 {
    543     "use strict";
    544 
    545     var loader = this;
     519    return this.resolve(moduleName, referrer, initiator).then((key) => {
     520        return this.requestReady(key, initiator);
     521    });
     522}
     523
     524function loadModule(moduleName, referrer, initiator)
     525{
     526    "use strict";
     527
    546528    // Loader.resolve hook point.
    547529    // resolve: moduleName => Promise(moduleKey)
    548530    // Take the name and resolve it to the unique identifier for the resource location.
    549531    // For example, take the "jquery" and return the URL for the resource.
    550     return this.resolve(moduleName, referrer).then(function (key) {
    551         return loader.requestInstantiateAll(key);
    552     }).then(function (entry) {
     532    return this.resolve(moduleName, referrer, initiator).then((key) => {
     533        return this.requestInstantiateAll(key, initiator);
     534    }).then((entry) => {
    553535        return entry.key;
    554536    });
    555537}
    556538
    557 function linkAndEvaluateModule(key)
     539function linkAndEvaluateModule(key, initiator)
    558540{
    559541    "use strict";
     
    563545        throw new @TypeError("Requested module is not instantiated yet.");
    564546
    565     this.link(entry);
    566     return this.moduleEvaluation(entry.module);
    567 }
     547    this.link(entry, initiator);
     548    return this.moduleEvaluation(entry.module, initiator);
     549}
  • trunk/Source/JavaScriptCore/bytecode/BytecodeIntrinsicRegistry.cpp

    r204358 r205278  
    5959    m_ModuleTranslate.set(m_vm, jsNumber(static_cast<unsigned>(JSModuleLoader::Status::Translate)));
    6060    m_ModuleInstantiate.set(m_vm, jsNumber(static_cast<unsigned>(JSModuleLoader::Status::Instantiate)));
    61     m_ModuleResolveDependencies.set(m_vm, jsNumber(static_cast<unsigned>(JSModuleLoader::Status::ResolveDependencies)));
     61    m_ModuleSatisfy.set(m_vm, jsNumber(static_cast<unsigned>(JSModuleLoader::Status::Satisfy)));
    6262    m_ModuleLink.set(m_vm, jsNumber(static_cast<unsigned>(JSModuleLoader::Status::Link)));
    6363    m_ModuleReady.set(m_vm, jsNumber(static_cast<unsigned>(JSModuleLoader::Status::Ready)));
  • trunk/Source/JavaScriptCore/bytecode/BytecodeIntrinsicRegistry.h

    r204597 r205278  
    6262    macro(ModuleTranslate) \
    6363    macro(ModuleInstantiate) \
    64     macro(ModuleResolveDependencies) \
     64    macro(ModuleSatisfy) \
    6565    macro(ModuleLink) \
    6666    macro(ModuleReady) \
  • trunk/Source/JavaScriptCore/jsc.cpp

    r205267 r205278  
    897897    }
    898898
    899     static JSInternalPromise* moduleLoaderResolve(JSGlobalObject*, ExecState*, JSModuleLoader*, JSValue, JSValue);
    900     static JSInternalPromise* moduleLoaderFetch(JSGlobalObject*, ExecState*, JSModuleLoader*, JSValue);
     899    static JSInternalPromise* moduleLoaderResolve(JSGlobalObject*, ExecState*, JSModuleLoader*, JSValue, JSValue, JSValue);
     900    static JSInternalPromise* moduleLoaderFetch(JSGlobalObject*, ExecState*, JSModuleLoader*, JSValue, JSValue);
    901901};
    902902
     
    10291029}
    10301030
    1031 JSInternalPromise* GlobalObject::moduleLoaderResolve(JSGlobalObject* globalObject, ExecState* exec, JSModuleLoader*, JSValue keyValue, JSValue referrerValue)
     1031JSInternalPromise* GlobalObject::moduleLoaderResolve(JSGlobalObject* globalObject, ExecState* exec, JSModuleLoader*, JSValue keyValue, JSValue referrerValue, JSValue)
    10321032{
    10331033    JSInternalPromiseDeferred* deferred = JSInternalPromiseDeferred::create(exec, globalObject);
     
    11341134}
    11351135
    1136 JSInternalPromise* GlobalObject::moduleLoaderFetch(JSGlobalObject* globalObject, ExecState* exec, JSModuleLoader*, JSValue key)
     1136JSInternalPromise* GlobalObject::moduleLoaderFetch(JSGlobalObject* globalObject, ExecState* exec, JSModuleLoader*, JSValue key, JSValue)
    11371137{
    11381138    JSInternalPromiseDeferred* deferred = JSInternalPromiseDeferred::create(exec, globalObject);
  • trunk/Source/JavaScriptCore/runtime/Completion.cpp

    r205276 r205278  
    156156}
    157157
    158 static JSInternalPromise* loadAndEvaluateModule(const JSLockHolder&, ExecState* exec, JSGlobalObject* globalObject, JSValue moduleName, JSValue referrer)
    159 {
    160     return globalObject->moduleLoader()->loadAndEvaluateModule(exec, moduleName, referrer);
    161 }
    162 
    163 static JSInternalPromise* loadAndEvaluateModule(const JSLockHolder& lock, ExecState* exec, JSGlobalObject* globalObject, const Identifier& moduleName)
    164 {
    165     return loadAndEvaluateModule(lock, exec, globalObject, identifierToJSValue(exec->vm(), moduleName), jsUndefined());
    166 }
    167 
    168 JSInternalPromise* loadAndEvaluateModule(ExecState* exec, const String& moduleName)
    169 {
    170     JSLockHolder lock(exec);
    171     RELEASE_ASSERT(exec->vm().atomicStringTable() == wtfThreadData().atomicStringTable());
    172     RELEASE_ASSERT(!exec->vm().isCollectorBusy());
    173 
    174     return loadAndEvaluateModule(lock, exec, exec->vmEntryGlobalObject(), Identifier::fromString(exec, moduleName));
    175 }
    176 
    177 JSInternalPromise* loadAndEvaluateModule(ExecState* exec, const SourceCode& source)
     158static JSInternalPromise* loadAndEvaluateModule(const JSLockHolder&, ExecState* exec, JSGlobalObject* globalObject, JSValue moduleName, JSValue referrer, JSValue initiator)
     159{
     160    return globalObject->moduleLoader()->loadAndEvaluateModule(exec, moduleName, referrer, initiator);
     161}
     162
     163static JSInternalPromise* loadAndEvaluateModule(const JSLockHolder& lock, ExecState* exec, JSGlobalObject* globalObject, const Identifier& moduleName, JSValue initiator)
     164{
     165    return loadAndEvaluateModule(lock, exec, globalObject, identifierToJSValue(exec->vm(), moduleName), jsUndefined(), initiator);
     166}
     167
     168JSInternalPromise* loadAndEvaluateModule(ExecState* exec, const String& moduleName, JSValue initiator)
     169{
     170    JSLockHolder lock(exec);
     171    RELEASE_ASSERT(exec->vm().atomicStringTable() == wtfThreadData().atomicStringTable());
     172    RELEASE_ASSERT(!exec->vm().isCollectorBusy());
     173
     174    return loadAndEvaluateModule(lock, exec, exec->vmEntryGlobalObject(), Identifier::fromString(exec, moduleName), initiator);
     175}
     176
     177JSInternalPromise* loadAndEvaluateModule(ExecState* exec, const SourceCode& source, JSValue initiator)
    178178{
    179179    JSLockHolder lock(exec);
     
    190190        return rejectPromise(exec, globalObject);
    191191
    192     return loadAndEvaluateModule(lock, exec, globalObject, key, jsUndefined());
    193 }
    194 
    195 static JSInternalPromise* loadModule(const JSLockHolder&, ExecState* exec, JSGlobalObject* globalObject, JSValue moduleName, JSValue referrer)
    196 {
    197     return globalObject->moduleLoader()->loadModule(exec, moduleName, referrer);
    198 }
    199 
    200 static JSInternalPromise* loadModule(const JSLockHolder& lock, ExecState* exec, JSGlobalObject* globalObject, const Identifier& moduleName)
    201 {
    202     return loadModule(lock, exec, globalObject, identifierToJSValue(exec->vm(), moduleName), jsUndefined());
    203 }
    204 
    205 JSInternalPromise* loadModule(ExecState* exec, const String& moduleName)
    206 {
    207     JSLockHolder lock(exec);
    208     RELEASE_ASSERT(exec->vm().atomicStringTable() == wtfThreadData().atomicStringTable());
    209     RELEASE_ASSERT(!exec->vm().isCollectorBusy());
    210 
    211     return loadModule(lock, exec, exec->vmEntryGlobalObject(), Identifier::fromString(exec, moduleName));
    212 }
    213 
    214 JSInternalPromise* loadModule(ExecState* exec, const SourceCode& source)
     192    return loadAndEvaluateModule(lock, exec, globalObject, key, jsUndefined(), initiator);
     193}
     194
     195static JSInternalPromise* loadModule(const JSLockHolder&, ExecState* exec, JSGlobalObject* globalObject, JSValue moduleName, JSValue referrer, JSValue initiator)
     196{
     197    return globalObject->moduleLoader()->loadModule(exec, moduleName, referrer, initiator);
     198}
     199
     200static JSInternalPromise* loadModule(const JSLockHolder& lock, ExecState* exec, JSGlobalObject* globalObject, const Identifier& moduleName, JSValue initiator)
     201{
     202    return loadModule(lock, exec, globalObject, identifierToJSValue(exec->vm(), moduleName), jsUndefined(), initiator);
     203}
     204
     205JSInternalPromise* loadModule(ExecState* exec, const String& moduleName, JSValue initiator)
     206{
     207    JSLockHolder lock(exec);
     208    RELEASE_ASSERT(exec->vm().atomicStringTable() == wtfThreadData().atomicStringTable());
     209    RELEASE_ASSERT(!exec->vm().isCollectorBusy());
     210
     211    return loadModule(lock, exec, exec->vmEntryGlobalObject(), Identifier::fromString(exec, moduleName), initiator);
     212}
     213
     214JSInternalPromise* loadModule(ExecState* exec, const SourceCode& source, JSValue initiator)
    215215{
    216216    JSLockHolder lock(exec);
     
    223223
    224224    // Insert the given source code to the ModuleLoader registry as the fetched registry entry.
     225    // FIXME: Introduce JSSourceCode object to wrap around this source.
    225226    globalObject->moduleLoader()->provide(exec, key, JSModuleLoader::Status::Fetch, source.view().toString());
    226227    if (exec->hadException())
    227228        return rejectPromise(exec, globalObject);
    228229
    229     return loadModule(lock, exec, globalObject, key, jsUndefined());
    230 }
    231 
    232 JSValue linkAndEvaluateModule(ExecState* exec, const Identifier& moduleKey)
    233 {
    234     JSLockHolder lock(exec);
    235     RELEASE_ASSERT(exec->vm().atomicStringTable() == wtfThreadData().atomicStringTable());
    236     RELEASE_ASSERT(!exec->vm().isCollectorBusy());
    237 
    238     JSGlobalObject* globalObject = exec->vmEntryGlobalObject();
    239     return globalObject->moduleLoader()->linkAndEvaluateModule(exec, identifierToJSValue(exec->vm(), moduleKey));
     230    return loadModule(lock, exec, globalObject, key, jsUndefined(), initiator);
     231}
     232
     233JSValue linkAndEvaluateModule(ExecState* exec, const Identifier& moduleKey, JSValue initiator)
     234{
     235    JSLockHolder lock(exec);
     236    RELEASE_ASSERT(exec->vm().atomicStringTable() == wtfThreadData().atomicStringTable());
     237    RELEASE_ASSERT(!exec->vm().isCollectorBusy());
     238
     239    JSGlobalObject* globalObject = exec->vmEntryGlobalObject();
     240    return globalObject->moduleLoader()->linkAndEvaluateModule(exec, identifierToJSValue(exec->vm(), moduleKey), initiator);
    240241}
    241242
  • trunk/Source/JavaScriptCore/runtime/Completion.h

    r205276 r205278  
    5959
    6060// Load the module source and evaluate it.
    61 JS_EXPORT_PRIVATE JSInternalPromise* loadAndEvaluateModule(ExecState*, const String& moduleName);
    62 JS_EXPORT_PRIVATE JSInternalPromise* loadAndEvaluateModule(ExecState*, const SourceCode&);
     61JS_EXPORT_PRIVATE JSInternalPromise* loadAndEvaluateModule(ExecState*, const String& moduleName, JSValue initiator = jsUndefined());
     62JS_EXPORT_PRIVATE JSInternalPromise* loadAndEvaluateModule(ExecState*, const SourceCode&, JSValue initiator = jsUndefined());
    6363
    6464// Fetch the module source, and instantiate the module record.
    65 JS_EXPORT_PRIVATE JSInternalPromise* loadModule(ExecState*, const String& moduleName);
    66 JS_EXPORT_PRIVATE JSInternalPromise* loadModule(ExecState*, const SourceCode&);
     65JS_EXPORT_PRIVATE JSInternalPromise* loadModule(ExecState*, const String& moduleName, JSValue initiator = jsUndefined());
     66JS_EXPORT_PRIVATE JSInternalPromise* loadModule(ExecState*, const SourceCode&, JSValue initiator = jsUndefined());
    6767
    6868// Link and evaluate the already linked module. This function is called in a sync manner.
    69 JS_EXPORT_PRIVATE JSValue linkAndEvaluateModule(ExecState*, const Identifier& moduleKey);
     69JS_EXPORT_PRIVATE JSValue linkAndEvaluateModule(ExecState*, const Identifier& moduleKey, JSValue initiator = jsUndefined());
    7070
    7171} // namespace JSC
  • trunk/Source/JavaScriptCore/runtime/JSGlobalObject.h

    r205267 r205278  
    167167    ShouldInterruptScriptBeforeTimeoutPtr shouldInterruptScriptBeforeTimeout;
    168168
    169     typedef JSInternalPromise* (*ModuleLoaderResolvePtr)(JSGlobalObject*, ExecState*, JSModuleLoader*, JSValue, JSValue);
     169    typedef JSInternalPromise* (*ModuleLoaderResolvePtr)(JSGlobalObject*, ExecState*, JSModuleLoader*, JSValue, JSValue, JSValue);
    170170    ModuleLoaderResolvePtr moduleLoaderResolve;
    171171
    172     typedef JSInternalPromise* (*ModuleLoaderFetchPtr)(JSGlobalObject*, ExecState*, JSModuleLoader*, JSValue);
     172    typedef JSInternalPromise* (*ModuleLoaderFetchPtr)(JSGlobalObject*, ExecState*, JSModuleLoader*, JSValue, JSValue);
    173173    ModuleLoaderFetchPtr moduleLoaderFetch;
    174174
    175     typedef JSInternalPromise* (*ModuleLoaderTranslatePtr)(JSGlobalObject*, ExecState*, JSModuleLoader*, JSValue, JSValue);
     175    typedef JSInternalPromise* (*ModuleLoaderTranslatePtr)(JSGlobalObject*, ExecState*, JSModuleLoader*, JSValue, JSValue, JSValue);
    176176    ModuleLoaderTranslatePtr moduleLoaderTranslate;
    177177
    178     typedef JSInternalPromise* (*ModuleLoaderInstantiatePtr)(JSGlobalObject*, ExecState*, JSModuleLoader*, JSValue, JSValue);
     178    typedef JSInternalPromise* (*ModuleLoaderInstantiatePtr)(JSGlobalObject*, ExecState*, JSModuleLoader*, JSValue, JSValue, JSValue);
    179179    ModuleLoaderInstantiatePtr moduleLoaderInstantiate;
    180180
    181     typedef JSValue (*ModuleLoaderEvaluatePtr)(JSGlobalObject*, ExecState*, JSModuleLoader*, JSValue, JSValue);
     181    typedef JSValue (*ModuleLoaderEvaluatePtr)(JSGlobalObject*, ExecState*, JSModuleLoader*, JSValue, JSValue, JSValue);
    182182    ModuleLoaderEvaluatePtr moduleLoaderEvaluate;
    183183
  • trunk/Source/JavaScriptCore/runtime/JSModuleLoader.cpp

    r205276 r205278  
    8787}
    8888
    89 JSInternalPromise* JSModuleLoader::loadAndEvaluateModule(ExecState* exec, JSValue moduleName, JSValue referrer)
     89JSInternalPromise* JSModuleLoader::loadAndEvaluateModule(ExecState* exec, JSValue moduleName, JSValue referrer, JSValue initiator)
    9090{
    9191    JSObject* function = jsCast<JSObject*>(get(exec, exec->propertyNames().builtinNames().loadAndEvaluateModulePublicName()));
     
    9797    arguments.append(moduleName);
    9898    arguments.append(referrer);
     99    arguments.append(initiator);
    99100
    100101    return jsCast<JSInternalPromise*>(call(exec, function, callType, callData, this, arguments));
    101102}
    102103
    103 JSInternalPromise* JSModuleLoader::loadModule(ExecState* exec, JSValue moduleName, JSValue referrer)
     104JSInternalPromise* JSModuleLoader::loadModule(ExecState* exec, JSValue moduleName, JSValue referrer, JSValue initiator)
    104105{
    105106    JSObject* function = jsCast<JSObject*>(get(exec, exec->propertyNames().builtinNames().loadModulePublicName()));
     
    111112    arguments.append(moduleName);
    112113    arguments.append(referrer);
     114    arguments.append(initiator);
    113115
    114116    return jsCast<JSInternalPromise*>(call(exec, function, callType, callData, this, arguments));
    115117}
    116118
    117 JSValue JSModuleLoader::linkAndEvaluateModule(ExecState* exec, JSValue moduleKey)
     119JSValue JSModuleLoader::linkAndEvaluateModule(ExecState* exec, JSValue moduleKey, JSValue initiator)
    118120{
    119121    JSObject* function = jsCast<JSObject*>(get(exec, exec->propertyNames().builtinNames().linkAndEvaluateModulePublicName()));
     
    124126    MarkedArgumentBuffer arguments;
    125127    arguments.append(moduleKey);
     128    arguments.append(initiator);
    126129
    127130    return call(exec, function, callType, callData, this, arguments);
    128131}
    129132
    130 JSInternalPromise* JSModuleLoader::resolve(ExecState* exec, JSValue name, JSValue referrer)
     133JSInternalPromise* JSModuleLoader::resolve(ExecState* exec, JSValue name, JSValue referrer, JSValue initiator)
    131134{
    132135    if (Options::dumpModuleLoadingState())
     
    135138    JSGlobalObject* globalObject = exec->lexicalGlobalObject();
    136139    if (globalObject->globalObjectMethodTable()->moduleLoaderResolve)
    137         return globalObject->globalObjectMethodTable()->moduleLoaderResolve(globalObject, exec, this, name, referrer);
     140        return globalObject->globalObjectMethodTable()->moduleLoaderResolve(globalObject, exec, this, name, referrer, initiator);
    138141    JSInternalPromiseDeferred* deferred = JSInternalPromiseDeferred::create(exec, globalObject);
    139142    deferred->resolve(exec, name);
     
    141144}
    142145
    143 JSInternalPromise* JSModuleLoader::fetch(ExecState* exec, JSValue key)
     146JSInternalPromise* JSModuleLoader::fetch(ExecState* exec, JSValue key, JSValue initiator)
    144147{
    145148    if (Options::dumpModuleLoadingState())
     
    148151    JSGlobalObject* globalObject = exec->lexicalGlobalObject();
    149152    if (globalObject->globalObjectMethodTable()->moduleLoaderFetch)
    150         return globalObject->globalObjectMethodTable()->moduleLoaderFetch(globalObject, exec, this, key);
     153        return globalObject->globalObjectMethodTable()->moduleLoaderFetch(globalObject, exec, this, key, initiator);
    151154    JSInternalPromiseDeferred* deferred = JSInternalPromiseDeferred::create(exec, globalObject);
    152155    String moduleKey = key.toString(exec)->value(exec);
     
    161164}
    162165
    163 JSInternalPromise* JSModuleLoader::translate(ExecState* exec, JSValue key, JSValue payload)
     166JSInternalPromise* JSModuleLoader::translate(ExecState* exec, JSValue key, JSValue payload, JSValue initiator)
    164167{
    165168    if (Options::dumpModuleLoadingState())
     
    168171    JSGlobalObject* globalObject = exec->lexicalGlobalObject();
    169172    if (globalObject->globalObjectMethodTable()->moduleLoaderTranslate)
    170         return globalObject->globalObjectMethodTable()->moduleLoaderTranslate(globalObject, exec, this, key, payload);
     173        return globalObject->globalObjectMethodTable()->moduleLoaderTranslate(globalObject, exec, this, key, payload, initiator);
    171174    JSInternalPromiseDeferred* deferred = JSInternalPromiseDeferred::create(exec, globalObject);
    172175    deferred->resolve(exec, payload);
     
    174177}
    175178
    176 JSInternalPromise* JSModuleLoader::instantiate(ExecState* exec, JSValue key, JSValue source)
     179JSInternalPromise* JSModuleLoader::instantiate(ExecState* exec, JSValue key, JSValue source, JSValue initiator)
    177180{
    178181    if (Options::dumpModuleLoadingState())
     
    181184    JSGlobalObject* globalObject = exec->lexicalGlobalObject();
    182185    if (globalObject->globalObjectMethodTable()->moduleLoaderInstantiate)
    183         return globalObject->globalObjectMethodTable()->moduleLoaderInstantiate(globalObject, exec, this, key, source);
     186        return globalObject->globalObjectMethodTable()->moduleLoaderInstantiate(globalObject, exec, this, key, source, initiator);
    184187    JSInternalPromiseDeferred* deferred = JSInternalPromiseDeferred::create(exec, globalObject);
    185188    deferred->resolve(exec, jsUndefined());
     
    187190}
    188191
    189 JSValue JSModuleLoader::evaluate(ExecState* exec, JSValue key, JSValue moduleRecordValue)
     192JSValue JSModuleLoader::evaluate(ExecState* exec, JSValue key, JSValue moduleRecordValue, JSValue initiator)
    190193{
    191194    if (Options::dumpModuleLoadingState())
     
    194197    JSGlobalObject* globalObject = exec->lexicalGlobalObject();
    195198    if (globalObject->globalObjectMethodTable()->moduleLoaderEvaluate)
    196         return globalObject->globalObjectMethodTable()->moduleLoaderEvaluate(globalObject, exec, this, key, moduleRecordValue);
     199        return globalObject->globalObjectMethodTable()->moduleLoaderEvaluate(globalObject, exec, this, key, moduleRecordValue, initiator);
    197200
    198201    JSModuleRecord* moduleRecord = jsDynamicCast<JSModuleRecord*>(moduleRecordValue);
  • trunk/Source/JavaScriptCore/runtime/JSModuleLoader.h

    r205276 r205278  
    4343        Translate = 2,
    4444        Instantiate = 3,
    45         ResolveDependencies = 4,
     45        Satisfy = 4,
    4646        Link = 5,
    4747        Ready = 6,
     
    6464    // APIs to control the module loader.
    6565    JSValue provide(ExecState*, JSValue key, Status, const String&);
    66     JSInternalPromise* loadAndEvaluateModule(ExecState*, JSValue moduleName, JSValue referrer);
    67     JSInternalPromise* loadModule(ExecState*, JSValue moduleName, JSValue referrer);
    68     JSValue linkAndEvaluateModule(ExecState*, JSValue moduleKey);
     66    JSInternalPromise* loadAndEvaluateModule(ExecState*, JSValue moduleName, JSValue referrer, JSValue initiator);
     67    JSInternalPromise* loadModule(ExecState*, JSValue moduleName, JSValue referrer, JSValue initiator);
     68    JSValue linkAndEvaluateModule(ExecState*, JSValue moduleKey, JSValue initiator);
    6969
    7070    // Platform dependent hooked APIs.
    71     JSInternalPromise* resolve(ExecState*, JSValue name, JSValue referrer);
    72     JSInternalPromise* fetch(ExecState*, JSValue key);
    73     JSInternalPromise* translate(ExecState*, JSValue key, JSValue payload);
    74     JSInternalPromise* instantiate(ExecState*, JSValue key, JSValue source);
     71    JSInternalPromise* resolve(ExecState*, JSValue name, JSValue referrer, JSValue initiator);
     72    JSInternalPromise* fetch(ExecState*, JSValue key, JSValue initiator);
     73    JSInternalPromise* translate(ExecState*, JSValue key, JSValue payload, JSValue initiator);
     74    JSInternalPromise* instantiate(ExecState*, JSValue key, JSValue source, JSValue initiator);
    7575
    7676    // Additional platform dependent hooked APIs.
    77     JSValue evaluate(ExecState*, JSValue key, JSValue moduleRecord);
     77    JSValue evaluate(ExecState*, JSValue key, JSValue moduleRecord, JSValue initiator);
    7878
    7979protected:
  • trunk/Source/JavaScriptCore/runtime/ModuleLoaderPrototype.cpp

    r205198 r205278  
    6767/* Source for ModuleLoaderPrototype.lut.h
    6868@begin moduleLoaderPrototypeTable
    69     setStateToMax                  JSBuiltin                                        DontEnum|Function 2
    70     newRegistryEntry               JSBuiltin                                        DontEnum|Function 1
    71     ensureRegistered               JSBuiltin                                        DontEnum|Function 1
    72     forceFulfillPromise            JSBuiltin                                        DontEnum|Function 2
    73     fulfillFetch                   JSBuiltin                                        DontEnum|Function 2
    74     fulfillTranslate               JSBuiltin                                        DontEnum|Function 2
    75     fulfillInstantiate             JSBuiltin                                        DontEnum|Function 2
    76     commitInstantiated             JSBuiltin                                        DontEnum|Function 3
    77     instantiation                  JSBuiltin                                        DontEnum|Function 3
    78     requestFetch                   JSBuiltin                                        DontEnum|Function 1
    79     requestTranslate               JSBuiltin                                        DontEnum|Function 1
    80     requestInstantiate             JSBuiltin                                        DontEnum|Function 1
    81     requestResolveDependencies     JSBuiltin                                        DontEnum|Function 1
    82     requestInstantiateAll          JSBuiltin                                        DontEnum|Function 1
    83     requestLink                    JSBuiltin                                        DontEnum|Function 1
    84     requestReady                   JSBuiltin                                        DontEnum|Function 1
    85     link                           JSBuiltin                                        DontEnum|Function 1
     69    setStateToMax                  JSBuiltin                                           DontEnum|Function 2
     70    newRegistryEntry               JSBuiltin                                           DontEnum|Function 1
     71    ensureRegistered               JSBuiltin                                           DontEnum|Function 1
     72    forceFulfillPromise            JSBuiltin                                           DontEnum|Function 2
     73    fulfillFetch                   JSBuiltin                                           DontEnum|Function 2
     74    fulfillTranslate               JSBuiltin                                           DontEnum|Function 2
     75    fulfillInstantiate             JSBuiltin                                           DontEnum|Function 2
     76    commitInstantiated             JSBuiltin                                           DontEnum|Function 3
     77    instantiation                  JSBuiltin                                           DontEnum|Function 3
     78    requestFetch                   JSBuiltin                                           DontEnum|Function 2
     79    requestTranslate               JSBuiltin                                           DontEnum|Function 2
     80    requestInstantiate             JSBuiltin                                           DontEnum|Function 2
     81    requestSatisfy                 JSBuiltin                                           DontEnum|Function 2
     82    requestInstantiateAll          JSBuiltin                                           DontEnum|Function 2
     83    requestLink                    JSBuiltin                                           DontEnum|Function 2
     84    requestReady                   JSBuiltin                                           DontEnum|Function 2
     85    link                           JSBuiltin                                           DontEnum|Function 2
    8686    moduleDeclarationInstantiation moduleLoaderPrototypeModuleDeclarationInstantiation DontEnum|Function 2
    87     moduleEvaluation               JSBuiltin                                        DontEnum|Function 2
    88     evaluate                       moduleLoaderPrototypeEvaluate                       DontEnum|Function 2
    89     provide                        JSBuiltin                                        DontEnum|Function 3
    90     loadAndEvaluateModule          JSBuiltin                                        DontEnum|Function 2
    91     loadModule                     JSBuiltin                                        DontEnum|Function 2
    92     linkAndEvaluateModule          JSBuiltin                                        DontEnum|Function 1
     87    moduleEvaluation               JSBuiltin                                           DontEnum|Function 2
     88    evaluate                       moduleLoaderPrototypeEvaluate                       DontEnum|Function 3
     89    provide                        JSBuiltin                                           DontEnum|Function 3
     90    loadAndEvaluateModule          JSBuiltin                                           DontEnum|Function 3
     91    loadModule                     JSBuiltin                                           DontEnum|Function 3
     92    linkAndEvaluateModule          JSBuiltin                                           DontEnum|Function 2
    9393    parseModule                    moduleLoaderPrototypeParseModule                    DontEnum|Function 2
    9494    requestedModules               moduleLoaderPrototypeRequestedModules               DontEnum|Function 1
    95     resolve                        moduleLoaderPrototypeResolve                        DontEnum|Function 1
    96     fetch                          moduleLoaderPrototypeFetch                          DontEnum|Function 1
    97     translate                      moduleLoaderPrototypeTranslate                      DontEnum|Function 2
    98     instantiate                    moduleLoaderPrototypeInstantiate                    DontEnum|Function 2
     95    resolve                        moduleLoaderPrototypeResolve                        DontEnum|Function 2
     96    fetch                          moduleLoaderPrototypeFetch                          DontEnum|Function 2
     97    translate                      moduleLoaderPrototypeTranslate                      DontEnum|Function 3
     98    instantiate                    moduleLoaderPrototypeInstantiate                    DontEnum|Function 3
    9999@end
    100100*/
     
    184184    if (!loader)
    185185        return JSValue::encode(jsUndefined());
    186     return JSValue::encode(loader->resolve(exec, exec->argument(0), exec->argument(1)));
     186    return JSValue::encode(loader->resolve(exec, exec->argument(0), exec->argument(1), exec->argument(2)));
    187187}
    188188
     
    197197    if (!loader)
    198198        return JSValue::encode(jsUndefined());
    199     return JSValue::encode(loader->fetch(exec, exec->argument(0)));
     199    return JSValue::encode(loader->fetch(exec, exec->argument(0), exec->argument(1)));
    200200}
    201201
     
    209209    if (!loader)
    210210        return JSValue::encode(jsUndefined());
    211     return JSValue::encode(loader->translate(exec, exec->argument(0), exec->argument(1)));
     211    return JSValue::encode(loader->translate(exec, exec->argument(0), exec->argument(1), exec->argument(2)));
    212212}
    213213
     
    223223    if (!loader)
    224224        return JSValue::encode(jsUndefined());
    225     return JSValue::encode(loader->instantiate(exec, exec->argument(0), exec->argument(1)));
     225    return JSValue::encode(loader->instantiate(exec, exec->argument(0), exec->argument(1), exec->argument(2)));
    226226}
    227227
     
    236236    if (!loader)
    237237        return JSValue::encode(jsUndefined());
    238     return JSValue::encode(loader->evaluate(exec, exec->argument(0), exec->argument(1)));
     238    return JSValue::encode(loader->evaluate(exec, exec->argument(0), exec->argument(1), exec->argument(2)));
    239239}
    240240
  • trunk/Source/WebCore/CMakeLists.txt

    r205269 r205278  
    12091209    bindings/js/JSMessageEventCustom.cpp
    12101210    bindings/js/JSMessagePortCustom.cpp
    1211     bindings/js/JSModuleLoader.cpp
    12121211    bindings/js/JSMutationCallback.cpp
    12131212    bindings/js/JSMutationObserverCustom.cpp
     
    12581257    bindings/js/ScriptController.cpp
    12591258    bindings/js/ScriptGlobalObject.cpp
     1259    bindings/js/ScriptModuleLoader.cpp
    12601260    bindings/js/ScriptState.cpp
    12611261    bindings/js/StructuredClone.cpp
  • trunk/Source/WebCore/ChangeLog

    r205277 r205278  
     12016-08-31  Yusuke Suzuki  <utatane.tea@gmail.com>
     2
     3        [JSC] Add initiator parameter to module pipeline
     4        https://bugs.webkit.org/show_bug.cgi?id=161470
     5
     6        Reviewed by Saam Barati.
     7
     8        No user-observable behavior change.
     9
     10        We rename JSModuleLoader to ScriptModuleLoader.
     11        The name "JSModuleLoader" is misleading since it seems like this is a JS object.
     12        "ModuleLoader" is not good since there is CSS modules.
     13
     14        * CMakeLists.txt:
     15        * WebCore.xcodeproj/project.pbxproj:
     16        * bindings/js/JSBindingsAllInOne.cpp:
     17        * bindings/js/JSDOMWindowBase.cpp:
     18        (WebCore::JSDOMWindowBase::moduleLoaderResolve):
     19        (WebCore::JSDOMWindowBase::moduleLoaderFetch):
     20        (WebCore::JSDOMWindowBase::moduleLoaderEvaluate):
     21        * bindings/js/JSDOMWindowBase.h:
     22        * bindings/js/JSMainThreadExecState.h:
     23        (WebCore::JSMainThreadExecState::loadModule):
     24        (WebCore::JSMainThreadExecState::linkAndEvaluateModule):
     25        * bindings/js/JSModuleLoader.cpp:
     26        (WebCore::JSModuleLoader::JSModuleLoader): Deleted.
     27        (WebCore::JSModuleLoader::resolve): Deleted.
     28        (WebCore::JSModuleLoader::fetch): Deleted.
     29        (WebCore::JSModuleLoader::evaluate): Deleted.
     30        * bindings/js/JSModuleLoader.h:
     31        (WebCore::JSModuleLoader::document): Deleted.
     32        * bindings/js/ScriptModuleLoader.cpp: Renamed from Source/WebCore/bindings/js/JSModuleLoader.cpp.
     33        (WebCore::ScriptModuleLoader::ScriptModuleLoader):
     34        (WebCore::ScriptModuleLoader::resolve):
     35        (WebCore::ScriptModuleLoader::fetch):
     36        (WebCore::ScriptModuleLoader::evaluate):
     37        * bindings/js/ScriptModuleLoader.h: Renamed from Source/WebCore/bindings/js/JSModuleLoader.h.
     38        (WebCore::ScriptModuleLoader::document):
     39        * dom/Document.cpp:
     40        (WebCore::Document::Document):
     41        * dom/Document.h:
     42        (WebCore::Document::moduleLoader):
     43
    1442016-08-31  Zalan Bujtas  <zalan@apple.com>
    245
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r205269 r205278  
    60926092                E1FF8F6C180DB5BE00132674 /* CryptoAlgorithmRegistry.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1FF8F6A180DB5BE00132674 /* CryptoAlgorithmRegistry.cpp */; };
    60936093                E1FF8F6D180DB5BE00132674 /* CryptoAlgorithmRegistry.h in Headers */ = {isa = PBXBuildFile; fileRef = E1FF8F6B180DB5BE00132674 /* CryptoAlgorithmRegistry.h */; };
    6094                 E38838981BAD145F00D62EE3 /* JSModuleLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38838941BAD145F00D62EE3 /* JSModuleLoader.cpp */; };
    6095                 E38838991BAD145F00D62EE3 /* JSModuleLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = E38838951BAD145F00D62EE3 /* JSModuleLoader.h */; };
     6094                E38838981BAD145F00D62EE3 /* ScriptModuleLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38838941BAD145F00D62EE3 /* ScriptModuleLoader.cpp */; };
     6095                E38838991BAD145F00D62EE3 /* ScriptModuleLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = E38838951BAD145F00D62EE3 /* ScriptModuleLoader.h */; };
    60966096                E3FA38641D71812D00AA5950 /* PendingScriptClient.h in Headers */ = {isa = PBXBuildFile; fileRef = E3FA38611D716E7600AA5950 /* PendingScriptClient.h */; };
    60976097                E401C27517CE53EC00C41A35 /* ElementIteratorAssertions.h in Headers */ = {isa = PBXBuildFile; fileRef = E401C27417CE53EC00C41A35 /* ElementIteratorAssertions.h */; settings = {ATTRIBUTES = (Private, ); }; };
     
    1366113661                E1FF8F6A180DB5BE00132674 /* CryptoAlgorithmRegistry.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CryptoAlgorithmRegistry.cpp; sourceTree = "<group>"; };
    1366213662                E1FF8F6B180DB5BE00132674 /* CryptoAlgorithmRegistry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CryptoAlgorithmRegistry.h; sourceTree = "<group>"; };
    13663                 E38838941BAD145F00D62EE3 /* JSModuleLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSModuleLoader.cpp; sourceTree = "<group>"; };
    13664                 E38838951BAD145F00D62EE3 /* JSModuleLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSModuleLoader.h; sourceTree = "<group>"; };
     13663                E38838941BAD145F00D62EE3 /* ScriptModuleLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScriptModuleLoader.cpp; sourceTree = "<group>"; };
     13664                E38838951BAD145F00D62EE3 /* ScriptModuleLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptModuleLoader.h; sourceTree = "<group>"; };
    1366513665                E3FA38611D716E7600AA5950 /* PendingScriptClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PendingScriptClient.h; sourceTree = "<group>"; };
    1366613666                E401C27417CE53EC00C41A35 /* ElementIteratorAssertions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ElementIteratorAssertions.h; sourceTree = "<group>"; };
     
    2097420974                                8F934D831189F1EE00508D5D /* JSMainThreadExecState.h */,
    2097520975                                B56576E417DA599F00A56BDC /* JSMainThreadExecStateInstrumentation.h */,
    20976                                 E38838941BAD145F00D62EE3 /* JSModuleLoader.cpp */,
    20977                                 E38838951BAD145F00D62EE3 /* JSModuleLoader.h */,
     20976                                E38838941BAD145F00D62EE3 /* ScriptModuleLoader.cpp */,
     20977                                E38838951BAD145F00D62EE3 /* ScriptModuleLoader.h */,
    2097820978                                C6F420A016B7164E0052A9F2 /* JSMutationCallback.cpp */,
    2097920979                                C6F420A116B7164E0052A9F2 /* JSMutationCallback.h */,
     
    2509125091                                41F584C7104652CB009CAA64 /* JSMessagePortCustom.h in Headers */,
    2509225092                                2D6F3E951C1F85550061DBD4 /* JSMockPageOverlay.h in Headers */,
    25093                                 E38838991BAD145F00D62EE3 /* JSModuleLoader.h in Headers */,
     25093                                E38838991BAD145F00D62EE3 /* ScriptModuleLoader.h in Headers */,
    2509425094                                A86629D109DA2B48009633A5 /* JSMouseEvent.h in Headers */,
    2509525095                                C6F420A316B7164E0052A9F2 /* JSMutationCallback.h in Headers */,
     
    2555725557                                52E2CAFC19FF0207001EEB4F /* MediaProducer.h in Headers */,
    2555825558                                4E19592A0A39DACC00220FE5 /* MediaQuery.h in Headers */,
     25559                                E38838991BAD145F00D62EE3 /* ScriptModuleLoader.h in Headers */,
    2555925560                                4E19592C0A39DACC00220FE5 /* MediaQueryEvaluator.h in Headers */,
    2556025561                                4E19592E0A39DACC00220FE5 /* MediaQueryExp.h in Headers */,
     
    2877128772                                E1ADEDDB0E76BD93004A1A5E /* JSMessagePort.cpp in Sources */,
    2877228773                                E1ADED470E76B8DD004A1A5E /* JSMessagePortCustom.cpp in Sources */,
    28773                                 E38838981BAD145F00D62EE3 /* JSModuleLoader.cpp in Sources */,
     28774                                E38838981BAD145F00D62EE3 /* ScriptModuleLoader.cpp in Sources */,
    2877428775                                A86629D209DA2B48009633A5 /* JSMouseEvent.cpp in Sources */,
    2877528776                                C6F420A216B7164E0052A9F2 /* JSMutationCallback.cpp in Sources */,
  • trunk/Source/WebCore/bindings/js/JSBindingsAllInOne.cpp

    r205088 r205278  
    108108#include "JSMessageEventCustom.cpp"
    109109#include "JSMessagePortCustom.cpp"
    110 #include "JSModuleLoader.cpp"
    111110#include "JSMutationCallback.cpp"
    112111#include "JSMutationObserverCustom.cpp"
     
    148147#include "ScriptController.cpp"
    149148#include "ScriptGlobalObject.cpp"
     149#include "ScriptModuleLoader.cpp"
    150150#include "ScriptState.cpp"
    151151#include "SerializedScriptValue.cpp"
  • trunk/Source/WebCore/bindings/js/JSDOMWindowBase.cpp

    r204330 r205278  
    3333#include "JSDOMWindowCustom.h"
    3434#include "JSMainThreadExecState.h"
    35 #include "JSModuleLoader.h"
    3635#include "JSNode.h"
    3736#include "Language.h"
     
    4039#include "RuntimeApplicationChecks.h"
    4140#include "ScriptController.h"
     41#include "ScriptModuleLoader.h"
    4242#include "SecurityOrigin.h"
    4343#include "Settings.h"
     
    324324
    325325
    326 JSC::JSInternalPromise* JSDOMWindowBase::moduleLoaderResolve(JSC::JSGlobalObject* globalObject, JSC::ExecState* exec, JSC::JSModuleLoader* moduleLoader, JSC::JSValue moduleName, JSC::JSValue importerModuleKey)
     326JSC::JSInternalPromise* JSDOMWindowBase::moduleLoaderResolve(JSC::JSGlobalObject* globalObject, JSC::ExecState* exec, JSC::JSModuleLoader* moduleLoader, JSC::JSValue moduleName, JSC::JSValue importerModuleKey, JSC::JSValue initiator)
    327327{
    328328    JSDOMWindowBase* thisObject = JSC::jsCast<JSDOMWindowBase*>(globalObject);
    329329    if (RefPtr<Document> document = thisObject->wrapped().document())
    330         return document->moduleLoader()->resolve(globalObject, exec, moduleLoader, moduleName, importerModuleKey);
     330        return document->moduleLoader()->resolve(globalObject, exec, moduleLoader, moduleName, importerModuleKey, initiator);
    331331    JSC::JSInternalPromiseDeferred* deferred = JSC::JSInternalPromiseDeferred::create(exec, globalObject);
    332332    return deferred->reject(exec, jsUndefined());
    333333}
    334334
    335 JSC::JSInternalPromise* JSDOMWindowBase::moduleLoaderFetch(JSC::JSGlobalObject* globalObject, JSC::ExecState* exec, JSC::JSModuleLoader* moduleLoader, JSC::JSValue moduleKey)
     335JSC::JSInternalPromise* JSDOMWindowBase::moduleLoaderFetch(JSC::JSGlobalObject* globalObject, JSC::ExecState* exec, JSC::JSModuleLoader* moduleLoader, JSC::JSValue moduleKey, JSC::JSValue initiator)
    336336{
    337337    JSDOMWindowBase* thisObject = JSC::jsCast<JSDOMWindowBase*>(globalObject);
    338338    if (RefPtr<Document> document = thisObject->wrapped().document())
    339         return document->moduleLoader()->fetch(globalObject, exec, moduleLoader, moduleKey);
     339        return document->moduleLoader()->fetch(globalObject, exec, moduleLoader, moduleKey, initiator);
    340340    JSC::JSInternalPromiseDeferred* deferred = JSC::JSInternalPromiseDeferred::create(exec, globalObject);
    341341    return deferred->reject(exec, jsUndefined());
    342342}
    343343
    344 JSC::JSValue JSDOMWindowBase::moduleLoaderEvaluate(JSC::JSGlobalObject* globalObject, JSC::ExecState* exec, JSC::JSModuleLoader* moduleLoader, JSC::JSValue moduleKey, JSC::JSValue moduleRecord)
     344JSC::JSValue JSDOMWindowBase::moduleLoaderEvaluate(JSC::JSGlobalObject* globalObject, JSC::ExecState* exec, JSC::JSModuleLoader* moduleLoader, JSC::JSValue moduleKey, JSC::JSValue moduleRecord, JSC::JSValue initiator)
    345345{
    346346    JSDOMWindowBase* thisObject = JSC::jsCast<JSDOMWindowBase*>(globalObject);
    347347    if (RefPtr<Document> document = thisObject->wrapped().document())
    348         return document->moduleLoader()->evaluate(globalObject, exec, moduleLoader, moduleKey, moduleRecord);
     348        return document->moduleLoader()->evaluate(globalObject, exec, moduleLoader, moduleKey, moduleRecord, initiator);
    349349    return JSC::jsUndefined();
    350350}
  • trunk/Source/WebCore/bindings/js/JSDOMWindowBase.h

    r204330 r205278  
    7979
    8080    private:
    81         static JSC::JSInternalPromise* moduleLoaderResolve(JSC::JSGlobalObject*, JSC::ExecState*, JSC::JSModuleLoader*, JSC::JSValue, JSC::JSValue);
    82         static JSC::JSInternalPromise* moduleLoaderFetch(JSC::JSGlobalObject*, JSC::ExecState*, JSC::JSModuleLoader*, JSC::JSValue);
    83         static JSC::JSValue moduleLoaderEvaluate(JSC::JSGlobalObject*, JSC::ExecState*, JSC::JSModuleLoader*, JSC::JSValue, JSC::JSValue);
     81        static JSC::JSInternalPromise* moduleLoaderResolve(JSC::JSGlobalObject*, JSC::ExecState*, JSC::JSModuleLoader*, JSC::JSValue, JSC::JSValue, JSC::JSValue);
     82        static JSC::JSInternalPromise* moduleLoaderFetch(JSC::JSGlobalObject*, JSC::ExecState*, JSC::JSModuleLoader*, JSC::JSValue, JSC::JSValue);
     83        static JSC::JSValue moduleLoaderEvaluate(JSC::JSGlobalObject*, JSC::ExecState*, JSC::JSModuleLoader*, JSC::JSValue, JSC::JSValue, JSC::JSValue);
    8484
    8585        RefPtr<DOMWindow> m_wrapped;
  • trunk/Source/WebCore/bindings/js/JSMainThreadExecState.h

    r204717 r205278  
    11/*
    22 * Copyright (C) 2010 Google Inc. All rights reserved.
     3 * Copyright (C) 2016 Apple Inc. All rights reserved.
    34 *
    45 * Redistribution and use in source and binary forms, with or without
     
    9394    }
    9495
     96    static JSC::JSInternalPromise* loadModule(JSC::ExecState* exec, const String& moduleName, JSC::JSValue initiator)
     97    {
     98        JSMainThreadExecState currentState(exec);
     99        return JSC::loadModule(exec, moduleName, initiator);
     100    }
     101
     102    static JSC::JSInternalPromise* loadModule(JSC::ExecState* exec, const JSC::SourceCode& sourceCode, JSC::JSValue initiator)
     103    {
     104        JSMainThreadExecState currentState(exec);
     105        return JSC::loadModule(exec, sourceCode, initiator);
     106    }
     107
     108    static JSC::JSValue linkAndEvaluateModule(JSC::ExecState* exec, const JSC::Identifier& moduleKey, JSC::JSValue initiator, NakedPtr<JSC::Exception>& returnedException)
     109    {
     110        JSMainThreadExecState currentState(exec);
     111        JSC::JSValue returnValue = JSC::linkAndEvaluateModule(exec, moduleKey, initiator);
     112        if (exec->hadException()) {
     113            returnedException = exec->vm().exception();
     114            exec->clearException();
     115            return JSC::jsUndefined();
     116        }
     117        return returnValue;
     118    }
     119
    95120    static InspectorInstrumentationCookie instrumentFunctionCall(ScriptExecutionContext*, JSC::CallType, const JSC::CallData&);
    96121    static InspectorInstrumentationCookie instrumentFunctionConstruct(ScriptExecutionContext*, JSC::ConstructType, const JSC::ConstructData&);
  • trunk/Source/WebCore/bindings/js/ScriptModuleLoader.cpp

    r205277 r205278  
    2525
    2626#include "config.h"
    27 #include "JSModuleLoader.h"
     27#include "ScriptModuleLoader.h"
    2828
    2929#include "Document.h"
     
    3838namespace WebCore {
    3939
    40 JSModuleLoader::JSModuleLoader(Document& document)
     40ScriptModuleLoader::ScriptModuleLoader(Document& document)
    4141    : m_document(document)
    4242{
    4343}
    4444
    45 JSC::JSInternalPromise* JSModuleLoader::resolve(JSC::JSGlobalObject* globalObject, JSC::ExecState* exec, JSC::JSModuleLoader*, JSC::JSValue moduleNameValue, JSC::JSValue importerModuleKey)
     45JSC::JSInternalPromise* ScriptModuleLoader::resolve(JSC::JSGlobalObject* globalObject, JSC::ExecState* exec, JSC::JSModuleLoader*, JSC::JSValue moduleNameValue, JSC::JSValue importerModuleKey, JSC::JSValue)
    4646{
    4747    JSC::JSInternalPromiseDeferred* deferred = JSC::JSInternalPromiseDeferred::create(exec, globalObject);
     
    8383}
    8484
    85 JSC::JSInternalPromise* JSModuleLoader::fetch(JSC::JSGlobalObject* globalObject, JSC::ExecState* exec, JSC::JSModuleLoader*, JSC::JSValue moduleKeyValue)
     85JSC::JSInternalPromise* ScriptModuleLoader::fetch(JSC::JSGlobalObject* globalObject, JSC::ExecState* exec, JSC::JSModuleLoader*, JSC::JSValue moduleKeyValue, JSC::JSValue)
    8686{
    8787    JSC::JSInternalPromiseDeferred* deferred = JSC::JSInternalPromiseDeferred::create(exec, globalObject);
     
    102102}
    103103
    104 JSC::JSValue JSModuleLoader::evaluate(JSC::JSGlobalObject*, JSC::ExecState* exec, JSC::JSModuleLoader*, JSC::JSValue moduleKeyValue, JSC::JSValue moduleRecordValue)
     104JSC::JSValue ScriptModuleLoader::evaluate(JSC::JSGlobalObject*, JSC::ExecState* exec, JSC::JSModuleLoader*, JSC::JSValue moduleKeyValue, JSC::JSValue moduleRecordValue, JSC::JSValue)
    105105{
    106106    JSC::VM& vm = exec->vm();
  • trunk/Source/WebCore/bindings/js/ScriptModuleLoader.h

    r205277 r205278  
    11/*
    2  * Copyright (C) 2015 Apple Inc. All rights reserved.
     2 * Copyright (C) 2015, 2016 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    4242class Document;
    4343
    44 class JSModuleLoader {
    45     WTF_MAKE_NONCOPYABLE(JSModuleLoader); WTF_MAKE_FAST_ALLOCATED;
     44class ScriptModuleLoader {
     45    WTF_MAKE_NONCOPYABLE(ScriptModuleLoader); WTF_MAKE_FAST_ALLOCATED;
    4646public:
    47     explicit JSModuleLoader(Document&);
     47    explicit ScriptModuleLoader(Document&);
    4848
    4949    Document& document() { return m_document; }
    5050
    51     JSC::JSInternalPromise* resolve(JSC::JSGlobalObject*, JSC::ExecState*, JSC::JSModuleLoader*, JSC::JSValue moduleName, JSC::JSValue importerModuleKey);
    52     JSC::JSInternalPromise* fetch(JSC::JSGlobalObject*, JSC::ExecState*, JSC::JSModuleLoader*, JSC::JSValue moduleKey);
    53     JSC::JSValue evaluate(JSC::JSGlobalObject*, JSC::ExecState*, JSC::JSModuleLoader*, JSC::JSValue moduleKey, JSC::JSValue moduleRecord);
     51    JSC::JSInternalPromise* resolve(JSC::JSGlobalObject*, JSC::ExecState*, JSC::JSModuleLoader*, JSC::JSValue moduleName, JSC::JSValue importerModuleKey, JSC::JSValue initiator);
     52    JSC::JSInternalPromise* fetch(JSC::JSGlobalObject*, JSC::ExecState*, JSC::JSModuleLoader*, JSC::JSValue moduleKey, JSC::JSValue initiator);
     53    JSC::JSValue evaluate(JSC::JSGlobalObject*, JSC::ExecState*, JSC::JSModuleLoader*, JSC::JSValue moduleKey, JSC::JSValue moduleRecord, JSC::JSValue initiator);
    5454
    5555private:
  • trunk/Source/WebCore/dom/Document.cpp

    r205138 r205278  
    104104#include "JSCustomElementInterface.h"
    105105#include "JSLazyEventListener.h"
    106 #include "JSModuleLoader.h"
    107106#include "KeyboardEvent.h"
    108107#include "Language.h"
     
    154153#include "ScopedEventQueue.h"
    155154#include "ScriptController.h"
     155#include "ScriptModuleLoader.h"
    156156#include "ScriptRunner.h"
    157157#include "ScriptSourceCode.h"
     
    481481    , m_overMinimumLayoutThreshold(false)
    482482    , m_scriptRunner(std::make_unique<ScriptRunner>(*this))
    483     , m_moduleLoader(std::make_unique<JSModuleLoader>(*this))
     483    , m_moduleLoader(std::make_unique<ScriptModuleLoader>(*this))
    484484    , m_xmlVersion(ASCIILiteral("1.0"))
    485485    , m_xmlStandalone(StandaloneUnspecified)
  • trunk/Source/WebCore/dom/Document.h

    r205106 r205278  
    125125class LayoutRect;
    126126class LiveNodeList;
    127 class JSModuleLoader;
     127class ScriptModuleLoader;
    128128class JSNode;
    129129class Locale;
     
    134134class MediaQueryList;
    135135class MediaQueryMatcher;
     136class ScriptModuleLoader;
    136137class MouseEventWithHitTestResults;
    137138class NamedFlowCollection;
     
    948949   
    949950    ScriptRunner* scriptRunner() { return m_scriptRunner.get(); }
    950     JSModuleLoader* moduleLoader() { return m_moduleLoader.get(); }
     951    ScriptModuleLoader* moduleLoader() { return m_moduleLoader.get(); }
    951952
    952953    HTMLScriptElement* currentScript() const { return !m_currentScriptStack.isEmpty() ? m_currentScriptStack.last().get() : nullptr; }
     
    15521553   
    15531554    std::unique_ptr<ScriptRunner> m_scriptRunner;
    1554     std::unique_ptr<JSModuleLoader> m_moduleLoader;
     1555    std::unique_ptr<ScriptModuleLoader> m_moduleLoader;
    15551556
    15561557    Vector<RefPtr<HTMLScriptElement>> m_currentScriptStack;
Note: See TracChangeset for help on using the changeset viewer.