mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-17 07:15:46 +00:00
Bug 1483274 - Remove nsIRemoteBrowser and always use nsIBrowser;r=smaug
Browsers can switch at runtime from remote to non-remote and vice versa, which on the C++ side is detected from a XBL binding change which causes nsIRemoteBrowser to either be implemented or not. Custom Elements can't change at runtime in the same way, so unifying on a single [implements] will allow browser (both remote and non-remote) to be migrated to a single Custom Element. To keep current functionality, this updates Qi calls into nsIRemoteBrowser to instead Qi into nsIBrowser and check isRemoteBrowser. Differential Revision: https://phabricator.services.mozilla.com/D3346 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
31ef9b1d53
commit
9382a39249
@ -167,7 +167,6 @@
|
||||
#include "nsIParserUtils.h"
|
||||
#include "nsIPermissionManager.h"
|
||||
#include "nsIPluginHost.h"
|
||||
#include "nsIRemoteBrowser.h"
|
||||
#include "nsIRequest.h"
|
||||
#include "nsIRunnable.h"
|
||||
#include "nsIScriptContext.h"
|
||||
@ -226,6 +225,7 @@
|
||||
#include "mozilla/dom/TabGroup.h"
|
||||
#include "nsIWebNavigationInfo.h"
|
||||
#include "nsPluginHost.h"
|
||||
#include "nsIBrowser.h"
|
||||
#include "mozilla/HangAnnotations.h"
|
||||
#include "mozilla/Encoding.h"
|
||||
#include "nsXULElement.h"
|
||||
@ -10547,8 +10547,13 @@ bool
|
||||
nsContentUtils::ShouldBlockReservedKeys(WidgetKeyboardEvent* aKeyEvent)
|
||||
{
|
||||
nsCOMPtr<nsIPrincipal> principal;
|
||||
nsCOMPtr<nsIRemoteBrowser> targetBrowser = do_QueryInterface(aKeyEvent->mOriginalTarget);
|
||||
nsCOMPtr<nsIBrowser> targetBrowser = do_QueryInterface(aKeyEvent->mOriginalTarget);
|
||||
bool isRemoteBrowser = false;
|
||||
if (targetBrowser) {
|
||||
targetBrowser->GetIsRemoteBrowser(&isRemoteBrowser);
|
||||
}
|
||||
|
||||
if (isRemoteBrowser) {
|
||||
targetBrowser->GetContentPrincipal(getter_AddRefs(principal));
|
||||
}
|
||||
else {
|
||||
|
@ -21,7 +21,6 @@ XPIDL_SOURCES += [
|
||||
'nsIDOMWindowUtils.idl',
|
||||
'nsIFocusManager.idl',
|
||||
'nsIQueryContentEventResult.idl',
|
||||
'nsIRemoteBrowser.idl',
|
||||
'nsIServiceWorkerManager.idl',
|
||||
'nsIStructuredCloneContainer.idl',
|
||||
'nsITabChild.idl',
|
||||
|
@ -66,4 +66,30 @@ interface nsIBrowser : nsISupports
|
||||
* Close the browser (usually means to remove a tab).
|
||||
*/
|
||||
void closeBrowser();
|
||||
|
||||
/**
|
||||
* A browser can change from remote to non-remote and vice versa.
|
||||
* For example, when navigating from an in-process chrome page to
|
||||
* a web page, this value would change from false to true.
|
||||
*/
|
||||
readonly attribute boolean isRemoteBrowser;
|
||||
|
||||
/**
|
||||
* Called by the child to inform the parent that a command update has occurred
|
||||
* and the supplied set of commands are now enabled and disabled.
|
||||
*
|
||||
* @param action command updater action
|
||||
* @param enabledLength length of enabledCommands array
|
||||
* @param enabledCommands commands to enable
|
||||
* @param disabledLength length of disabledCommands array
|
||||
* @param disabledCommand commands to disable
|
||||
*/
|
||||
void enableDisableCommandsRemoteOnly(in AString action,
|
||||
in unsigned long enabledLength,
|
||||
[array, size_is(enabledLength)] in string enabledCommands,
|
||||
in unsigned long disabledLength,
|
||||
[array, size_is(disabledLength)] in string disabledCommands);
|
||||
|
||||
readonly attribute nsIPrincipal contentPrincipal;
|
||||
|
||||
};
|
||||
|
@ -1,29 +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/. */
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
interface nsIPrincipal;
|
||||
|
||||
[scriptable, uuid(C8379366-F79F-4D25-89A6-22BEC0A93D16)]
|
||||
interface nsIRemoteBrowser : nsISupports
|
||||
{
|
||||
/*
|
||||
* Called by the child to inform the parent that a command update has occurred
|
||||
* and the supplied set of commands are now enabled and disabled.
|
||||
*
|
||||
* @param action command updater action
|
||||
* @param enabledLength length of enabledCommands array
|
||||
* @param enabledCommands commands to enable
|
||||
* @param disabledLength length of disabledCommands array
|
||||
* @param disabledCommand commands to disable
|
||||
*/
|
||||
void enableDisableCommands(in AString action,
|
||||
in unsigned long enabledLength,
|
||||
[array, size_is(enabledLength)] in string enabledCommands,
|
||||
in unsigned long disabledLength,
|
||||
[array, size_is(disabledLength)] in string disabledCommands);
|
||||
|
||||
readonly attribute nsIPrincipal contentPrincipal;
|
||||
};
|
@ -65,7 +65,6 @@
|
||||
#include "nsIWebBrowserChrome.h"
|
||||
#include "nsIXULBrowserWindow.h"
|
||||
#include "nsIXULWindow.h"
|
||||
#include "nsIRemoteBrowser.h"
|
||||
#include "nsViewManager.h"
|
||||
#include "nsVariant.h"
|
||||
#include "nsIWidget.h"
|
||||
@ -2060,8 +2059,12 @@ TabParent::RecvEnableDisableCommands(const nsString& aAction,
|
||||
nsTArray<nsCString>&& aEnabledCommands,
|
||||
nsTArray<nsCString>&& aDisabledCommands)
|
||||
{
|
||||
nsCOMPtr<nsIRemoteBrowser> remoteBrowser = do_QueryInterface(mFrameElement);
|
||||
if (remoteBrowser) {
|
||||
nsCOMPtr<nsIBrowser> browser = do_QueryInterface(mFrameElement);
|
||||
bool isRemoteBrowser = false;
|
||||
if (browser) {
|
||||
browser->GetIsRemoteBrowser(&isRemoteBrowser);
|
||||
}
|
||||
if (isRemoteBrowser) {
|
||||
UniquePtr<const char*[]> enabledCommands, disabledCommands;
|
||||
|
||||
if (aEnabledCommands.Length()) {
|
||||
@ -2078,9 +2081,9 @@ TabParent::RecvEnableDisableCommands(const nsString& aAction,
|
||||
}
|
||||
}
|
||||
|
||||
remoteBrowser->EnableDisableCommands(aAction,
|
||||
aEnabledCommands.Length(), enabledCommands.get(),
|
||||
aDisabledCommands.Length(), disabledCommands.get());
|
||||
browser->EnableDisableCommandsRemoteOnly(aAction,
|
||||
aEnabledCommands.Length(), enabledCommands.get(),
|
||||
aDisabledCommands.Length(), disabledCommands.get());
|
||||
}
|
||||
|
||||
return IPC_OK();
|
||||
|
@ -10,8 +10,7 @@
|
||||
|
||||
<binding id="remote-browser" extends="chrome://global/content/bindings/browser.xml#browser">
|
||||
|
||||
<implementation type="application/javascript"
|
||||
implements="nsIObserver, nsIRemoteBrowser">
|
||||
<implementation type="application/javascript">
|
||||
|
||||
<field name="_securityUI">null</field>
|
||||
|
||||
@ -542,7 +541,7 @@
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="enableDisableCommands">
|
||||
<method name="enableDisableCommandsRemoteOnly">
|
||||
<parameter name="aAction"/>
|
||||
<parameter name="aEnabledLength"/>
|
||||
<parameter name="aEnabledCommands"/>
|
||||
|
Loading…
Reference in New Issue
Block a user