From da32016d7637095effe3ddaa5e5e4792a2344dae Mon Sep 17 00:00:00 2001 From: Chung-Sheng Fu Date: Mon, 7 Aug 2017 15:55:39 +0800 Subject: [PATCH] Bug 863246 - Use system principal to load debugger scripts r=billm,bkelly MozReview-Commit-ID: DPvbR1As2UV --HG-- extra : rebase_source : c185be0d4d2180dd3dd7d0fbcfdd1035f3b4ddf3 --- dom/workers/ScriptLoader.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/dom/workers/ScriptLoader.cpp b/dom/workers/ScriptLoader.cpp index 0948e8b1f860..461c7f4cd925 100644 --- a/dom/workers/ScriptLoader.cpp +++ b/dom/workers/ScriptLoader.cpp @@ -894,10 +894,19 @@ private: { AssertIsOnMainThread(); MOZ_ASSERT(aIndex < mLoadInfos.Length()); + MOZ_ASSERT_IF(IsMainWorkerScript(), mWorkerScriptType != DebuggerScript); WorkerPrivate* parentWorker = mWorkerPrivate->GetParent(); - nsIPrincipal* principal = mWorkerPrivate->GetPrincipal(); + // For JavaScript debugging, the devtools server must run on the same + // thread as the debuggee, indicating the worker uses content principal. + // However, in Bug 863246, web content will no longer be able to load + // resource:// URIs by default, so we need system principal to load + // debugger scripts. + nsIPrincipal* principal = (mWorkerScriptType == DebuggerScript) ? + nsContentUtils::GetSystemPrincipal() : + mWorkerPrivate->GetPrincipal(); + nsCOMPtr loadGroup = mWorkerPrivate->GetLoadGroup(); MOZ_DIAGNOSTIC_ASSERT(principal);