author | Andreea Pavel <apavel@mozilla.com> |
Fri, 02 Mar 2018 18:08:23 +0200 | |
changeset 406248 | accb1b3cf5932526b4cf983819f9fb4cc1111546 |
parent 406247 | 82c009dbf592a073ce41bc4fab030cfd88731365 |
child 406272 | 9552b5f236a56a89edbe0625231502b3d8fe5bcd |
push id | 33549 |
push user | apavel@mozilla.com |
push date | Fri, 02 Mar 2018 16:08:39 +0000 |
treeherder | mozilla-central@accb1b3cf593 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | backout |
bugs | 1442313, 772282, 542136 |
milestone | 60.0a1 |
backs out | bfef9139500f8f47e456f0190da6a8e372c01bd3 660332ce1bf08699ce4cbf9aa50a7921850a1cd0 9788a46b8874dbc1a785e9eef091a9fc2e0b4f36 8fc2c103027ba37bd50dec5e2fe8b79d3d68c28c |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/dom/webidl/WorkerGlobalScope.webidl +++ b/dom/webidl/WorkerGlobalScope.webidl @@ -38,12 +38,9 @@ WorkerGlobalScope implements WindowOrWor // Mozilla extensions partial interface WorkerGlobalScope { void dump(optional DOMString str); // XXXbz no spec for this yet, because the webperf WG is a bit dysfunctional [Constant, Cached] readonly attribute Performance performance; - - [Func="WorkerGlobalScope::IsInAutomation", Throws] - object getJSTestingFunctions(); };
--- a/dom/workers/WorkerPrivate.cpp +++ b/dom/workers/WorkerPrivate.cpp @@ -2612,34 +2612,31 @@ WorkerPrivate::WorkerPrivate(WorkerPriva , mWorkerScriptExecutedSuccessfully(false) , mFetchHandlerWasAdded(false) , mOnLine(false) , mMainThreadObjectsForgotten(false) , mIsChromeWorker(aIsChromeWorker) , mParentFrozen(false) , mIsSecureContext(false) , mDebuggerRegistered(false) - , mIsInAutomation(false) { MOZ_ASSERT_IF(!IsDedicatedWorker(), NS_IsMainThread()); mLoadInfo.StealFrom(aLoadInfo); if (aParent) { aParent->AssertIsOnWorkerThread(); // Note that this copies our parent's secure context state into mJSSettings. aParent->CopyJSSettings(mJSSettings); // And manually set our mIsSecureContext, though it's not really relevant to // dedicated workers... mIsSecureContext = aParent->IsSecureContext(); MOZ_ASSERT_IF(mIsChromeWorker, mIsSecureContext); - mIsInAutomation = aParent->IsInAutomation(); - MOZ_ASSERT(IsDedicatedWorker()); if (aParent->mParentFrozen) { Freeze(nullptr); } mOnLine = aParent->OnLine(); } @@ -2663,18 +2660,16 @@ WorkerPrivate::WorkerPrivate(WorkerPriva if (mIsSecureContext) { mJSSettings.chrome.compartmentOptions .creationOptions().setSecureContext(true); mJSSettings.content.compartmentOptions .creationOptions().setSecureContext(true); } - mIsInAutomation = xpc::IsInAutomation(); - // Our parent can get suspended after it initiates the async creation // of a new worker thread. In this case suspend the new worker as well. if (mLoadInfo.mWindow && mLoadInfo.mWindow->IsSuspended()) { ParentWindowPaused(); } if (mLoadInfo.mWindow && mLoadInfo.mWindow->IsFrozen()) { Freeze(mLoadInfo.mWindow);
--- a/dom/workers/WorkerPrivate.h +++ b/dom/workers/WorkerPrivate.h @@ -628,22 +628,16 @@ public: // compartment of the worker global. The only reason we don't // AssertIsOnParentThread() here is so we can assert that this value matches // the one on the compartment, which has to be done from the worker thread. bool IsSecureContext() const { return mIsSecureContext; } - // Check whether we're running in automation. - bool IsInAutomation() const - { - return mIsInAutomation; - } - TimeStamp CreationTimeStamp() const { return mCreationTimeStamp; } DOMHighResTimeStamp CreationTime() const { return mCreationTimeHighRes; @@ -1480,20 +1474,16 @@ private: // of state (loadinfo, worker type, parent). // // It's a bit unfortunate that we have to have an out-of-band boolean for // this, but we need access to this state from the parent thread, and we can't // use our global object's secure state there. bool mIsSecureContext; bool mDebuggerRegistered; - - // mIsInAutomation is true when we're running in test automation. - // We expose some extra testing functions in that case. - bool mIsInAutomation; }; class AutoSyncLoopHolder { WorkerPrivate* mWorkerPrivate; nsCOMPtr<nsIEventTarget> mTarget; uint32_t mIndex;
--- a/dom/workers/WorkerScope.cpp +++ b/dom/workers/WorkerScope.cpp @@ -2,17 +2,16 @@ /* vim: set ts=8 sts=2 et sw=2 tw=80: */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "WorkerScope.h" #include "jsapi.h" -#include "jsfriendapi.h" #include "mozilla/EventListenerManager.h" #include "mozilla/dom/BindingDeclarations.h" #include "mozilla/dom/Clients.h" #include "mozilla/dom/ClientState.h" #include "mozilla/dom/Console.h" #include "mozilla/dom/DedicatedWorkerGlobalScopeBinding.h" #include "mozilla/dom/DOMPrefs.h" #include "mozilla/dom/Fetch.h" @@ -396,36 +395,16 @@ WorkerGlobalScope::GetPerformance() if (!mPerformance) { mPerformance = Performance::CreateForWorker(mWorkerPrivate); } return mPerformance; } -bool -WorkerGlobalScope::IsInAutomation(JSContext* aCx, JSObject* /* unused */) -{ - return GetWorkerPrivateFromContext(aCx)->IsInAutomation(); -} - -void -WorkerGlobalScope::GetJSTestingFunctions(JSContext* aCx, - JS::MutableHandle<JSObject*> aFunctions, - ErrorResult& aRv) -{ - JSObject* obj = js::GetTestingFunctions(aCx); - if (!obj) { - aRv.Throw(NS_ERROR_OUT_OF_MEMORY); - return; - } - - aFunctions.set(obj); -} - already_AddRefed<Promise> WorkerGlobalScope::Fetch(const RequestOrUSVString& aInput, const RequestInit& aInit, CallerType aCallerType, ErrorResult& aRv) { return FetchRequest(this, aInput, aInit, aCallerType, aRv); }
--- a/dom/workers/WorkerScope.h +++ b/dom/workers/WorkerScope.h @@ -156,21 +156,16 @@ public: Performance* GetPerformance(); Performance* GetPerformanceIfExists() const { return mPerformance; } - static bool IsInAutomation(JSContext* aCx, JSObject* /* unused */); - void GetJSTestingFunctions(JSContext* aCx, - JS::MutableHandle<JSObject*> aFunctions, - ErrorResult& aRv); - already_AddRefed<Promise> Fetch(const RequestOrUSVString& aInput, const RequestInit& aInit, CallerType aCallerType, ErrorResult& aRv); already_AddRefed<IDBFactory> GetIndexedDB(ErrorResult& aErrorResult); already_AddRefed<cache::CacheStorage>
--- a/dom/workers/test/test_worker_interfaces.js +++ b/dom/workers/test/test_worker_interfaces.js @@ -71,17 +71,21 @@ var ecmaGlobals = {name: "TypeError", insecureContext: true}, {name: "Uint16Array", insecureContext: true}, {name: "Uint32Array", insecureContext: true}, {name: "Uint8Array", insecureContext: true}, {name: "Uint8ClampedArray", insecureContext: true}, {name: "URIError", insecureContext: true}, {name: "WeakMap", insecureContext: true}, {name: "WeakSet", insecureContext: true}, - {name: "WebAssembly", insecureContext: true, disabled: !getJSTestingFunctions().wasmIsSupportedByHardware()}, + // WebAssembly is not supported on some hardware configurations, + // but we have no way to check that from here. Just give up for + // now and don't check for it at all. Do NOT add any other uses + // of "optional"! + {name: "WebAssembly", insecureContext: true, optional: true}, ]; // IMPORTANT: Do not change the list above without review from // a JavaScript Engine peer! // IMPORTANT: Do not change the list below without review from a DOM peer! var interfaceNamesInGlobalScope = [ // IMPORTANT: Do not change this list without review from a DOM peer! @@ -282,16 +286,18 @@ function createInterfaceMap(version, use // The insecureContext test is very purposefully converting // entry.insecureContext to boolean, so undefined will convert to // false. That way entries without an insecureContext annotation // will get treated as "insecureContext: false", which means exposed // only in secure contexts. (isInsecureContext && !Boolean(entry.insecureContext)) || entry.disabled) { interfaceMap[entry.name] = false; + } else if (entry.optional) { + interfaceMap[entry.name] = "optional"; } else { interfaceMap[entry.name] = true; } } } } addInterfaces(ecmaGlobals); @@ -302,27 +308,31 @@ function createInterfaceMap(version, use function runTest(version, userAgent) { var interfaceMap = createInterfaceMap(version, userAgent); for (var name of Object.getOwnPropertyNames(self)) { // An interface name should start with an upper case character. if (!/^[A-Z]/.test(name)) { continue; } - ok(interfaceMap[name], + ok(interfaceMap[name] === "optional" || interfaceMap[name], "If this is failing: DANGER, are you sure you want to expose the new interface " + name + " to all webpages as a property on the worker? Do not make a change to this file without a " + " review from a DOM peer for that specific change!!! (or a JS peer for changes to ecmaGlobals)"); delete interfaceMap[name]; } for (var name of Object.keys(interfaceMap)) { - ok(name in self === interfaceMap[name], - name + " should " + (interfaceMap[name] ? "" : " NOT") + " be defined on the global scope"); - if (!interfaceMap[name]) { + if (interfaceMap[name] === "optional") { delete interfaceMap[name]; + } else { + ok(name in self === interfaceMap[name], + name + " should " + (interfaceMap[name] ? "" : " NOT") + " be defined on the global scope"); + if (!interfaceMap[name]) { + delete interfaceMap[name]; + } } } is(Object.keys(interfaceMap).length, 0, "The following interface(s) are not enumerated: " + Object.keys(interfaceMap).join(", ")); } workerTestGetVersion(function(version) { workerTestGetUserAgent(function(userAgent) {
--- a/js/xpconnect/src/xpcpublic.h +++ b/js/xpconnect/src/xpcpublic.h @@ -672,26 +672,20 @@ AreNonLocalConnectionsDisabled() } } return disabledForTest; } inline bool IsInAutomation() { - static bool sAutomationPrefIsSet; - static bool sPrefCacheAdded = false; - if (!sPrefCacheAdded) { - mozilla::Preferences::AddBoolVarCache( - &sAutomationPrefIsSet, - "security.turn_off_all_security_so_that_viruses_can_take_over_this_computer", - false); - sPrefCacheAdded = true; - } - return sAutomationPrefIsSet && AreNonLocalConnectionsDisabled(); + const char* prefName = + "security.turn_off_all_security_so_that_viruses_can_take_over_this_computer"; + return mozilla::Preferences::GetBool(prefName) && + AreNonLocalConnectionsDisabled(); } void CreateCooperativeContext(); void DestroyCooperativeContext();