Bug 1638092 - do not require a browsingcontext to call the external protocol service's loadURI method, r=mattwoodrow

Differential Revision: https://phabricator.services.mozilla.com/D75543
This commit is contained in:
Gijs Kruitbosch 2020-05-17 22:54:30 +00:00
parent 27835d15d1
commit 72186b2199
5 changed files with 6 additions and 17 deletions

View File

@ -3731,7 +3731,7 @@ mozilla::ipc::IPCResult ContentParent::RecvAccumulateMixedContentHSTS(
mozilla::ipc::IPCResult ContentParent::RecvLoadURIExternal(
nsIURI* uri, const MaybeDiscarded<BrowsingContext>& aContext) {
if (aContext.IsNullOrDiscarded()) {
if (aContext.IsDiscarded()) {
return IPC_OK();
}

View File

@ -18,18 +18,8 @@ nsContentDispatchChooser.prototype = {
// nsIContentDispatchChooser
ask: function ask(aHandler, aWindowContext, aURI, aReason) {
var window = null;
try {
if (aWindowContext) {
window = aWindowContext.getInterface(Ci.nsIDOMWindow);
if (window) {
window = window.docShell.rootTreeItem.domWindow;
}
}
} catch (e) {
/* it's OK to not have a window */
}
ask: function ask(aHandler, aBrowsingContext, aURI, aReason) {
let window = aBrowsingContext?.top?.embedderElement?.ownerGlobal || null;
var bundle = Services.strings.createBundle(STRINGBUNDLE_URL);
@ -59,7 +49,7 @@ nsContentDispatchChooser.prototype = {
}
params.appendElement(aHandler);
params.appendElement(aURI);
params.appendElement(aWindowContext);
params.appendElement(aBrowsingContext);
Services.ww.openWindow(
window,

View File

@ -25,7 +25,7 @@
* window.arguments[8]:
* This is the nsIURI that we are being brought up for in the first place.
* window.arguments[9]:
* The nsIInterfaceRequestor of the parent window; may be null
* The browsingContext from which the request originates; may be null.
*/
const { EnableDelayHelper } = ChromeUtils.import(

View File

@ -923,7 +923,6 @@ NS_IMETHODIMP
nsExternalHelperAppService::LoadURI(nsIURI* aURI,
BrowsingContext* aBrowsingContext) {
NS_ENSURE_ARG_POINTER(aURI);
NS_ENSURE_ARG_POINTER(aBrowsingContext);
if (XRE_IsContentProcess()) {
mozilla::dom::ContentChild::GetSingleton()->SendLoadURIExternal(

View File

@ -110,7 +110,7 @@ interface nsIExternalProtocolService : nsISupports
* (bug 394479).
*/
void loadURI(in nsIURI aURI,
in BrowsingContext aBrowsingContext);
[optional] in BrowsingContext aBrowsingContext);
/**
* Gets a human-readable description for the application responsible for