Backed out 2 changesets (bug 1529345) for Windows 2012 build bustages

Backed out changeset 87aa4894b4a1 (bug 1529345)
Backed out changeset cf6f6281cb44 (bug 1529345)

--HG--
extra : rebase_source : b19274a3d20d3a1ea92f0fe1224ef30910e10916
This commit is contained in:
Dorel Luca 2019-06-14 23:34:36 +03:00
parent 18c1b2bdf4
commit e12ad70ab7
36 changed files with 18 additions and 1090 deletions

View File

@ -12,7 +12,6 @@
#define mozilla_dom_Attr_h
#include "mozilla/Attributes.h"
#include "nsDOMAttributeMap.h"
#include "nsINode.h"
#include "nsString.h"
#include "nsCOMPtr.h"

View File

@ -224,7 +224,6 @@
namespace mozilla {
using mozilla::dom::Element;
using mozilla::dom::HTMLSlotElement;
using mozilla::dom::ShadowRoot;
static nsIContent* GetParentOrHostOrSlot(

View File

@ -7,8 +7,6 @@
#ifndef dom_NodeUbiReporting_h
#define dom_NodeUbiReporting_h
#include "Attr.h"
#include "Document.h"
#include "nsIContent.h"
#include "nsIContentInlines.h"
#include "nsINode.h"

View File

@ -18,11 +18,9 @@
#include "nsReadableUtils.h"
#include "nsThreadUtils.h"
#include "mozilla/ClearOnShutdown.h"
#include "mozilla/dom/Document.h"
#include "mozilla/Logging.h"
#include "mozilla/StaticPtr.h"
#include "mozilla/Unused.h"
#include "nsGlobalWindowOuter.h"
#include "nsPIDOMWindow.h"
NS_IMPL_ISUPPORTS(ThirdPartyUtil, mozIThirdPartyUtil)
@ -94,16 +92,6 @@ nsresult ThirdPartyUtil::IsThirdPartyInternal(const nsCString& aFirstDomain,
return NS_OK;
}
nsCString ThirdPartyUtil::GetBaseDomainFromWindow(nsPIDOMWindowOuter* aWindow) {
mozilla::dom::Document* doc = aWindow ? aWindow->GetExtantDoc() : nullptr;
if (!doc) {
return EmptyCString();
}
return doc->GetBaseDomain();
}
NS_IMETHODIMP
ThirdPartyUtil::GetPrincipalFromWindow(mozIDOMWindowProxy* aWin,
nsIPrincipal** result) {

View File

@ -14,7 +14,6 @@
#include "mozilla/Attributes.h"
class nsIURI;
class nsPIDOMWindowOuter;
class ThirdPartyUtil final : public mozIThirdPartyUtil {
public:
@ -37,7 +36,15 @@ class ThirdPartyUtil final : public mozIThirdPartyUtil {
nsresult IsThirdPartyInternal(const nsCString& aFirstDomain,
nsIURI* aSecondURI, bool* aResult);
nsCString GetBaseDomainFromWindow(nsPIDOMWindowOuter* aWindow);
nsCString GetBaseDomainFromWindow(nsPIDOMWindowOuter* aWindow) {
mozilla::dom::Document* doc = aWindow ? aWindow->GetExtantDoc() : nullptr;
if (!doc) {
return EmptyCString();
}
return doc->GetBaseDomain();
}
RefPtr<nsEffectiveTLDService> mTLDService;
};

View File

@ -12,6 +12,7 @@
#define nsDOMAttributeMap_h
#include "mozilla/MemoryReporting.h"
#include "mozilla/dom/Attr.h"
#include "mozilla/ErrorResult.h"
#include "nsCycleCollectionParticipant.h"
#include "nsRefPtrHashtable.h"
@ -19,15 +20,10 @@
#include "nsWrapperCache.h"
class nsAtom;
class nsINode;
namespace mozilla {
namespace dom {
class Attr;
class DocGroup;
class Document;
class Element;
class NodeInfo;
} // namespace dom
} // namespace mozilla

View File

@ -11,7 +11,6 @@
*/
#include "nsContentUtils.h"
#include "nsContentPolicyUtils.h"
#include "nsDataDocumentContentPolicy.h"
#include "nsNetUtil.h"
#include "nsIProtocolHandler.h"
@ -41,7 +40,7 @@ nsDataDocumentContentPolicy::ShouldLoad(nsIURI* aContentLocation,
nsILoadInfo* aLoadInfo,
const nsACString& aMimeGuess,
int16_t* aDecision) {
auto setBlockingReason = mozilla::MakeScopeExit([&]() {
auto setBlockingReason = MakeScopeExit([&]() {
if (NS_CP_REJECTED(*aDecision)) {
NS_SetRequestBlockingReason(
aLoadInfo, nsILoadInfo::BLOCKING_REASON_CONTENT_POLICY_DATA_DOCUMENT);

View File

@ -17,9 +17,7 @@
#include "nsHistory.h"
#include "nsDOMNavigationTiming.h"
#include "nsIDOMStorageManager.h"
#include "mozilla/dom/CallbackDebuggerNotification.h"
#include "mozilla/dom/ContentFrameMessageManager.h"
#include "mozilla/dom/DebuggerNotification.h"
#include "mozilla/dom/DocumentInlines.h"
#include "mozilla/dom/DOMJSProxyHandler.h"
#include "mozilla/dom/EventTarget.h"
@ -1375,8 +1373,6 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INTERNAL(nsGlobalWindowInner)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mCacheStorage)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mVRDisplays)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mDebuggerNotificationManager)
// Traverse stuff from nsPIDOMWindow
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mChromeEventHandler)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mParentTarget)
@ -1475,8 +1471,6 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsGlobalWindowInner)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mCacheStorage)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mVRDisplays)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mDebuggerNotificationManager)
// Unlink stuff from nsPIDOMWindow
NS_IMPL_CYCLE_COLLECTION_UNLINK(mChromeEventHandler)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mParentTarget)
@ -3298,9 +3292,6 @@ int32_t nsGlobalWindowInner::RequestAnimationFrame(
js::NotifyAnimationActivity(GetWrapperPreserveColor());
}
DebuggerNotificationDispatch(this,
DebuggerNotificationType::RequestAnimationFrame);
int32_t handle;
aError = mDoc->ScheduleFrameRequestCallback(aCallback, &handle);
return handle;
@ -3312,9 +3303,6 @@ void nsGlobalWindowInner::CancelAnimationFrame(int32_t aHandle,
return;
}
DebuggerNotificationDispatch(this,
DebuggerNotificationType::CancelAnimationFrame);
mDoc->CancelFrameRequestCallback(aHandle);
}
@ -3745,16 +3733,12 @@ void nsGlobalWindowInner::MozScrollSnap() {
}
void nsGlobalWindowInner::ClearTimeout(int32_t aHandle) {
DebuggerNotificationDispatch(this, DebuggerNotificationType::ClearTimeout);
if (aHandle > 0) {
mTimeoutManager->ClearTimeout(aHandle, Timeout::Reason::eTimeoutOrInterval);
}
}
void nsGlobalWindowInner::ClearInterval(int32_t aHandle) {
DebuggerNotificationDispatch(this, DebuggerNotificationType::ClearInterval);
if (aHandle > 0) {
mTimeoutManager->ClearTimeout(aHandle, Timeout::Reason::eTimeoutOrInterval);
}
@ -4022,20 +4006,6 @@ EventListenerManager* nsGlobalWindowInner::GetExistingListenerManager() const {
return mListenerManager;
}
mozilla::dom::DebuggerNotificationManager*
nsGlobalWindowInner::GetOrCreateDebuggerNotificationManager() {
if (!mDebuggerNotificationManager) {
mDebuggerNotificationManager = new DebuggerNotificationManager(this);
}
return mDebuggerNotificationManager;
}
mozilla::dom::DebuggerNotificationManager*
nsGlobalWindowInner::GetExistingDebuggerNotificationManager() {
return mDebuggerNotificationManager;
}
//*****************************************************************************
// nsGlobalWindowInner::nsPIDOMWindow
//*****************************************************************************
@ -5731,15 +5701,10 @@ int32_t nsGlobalWindowInner::SetTimeoutOrInterval(
}
if (inner != this) {
RefPtr<nsGlobalWindowInner> innerRef(inner);
return innerRef->SetTimeoutOrInterval(aCx, aFunction, aTimeout, aArguments,
aIsInterval, aError);
return inner->SetTimeoutOrInterval(aCx, aFunction, aTimeout, aArguments,
aIsInterval, aError);
}
DebuggerNotificationDispatch(
this, aIsInterval ? DebuggerNotificationType::SetInterval
: DebuggerNotificationType::SetTimeout);
nsCOMPtr<nsIScriptTimeoutHandler> handler =
NS_CreateJSTimeoutHandler(aCx, this, aFunction, aArguments, aError);
if (!handler) {
@ -5764,15 +5729,10 @@ int32_t nsGlobalWindowInner::SetTimeoutOrInterval(JSContext* aCx,
}
if (inner != this) {
RefPtr<nsGlobalWindowInner> innerRef(inner);
return innerRef->SetTimeoutOrInterval(aCx, aHandler, aTimeout, aIsInterval,
aError);
return inner->SetTimeoutOrInterval(aCx, aHandler, aTimeout, aIsInterval,
aError);
}
DebuggerNotificationDispatch(
this, aIsInterval ? DebuggerNotificationType::SetInterval
: DebuggerNotificationType::SetTimeout);
nsCOMPtr<nsIScriptTimeoutHandler> handler =
NS_CreateJSTimeoutHandler(aCx, this, aHandler, aError);
if (!handler) {
@ -5820,10 +5780,6 @@ bool nsGlobalWindowInner::RunTimeoutHandler(Timeout* aTimeout,
reason = "setTimeout handler";
}
auto timerNotificationType =
timeout->mIsInterval ? DebuggerNotificationType::SetIntervalCallback
: DebuggerNotificationType::SetTimeoutCallback;
bool abortIntervalHandler = false;
nsCOMPtr<nsIScriptTimeoutHandler> handler(
do_QueryInterface(timeout->mScriptHandler));
@ -5857,8 +5813,6 @@ bool nsGlobalWindowInner::RunTimeoutHandler(Timeout* aTimeout,
initiatingScript->AssociateWithScript(script);
}
CallbackDebuggerNotificationGuard guard(this, timerNotificationType);
rv = exec.ExecScript();
}
}
@ -5871,13 +5825,7 @@ bool nsGlobalWindowInner::RunTimeoutHandler(Timeout* aTimeout,
nsCOMPtr<nsISupports> me(static_cast<nsIDOMWindow*>(this));
ErrorResult rv;
JS::Rooted<JS::Value> ignoredVal(RootingCx());
{
CallbackDebuggerNotificationGuard guard(this, timerNotificationType);
callback->Call(me, handler->GetArgs(), &ignoredVal, rv, reason);
}
callback->Call(me, handler->GetArgs(), &ignoredVal, rv, reason);
if (rv.IsUncatchableException()) {
abortIntervalHandler = true;
}
@ -5888,9 +5836,6 @@ bool nsGlobalWindowInner::RunTimeoutHandler(Timeout* aTimeout,
nsCOMPtr<nsITimeoutHandler> basicHandler(timeout->mScriptHandler);
nsCOMPtr<nsISupports> kungFuDeathGrip(static_cast<nsIDOMWindow*>(this));
mozilla::Unused << kungFuDeathGrip;
CallbackDebuggerNotificationGuard guard(this, timerNotificationType);
basicHandler->Call();
}

View File

@ -36,7 +36,6 @@
#include "prclist.h"
#include "mozilla/dom/BindingDeclarations.h"
#include "mozilla/dom/ChromeMessageBroadcaster.h"
#include "mozilla/dom/DebuggerNotificationManager.h"
#include "mozilla/dom/NavigatorBinding.h"
#include "mozilla/dom/StorageEvent.h"
#include "mozilla/dom/StorageEventBinding.h"
@ -285,12 +284,6 @@ class nsGlobalWindowInner final : public mozilla::dom::EventTarget,
virtual mozilla::EventListenerManager* GetOrCreateListenerManager() override;
mozilla::Maybe<mozilla::dom::EventCallbackDebuggerNotificationType>
GetDebuggerNotificationType() const override {
return mozilla::Some(
mozilla::dom::EventCallbackDebuggerNotificationType::Global);
}
bool ComputeDefaultWantsUntrusted(mozilla::ErrorResult& aRv) final;
virtual nsPIDOMWindowOuter* GetOwnerGlobalForBindingsInternal() override;
@ -324,12 +317,6 @@ class nsGlobalWindowInner final : public mozilla::dom::EventTarget,
virtual bool IsFrozen() const override;
void SyncStateFromParentWindow();
mozilla::dom::DebuggerNotificationManager*
GetOrCreateDebuggerNotificationManager() override;
mozilla::dom::DebuggerNotificationManager*
GetExistingDebuggerNotificationManager() override;
mozilla::Maybe<mozilla::dom::ClientInfo> GetClientInfo() const override;
mozilla::Maybe<mozilla::dom::ClientState> GetClientState() const;
mozilla::Maybe<mozilla::dom::ServiceWorkerDescriptor> GetController()
@ -694,35 +681,23 @@ class nsGlobalWindowInner final : public mozilla::dom::EventTarget,
const mozilla::dom::WindowPostMessageOptions& aOptions,
nsIPrincipal& aSubjectPrincipal,
mozilla::ErrorResult& aError);
MOZ_CAN_RUN_SCRIPT
int32_t SetTimeout(JSContext* aCx, mozilla::dom::Function& aFunction,
int32_t aTimeout,
const mozilla::dom::Sequence<JS::Value>& aArguments,
mozilla::ErrorResult& aError);
MOZ_CAN_RUN_SCRIPT
int32_t SetTimeout(JSContext* aCx, const nsAString& aHandler,
int32_t aTimeout,
const mozilla::dom::Sequence<JS::Value>& /* unused */,
mozilla::ErrorResult& aError);
MOZ_CAN_RUN_SCRIPT
void ClearTimeout(int32_t aHandle);
MOZ_CAN_RUN_SCRIPT
int32_t SetInterval(JSContext* aCx, mozilla::dom::Function& aFunction,
const int32_t aTimeout,
const mozilla::dom::Sequence<JS::Value>& aArguments,
mozilla::ErrorResult& aError);
MOZ_CAN_RUN_SCRIPT
int32_t SetInterval(JSContext* aCx, const nsAString& aHandler,
const int32_t aTimeout,
const mozilla::dom::Sequence<JS::Value>& /* unused */,
mozilla::ErrorResult& aError);
MOZ_CAN_RUN_SCRIPT
void ClearInterval(int32_t aHandle);
void GetOrigin(nsAString& aOrigin);
void Atob(const nsAString& aAsciiBase64String, nsAString& aBinaryData,
@ -819,12 +794,8 @@ class nsGlobalWindowInner final : public mozilla::dom::EventTarget,
void SetOuterHeight(JSContext* aCx, JS::Handle<JS::Value> aValue,
mozilla::dom::CallerType aCallerType,
mozilla::ErrorResult& aError);
MOZ_CAN_RUN_SCRIPT
int32_t RequestAnimationFrame(mozilla::dom::FrameRequestCallback& aCallback,
mozilla::ErrorResult& aError);
MOZ_CAN_RUN_SCRIPT
void CancelAnimationFrame(int32_t aHandle, mozilla::ErrorResult& aError);
uint32_t RequestIdleCallback(JSContext* aCx,
@ -1088,13 +1059,10 @@ class nsGlobalWindowInner final : public mozilla::dom::EventTarget,
public:
// Timeout Functions
// |interval| is in milliseconds.
MOZ_CAN_RUN_SCRIPT
int32_t SetTimeoutOrInterval(
JSContext* aCx, mozilla::dom::Function& aFunction, int32_t aTimeout,
const mozilla::dom::Sequence<JS::Value>& aArguments, bool aIsInterval,
mozilla::ErrorResult& aError);
MOZ_CAN_RUN_SCRIPT
int32_t SetTimeoutOrInterval(JSContext* aCx, const nsAString& aHandler,
int32_t aTimeout, bool aIsInterval,
mozilla::ErrorResult& aError);
@ -1349,9 +1317,6 @@ class nsGlobalWindowInner final : public mozilla::dom::EventTarget,
nsCOMPtr<nsIPrincipal> mDocumentStoragePrincipal;
nsCOMPtr<nsIContentSecurityPolicy> mDocumentCsp;
RefPtr<mozilla::dom::DebuggerNotificationManager>
mDebuggerNotificationManager;
// mBrowserChild is only ever populated in the content process.
nsCOMPtr<nsIBrowserChild> mBrowserChild;

View File

@ -35,7 +35,6 @@ namespace mozilla {
class DOMEventTargetHelper;
namespace dom {
class VoidFunction;
class DebuggerNotificationManager;
class ServiceWorker;
class ServiceWorkerRegistration;
class ServiceWorkerRegistrationDescriptor;
@ -132,16 +131,6 @@ class nsIGlobalObject : public nsISupports,
virtual bool IsInSyncOperation() { return false; }
virtual mozilla::dom::DebuggerNotificationManager*
GetOrCreateDebuggerNotificationManager() {
return nullptr;
}
virtual mozilla::dom::DebuggerNotificationManager*
GetExistingDebuggerNotificationManager() {
return nullptr;
}
virtual mozilla::Maybe<mozilla::dom::ClientInfo> GetClientInfo() const;
virtual mozilla::Maybe<mozilla::dom::ServiceWorkerDescriptor> GetController()

View File

@ -940,12 +940,6 @@ class nsINode : public mozilla::dom::EventTarget {
const override;
virtual mozilla::EventListenerManager* GetOrCreateListenerManager() override;
mozilla::Maybe<mozilla::dom::EventCallbackDebuggerNotificationType>
GetDebuggerNotificationType() const override {
return mozilla::Some(
mozilla::dom::EventCallbackDebuggerNotificationType::Node);
}
bool ComputeDefaultWantsUntrusted(mozilla::ErrorResult& aRv) final;
virtual bool IsApzAware() const override;

View File

@ -201,13 +201,6 @@ DOMInterfaces = {
'implicitJSContext': ['define'],
},
'DebuggerNotification': {
'concrete': True,
},
'CallbackDebuggerNotification': {
'concrete': True,
},
'DedicatedWorkerGlobalScope': {
'headerFile': 'mozilla/dom/WorkerScope.h',
},

View File

@ -1,57 +0,0 @@
/* 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/. */
enum DebuggerNotificationType {
// DebuggerNotification
"setTimeout",
"clearTimeout",
"setInterval",
"clearInterval",
"requestAnimationFrame",
"cancelAnimationFrame",
// CallbackDebuggerNotification
"setTimeoutCallback",
"setIntervalCallback",
"requestAnimationFrameCallback",
// EventCallbackDebuggerNotification
"domEvent",
};
[ChromeOnly]
interface DebuggerNotification {
readonly attribute DebuggerNotificationType type;
// The global object that has triggered the notification.
readonly attribute object global;
};
// For DOM events, we send notifications just before, and just after the
// event handler has been dispatched so that listeners
enum CallbackDebuggerNotificationPhase {
"pre",
"post",
};
// A base notification type for notifications that are dispatched as pairs with
// a before and after notification.
[ChromeOnly]
interface CallbackDebuggerNotification : DebuggerNotification {
readonly attribute CallbackDebuggerNotificationPhase phase;
};
enum EventCallbackDebuggerNotificationType {
"global",
"node",
"xhr",
"worker",
};
// A notification that about the engine calling a DOM event handler.
[ChromeOnly]
interface EventCallbackDebuggerNotification : CallbackDebuggerNotification {
readonly attribute Event event;
readonly attribute EventCallbackDebuggerNotificationType targetType;
};

View File

@ -1,28 +0,0 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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/.
*/
callback DebuggerNotificationCallback = void (DebuggerNotification n);
[ChromeOnly, Constructor, Exposed=(Window, Worker)]
interface DebuggerNotificationObserver {
// Throws if the object is not a browser global or does not support
// debugger notifications.
// Returns false if already connected to this global.
[Throws]
boolean connect(object global);
// Throws if the object is not a browser global or does not support
// debugger notifications.
// Returns false if not connected to this global.
[Throws]
boolean disconnect(object global);
// Returns false if listener already added.
boolean addListener(DebuggerNotificationCallback handler);
// Returns false if listener was not found.
boolean removeListener(DebuggerNotificationCallback handler);
};

View File

@ -35,8 +35,6 @@ PREPROCESSED_WEBIDL_FILES = [
WEBIDL_FILES = [
'BrowsingContext.webidl',
'ChannelWrapper.webidl',
'DebuggerNotification.webidl',
'DebuggerNotificationObserver.webidl',
'DocumentL10n.webidl',
'DominatorTree.webidl',
'DOMLocalization.webidl',

View File

@ -1,35 +0,0 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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 "CallbackDebuggerNotification.h"
namespace mozilla {
namespace dom {
NS_IMPL_CYCLE_COLLECTION_INHERITED(CallbackDebuggerNotification,
DebuggerNotification)
NS_IMPL_ADDREF_INHERITED(CallbackDebuggerNotification, DebuggerNotification)
NS_IMPL_RELEASE_INHERITED(CallbackDebuggerNotification, DebuggerNotification)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(CallbackDebuggerNotification)
NS_INTERFACE_MAP_END_INHERITING(DebuggerNotification)
JSObject* CallbackDebuggerNotification::WrapObject(
JSContext* aCx, JS::Handle<JSObject*> aGivenProto) {
return CallbackDebuggerNotification_Binding::Wrap(aCx, this, aGivenProto);
}
already_AddRefed<DebuggerNotification> CallbackDebuggerNotification::CloneInto(
nsIGlobalObject* aNewOwner) const {
RefPtr<CallbackDebuggerNotification> notification(
new CallbackDebuggerNotification(mDebuggeeGlobal, mType, mPhase,
aNewOwner));
return notification.forget();
}
} // namespace dom
} // namespace mozilla

View File

@ -1,79 +0,0 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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/. */
#ifndef mozilla_dom_CallbackDebuggerNotification_h
#define mozilla_dom_CallbackDebuggerNotification_h
#include "DebuggerNotification.h"
#include "DebuggerNotificationManager.h"
namespace mozilla {
namespace dom {
class CallbackDebuggerNotification : public DebuggerNotification {
public:
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(CallbackDebuggerNotification,
DebuggerNotification)
CallbackDebuggerNotification(nsIGlobalObject* aDebuggeeGlobal,
DebuggerNotificationType aType,
CallbackDebuggerNotificationPhase aPhase,
nsIGlobalObject* aOwnerGlobal = nullptr)
: DebuggerNotification(aDebuggeeGlobal, aType, aOwnerGlobal),
mPhase(aPhase) {}
// nsWrapperCache
virtual JSObject* WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto) override;
already_AddRefed<DebuggerNotification> CloneInto(
nsIGlobalObject* aNewOwner) const override;
CallbackDebuggerNotificationPhase Phase() const { return mPhase; }
protected:
~CallbackDebuggerNotification() = default;
CallbackDebuggerNotificationPhase mPhase;
};
class MOZ_RAII CallbackDebuggerNotificationGuard final {
public:
MOZ_CAN_RUN_SCRIPT CallbackDebuggerNotificationGuard(
nsIGlobalObject* aDebuggeeGlobal, DebuggerNotificationType aType)
: mDebuggeeGlobal(aDebuggeeGlobal), mType(aType) {
Dispatch(CallbackDebuggerNotificationPhase::Pre);
}
CallbackDebuggerNotificationGuard(const CallbackDebuggerNotificationGuard&) =
delete;
CallbackDebuggerNotificationGuard(CallbackDebuggerNotificationGuard&&) =
delete;
CallbackDebuggerNotificationGuard& operator=(
const CallbackDebuggerNotificationGuard&) = delete;
CallbackDebuggerNotificationGuard& operator=(
CallbackDebuggerNotificationGuard&&) = delete;
MOZ_CAN_RUN_SCRIPT ~CallbackDebuggerNotificationGuard() {
Dispatch(CallbackDebuggerNotificationPhase::Post);
}
private:
MOZ_CAN_RUN_SCRIPT void Dispatch(CallbackDebuggerNotificationPhase aPhase) {
auto manager = DebuggerNotificationManager::ForDispatch(mDebuggeeGlobal);
if (MOZ_UNLIKELY(manager)) {
manager->Dispatch<CallbackDebuggerNotification>(mType, aPhase);
}
}
nsIGlobalObject* mDebuggeeGlobal;
DebuggerNotificationType mType;
};
} // namespace dom
} // namespace mozilla
#endif // mozilla_dom_CallbackDebuggerNotification_h

View File

@ -1,38 +0,0 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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 "DebuggerNotification.h"
#include "DebuggerNotificationManager.h"
namespace mozilla {
namespace dom {
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(DebuggerNotification, mDebuggeeGlobal,
mOwnerGlobal)
NS_IMPL_CYCLE_COLLECTING_ADDREF(DebuggerNotification)
NS_IMPL_CYCLE_COLLECTING_RELEASE(DebuggerNotification)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(DebuggerNotification)
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
NS_INTERFACE_MAP_ENTRY(nsISupports)
NS_INTERFACE_MAP_END
JSObject* DebuggerNotification::WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto) {
return DebuggerNotification_Binding::Wrap(aCx, this, aGivenProto);
}
already_AddRefed<DebuggerNotification> DebuggerNotification::CloneInto(
nsIGlobalObject* aNewOwner) const {
RefPtr<DebuggerNotification> notification(
new DebuggerNotification(mDebuggeeGlobal, mType, aNewOwner));
return notification.forget();
}
} // namespace dom
} // namespace mozilla

View File

@ -1,72 +0,0 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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/. */
#ifndef mozilla_dom_DebuggerNotification_h
#define mozilla_dom_DebuggerNotification_h
#include "DebuggerNotificationManager.h"
#include "mozilla/dom/DebuggerNotificationBinding.h"
#include "nsIGlobalObject.h"
#include "nsISupports.h"
#include "nsWrapperCache.h"
namespace mozilla {
namespace dom {
class DebuggerNotification : public nsISupports, public nsWrapperCache {
public:
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(DebuggerNotification)
DebuggerNotification(nsIGlobalObject* aDebuggeeGlobal,
DebuggerNotificationType aType,
nsIGlobalObject* aOwnerGlobal = nullptr)
: mType(aType),
mDebuggeeGlobal(aDebuggeeGlobal),
mOwnerGlobal(aOwnerGlobal){};
nsIGlobalObject* GetParentObject() const {
MOZ_ASSERT(mOwnerGlobal,
"Notification must be cloned into an observer global before "
"being wrapped");
return mOwnerGlobal;
}
DebuggerNotificationType Type() const { return mType; }
void GetGlobal(JSContext* aCx, JS::MutableHandle<JSObject*> aResult) {
aResult.set(mDebuggeeGlobal->GetGlobalJSObject());
}
virtual already_AddRefed<DebuggerNotification> CloneInto(
nsIGlobalObject* aNewOwner) const;
// nsWrapperCache
virtual JSObject* WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto) override;
protected:
virtual ~DebuggerNotification() = default;
DebuggerNotificationType mType;
nsCOMPtr<nsIGlobalObject> mDebuggeeGlobal;
private:
nsCOMPtr<nsIGlobalObject> mOwnerGlobal;
};
MOZ_CAN_RUN_SCRIPT inline void DebuggerNotificationDispatch(
nsIGlobalObject* aDebuggeeGlobal, DebuggerNotificationType aType) {
auto manager = DebuggerNotificationManager::ForDispatch(aDebuggeeGlobal);
if (MOZ_UNLIKELY(manager)) {
manager->Dispatch<DebuggerNotification>(aType);
}
}
} // namespace dom
} // namespace mozilla
#endif // mozilla_dom_DebuggerNotification_h

View File

@ -1,72 +0,0 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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 "DebuggerNotificationManager.h"
#include "mozilla/ScopeExit.h"
#include "nsIGlobalObject.h"
namespace mozilla {
namespace dom {
NS_IMPL_CYCLE_COLLECTION(DebuggerNotificationManager, mDebuggeeGlobal,
mNotificationObservers)
NS_IMPL_CYCLE_COLLECTING_ADDREF(DebuggerNotificationManager)
NS_IMPL_CYCLE_COLLECTING_RELEASE(DebuggerNotificationManager)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(DebuggerNotificationManager)
NS_INTERFACE_MAP_ENTRY(nsISupports)
NS_INTERFACE_MAP_END
NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN(DebuggerNotificationManager)
NS_IMPL_CYCLE_COLLECTION_TRACE_END
bool DebuggerNotificationManager::Attach(
DebuggerNotificationObserver* aObserver) {
RefPtr<DebuggerNotificationObserver> ptr(aObserver);
if (mNotificationObservers.Contains(ptr)) {
return false;
}
mNotificationObservers.AppendElement(ptr);
return true;
}
bool DebuggerNotificationManager::Detach(
DebuggerNotificationObserver* aObserver) {
RefPtr<DebuggerNotificationObserver> ptr(aObserver);
return mNotificationObservers.RemoveElement(ptr);
}
bool DebuggerNotificationManager::HasListeners() {
nsTObserverArray<RefPtr<DebuggerNotificationObserver>>::ForwardIterator iter(
mNotificationObservers);
while (iter.HasMore()) {
RefPtr<DebuggerNotificationObserver> observer(iter.GetNext());
if (observer->HasListeners()) {
return true;
}
}
return false;
}
void DebuggerNotificationManager::NotifyListeners(
DebuggerNotification* aNotification) {
nsTObserverArray<RefPtr<DebuggerNotificationObserver>>::ForwardIterator iter(
mNotificationObservers);
while (iter.HasMore()) {
RefPtr<DebuggerNotificationObserver> observer(iter.GetNext());
observer->NotifyListeners(aNotification);
}
}
} // namespace dom
} // namespace mozilla

View File

@ -1,63 +0,0 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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/. */
#ifndef mozilla_dom_DebuggerNotificationManager_h
#define mozilla_dom_DebuggerNotificationManager_h
#include "DebuggerNotificationObserver.h"
#include "nsCycleCollectionParticipant.h"
#include "nsIGlobalObject.h"
#include "nsISupports.h"
#include "nsTObserverArray.h"
namespace mozilla {
namespace dom {
class DebuggerNotificationManager final : public nsISupports {
public:
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(DebuggerNotificationManager)
static RefPtr<DebuggerNotificationManager> ForDispatch(
nsIGlobalObject* aDebuggeeGlobal) {
if (MOZ_UNLIKELY(!aDebuggeeGlobal)) {
return nullptr;
}
auto managerPtr = aDebuggeeGlobal->GetExistingDebuggerNotificationManager();
if (MOZ_LIKELY(!managerPtr) || !managerPtr->HasListeners()) {
return nullptr;
}
return managerPtr;
}
explicit DebuggerNotificationManager(nsIGlobalObject* aDebuggeeGlobal)
: mDebuggeeGlobal(aDebuggeeGlobal), mNotificationObservers() {}
bool Attach(DebuggerNotificationObserver* aObserver);
bool Detach(DebuggerNotificationObserver* aObserver);
bool HasListeners();
template <typename T, typename... Args>
MOZ_CAN_RUN_SCRIPT void Dispatch(Args... aArgs) {
RefPtr<DebuggerNotification> notification(new T(mDebuggeeGlobal, aArgs...));
NotifyListeners(notification);
}
private:
~DebuggerNotificationManager() = default;
MOZ_CAN_RUN_SCRIPT void NotifyListeners(DebuggerNotification* aNotification);
nsCOMPtr<nsIGlobalObject> mDebuggeeGlobal;
nsTObserverArray<RefPtr<DebuggerNotificationObserver>> mNotificationObservers;
};
} // namespace dom
} // namespace mozilla
#endif // mozilla_dom_DebuggerNotificationManager_h

View File

@ -1,152 +0,0 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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 "DebuggerNotificationObserver.h"
#include "DebuggerNotification.h"
#include "nsIGlobalObject.h"
#include "WrapperFactory.h"
namespace mozilla {
namespace dom {
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(DebuggerNotificationObserver,
mOwnerGlobal, mEventListenerCallbacks)
NS_IMPL_CYCLE_COLLECTING_ADDREF(DebuggerNotificationObserver)
NS_IMPL_CYCLE_COLLECTING_RELEASE(DebuggerNotificationObserver)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(DebuggerNotificationObserver)
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
NS_INTERFACE_MAP_END
/* static */ already_AddRefed<DebuggerNotificationObserver>
DebuggerNotificationObserver::Constructor(GlobalObject& aGlobal,
ErrorResult& aRv) {
nsCOMPtr<nsIGlobalObject> globalInterface(
do_QueryInterface(aGlobal.GetAsSupports()));
if (NS_WARN_IF(!globalInterface)) {
aRv.Throw(NS_ERROR_FAILURE);
return nullptr;
}
RefPtr<DebuggerNotificationObserver> observer(
new DebuggerNotificationObserver(globalInterface));
return observer.forget();
}
DebuggerNotificationObserver::DebuggerNotificationObserver(
nsIGlobalObject* aOwnerGlobal)
: mEventListenerCallbacks(), mOwnerGlobal(aOwnerGlobal) {}
JSObject* DebuggerNotificationObserver::WrapObject(
JSContext* aCx, JS::Handle<JSObject*> aGivenProto) {
return DebuggerNotificationObserver_Binding::Wrap(aCx, this, aGivenProto);
}
static already_AddRefed<DebuggerNotificationManager> GetManager(
JSContext* aCx, JS::Handle<JSObject*> aDebuggeeGlobal) {
// The debuggee global here is likely a debugger-compartment cross-compartment
// wrapper for the debuggee global object, so we need to unwrap it to get
// the real debuggee-compartment global object.
JS::Rooted<JSObject*> debuggeeGlobalRooted(
aCx, js::UncheckedUnwrap(aDebuggeeGlobal, false));
if (!debuggeeGlobalRooted) {
return nullptr;
}
nsCOMPtr<nsIGlobalObject> debuggeeGlobalObject(
xpc::NativeGlobal(debuggeeGlobalRooted));
if (!debuggeeGlobalObject) {
return nullptr;
}
RefPtr<DebuggerNotificationManager> manager(
debuggeeGlobalObject->GetOrCreateDebuggerNotificationManager());
return manager.forget();
}
bool DebuggerNotificationObserver::Connect(
JSContext* aCx, JS::Handle<JSObject*> aDebuggeeGlobal, ErrorResult& aRv) {
RefPtr<DebuggerNotificationManager> manager(GetManager(aCx, aDebuggeeGlobal));
if (!manager) {
aRv.Throw(NS_ERROR_FAILURE);
return false;
}
return manager->Attach(this);
}
bool DebuggerNotificationObserver::Disconnect(
JSContext* aCx, JS::Handle<JSObject*> aDebuggeeGlobal, ErrorResult& aRv) {
RefPtr<DebuggerNotificationManager> manager(GetManager(aCx, aDebuggeeGlobal));
if (!manager) {
aRv.Throw(NS_ERROR_FAILURE);
return false;
}
return manager->Detach(this);
}
bool DebuggerNotificationObserver::AddListener(
DebuggerNotificationCallback& aHandlerFn) {
nsTObserverArray<RefPtr<DebuggerNotificationCallback>>::ForwardIterator iter(
mEventListenerCallbacks);
while (iter.HasMore()) {
if (*iter.GetNext().get() == aHandlerFn) {
return false;
}
}
RefPtr<DebuggerNotificationCallback> handlerFn(&aHandlerFn);
mEventListenerCallbacks.AppendElement(handlerFn);
return true;
}
bool DebuggerNotificationObserver::RemoveListener(
DebuggerNotificationCallback& aHandlerFn) {
nsTObserverArray<RefPtr<DebuggerNotificationCallback>>::ForwardIterator iter(
mEventListenerCallbacks);
for (uint32_t i = 0; iter.HasMore(); i++) {
if (*iter.GetNext().get() == aHandlerFn) {
mEventListenerCallbacks.RemoveElementAt(i);
return true;
}
}
return false;
}
bool DebuggerNotificationObserver::HasListeners() {
return !mEventListenerCallbacks.IsEmpty();
}
void DebuggerNotificationObserver::NotifyListeners(
DebuggerNotification* aNotification) {
if (!HasListeners()) {
return;
}
// Since we want the notification objects to live in the same compartment
// as the observer, we create a new instance of the notification before
// an observer dispatches the event listeners.
RefPtr<DebuggerNotification> debuggerNotification(
aNotification->CloneInto(mOwnerGlobal));
nsTObserverArray<RefPtr<DebuggerNotificationCallback>>::ForwardIterator iter(
mEventListenerCallbacks);
while (iter.HasMore()) {
RefPtr<DebuggerNotificationCallback> cb(iter.GetNext());
cb->Call(*debuggerNotification);
}
}
} // namespace dom
} // namespace mozilla

View File

@ -1,62 +0,0 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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/. */
#ifndef mozilla_dom_DebuggerNotificationObserver_h
#define mozilla_dom_DebuggerNotificationObserver_h
#include "DebuggerNotificationManager.h"
#include "mozilla/dom/DebuggerNotificationObserverBinding.h"
#include "mozilla/RefPtr.h"
#include "nsTObserverArray.h"
#include "nsWrapperCache.h"
class nsIGlobalObject;
namespace mozilla {
namespace dom {
class DebuggerNotification;
class DebuggerNotificationObserver final : public nsISupports,
public nsWrapperCache {
public:
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(DebuggerNotificationObserver)
static already_AddRefed<DebuggerNotificationObserver> Constructor(
GlobalObject& aGlobal, ErrorResult& aRv);
nsIGlobalObject* GetParentObject() const { return mOwnerGlobal; }
// nsWrapperCache
virtual JSObject* WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto) override;
bool Connect(JSContext* aCx, JS::Handle<JSObject*> aDebuggeeGlobal,
ErrorResult& aRv);
bool Disconnect(JSContext* aCx, JS::Handle<JSObject*> aDebuggeeGlobal,
ErrorResult& aRv);
bool AddListener(DebuggerNotificationCallback& aHandlerFn);
bool RemoveListener(DebuggerNotificationCallback& aHandlerFn);
bool HasListeners();
MOZ_CAN_RUN_SCRIPT void NotifyListeners(DebuggerNotification* aNotification);
private:
explicit DebuggerNotificationObserver(nsIGlobalObject* aOwnerGlobal);
~DebuggerNotificationObserver() = default;
nsTObserverArray<RefPtr<DebuggerNotificationCallback>>
mEventListenerCallbacks;
nsCOMPtr<nsIGlobalObject> mOwnerGlobal;
};
} // namespace dom
} // namespace mozilla
#endif // mozilla_dom_DebuggerNotificationObserver_h

View File

@ -1,65 +0,0 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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 "EventCallbackDebuggerNotification.h"
#include "DebuggerNotificationManager.h"
#include "mozilla/dom/EventTarget.h"
#include "mozilla/dom/Worker.h"
#include "mozilla/dom/XMLHttpRequestEventTarget.h"
#include "nsIGlobalObject.h"
#include "nsINode.h"
#include "nsQueryObject.h"
namespace mozilla {
namespace dom {
NS_IMPL_CYCLE_COLLECTION_INHERITED(EventCallbackDebuggerNotification,
CallbackDebuggerNotification, mEvent)
NS_IMPL_ADDREF_INHERITED(EventCallbackDebuggerNotification,
CallbackDebuggerNotification)
NS_IMPL_RELEASE_INHERITED(EventCallbackDebuggerNotification,
CallbackDebuggerNotification)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(EventCallbackDebuggerNotification)
NS_INTERFACE_MAP_END_INHERITING(CallbackDebuggerNotification)
JSObject* EventCallbackDebuggerNotification::WrapObject(
JSContext* aCx, JS::Handle<JSObject*> aGivenProto) {
return EventCallbackDebuggerNotification_Binding::Wrap(aCx, this,
aGivenProto);
}
already_AddRefed<DebuggerNotification>
EventCallbackDebuggerNotification::CloneInto(nsIGlobalObject* aNewOwner) const {
RefPtr<EventCallbackDebuggerNotification> notification(
new EventCallbackDebuggerNotification(mDebuggeeGlobal, mType, mEvent,
mTargetType, mPhase, aNewOwner));
return notification.forget();
}
void EventCallbackDebuggerNotificationGuard::DispatchToManager(
const RefPtr<DebuggerNotificationManager>& aManager,
CallbackDebuggerNotificationPhase aPhase) {
if (!mEventTarget) {
MOZ_ASSERT(false, "target should exist");
return;
}
Maybe<EventCallbackDebuggerNotificationType> notificationType(
mEventTarget->GetDebuggerNotificationType());
if (notificationType) {
aManager->Dispatch<EventCallbackDebuggerNotification>(
DebuggerNotificationType::DomEvent,
// The DOM event will always be live during event dispatch.
MOZ_KnownLive(mEvent), *notificationType, aPhase);
}
}
} // namespace dom
} // namespace mozilla

View File

@ -1,95 +0,0 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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/. */
#ifndef mozilla_dom_EventCallbackDebuggerNotification_h
#define mozilla_dom_EventCallbackDebuggerNotification_h
#include "CallbackDebuggerNotification.h"
#include "DebuggerNotificationManager.h"
#include "mozilla/dom/Event.h"
#include "mozilla/RefPtr.h"
namespace mozilla {
namespace dom {
class EventCallbackDebuggerNotification : public CallbackDebuggerNotification {
public:
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(EventCallbackDebuggerNotification,
CallbackDebuggerNotification)
EventCallbackDebuggerNotification(
nsIGlobalObject* debuggeeGlobal, DebuggerNotificationType t, Event* event,
EventCallbackDebuggerNotificationType targetType,
CallbackDebuggerNotificationPhase phase,
nsIGlobalObject* ownerGlobal = nullptr)
: CallbackDebuggerNotification(debuggeeGlobal, t, phase, ownerGlobal),
mEvent(event),
mTargetType(targetType) {}
// nsWrapperCache
virtual JSObject* WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto) override;
already_AddRefed<DebuggerNotification> CloneInto(
nsIGlobalObject* newOwner) const override;
mozilla::dom::Event* Event() const { return mEvent; }
EventCallbackDebuggerNotificationType TargetType() const {
return mTargetType;
}
private:
~EventCallbackDebuggerNotification() = default;
RefPtr<mozilla::dom::Event> mEvent;
EventCallbackDebuggerNotificationType mTargetType;
};
class MOZ_RAII EventCallbackDebuggerNotificationGuard final {
public:
MOZ_CAN_RUN_SCRIPT explicit EventCallbackDebuggerNotificationGuard(
mozilla::dom::EventTarget* aEventTarget, mozilla::dom::Event* aEvent)
: mDebuggeeGlobal(aEventTarget ? aEventTarget->GetOwnerGlobal()
: nullptr),
mEventTarget(aEventTarget),
mEvent(aEvent) {
Dispatch(CallbackDebuggerNotificationPhase::Pre);
}
EventCallbackDebuggerNotificationGuard(
const EventCallbackDebuggerNotificationGuard&) = delete;
EventCallbackDebuggerNotificationGuard(
EventCallbackDebuggerNotificationGuard&&) = delete;
EventCallbackDebuggerNotificationGuard& operator=(
const EventCallbackDebuggerNotificationGuard&) = delete;
EventCallbackDebuggerNotificationGuard& operator=(
EventCallbackDebuggerNotificationGuard&&) = delete;
MOZ_CAN_RUN_SCRIPT ~EventCallbackDebuggerNotificationGuard() {
Dispatch(CallbackDebuggerNotificationPhase::Post);
}
private:
MOZ_CAN_RUN_SCRIPT void Dispatch(CallbackDebuggerNotificationPhase aPhase) {
auto manager = DebuggerNotificationManager::ForDispatch(mDebuggeeGlobal);
if (MOZ_UNLIKELY(manager)) {
DispatchToManager(manager, aPhase);
}
}
MOZ_CAN_RUN_SCRIPT void DispatchToManager(
const RefPtr<DebuggerNotificationManager>& aManager,
CallbackDebuggerNotificationPhase aPhase);
nsIGlobalObject* mDebuggeeGlobal;
mozilla::dom::EventTarget* mEventTarget;
mozilla::dom::Event* mEvent;
};
} // namespace dom
} // namespace mozilla
#endif // mozilla_dom_EventCallbackDebuggerNotification_h

View File

@ -1,26 +0,0 @@
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# 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/.
with Files("**"):
BUG_COMPONENT = ("DevTools", "Debugger")
EXPORTS.mozilla.dom += [
'CallbackDebuggerNotification.h',
'DebuggerNotification.h',
'DebuggerNotificationManager.h',
'DebuggerNotificationObserver.h',
'EventCallbackDebuggerNotification.h',
]
UNIFIED_SOURCES += [
'CallbackDebuggerNotification.cpp',
'DebuggerNotification.cpp',
'DebuggerNotificationManager.cpp',
'DebuggerNotificationObserver.cpp',
'EventCallbackDebuggerNotification.cpp',
]
FINAL_LIBRARY = 'xul'

View File

@ -20,7 +20,6 @@
#include "mozilla/Preferences.h"
#include "mozilla/PresShell.h"
#include "mozilla/dom/BindingUtils.h"
#include "mozilla/dom/EventCallbackDebuggerNotification.h"
#include "mozilla/dom/Element.h"
#include "mozilla/dom/Event.h"
#include "mozilla/dom/EventTargetBinding.h"
@ -1015,7 +1014,6 @@ nsresult EventListenerManager::HandleEventSubType(Listener* aListener,
}
if (NS_SUCCEEDED(result)) {
EventCallbackDebuggerNotificationGuard dbgGuard(aCurrentTarget, aDOMEvent);
nsAutoMicroTask mt;
// Event::currentTarget is set in EventDispatcher.

View File

@ -8,7 +8,6 @@
#define mozilla_dom_EventTarget_h_
#include "mozilla/dom/BindingDeclarations.h"
#include "mozilla/dom/DebuggerNotificationBinding.h"
#include "mozilla/dom/Nullable.h"
#include "nsISupports.h"
#include "nsWrapperCache.h"
@ -196,11 +195,6 @@ class EventTarget : public nsISupports, public nsWrapperCache {
*/
virtual EventListenerManager* GetExistingListenerManager() const = 0;
virtual Maybe<EventCallbackDebuggerNotificationType>
GetDebuggerNotificationType() const {
return Nothing();
}
// Called from AsyncEventDispatcher to notify it is running.
virtual void AsyncEventRunning(AsyncEventDispatcher* aEvent) {}

View File

@ -44,7 +44,6 @@ DIRS += [
'commandhandler',
'credentialmanagement',
'crypto',
'debugger',
'encoding',
'events',
'fetch',

View File

@ -9,7 +9,6 @@
#include "RuntimeService.h"
#include "jsapi.h"
#include "mozilla/dom/DebuggerNotificationObserverBinding.h"
#include "mozilla/dom/RegisterWorkerBindings.h"
#include "mozilla/dom/RegisterWorkerDebuggerBindings.h"
#include "mozilla/OSFileConstants.h"
@ -53,10 +52,6 @@ bool WorkerPrivate::RegisterDebuggerBindings(JSContext* aCx,
return false;
}
if (!DebuggerNotificationObserver_Binding::GetConstructorObject(aCx)) {
return false;
}
if (!JS_DefineDebuggerObject(aCx, aGlobal)) {
return false;
}

View File

@ -8,7 +8,6 @@
#define mozilla_dom_Worker_h
#include "mozilla/Attributes.h"
#include "mozilla/dom/DebuggerNotificationBinding.h"
#include "mozilla/DOMEventTargetHelper.h"
#include "mozilla/RefPtr.h"
#include "mozilla/WeakPtr.h"
@ -39,11 +38,6 @@ class Worker : public DOMEventTargetHelper, public SupportsWeakPtr<Worker> {
JSObject* WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto) override;
Maybe<EventCallbackDebuggerNotificationType> GetDebuggerNotificationType()
const override {
return Some(EventCallbackDebuggerNotificationType::Worker);
}
void PostMessage(JSContext* aCx, JS::Handle<JS::Value> aMessage,
const Sequence<JSObject*>& aTransferable, ErrorResult& aRv);

View File

@ -17,7 +17,6 @@
#include "mozilla/ScopeExit.h"
#include "mozilla/StaticPrefs.h"
#include "mozilla/dom/BlobURLProtocolHandler.h"
#include "mozilla/dom/CallbackDebuggerNotification.h"
#include "mozilla/dom/ClientManager.h"
#include "mozilla/dom/ClientSource.h"
#include "mozilla/dom/ClientState.h"
@ -4310,11 +4309,6 @@ bool WorkerPrivate::RunExpiredTimeouts(JSContext* aCx) {
reason = "setTimeout handler";
}
auto timerNotificationType =
info->mIsInterval ? DebuggerNotificationType::SetIntervalCallback
: DebuggerNotificationType::SetTimeoutCallback;
RefPtr<WorkerGlobalScope> scope = GlobalScope();
RefPtr<Function> callback = info->mHandler->GetCallback();
if (!callback) {
nsAutoMicroTask mt;
@ -4334,9 +4328,6 @@ bool WorkerPrivate::RunExpiredTimeouts(JSContext* aCx) {
JS::Rooted<JS::Value> unused(aes.cx());
JS::SourceText<char16_t> srcBuf;
CallbackDebuggerNotificationGuard guard(scope, timerNotificationType);
if (!srcBuf.init(aes.cx(), script.BeginReading(), script.Length(),
JS::SourceOwnership::Borrowed) ||
!JS::Evaluate(aes.cx(), options, srcBuf, &unused)) {
@ -4348,13 +4339,8 @@ bool WorkerPrivate::RunExpiredTimeouts(JSContext* aCx) {
} else {
ErrorResult rv;
JS::Rooted<JS::Value> ignoredVal(aCx);
{
CallbackDebuggerNotificationGuard guard(scope, timerNotificationType);
callback->Call(scope, info->mHandler->GetArgs(), &ignoredVal, rv,
reason);
}
RefPtr<WorkerGlobalScope> scope = GlobalScope();
callback->Call(scope, info->mHandler->GetArgs(), &ignoredVal, rv, reason);
if (rv.IsUncatchableException()) {
rv.SuppressException();
retval = false;

View File

@ -13,7 +13,6 @@
#include "mozilla/dom/Clients.h"
#include "mozilla/dom/ClientState.h"
#include "mozilla/dom/Console.h"
#include "mozilla/dom/DebuggerNotification.h"
#include "mozilla/dom/DedicatedWorkerGlobalScopeBinding.h"
#include "mozilla/dom/Fetch.h"
#include "mozilla/dom/FunctionBinding.h"
@ -104,7 +103,6 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(WorkerGlobalScope,
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mNavigator)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mIndexedDB)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mCacheStorage)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mDebuggerNotificationManager)
tmp->TraverseHostObjectURIs(cb);
tmp->mWorkerPrivate->TraverseTimeouts(cb);
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
@ -119,7 +117,6 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(WorkerGlobalScope,
NS_IMPL_CYCLE_COLLECTION_UNLINK(mNavigator)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mIndexedDB)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mCacheStorage)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mDebuggerNotificationManager)
tmp->UnlinkHostObjectURIs();
tmp->mWorkerPrivate->UnlinkTimeouts();
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
@ -259,8 +256,6 @@ int32_t WorkerGlobalScope::SetTimeout(JSContext* aCx, Function& aHandler,
ErrorResult& aRv) {
mWorkerPrivate->AssertIsOnWorkerThread();
DebuggerNotificationDispatch(this, DebuggerNotificationType::SetTimeout);
nsCOMPtr<nsIScriptTimeoutHandler> handler =
NS_CreateJSTimeoutHandler(aCx, mWorkerPrivate, aHandler, aArguments, aRv);
if (!handler) {
@ -276,8 +271,6 @@ int32_t WorkerGlobalScope::SetTimeout(JSContext* aCx, const nsAString& aHandler,
ErrorResult& aRv) {
mWorkerPrivate->AssertIsOnWorkerThread();
DebuggerNotificationDispatch(this, DebuggerNotificationType::SetTimeout);
nsCOMPtr<nsIScriptTimeoutHandler> handler =
NS_CreateJSTimeoutHandler(aCx, mWorkerPrivate, aHandler, aRv);
if (!handler) {
@ -289,9 +282,6 @@ int32_t WorkerGlobalScope::SetTimeout(JSContext* aCx, const nsAString& aHandler,
void WorkerGlobalScope::ClearTimeout(int32_t aHandle) {
mWorkerPrivate->AssertIsOnWorkerThread();
DebuggerNotificationDispatch(this, DebuggerNotificationType::ClearTimeout);
mWorkerPrivate->ClearTimeout(aHandle);
}
@ -301,8 +291,6 @@ int32_t WorkerGlobalScope::SetInterval(JSContext* aCx, Function& aHandler,
ErrorResult& aRv) {
mWorkerPrivate->AssertIsOnWorkerThread();
DebuggerNotificationDispatch(this, DebuggerNotificationType::SetInterval);
nsCOMPtr<nsIScriptTimeoutHandler> handler =
NS_CreateJSTimeoutHandler(aCx, mWorkerPrivate, aHandler, aArguments, aRv);
if (NS_WARN_IF(aRv.Failed())) {
@ -319,8 +307,6 @@ int32_t WorkerGlobalScope::SetInterval(JSContext* aCx,
ErrorResult& aRv) {
mWorkerPrivate->AssertIsOnWorkerThread();
DebuggerNotificationDispatch(this, DebuggerNotificationType::SetInterval);
Sequence<JS::Value> dummy;
nsCOMPtr<nsIScriptTimeoutHandler> handler =
@ -334,9 +320,6 @@ int32_t WorkerGlobalScope::SetInterval(JSContext* aCx,
void WorkerGlobalScope::ClearInterval(int32_t aHandle) {
mWorkerPrivate->AssertIsOnWorkerThread();
DebuggerNotificationDispatch(this, DebuggerNotificationType::ClearInterval);
mWorkerPrivate->ClearTimeout(aHandle);
}
@ -477,20 +460,6 @@ AbstractThread* WorkerGlobalScope::AbstractMainThreadFor(
MOZ_CRASH("AbstractMainThreadFor not supported for workers.");
}
mozilla::dom::DebuggerNotificationManager*
WorkerGlobalScope::GetOrCreateDebuggerNotificationManager() {
if (!mDebuggerNotificationManager) {
mDebuggerNotificationManager = new DebuggerNotificationManager(this);
}
return mDebuggerNotificationManager;
}
mozilla::dom::DebuggerNotificationManager*
WorkerGlobalScope::GetExistingDebuggerNotificationManager() {
return mDebuggerNotificationManager;
}
Maybe<ClientInfo> WorkerGlobalScope::GetClientInfo() const {
return mWorkerPrivate->GetClientInfo();
}

View File

@ -10,7 +10,6 @@
#include "mozilla/Attributes.h"
#include "mozilla/dom/WorkerCommon.h"
#include "mozilla/DOMEventTargetHelper.h"
#include "mozilla/dom/DebuggerNotificationManager.h"
#include "mozilla/dom/Headers.h"
#include "mozilla/dom/RequestBinding.h"
#include "nsWeakReference.h"
@ -61,8 +60,6 @@ class WorkerGlobalScope : public DOMEventTargetHelper,
RefPtr<IDBFactory> mIndexedDB;
RefPtr<cache::CacheStorage> mCacheStorage;
nsCOMPtr<nsISerialEventTarget> mSerialEventTarget;
RefPtr<mozilla::dom::DebuggerNotificationManager>
mDebuggerNotificationManager;
uint32_t mWindowInteractionsAllowed;
@ -110,25 +107,19 @@ class WorkerGlobalScope : public DOMEventTargetHelper,
void ImportScripts(JSContext* aCx, const Sequence<nsString>& aScriptURLs,
ErrorResult& aRv);
MOZ_CAN_RUN_SCRIPT
int32_t SetTimeout(JSContext* aCx, Function& aHandler, const int32_t aTimeout,
const Sequence<JS::Value>& aArguments, ErrorResult& aRv);
MOZ_CAN_RUN_SCRIPT
int32_t SetTimeout(JSContext* aCx, const nsAString& aHandler,
const int32_t aTimeout,
const Sequence<JS::Value>& /* unused */, ErrorResult& aRv);
MOZ_CAN_RUN_SCRIPT
void ClearTimeout(int32_t aHandle);
MOZ_CAN_RUN_SCRIPT
int32_t SetInterval(JSContext* aCx, Function& aHandler,
const int32_t aTimeout,
const Sequence<JS::Value>& aArguments, ErrorResult& aRv);
MOZ_CAN_RUN_SCRIPT
int32_t SetInterval(JSContext* aCx, const nsAString& aHandler,
const int32_t aTimeout,
const Sequence<JS::Value>& /* unused */,
ErrorResult& aRv);
MOZ_CAN_RUN_SCRIPT
void ClearInterval(int32_t aHandle);
void GetOrigin(nsAString& aOrigin) const;
@ -192,18 +183,6 @@ class WorkerGlobalScope : public DOMEventTargetHelper,
AbstractThread* AbstractMainThreadFor(TaskCategory aCategory) override;
mozilla::dom::DebuggerNotificationManager*
GetOrCreateDebuggerNotificationManager() override;
mozilla::dom::DebuggerNotificationManager*
GetExistingDebuggerNotificationManager() override;
mozilla::Maybe<mozilla::dom::EventCallbackDebuggerNotificationType>
GetDebuggerNotificationType() const override {
return mozilla::Some(
mozilla::dom::EventCallbackDebuggerNotificationType::Global);
}
Maybe<ClientInfo> GetClientInfo() const override;
Maybe<ClientState> GetClientState() const;

View File

@ -26,11 +26,6 @@ class XMLHttpRequestEventTarget : public DOMEventTargetHelper {
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(XMLHttpRequestEventTarget,
DOMEventTargetHelper)
mozilla::Maybe<EventCallbackDebuggerNotificationType>
GetDebuggerNotificationType() const override {
return mozilla::Some(EventCallbackDebuggerNotificationType::Xhr);
}
IMPL_EVENT_HANDLER(loadstart)
IMPL_EVENT_HANDLER(progress)
IMPL_EVENT_HANDLER(abort)

View File

@ -52,7 +52,6 @@
#include "nsViewManager.h"
#include "GeckoProfiler.h"
#include "nsNPAPIPluginInstance.h"
#include "mozilla/dom/CallbackDebuggerNotification.h"
#include "mozilla/dom/Event.h"
#include "mozilla/dom/Performance.h"
#include "mozilla/dom/Selection.h"
@ -1696,12 +1695,6 @@ void nsRefreshDriver::RunFrameRequestCallbacks(TimeStamp aNowTime) {
callback.mHandle)) {
continue;
}
nsCOMPtr<nsIGlobalObject> global(innerWindow ? innerWindow->AsGlobal()
: nullptr);
CallbackDebuggerNotificationGuard guard(
global, DebuggerNotificationType::RequestAnimationFrameCallback);
// MOZ_KnownLive is OK, because the stack array frameRequestCallbacks
// keeps callback alive and the mCallback strong reference can't be
// mutated by the call.