mirror of
https://github.com/roytam1/UXP.git
synced 2026-05-27 01:28:37 +00:00
Issue #1691 - Part 7d: Allow dynamic import in cases where there's no referencing script or module. Support dynamic import from classic scripts by creating ClassicScript objects and associating them with the compiled. https://bugzilla.mozilla.org/show_bug.cgi?id=1342012 This patch is incomplete, some code in ScriptLoader::EvaluateScript() could not be applied for missing dependencies. Part 7e will apply the missing dependencies and finish the patch.
(cherry picked from commit ce31a906e801b72f06385b0755710317ccf3658b)
This commit is contained in:
@@ -31,8 +31,8 @@ class LoadedScript : public nsISupports
|
||||
nsCOMPtr<nsIURI> mBaseURL;
|
||||
|
||||
protected:
|
||||
LoadedScript(ScriptKind aKind, ScriptLoader* aLoader,
|
||||
ScriptFetchOptions* aFetchOptions, nsIURI* aBaseURL);
|
||||
LoadedScript(ScriptKind aKind,
|
||||
ScriptFetchOptions* aFetchOptions, nsIURI* aBaseURL);
|
||||
|
||||
virtual ~LoadedScript();
|
||||
|
||||
@@ -45,9 +45,10 @@ class LoadedScript : public nsISupports
|
||||
inline ClassicScript* AsClassicScript();
|
||||
inline ModuleScript* AsModuleScript();
|
||||
|
||||
ScriptLoader* Loader() const { return mLoader; }
|
||||
ScriptFetchOptions* FetchOptions() const { return mFetchOptions; }
|
||||
nsIURI* BaseURL() const { return mBaseURL; }
|
||||
|
||||
void AssociateWithScript(JSScript* aScript);
|
||||
};
|
||||
|
||||
class ClassicScript final : public LoadedScript
|
||||
@@ -55,8 +56,7 @@ class ClassicScript final : public LoadedScript
|
||||
~ClassicScript() = default;
|
||||
|
||||
public:
|
||||
ClassicScript(ScriptLoader* aLoader, ScriptFetchOptions* aFetchOptions,
|
||||
nsIURI* aBaseURL);
|
||||
ClassicScript(ScriptFetchOptions* aFetchOptions, nsIURI* aBaseURL);
|
||||
};
|
||||
|
||||
// A single module script. May be used to satisfy multiple load requests.
|
||||
@@ -74,8 +74,7 @@ public:
|
||||
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED(ModuleScript,
|
||||
LoadedScript)
|
||||
|
||||
ModuleScript(ScriptLoader* aLoader, ScriptFetchOptions* aFetchOptions,
|
||||
nsIURI* aBaseURL);
|
||||
ModuleScript(ScriptFetchOptions* aFetchOptions, nsIURI* aBaseURL);
|
||||
|
||||
void SetModuleRecord(JS::Handle<JSObject*> aModuleRecord);
|
||||
void SetParseError(const JS::Value& aError);
|
||||
|
||||
Reference in New Issue
Block a user