Backed out 4 changesets (bug 1605209) for causing browser-chrome failures at dom/ipc/tests/JSWindowActor/browser_crash_report.js

CLOSED TREE

Backed out changeset 6eb1cc169dbf (bug 1605209)
Backed out changeset d81b566ad94f (bug 1605209)
Backed out changeset e0e6dbf1d48d (bug 1605209)
Backed out changeset 289f5bbac1ae (bug 1605209)
This commit is contained in:
Daniel Varga 2020-04-17 13:49:04 +03:00
parent e99eb8477c
commit ca80197a2f
33 changed files with 76 additions and 226 deletions

View File

@ -2011,7 +2011,7 @@ nsDocShell::GetLoadURIDelegate(nsILoadURIDelegate** aLoadURIDelegate) {
already_AddRefed<nsILoadURIDelegate> nsDocShell::GetLoadURIDelegate() {
if (nsCOMPtr<nsILoadURIDelegate> result =
do_QueryActor("LoadURIDelegate", GetWindow())) {
do_QueryActor(u"LoadURIDelegate", GetWindow())) {
return result.forget();
}

View File

@ -1198,7 +1198,7 @@ void ChromeUtils::ResetLastExternalProtocolIframeAllowed(
/* static */
void ChromeUtils::RegisterWindowActor(const GlobalObject& aGlobal,
const nsACString& aName,
const nsAString& aName,
const WindowActorOptions& aOptions,
ErrorResult& aRv) {
MOZ_ASSERT(XRE_IsParentProcess());
@ -1209,7 +1209,7 @@ void ChromeUtils::RegisterWindowActor(const GlobalObject& aGlobal,
/* static */
void ChromeUtils::UnregisterWindowActor(const GlobalObject& aGlobal,
const nsACString& aName) {
const nsAString& aName) {
MOZ_ASSERT(XRE_IsParentProcess());
RefPtr<JSWindowActorService> service = JSWindowActorService::GetSingleton();

View File

@ -193,12 +193,12 @@ class ChromeUtils {
static void ResetLastExternalProtocolIframeAllowed(GlobalObject& aGlobal);
static void RegisterWindowActor(const GlobalObject& aGlobal,
const nsACString& aName,
const nsAString& aName,
const WindowActorOptions& aOptions,
ErrorResult& aRv);
static void UnregisterWindowActor(const GlobalObject& aGlobal,
const nsACString& aName);
const nsAString& aName);
static bool IsClassifierBlockingErrorCode(GlobalObject& aGlobal,
uint32_t aError);

View File

@ -205,7 +205,7 @@ nsresult nsWindowRoot::GetControllerForCommand(const char* aCommand,
// At this point, it is known that a child process is focused, so ask
// its Controllers actor if the command is supported.
nsCOMPtr<nsIController> controller =
do_QueryActor("Controllers", canonicalFocusedBC);
do_QueryActor(u"Controllers", canonicalFocusedBC);
if (controller) {
bool supported;
controller->SupportsCommand(aCommand, &supported);

View File

@ -441,10 +441,10 @@ partial namespace ChromeUtils {
* See JSWindowActor.webidl for WindowActorOptions fields documentation.
*/
[ChromeOnly, Throws]
void registerWindowActor(UTF8String aName, optional WindowActorOptions aOptions = {});
void registerWindowActor(DOMString aName, optional WindowActorOptions aOptions = {});
[ChromeOnly]
void unregisterWindowActor(UTF8String aName);
void unregisterWindowActor(DOMString aName);
[ChromeOnly]
// aError should a nsresult.

View File

@ -68,7 +68,7 @@ interface WindowGlobalParent : WindowContext {
* customize actor creation.
*/
[Throws]
JSWindowActorParent getActor(UTF8String name);
JSWindowActorParent getActor(DOMString name);
/**
* Renders a region of the frame into an image bitmap.
@ -130,5 +130,5 @@ interface WindowGlobalChild {
* customize actor creation.
*/
[Throws]
JSWindowActorChild getActor(UTF8String name);
JSWindowActorChild getActor(DOMString name);
};

View File

@ -2919,7 +2919,7 @@ NS_IMETHODIMP
BrowserChild::GetWebBrowserChrome(nsIWebBrowserChrome3** aWebBrowserChrome) {
nsCOMPtr<nsPIDOMWindowOuter> outer = do_GetInterface(WebNavigation());
if (nsCOMPtr<nsIWebBrowserChrome3> chrome =
do_QueryActor("WebBrowserChrome", outer)) {
do_QueryActor(u"WebBrowserChrome", outer)) {
chrome.forget(aWebBrowserChrome);
} else {
// TODO: remove fallback

View File

@ -2346,7 +2346,7 @@ mozilla::ipc::IPCResult BrowserParent::RecvEnableDisableCommands(
}
nsCOMPtr<nsIBrowserController> browserController =
do_QueryActor("Controllers", aContext.get_canonical());
do_QueryActor(u"Controllers", aContext.get_canonical());
if (browserController) {
browserController->EnableDisableCommands(aAction, aEnabledCommands,
aDisabledCommands);

View File

@ -2653,7 +2653,7 @@ mozilla::ipc::IPCResult ContentChild::RecvInitJSWindowActorInfos(
}
mozilla::ipc::IPCResult ContentChild::RecvUnregisterJSWindowActor(
const nsCString& aName) {
const nsString& aName) {
RefPtr<JSWindowActorService> actSvc = JSWindowActorService::GetSingleton();
actSvc->UnregisterWindowActor(aName);
return IPC_OK();

View File

@ -408,7 +408,7 @@ class ContentChild final
mozilla::ipc::IPCResult RecvInitJSWindowActorInfos(
nsTArray<JSWindowActorInfo>&& aInfos);
mozilla::ipc::IPCResult RecvUnregisterJSWindowActor(const nsCString& aName);
mozilla::ipc::IPCResult RecvUnregisterJSWindowActor(const nsString& aName);
mozilla::ipc::IPCResult RecvLastPrivateDocShellDestroyed();

View File

@ -7,7 +7,6 @@
#include "mozilla/dom/JSWindowActor.h"
#include "mozilla/dom/JSWindowActorBinding.h"
#include "mozilla/Attributes.h"
#include "mozilla/Telemetry.h"
#include "mozilla/dom/ClonedErrorHolder.h"
#include "mozilla/dom/ClonedErrorHolderBinding.h"
@ -19,7 +18,6 @@
#include "js/Promise.h"
#include "xpcprivate.h"
#include "nsASCIIMask.h"
#include "nsICrashReporter.h"
namespace mozilla {
namespace dom {
@ -49,33 +47,11 @@ NS_IMPL_CYCLE_COLLECTION_TRACE_WRAPPERCACHE(JSWindowActor)
JSWindowActor::JSWindowActor() : mNextQueryId(0) {}
// RAII class to ensure that, if we crash while handling a message, the
// crash will be annotated with the name of the actor and the message.
struct MOZ_RAII AutoAnnotateMessageInCaseOfCrash {
AutoAnnotateMessageInCaseOfCrash(const nsCString& aActorName,
const nsCString& aMessageName) {
CrashReporter::AnnotateCrashReport(CrashReporter::Annotation::JSActorName,
aActorName);
CrashReporter::AnnotateCrashReport(
CrashReporter::Annotation::JSActorMessage, aMessageName);
}
~AutoAnnotateMessageInCaseOfCrash() {
CrashReporter::RemoveCrashReportAnnotation(
CrashReporter::Annotation::JSActorMessage);
CrashReporter::RemoveCrashReportAnnotation(
CrashReporter::Annotation::JSActorName);
}
};
void JSWindowActor::StartDestroy() {
AutoAnnotateMessageInCaseOfCrash guard(/* aActorName = */ mName,
NS_LITERAL_CSTRING("<WillDestroy>"));
InvokeCallback(CallbackFunction::WillDestroy);
}
void JSWindowActor::AfterDestroy() {
AutoAnnotateMessageInCaseOfCrash guard(/* aActorName = */ mName,
NS_LITERAL_CSTRING("<DidDestroy>"));
InvokeCallback(CallbackFunction::DidDestroy);
// Clear out & reject mPendingQueries
RejectPendingQueries();
@ -155,7 +131,7 @@ bool JSWindowActor::AllowMessage(const JSWindowActorMessageMeta& aMetadata,
return true;
}
nsAutoString messageName(NS_ConvertUTF8toUTF16(aMetadata.actorName()));
nsAutoString messageName(aMetadata.actorName());
messageName.AppendLiteral("::");
messageName.Append(aMetadata.messageName());
@ -170,7 +146,7 @@ bool JSWindowActor::AllowMessage(const JSWindowActorMessageMeta& aMetadata,
return false;
}
void JSWindowActor::SetName(const nsACString& aName) {
void JSWindowActor::SetName(const nsAString& aName) {
MOZ_ASSERT(mName.IsEmpty(), "Cannot set name twice!");
mName = aName;
}
@ -268,9 +244,6 @@ void JSWindowActor::ReceiveRawMessage(const JSWindowActorMessageMeta& aMetadata,
ipc::StructuredCloneData&& aData,
ipc::StructuredCloneData&& aStack) {
MOZ_ASSERT(nsContentUtils::IsSafeToRunScript());
AutoAnnotateMessageInCaseOfCrash guard(
/* aActorName = */ mName,
NS_LossyConvertUTF16toASCII(aMetadata.messageName()));
AutoEntryScript aes(GetParentObject(), "JSWindowActor message handler");
JSContext* cx = aes.cx();
@ -468,15 +441,17 @@ void JSWindowActor::QueryHandler::ResolvedCallback(
IgnoredErrorResult error;
data.Write(aCx, aValue, error);
if (NS_WARN_IF(error.Failed())) {
nsAutoCString msg;
// We failed to serialize the message over IPC. Report this error to the
// console, and send a reject reply.
nsAutoString msg;
msg.Append(mActor->Name());
msg.Append(':');
msg.Append(NS_LossyConvertUTF16toASCII(mMessageName));
msg.Append(mMessageName);
msg.AppendLiteral(": message reply cannot be cloned.");
auto exc = MakeRefPtr<Exception>(msg, NS_ERROR_FAILURE,
NS_LITERAL_CSTRING("DataCloneError"),
nullptr, nullptr);
auto exc = MakeRefPtr<Exception>(
NS_ConvertUTF16toUTF8(msg), NS_ERROR_FAILURE,
NS_LITERAL_CSTRING("DataCloneError"), nullptr, nullptr);
JS::Rooted<JS::Value> val(aCx);
if (ToJSValue(aCx, exc, &val)) {

View File

@ -45,7 +45,7 @@ class JSWindowActor : public nsISupports, public nsWrapperCache {
enum class Type { Parent, Child };
enum class CallbackFunction { WillDestroy, DidDestroy, ActorCreated };
const nsCString& Name() const { return mName; }
const nsString& Name() const { return mName; }
void SendAsyncMessage(JSContext* aCx, const nsAString& aMessageName,
JS::Handle<JS::Value> aObj, ErrorResult& aRv);
@ -79,7 +79,7 @@ class JSWindowActor : public nsISupports, public nsWrapperCache {
virtual ~JSWindowActor() = default;
void SetName(const nsACString& aName);
void SetName(const nsAString& aName);
void StartDestroy();
@ -130,7 +130,7 @@ class JSWindowActor : public nsISupports, public nsWrapperCache {
};
nsCOMPtr<nsISupports> mWrappedJS;
nsCString mName;
nsString mName;
nsRefPtrHashtable<nsUint64HashKey, Promise> mPendingQueries;
uint64_t mNextQueryId;
};

View File

@ -30,7 +30,7 @@ JSObject* JSWindowActorChild::WrapObject(JSContext* aCx,
WindowGlobalChild* JSWindowActorChild::GetManager() const { return mManager; }
void JSWindowActorChild::Init(const nsACString& aName,
void JSWindowActorChild::Init(const nsAString& aName,
WindowGlobalChild* aManager) {
MOZ_ASSERT(!mManager, "Cannot Init() a JSWindowActorChild twice!");
SetName(aName);

View File

@ -52,7 +52,7 @@ class JSWindowActorChild final : public JSWindowActor {
}
WindowGlobalChild* GetManager() const;
void Init(const nsACString& aName, WindowGlobalChild* aManager);
void Init(const nsAString& aName, WindowGlobalChild* aManager);
void StartDestroy();
void AfterDestroy();
Document* GetDocument(ErrorResult& aRv);

View File

@ -26,7 +26,7 @@ JSObject* JSWindowActorParent::WrapObject(JSContext* aCx,
WindowGlobalParent* JSWindowActorParent::GetManager() const { return mManager; }
void JSWindowActorParent::Init(const nsACString& aName,
void JSWindowActorParent::Init(const nsAString& aName,
WindowGlobalParent* aManager) {
MOZ_ASSERT(!mManager, "Cannot Init() a JSWindowActorParent twice!");
SetName(aName);

View File

@ -43,7 +43,7 @@ class JSWindowActorParent final : public JSWindowActor {
nsIGlobalObject* GetParentObject() const override;
WindowGlobalParent* GetManager() const;
void Init(const nsACString& aName, WindowGlobalParent* aManager);
void Init(const nsAString& aName, WindowGlobalParent* aManager);
void StartDestroy();
void AfterDestroy();
CanonicalBrowsingContext* GetBrowsingContext(ErrorResult& aRv);

View File

@ -94,7 +94,7 @@ JSWindowActorInfo JSWindowActorProtocol::ToIPC() {
}
already_AddRefed<JSWindowActorProtocol>
JSWindowActorProtocol::FromWebIDLOptions(const nsACString& aName,
JSWindowActorProtocol::FromWebIDLOptions(const nsAString& aName,
const WindowActorOptions& aOptions,
ErrorResult& aRv) {
MOZ_DIAGNOSTIC_ASSERT(XRE_IsParentProcess());
@ -395,15 +395,16 @@ already_AddRefed<JSWindowActorService> JSWindowActorService::GetSingleton() {
}
void JSWindowActorService::RegisterWindowActor(
const nsACString& aName, const WindowActorOptions& aOptions,
const nsAString& aName, const WindowActorOptions& aOptions,
ErrorResult& aRv) {
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(XRE_IsParentProcess());
auto entry = mDescriptors.LookupForAdd(aName);
if (entry) {
aRv.ThrowNotSupportedError(nsPrintfCString(
"'%s' actor is already registered.", PromiseFlatCString(aName).get()));
aRv.ThrowNotSupportedError(
nsPrintfCString("'%s' actor is already registered.",
NS_ConvertUTF16toUTF8(aName).get()));
return;
}
@ -433,8 +434,8 @@ void JSWindowActorService::RegisterWindowActor(
proto->AddObservers();
}
void JSWindowActorService::UnregisterWindowActor(const nsACString& aName) {
nsAutoCString name(aName);
void JSWindowActorService::UnregisterWindowActor(const nsAString& aName) {
nsAutoString name(aName);
RefPtr<JSWindowActorProtocol> proto;
if (mDescriptors.Remove(aName, getter_AddRefs(proto))) {
@ -506,7 +507,7 @@ void JSWindowActorService::UnregisterChromeEventTarget(EventTarget* aTarget) {
}
already_AddRefed<JSWindowActorProtocol> JSWindowActorService::GetProtocol(
const nsACString& aName) {
const nsAString& aName) {
return mDescriptors.Get(aName);
}

View File

@ -47,7 +47,7 @@ class JSWindowActorProtocol final : public nsIObserver,
JSWindowActorInfo ToIPC();
static already_AddRefed<JSWindowActorProtocol> FromWebIDLOptions(
const nsACString& aName, const WindowActorOptions& aOptions,
const nsAString& aName, const WindowActorOptions& aOptions,
ErrorResult& aRv);
struct Sided {
@ -78,13 +78,13 @@ class JSWindowActorProtocol final : public nsIObserver,
const nsAString& aRemoteType);
private:
explicit JSWindowActorProtocol(const nsACString& aName) : mName(aName) {}
explicit JSWindowActorProtocol(const nsAString& aName) : mName(aName) {}
extensions::MatchPatternSet* GetURIMatcher();
bool RemoteTypePrefixMatches(const nsDependentSubstring& aRemoteType);
bool MessageManagerGroupMatches(BrowsingContext* aBrowsingContext);
~JSWindowActorProtocol() = default;
nsCString mName;
nsString mName;
bool mAllFrames = false;
bool mIncludeChrome = false;
nsTArray<nsString> mMatches;
@ -103,11 +103,11 @@ class JSWindowActorService final {
static already_AddRefed<JSWindowActorService> GetSingleton();
void RegisterWindowActor(const nsACString& aName,
void RegisterWindowActor(const nsAString& aName,
const WindowActorOptions& aOptions,
ErrorResult& aRv);
void UnregisterWindowActor(const nsACString& aName);
void UnregisterWindowActor(const nsAString& aName);
// Register child's Window Actor from JSWindowActorInfos for content process.
void LoadJSWindowActorInfos(nsTArray<JSWindowActorInfo>& aInfos);
@ -122,14 +122,14 @@ class JSWindowActorService final {
// NOTE: This method is static, as it may be called during shutdown.
static void UnregisterChromeEventTarget(EventTarget* aTarget);
already_AddRefed<JSWindowActorProtocol> GetProtocol(const nsACString& aName);
already_AddRefed<JSWindowActorProtocol> GetProtocol(const nsAString& aName);
private:
JSWindowActorService();
~JSWindowActorService();
nsTArray<EventTarget*> mChromeEventTargets;
nsRefPtrHashtable<nsCStringHashKey, JSWindowActorProtocol> mDescriptors;
nsRefPtrHashtable<nsStringHashKey, JSWindowActorProtocol> mDescriptors;
};
} // namespace dom

View File

@ -244,7 +244,7 @@ struct JSWindowActorEventDecl
struct JSWindowActorInfo
{
nsCString name;
nsString name;
bool allFrames;
nsCString? url;
@ -618,7 +618,7 @@ child:
/**
* Unregister a previously registered JSWindowActor in the child process.
*/
async UnregisterJSWindowActor(nsCString name);
async UnregisterJSWindowActor(nsString name);
async SetXPCOMProcessAttributes(XPCOMInitData xpcomInit,
StructuredCloneData initialData,

View File

@ -25,7 +25,7 @@ namespace mozilla {
namespace dom {
struct JSWindowActorMessageMeta {
nsCString actorName;
nsString actorName;
nsString messageName;
uint64_t queryId;
JSWindowActorMessageKind kind;

View File

@ -37,7 +37,7 @@ WindowGlobalInit WindowGlobalActor::AboutBlankInitializer(
outerWindowId);
}
void WindowGlobalActor::ConstructActor(const nsACString& aName,
void WindowGlobalActor::ConstructActor(const nsAString& aName,
JS::MutableHandleObject aActor,
ErrorResult& aRv) {
MOZ_ASSERT(nsContentUtils::IsSafeToRunScript());
@ -113,17 +113,19 @@ void WindowGlobalActor::ConstructActor(const nsACString& aName,
// Load the specific property from our module.
JS::RootedValue ctor(cx);
nsAutoCString ctorName(aName);
ctorName.AppendASCII(actorType == JSWindowActor::Type::Parent ? "Parent"
: "Child");
if (!JS_GetProperty(cx, exports, ctorName.get(), &ctor)) {
nsAutoString ctorName(aName);
ctorName.Append(actorType == JSWindowActor::Type::Parent
? NS_LITERAL_STRING("Parent")
: NS_LITERAL_STRING("Child"));
if (!JS_GetUCProperty(cx, exports, ctorName.get(), ctorName.Length(),
&ctor)) {
aRv.NoteJSContextException(cx);
return;
}
if (NS_WARN_IF(!ctor.isObject())) {
nsPrintfCString message("Could not find actor constructor '%s'",
ctorName.get());
NS_ConvertUTF16toUTF8(ctorName).get());
aRv.ThrowNotFoundError(message);
return;
}

View File

@ -30,7 +30,7 @@ class WindowGlobalActor : public nsISupports {
// Load the module for the named Window Actor and contruct it.
// This method will not initialize the actor or set its manager,
// which is handled by callers.
void ConstructActor(const nsACString& aName, JS::MutableHandleObject aActor,
void ConstructActor(const nsAString& aName, JS::MutableHandleObject aActor,
ErrorResult& aRv);
virtual nsIURI* GetDocumentURI() = 0;
virtual const nsAString& GetRemoteType() = 0;

View File

@ -471,7 +471,7 @@ const nsAString& WindowGlobalChild::GetRemoteType() {
}
already_AddRefed<JSWindowActorChild> WindowGlobalChild::GetActor(
const nsACString& aName, ErrorResult& aRv) {
const nsAString& aName, ErrorResult& aRv) {
if (!CanSend()) {
aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
return nullptr;
@ -513,7 +513,7 @@ void WindowGlobalChild::ActorDestroy(ActorDestroyReason aWhy) {
#endif
// Destroy our JSWindowActors, and reject any pending queries.
nsRefPtrHashtable<nsCStringHashKey, JSWindowActorChild> windowActors;
nsRefPtrHashtable<nsStringHashKey, JSWindowActorChild> windowActors;
mWindowActors.SwapElements(windowActors);
for (auto iter = windowActors.Iter(); !iter.Done(); iter.Next()) {
iter.Data()->RejectPendingQueries();

View File

@ -94,7 +94,7 @@ class WindowGlobalChild final : public WindowGlobalActor,
ipc::StructuredCloneData&& aStack);
// Get a JS actor object by name.
already_AddRefed<JSWindowActorChild> GetActor(const nsACString& aName,
already_AddRefed<JSWindowActorChild> GetActor(const nsAString& aName,
ErrorResult& aRv);
// Create and initialize the WindowGlobalChild object.
@ -150,7 +150,7 @@ class WindowGlobalChild final : public WindowGlobalActor,
RefPtr<nsGlobalWindowInner> mWindowGlobal;
RefPtr<dom::BrowsingContext> mBrowsingContext;
RefPtr<dom::WindowContext> mWindowContext;
nsRefPtrHashtable<nsCStringHashKey, JSWindowActorChild> mWindowActors;
nsRefPtrHashtable<nsStringHashKey, JSWindowActorChild> mWindowActors;
nsCOMPtr<nsIPrincipal> mDocumentPrincipal;
nsCOMPtr<nsIURI> mDocumentURI;
uint64_t mInnerWindowId;

View File

@ -414,7 +414,7 @@ void WindowGlobalParent::NotifyContentBlockingEvent(
}
already_AddRefed<JSWindowActorParent> WindowGlobalParent::GetActor(
const nsACString& aName, ErrorResult& aRv) {
const nsAString& aName, ErrorResult& aRv) {
if (!CanSend()) {
aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
return nullptr;
@ -671,7 +671,7 @@ void WindowGlobalParent::ActorDestroy(ActorDestroyReason aWhy) {
}
// Destroy our JSWindowActors, and reject any pending queries.
nsRefPtrHashtable<nsCStringHashKey, JSWindowActorParent> windowActors;
nsRefPtrHashtable<nsStringHashKey, JSWindowActorParent> windowActors;
mWindowActors.SwapElements(windowActors);
for (auto iter = windowActors.Iter(); !iter.Done(); iter.Next()) {
iter.Data()->RejectPendingQueries();

View File

@ -74,7 +74,7 @@ class WindowGlobalParent final : public WindowContext,
already_AddRefed<WindowGlobalChild> GetChildActor();
// Get a JS actor object by name.
already_AddRefed<JSWindowActorParent> GetActor(const nsACString& aName,
already_AddRefed<JSWindowActorParent> GetActor(const nsAString& aName,
ErrorResult& aRv);
// Get this actor's manager if it is not an in-process actor. Returns
@ -233,7 +233,7 @@ class WindowGlobalParent final : public WindowContext,
nsCOMPtr<nsIURI> mDocumentURI;
nsString mDocumentTitle;
nsRefPtrHashtable<nsCStringHashKey, JSWindowActorParent> mWindowActors;
nsRefPtrHashtable<nsStringHashKey, JSWindowActorParent> mWindowActors;
bool mInProcess;
bool mIsInitialDocument;

View File

@ -17,7 +17,7 @@
// only has any use within a child process.
class MOZ_STACK_CLASS nsQueryActorChild final : public nsCOMPtr_helper {
public:
nsQueryActorChild(const nsLiteralCString aActorName,
nsQueryActorChild(const nsLiteralString aActorName,
nsPIDOMWindowOuter* aWindow)
: mActorName(aActorName), mWindow(aWindow) {}
@ -43,21 +43,21 @@ class MOZ_STACK_CLASS nsQueryActorChild final : public nsCOMPtr_helper {
}
private:
const nsLiteralCString mActorName;
const nsLiteralString mActorName;
nsPIDOMWindowOuter* mWindow;
};
template <size_t length>
inline nsQueryActorChild do_QueryActor(const char (&aActorName)[length],
inline nsQueryActorChild do_QueryActor(const char16_t (&aActorName)[length],
nsPIDOMWindowOuter* aWindow) {
return nsQueryActorChild(nsLiteralCString(aActorName), aWindow);
return nsQueryActorChild(nsLiteralString(aActorName), aWindow);
}
// This type is used to get an actor given a CanonicalBrowsingContext. It
// is only useful in the parent process.
class MOZ_STACK_CLASS nsQueryActorParent final : public nsCOMPtr_helper {
public:
nsQueryActorParent(nsLiteralCString aActorName,
nsQueryActorParent(nsLiteralString aActorName,
mozilla::dom::CanonicalBrowsingContext* aBrowsingContext)
: mActorName(aActorName), mBrowsingContext(aBrowsingContext) {}
@ -83,15 +83,15 @@ class MOZ_STACK_CLASS nsQueryActorParent final : public nsCOMPtr_helper {
}
private:
const nsLiteralCString mActorName;
const nsLiteralString mActorName;
mozilla::dom::CanonicalBrowsingContext* mBrowsingContext;
};
template <size_t length>
inline nsQueryActorParent do_QueryActor(
const char (&aActorName)[length],
const char16_t (&aActorName)[length],
mozilla::dom::CanonicalBrowsingContext* aBrowsingContext) {
return nsQueryActorParent(nsLiteralCString(aActorName), aBrowsingContext);
return nsQueryActorParent(nsLiteralString(aActorName), aBrowsingContext);
}
#endif // defined nsQueryActor_h

View File

@ -2,7 +2,6 @@
support-files =
head.js
[browser_crash_report.js]
[browser_destroy_callbacks.js]
[browser_event_listener.js]
[browser_getActor.js]

View File

@ -1,104 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
declTest("crash actor", {
allFrames: true,
async test(browser) {
if (!("@mozilla.org/toolkit/crash-reporter;1" in Cc)) {
info("Cannot test crash annotations without a crash reporter");
return;
}
{
info("Creating a new tab.");
let newTab = await BrowserTestUtils.openNewForegroundTab(gBrowser, URL);
let newTabBrowser = newTab.linkedBrowser;
let parent = newTabBrowser.browsingContext.currentWindowGlobal.getActor(
"Test"
);
ok(parent, "JSWindowActorParent should have value.");
await SpecialPowers.spawn(newTabBrowser, [], async function() {
let child = content.windowGlobalChild;
ok(child, "WindowGlobalChild should have value.");
is(
child.isInProcess,
false,
"Actor should be loaded in the content process."
);
// Make sure that the actor is loaded.
let actorChild = child.getActor("Test");
is(actorChild.show(), "TestChild", "actor show should have value.");
is(
actorChild.manager,
child,
"manager should match WindowGlobalChild."
);
});
info(
"Crashing from withing an actor. We should have an actor name and a message name."
);
let report = await BrowserTestUtils.crashFrame(
newTabBrowser,
/* shouldShowTabCrashPage = */ false,
/* shouldClearMinidumps = */ true,
/* browsingContext = */ null,
{ asyncCrash: false }
);
is(report.JSActorName, "BrowserTestUtils");
is(report.JSActorMessage, "BrowserTestUtils:CrashFrame");
BrowserTestUtils.removeTab(newTab);
}
{
info("Creating a new tab for async crash");
let newTab = await BrowserTestUtils.openNewForegroundTab(gBrowser, URL);
let newTabBrowser = newTab.linkedBrowser;
let parent = newTabBrowser.browsingContext.currentWindowGlobal.getActor(
"Test"
);
ok(parent, "JSWindowActorParent should have value.");
await SpecialPowers.spawn(newTabBrowser, [], async function() {
let child = content.windowGlobalChild;
ok(child, "WindowGlobalChild should have value.");
is(
child.isInProcess,
false,
"Actor should be loaded in the content process."
);
// Make sure that the actor is loaded.
let actorChild = child.getActor("Test");
is(actorChild.show(), "TestChild", "actor show should have value.");
is(
actorChild.manager,
child,
"manager should match WindowGlobalChild."
);
});
info(
"Crashing from without an actor. We should have neither an actor name nor a message name."
);
let report = await BrowserTestUtils.crashFrame(
newTabBrowser,
/* shouldShowTabCrashPage = */ false,
/* shouldClearMinidumps = */ true,
/* browsingContext = */ null,
{ asyncCrash: true }
);
is(report.JSActorName, null);
is(report.JSActorMessage, null);
BrowserTestUtils.removeTab(newTab);
}
},
});

View File

@ -1632,8 +1632,6 @@ var BrowserTestUtils = {
* An object with any of the following fields:
* crashType: "CRASH_INVALID_POINTER_DEREF" | "CRASH_OOM"
* The type of crash. If unspecified, default to "CRASH_INVALID_POINTER_DEREF"
* asyncCrash: bool
* If specified and `true`, cause the crash asynchronously.
*
* @returns (Promise)
* @resolves An Object with key-value pairs representing the data from the
@ -1781,7 +1779,6 @@ var BrowserTestUtils = {
"BrowserTestUtils:CrashFrame",
{
crashType: options.crashType || "",
asyncCrash: options.asyncCrash || false,
}
);

View File

@ -219,7 +219,6 @@ class BrowserTestUtilsChild extends JSWindowActorChild {
);
let dies = function() {
dump("\nEt tu, Brute?\n");
ChromeUtils.privateNoteIntentionalCrash();
switch (aMessage.data.crashType) {
@ -243,15 +242,8 @@ class BrowserTestUtilsChild extends JSWindowActorChild {
}
};
if (aMessage.data.asyncCrash) {
let { setTimeout } = ChromeUtils.import(
"resource://gre/modules/Timer.jsm"
);
// Get out of the stack.
setTimeout(dies, 0);
} else {
dies();
}
dump("\nEt tu, Brute?\n");
dies();
}
}

View File

@ -553,18 +553,6 @@ JavaStackTrace:
uncaught Java exception.
type: string
JSActorMessage:
description: >
If an actor is currently treating a message, this is the name of the message.
Otherwise, empty.
type: string
JSActorName:
description: >
If an actor is currently treating a message, this is the name of the actor.
Otherwise, empty.
type: string
JSLargeAllocationFailure:
description: >
A large allocation couldn't be satisfied, check the JSOutOfMemory

View File

@ -84,7 +84,7 @@ nsContentTreeOwner::GetWebBrowserChrome() {
nsCOMPtr<nsPIDOMWindowOuter> outer(docShell->GetWindow());
if (nsCOMPtr<nsIWebBrowserChrome3> chrome =
do_QueryActor("WebBrowserChrome", outer)) {
do_QueryActor(u"WebBrowserChrome", outer)) {
return chrome.forget();
}