☠☠ backed out by accb1b3cf593 ☠ ☠ | |
author | Boris Zbarsky <bzbarsky@mit.edu> |
Thu, 01 Mar 2018 14:24:20 -0500 | |
changeset 406204 | 660332ce1bf08699ce4cbf9aa50a7921850a1cd0 |
parent 406203 | 9788a46b8874dbc1a785e9eef091a9fc2e0b4f36 |
child 406205 | bfef9139500f8f47e456f0190da6a8e372c01bd3 |
push id | 33546 |
push user | aciure@mozilla.com |
push date | Fri, 02 Mar 2018 10:16:37 +0000 |
treeherder | mozilla-central@b2a9a4bb5c94 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | bkelly |
bugs | 1442313 |
milestone | 60.0a1 |
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,9 +38,12 @@ 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/WorkerScope.cpp +++ b/dom/workers/WorkerScope.cpp @@ -2,16 +2,17 @@ /* 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" @@ -395,16 +396,36 @@ 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,16 +156,21 @@ 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>