mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-08-15 17:03:07 +09:00
Issue #1691 - Part 6b: Initial browser support for dynamic import from module scripts. https://bugzilla.mozilla.org/show_bug.cgi?id=1342012 Factor out script fetch options from script load request classes. https://bugzilla.mozilla.org/show_bug.cgi?id=1480720 Remove support for version parameter from script loader. https://bugzilla.mozilla.org/show_bug.cgi?id=1428745
(cherry picked from commit 3ec2529aa6303f6950622e3cb91a23580649c73b)
This commit is contained in:
parent
1b811bd711
commit
86e0057ea7
7 changed files with 558 additions and 200 deletions
|
|
@ -37,30 +37,42 @@ class ModuleLoadRequest final : public ScriptLoadRequest
|
|||
ModuleLoadRequest(const ModuleLoadRequest& aOther) = delete;
|
||||
ModuleLoadRequest(ModuleLoadRequest&& aOther) = delete;
|
||||
|
||||
ModuleLoadRequest(nsIURI* aURI, ScriptFetchOptions* aFetchOptions,
|
||||
const SRIMetadata& aIntegrity, nsIURI* aReferrer,
|
||||
bool aIsTopLevel, bool aIsDynamicImport,
|
||||
ScriptLoader* aLoader, VisitedURLSet* aVisitedSet);
|
||||
|
||||
public:
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(ModuleLoadRequest, ScriptLoadRequest)
|
||||
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED(ModuleLoadRequest,
|
||||
ScriptLoadRequest)
|
||||
|
||||
// Create a top-level module load request.
|
||||
ModuleLoadRequest(nsIURI* aURI,
|
||||
nsIScriptElement* aElement,
|
||||
uint32_t aVersion,
|
||||
CORSMode aCORSMode,
|
||||
const SRIMetadata& aIntegrity,
|
||||
nsIURI* aReferrer,
|
||||
mozilla::net::ReferrerPolicy,
|
||||
ScriptLoader* aLoader);
|
||||
static ModuleLoadRequest* CreateTopLevel(nsIURI* aURI,
|
||||
ScriptFetchOptions* aFetchOptions,
|
||||
const SRIMetadata& aIntegrity,
|
||||
nsIURI* aReferrer,
|
||||
ScriptLoader* aLoader);
|
||||
|
||||
// Create a module load request for an imported module.
|
||||
ModuleLoadRequest(nsIURI* aURI,
|
||||
ModuleLoadRequest* aParent);
|
||||
// Create a module load request for a static module import.
|
||||
static ModuleLoadRequest* CreateStaticImport(nsIURI* aURI,
|
||||
ModuleLoadRequest* aParent);
|
||||
|
||||
// Create a module load request for dynamic module import.
|
||||
static ModuleLoadRequest* CreateDynamicImport(
|
||||
nsIURI* aURI, ModuleScript* aScript,
|
||||
JS::Handle<JS::Value> aReferencingPrivate,
|
||||
JS::Handle<JSString*> aSpecifier, JS::Handle<JSObject*> aPromise);
|
||||
|
||||
bool IsTopLevel() const override {
|
||||
return mIsTopLevel;
|
||||
}
|
||||
|
||||
bool IsDynamicImport() const { return mIsDynamicImport; }
|
||||
|
||||
void SetReady() override;
|
||||
void Cancel() override;
|
||||
void ClearDynamicImport();
|
||||
|
||||
void ModuleLoaded();
|
||||
void ModuleErrored();
|
||||
|
|
@ -74,6 +86,9 @@ private:
|
|||
public:
|
||||
// Is this a request for a top level module script or an import?
|
||||
const bool mIsTopLevel;
|
||||
|
||||
// Is this the top level request for a dynamic module import?
|
||||
const bool mIsDynamicImport;
|
||||
|
||||
// The base URL used for resolving relative module imports.
|
||||
nsCOMPtr<nsIURI> mBaseURL;
|
||||
|
|
@ -97,6 +112,11 @@ public:
|
|||
// Set of module URLs visited while fetching the module graph this request is
|
||||
// part of.
|
||||
RefPtr<VisitedURLSet> mVisitedSet;
|
||||
|
||||
// For dynamic imports, the details to pass to FinishDynamicImport.
|
||||
JS::Heap<JS::Value> mDynamicReferencingPrivate;
|
||||
JS::Heap<JSString*> mDynamicSpecifier;
|
||||
JS::Heap<JSObject*> mDynamicPromise;
|
||||
};
|
||||
|
||||
} // dom namespace
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue