Bug 1605209 - Turn actor names into nsCString;r=nika

This should save (a little) memory and avoid quite a few conversions.

Differential Revision: https://phabricator.services.mozilla.com/D70341
This commit is contained in:
David Teller 2020-04-16 08:58:21 +00:00
parent acc935de46
commit 5435691b55
28 changed files with 78 additions and 91 deletions

View File

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

View File

@ -1198,7 +1198,7 @@ void ChromeUtils::ResetLastExternalProtocolIframeAllowed(
/* static */
void ChromeUtils::RegisterWindowActor(const GlobalObject& aGlobal,
const nsAString& aName,
const nsACString& 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 nsAString& aName) {
const nsACString& 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 nsAString& aName,
const nsACString& aName,
const WindowActorOptions& aOptions,
ErrorResult& aRv);
static void UnregisterWindowActor(const GlobalObject& aGlobal,
const nsAString& aName);
const nsACString& 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(u"Controllers", canonicalFocusedBC);
do_QueryActor("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(DOMString aName, optional WindowActorOptions aOptions = {});
void registerWindowActor(UTF8String aName, optional WindowActorOptions aOptions = {});
[ChromeOnly]
void unregisterWindowActor(DOMString aName);
void unregisterWindowActor(UTF8String aName);
[ChromeOnly]
// aError should a nsresult.

View File

@ -68,7 +68,7 @@ interface WindowGlobalParent : WindowContext {
* customize actor creation.
*/
[Throws]
JSWindowActorParent getActor(DOMString name);
JSWindowActorParent getActor(UTF8String name);
/**
* Renders a region of the frame into an image bitmap.
@ -130,5 +130,5 @@ interface WindowGlobalChild {
* customize actor creation.
*/
[Throws]
JSWindowActorChild getActor(DOMString name);
JSWindowActorChild getActor(UTF8String 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(u"WebBrowserChrome", outer)) {
do_QueryActor("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(u"Controllers", aContext.get_canonical());
do_QueryActor("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 nsString& aName) {
const nsCString& 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 nsString& aName);
mozilla::ipc::IPCResult RecvUnregisterJSWindowActor(const nsCString& aName);
mozilla::ipc::IPCResult RecvLastPrivateDocShellDestroyed();

View File

@ -52,14 +52,6 @@ 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 nsString& aMessageName) {
CrashReporter::AnnotateCrashReport(
CrashReporter::Annotation::JSActorName, aActorName);
CrashReporter::AnnotateCrashReport(
CrashReporter::Annotation::JSActorMessage,
NS_LossyConvertUTF16toASCII(aMessageName));
}
AutoAnnotateMessageInCaseOfCrash(const nsCString& aActorName,
const nsCString& aMessageName) {
CrashReporter::AnnotateCrashReport(CrashReporter::Annotation::JSActorName,
@ -68,19 +60,21 @@ struct MOZ_RAII AutoAnnotateMessageInCaseOfCrash {
CrashReporter::Annotation::JSActorMessage, aMessageName);
}
~AutoAnnotateMessageInCaseOfCrash() {
CrashReporter::RemoveCrashReportAnnotation(CrashReporter::Annotation::JSActorMessage);
CrashReporter::RemoveCrashReportAnnotation(CrashReporter::Annotation::JSActorName);
CrashReporter::RemoveCrashReportAnnotation(
CrashReporter::Annotation::JSActorMessage);
CrashReporter::RemoveCrashReportAnnotation(
CrashReporter::Annotation::JSActorName);
}
};
void JSWindowActor::StartDestroy() {
AutoAnnotateMessageInCaseOfCrash guard(mCName,
AutoAnnotateMessageInCaseOfCrash guard(/* aActorName = */ mName,
NS_LITERAL_CSTRING("<WillDestroy>"));
InvokeCallback(CallbackFunction::WillDestroy);
}
void JSWindowActor::AfterDestroy() {
AutoAnnotateMessageInCaseOfCrash guard(mCName,
AutoAnnotateMessageInCaseOfCrash guard(/* aActorName = */ mName,
NS_LITERAL_CSTRING("<DidDestroy>"));
InvokeCallback(CallbackFunction::DidDestroy);
// Clear out & reject mPendingQueries
@ -161,7 +155,7 @@ bool JSWindowActor::AllowMessage(const JSWindowActorMessageMeta& aMetadata,
return true;
}
nsAutoString messageName(aMetadata.actorName());
nsAutoString messageName(NS_ConvertUTF8toUTF16(aMetadata.actorName()));
messageName.AppendLiteral("::");
messageName.Append(aMetadata.messageName());
@ -176,10 +170,9 @@ bool JSWindowActor::AllowMessage(const JSWindowActorMessageMeta& aMetadata,
return false;
}
void JSWindowActor::SetName(const nsAString& aName) {
void JSWindowActor::SetName(const nsACString& aName) {
MOZ_ASSERT(mName.IsEmpty(), "Cannot set name twice!");
mName = aName;
mCName = NS_LossyConvertUTF16toASCII(aName);
}
static ipc::StructuredCloneData CloneJSStack(JSContext* aCx,
@ -275,7 +268,9 @@ void JSWindowActor::ReceiveRawMessage(const JSWindowActorMessageMeta& aMetadata,
ipc::StructuredCloneData&& aData,
ipc::StructuredCloneData&& aStack) {
MOZ_ASSERT(nsContentUtils::IsSafeToRunScript());
AutoAnnotateMessageInCaseOfCrash guard(mCName, aMetadata.messageName());
AutoAnnotateMessageInCaseOfCrash guard(
/* aActorName = */ mName,
NS_LossyConvertUTF16toASCII(aMetadata.messageName()));
AutoEntryScript aes(GetParentObject(), "JSWindowActor message handler");
JSContext* cx = aes.cx();
@ -473,17 +468,15 @@ void JSWindowActor::QueryHandler::ResolvedCallback(
IgnoredErrorResult error;
data.Write(aCx, aValue, error);
if (NS_WARN_IF(error.Failed())) {
// We failed to serialize the message over IPC. Report this error to the
// console, and send a reject reply.
nsAutoString msg;
nsAutoCString msg;
msg.Append(mActor->Name());
msg.Append(':');
msg.Append(mMessageName);
msg.Append(NS_LossyConvertUTF16toASCII(mMessageName));
msg.AppendLiteral(": message reply cannot be cloned.");
auto exc = MakeRefPtr<Exception>(
NS_ConvertUTF16toUTF8(msg), NS_ERROR_FAILURE,
NS_LITERAL_CSTRING("DataCloneError"), nullptr, nullptr);
auto exc = MakeRefPtr<Exception>(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 nsString& Name() const { return mName; }
const nsCString& 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 nsAString& aName);
void SetName(const nsACString& aName);
void StartDestroy();
@ -130,10 +130,7 @@ class JSWindowActor : public nsISupports, public nsWrapperCache {
};
nsCOMPtr<nsISupports> mWrappedJS;
// A ASCII-encoded version of the name, cached to avoid converting UTF-16 =>
// UTF-8 at every message.
nsCString mCName;
nsString mName;
nsCString 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 nsAString& aName,
void JSWindowActorChild::Init(const nsACString& 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 nsAString& aName, WindowGlobalChild* aManager);
void Init(const nsACString& 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 nsAString& aName,
void JSWindowActorParent::Init(const nsACString& 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 nsAString& aName, WindowGlobalParent* aManager);
void Init(const nsACString& 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 nsAString& aName,
JSWindowActorProtocol::FromWebIDLOptions(const nsACString& aName,
const WindowActorOptions& aOptions,
ErrorResult& aRv) {
MOZ_DIAGNOSTIC_ASSERT(XRE_IsParentProcess());
@ -395,16 +395,15 @@ already_AddRefed<JSWindowActorService> JSWindowActorService::GetSingleton() {
}
void JSWindowActorService::RegisterWindowActor(
const nsAString& aName, const WindowActorOptions& aOptions,
const nsACString& 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.",
NS_ConvertUTF16toUTF8(aName).get()));
aRv.ThrowNotSupportedError(nsPrintfCString(
"'%s' actor is already registered.", PromiseFlatCString(aName).get()));
return;
}
@ -434,8 +433,8 @@ void JSWindowActorService::RegisterWindowActor(
proto->AddObservers();
}
void JSWindowActorService::UnregisterWindowActor(const nsAString& aName) {
nsAutoString name(aName);
void JSWindowActorService::UnregisterWindowActor(const nsACString& aName) {
nsAutoCString name(aName);
RefPtr<JSWindowActorProtocol> proto;
if (mDescriptors.Remove(aName, getter_AddRefs(proto))) {
@ -507,7 +506,7 @@ void JSWindowActorService::UnregisterChromeEventTarget(EventTarget* aTarget) {
}
already_AddRefed<JSWindowActorProtocol> JSWindowActorService::GetProtocol(
const nsAString& aName) {
const nsACString& aName) {
return mDescriptors.Get(aName);
}

View File

@ -47,7 +47,7 @@ class JSWindowActorProtocol final : public nsIObserver,
JSWindowActorInfo ToIPC();
static already_AddRefed<JSWindowActorProtocol> FromWebIDLOptions(
const nsAString& aName, const WindowActorOptions& aOptions,
const nsACString& aName, const WindowActorOptions& aOptions,
ErrorResult& aRv);
struct Sided {
@ -78,13 +78,13 @@ class JSWindowActorProtocol final : public nsIObserver,
const nsAString& aRemoteType);
private:
explicit JSWindowActorProtocol(const nsAString& aName) : mName(aName) {}
explicit JSWindowActorProtocol(const nsACString& aName) : mName(aName) {}
extensions::MatchPatternSet* GetURIMatcher();
bool RemoteTypePrefixMatches(const nsDependentSubstring& aRemoteType);
bool MessageManagerGroupMatches(BrowsingContext* aBrowsingContext);
~JSWindowActorProtocol() = default;
nsString mName;
nsCString 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 nsAString& aName,
void RegisterWindowActor(const nsACString& aName,
const WindowActorOptions& aOptions,
ErrorResult& aRv);
void UnregisterWindowActor(const nsAString& aName);
void UnregisterWindowActor(const nsACString& 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 nsAString& aName);
already_AddRefed<JSWindowActorProtocol> GetProtocol(const nsACString& aName);
private:
JSWindowActorService();
~JSWindowActorService();
nsTArray<EventTarget*> mChromeEventTargets;
nsRefPtrHashtable<nsStringHashKey, JSWindowActorProtocol> mDescriptors;
nsRefPtrHashtable<nsCStringHashKey, JSWindowActorProtocol> mDescriptors;
};
} // namespace dom

View File

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

View File

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

View File

@ -37,7 +37,7 @@ WindowGlobalInit WindowGlobalActor::AboutBlankInitializer(
outerWindowId);
}
void WindowGlobalActor::ConstructActor(const nsAString& aName,
void WindowGlobalActor::ConstructActor(const nsACString& aName,
JS::MutableHandleObject aActor,
ErrorResult& aRv) {
MOZ_ASSERT(nsContentUtils::IsSafeToRunScript());
@ -113,19 +113,17 @@ void WindowGlobalActor::ConstructActor(const nsAString& aName,
// Load the specific property from our module.
JS::RootedValue ctor(cx);
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)) {
nsAutoCString ctorName(aName);
ctorName.AppendASCII(actorType == JSWindowActor::Type::Parent ? "Parent"
: "Child");
if (!JS_GetProperty(cx, exports, ctorName.get(), &ctor)) {
aRv.NoteJSContextException(cx);
return;
}
if (NS_WARN_IF(!ctor.isObject())) {
nsPrintfCString message("Could not find actor constructor '%s'",
NS_ConvertUTF16toUTF8(ctorName).get());
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 nsAString& aName, JS::MutableHandleObject aActor,
void ConstructActor(const nsACString& 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 nsAString& aName, ErrorResult& aRv) {
const nsACString& 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<nsStringHashKey, JSWindowActorChild> windowActors;
nsRefPtrHashtable<nsCStringHashKey, 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 nsAString& aName,
already_AddRefed<JSWindowActorChild> GetActor(const nsACString& 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<nsStringHashKey, JSWindowActorChild> mWindowActors;
nsRefPtrHashtable<nsCStringHashKey, 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 nsAString& aName, ErrorResult& aRv) {
const nsACString& 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<nsStringHashKey, JSWindowActorParent> windowActors;
nsRefPtrHashtable<nsCStringHashKey, 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 nsAString& aName,
already_AddRefed<JSWindowActorParent> GetActor(const nsACString& 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<nsStringHashKey, JSWindowActorParent> mWindowActors;
nsRefPtrHashtable<nsCStringHashKey, 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 nsLiteralString aActorName,
nsQueryActorChild(const nsLiteralCString aActorName,
nsPIDOMWindowOuter* aWindow)
: mActorName(aActorName), mWindow(aWindow) {}
@ -43,21 +43,21 @@ class MOZ_STACK_CLASS nsQueryActorChild final : public nsCOMPtr_helper {
}
private:
const nsLiteralString mActorName;
const nsLiteralCString mActorName;
nsPIDOMWindowOuter* mWindow;
};
template <size_t length>
inline nsQueryActorChild do_QueryActor(const char16_t (&aActorName)[length],
inline nsQueryActorChild do_QueryActor(const char (&aActorName)[length],
nsPIDOMWindowOuter* aWindow) {
return nsQueryActorChild(nsLiteralString(aActorName), aWindow);
return nsQueryActorChild(nsLiteralCString(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(nsLiteralString aActorName,
nsQueryActorParent(nsLiteralCString aActorName,
mozilla::dom::CanonicalBrowsingContext* aBrowsingContext)
: mActorName(aActorName), mBrowsingContext(aBrowsingContext) {}
@ -83,15 +83,15 @@ class MOZ_STACK_CLASS nsQueryActorParent final : public nsCOMPtr_helper {
}
private:
const nsLiteralString mActorName;
const nsLiteralCString mActorName;
mozilla::dom::CanonicalBrowsingContext* mBrowsingContext;
};
template <size_t length>
inline nsQueryActorParent do_QueryActor(
const char16_t (&aActorName)[length],
const char (&aActorName)[length],
mozilla::dom::CanonicalBrowsingContext* aBrowsingContext) {
return nsQueryActorParent(nsLiteralString(aActorName), aBrowsingContext);
return nsQueryActorParent(nsLiteralCString(aActorName), aBrowsingContext);
}
#endif // defined nsQueryActor_h

View File

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