Bug 1571622 use absolute URL in CompileOptions for worklet scripts r=baku

This is consistent with ScriptLoader::FillCompileOptionsForRequest()
https://searchfox.org/mozilla-central/rev/29cce9a2684ef64c4f1f996087da8b7545d31f65/dom/script/ScriptLoader.cpp#2437
and provides that devtools can find the script.

Differential Revision: https://phabricator.services.mozilla.com/D40768

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Karl Tomlinson 2019-08-06 09:06:53 +00:00
Родитель eb40cac898
Коммит 7519a779ac
1 изменённых файлов: 5 добавлений и 7 удалений

Просмотреть файл

@ -131,7 +131,7 @@ class WorkletFetchHandler final : public PromiseNativeHandler,
}
RefPtr<WorkletFetchHandler> handler =
new WorkletFetchHandler(aWorklet, aModuleURL, promise);
new WorkletFetchHandler(aWorklet, spec, promise);
fetchPromise->AppendNativeHandler(handler);
aWorklet->AddImportFetchHandler(spec, handler);
@ -236,7 +236,7 @@ class WorkletFetchHandler final : public PromiseNativeHandler,
RejectPromises(NS_ERROR_DOM_NETWORK_ERR);
}
const nsString& URL() const { return mURL; }
const nsCString& URL() const { return mURL; }
void ExecutionFailed(nsresult aRv) {
MOZ_ASSERT(NS_IsMainThread());
@ -249,7 +249,7 @@ class WorkletFetchHandler final : public PromiseNativeHandler,
}
private:
WorkletFetchHandler(Worklet* aWorklet, const nsAString& aURL,
WorkletFetchHandler(Worklet* aWorklet, const nsACString& aURL,
Promise* aPromise)
: mWorklet(aWorklet), mStatus(ePending), mErrorStatus(NS_OK), mURL(aURL) {
MOZ_ASSERT(aWorklet);
@ -316,7 +316,7 @@ class WorkletFetchHandler final : public PromiseNativeHandler,
nsresult mErrorStatus;
nsString mURL;
nsCString mURL;
};
NS_IMPL_ISUPPORTS(WorkletFetchHandler, nsIStreamLoaderObserver)
@ -347,11 +347,9 @@ void ExecutionRunnable::RunOnWorkletThread() {
JS::Rooted<JSObject*> globalObj(cx, globalScope->GetGlobalJSObject());
NS_ConvertUTF16toUTF8 url(mHandler->URL());
JS::CompileOptions compileOptions(cx);
compileOptions.setIntroductionType("Worklet");
compileOptions.setFileAndLine(url.get(), 0);
compileOptions.setFileAndLine(mHandler->URL().get(), 0);
compileOptions.setIsRunOnce(true);
compileOptions.setNoScriptRval(true);