Bug 1452321. Remove nsIWebBrowserPersistable. r=mystor

MozReview-Commit-ID: CCw86gAtKn3
This commit is contained in:
Boris Zbarsky 2018-04-09 16:30:33 -04:00
Родитель 1c287692f6
Коммит eb5f28a236
13 изменённых файлов: 58 добавлений и 86 удалений

Просмотреть файл

@ -157,8 +157,8 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsFrameLoader)
// from nsISupports* to nsFrameLoader* and end up with |this|.
foundInterface = reinterpret_cast<nsISupports*>(this);
} else
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIWebBrowserPersistable)
NS_INTERFACE_MAP_ENTRY(nsIWebBrowserPersistable)
NS_INTERFACE_MAP_ENTRY(nsIMutationObserver)
NS_INTERFACE_MAP_ENTRY(nsISupports)
NS_INTERFACE_MAP_END
nsFrameLoader::nsFrameLoader(Element* aOwner, nsPIDOMWindowOuter* aOpener,
@ -3230,22 +3230,11 @@ nsFrameLoader::StartPersistence(uint64_t aOuterWindowID,
nsIWebBrowserPersistDocumentReceiver* aRecv,
ErrorResult& aRv)
{
nsresult rv = StartPersistence(aOuterWindowID, aRecv);
if (NS_FAILED(rv)) {
aRv.Throw(rv);
}
}
NS_IMETHODIMP
nsFrameLoader::StartPersistence(uint64_t aOuterWindowID,
nsIWebBrowserPersistDocumentReceiver* aRecv)
{
if (!aRecv) {
return NS_ERROR_INVALID_POINTER;
}
MOZ_ASSERT(aRecv);
if (mRemoteBrowser) {
return mRemoteBrowser->StartPersistence(aOuterWindowID, aRecv);
mRemoteBrowser->StartPersistence(aOuterWindowID, aRecv, aRv);
return;
}
nsCOMPtr<nsIDocument> rootDoc =
@ -3264,7 +3253,6 @@ nsFrameLoader::StartPersistence(uint64_t aOuterWindowID,
new mozilla::WebBrowserPersistLocalDocument(foundDoc);
aRecv->OnDocumentReady(pdoc);
}
return NS_OK;
}
void

Просмотреть файл

@ -25,7 +25,6 @@
#include "mozilla/Attributes.h"
#include "nsStubMutationObserver.h"
#include "Units.h"
#include "nsIWebBrowserPersistable.h"
#include "nsIFrame.h"
#include "nsPluginTags.h"
@ -41,6 +40,7 @@ class nsIDocShellTreeOwner;
class nsILoadContext;
class nsIMessageSender;
class nsIPrintSettings;
class nsIWebBrowserPersistDocumentReceiver;
class nsIWebProgressListener;
namespace mozilla {
@ -76,8 +76,7 @@ typedef struct _GtkWidget GtkWidget;
{ 0x297fd0ea, 0x1b4a, 0x4c9a, \
{ 0xa4, 0x04, 0xe5, 0x8b, 0xe8, 0x95, 0x10, 0x50 } }
class nsFrameLoader final : public nsIWebBrowserPersistable,
public nsStubMutationObserver,
class nsFrameLoader final : public nsStubMutationObserver,
public mozilla::dom::ipc::MessageManagerCallback,
public nsWrapperCache
{
@ -96,10 +95,9 @@ public:
NS_DECLARE_STATIC_IID_ACCESSOR(NS_FRAMELOADER_IID)
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_AMBIGUOUS(nsFrameLoader,
nsIWebBrowserPersistable)
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(nsFrameLoader)
NS_DECL_NSIMUTATIONOBSERVER_ATTRIBUTECHANGED
NS_DECL_NSIWEBBROWSERPERSISTABLE
nsresult CheckForRecursiveLoad(nsIURI* aURI);
nsresult ReallyStartLoading();
void StartDestroy();
@ -511,7 +509,7 @@ NS_DEFINE_STATIC_IID_ACCESSOR(nsFrameLoader, NS_FRAMELOADER_IID)
inline nsISupports*
ToSupports(nsFrameLoader* aFrameLoader)
{
return static_cast<nsIWebBrowserPersistable*>(aFrameLoader);
return aFrameLoader;
}
#endif

Просмотреть файл

@ -136,8 +136,7 @@ NS_IMPL_ISUPPORTS(TabParent,
nsITabParent,
nsIAuthPromptProvider,
nsISecureBrowserUI,
nsISupportsWeakReference,
nsIWebBrowserPersistable)
nsISupportsWeakReference)
TabParent::TabParent(nsIContentParent* aManager,
const TabId& aTabId,
@ -3437,19 +3436,23 @@ TabParent::AsyncPanZoomEnabled() const
return widget && widget->AsyncPanZoomEnabled();
}
NS_IMETHODIMP
void
TabParent::StartPersistence(uint64_t aOuterWindowID,
nsIWebBrowserPersistDocumentReceiver* aRecv)
nsIWebBrowserPersistDocumentReceiver* aRecv,
ErrorResult& aRv)
{
nsCOMPtr<nsIContentParent> manager = Manager();
if (!manager->IsContentParent()) {
return NS_ERROR_UNEXPECTED;
aRv.Throw(NS_ERROR_UNEXPECTED);
return;
}
auto* actor = new WebBrowserPersistDocumentParent();
actor->SetOnReady(aRecv);
return manager->AsContentParent()
->SendPWebBrowserPersistDocumentConstructor(actor, this, aOuterWindowID)
? NS_OK : NS_ERROR_FAILURE;
bool ok = manager->AsContentParent()
->SendPWebBrowserPersistDocumentConstructor(actor, this, aOuterWindowID);
if (!ok) {
aRv.Throw(NS_ERROR_FAILURE);
}
// (The actor will be destroyed on constructor failure.)
}

Просмотреть файл

@ -27,7 +27,6 @@
#include "nsIKeyEventInPluginCallback.h"
#include "nsISecureBrowserUI.h"
#include "nsITabParent.h"
#include "nsIWebBrowserPersistable.h"
#include "nsIXULBrowserWindow.h"
#include "nsRefreshDriver.h"
#include "nsWeakReference.h"
@ -40,6 +39,7 @@ class nsIPrincipal;
class nsIURI;
class nsILoadContext;
class nsIDocShell;
class nsIWebBrowserPersistDocumentReceiver;
namespace mozilla {
@ -87,7 +87,6 @@ class TabParent final : public PBrowserParent
, public nsIKeyEventInPluginCallback
, public nsSupportsWeakReference
, public TabContext
, public nsIWebBrowserPersistable
, public LiveResizeListener
{
typedef mozilla::dom::ClonedMessageData ClonedMessageData;
@ -490,7 +489,10 @@ public:
NS_DECL_ISUPPORTS
NS_DECL_NSIAUTHPROMPTPROVIDER
NS_DECL_NSISECUREBROWSERUI
NS_DECL_NSIWEBBROWSERPERSISTABLE
void StartPersistence(uint64_t aOuterWindowID,
nsIWebBrowserPersistDocumentReceiver* aRecv,
ErrorResult& aRv);
bool HandleQueryContentEvent(mozilla::WidgetQueryContentEvent& aEvent);

Просмотреть файл

@ -329,7 +329,9 @@ ResourceReader::OnWalkSubframe(nsIDOMNode* aNode)
// Pass in 0 as the outer window ID so that we start
// persisting the root of this subframe, and not some other
// subframe child of this subframe.
nsresult rv = loader->StartPersistence(0, this);
ErrorResult err;
loader->StartPersistence(0, this, err);
nsresult rv = err.StealNSResult();
if (NS_FAILED(rv)) {
if (rv == NS_ERROR_NO_CONTENT) {
// Just ignore frames with no content document.

Просмотреть файл

@ -11,7 +11,6 @@ with Files("**"):
XPIDL_SOURCES += [
'nsCWebBrowserPersist.idl',
'nsIWebBrowserPersist.idl',
'nsIWebBrowserPersistable.idl',
'nsIWebBrowserPersistDocument.idl',
]

Просмотреть файл

@ -248,7 +248,7 @@ interface nsIWebBrowserPersist : nsICancelable
* specified by the encoding flags.
*
* @see nsIWebBrowserPersistDocument
* @see nsIWebBrowserPersistable
* @see WebBrowserPersistable
* @see nsIFile
* @see nsIURI
*

Просмотреть файл

@ -187,7 +187,10 @@ interface nsIWebBrowserPersistWriteCompletion : nsISupports
* Asynchronous callback for creating a persistable document from some
* other object.
*
* @see nsIWebBrowserPersistable.
* XXXbz This should really be changed to just return a promise that
* then gets resolved or rejected...
*
* @see WebBrowserPersistable in FrameLoader.webidl.
*/
[scriptable, uuid(321e3174-594f-4036-b7be-791b821bd376)]
interface nsIWebBrowserPersistDocumentReceiver : nsISupports

Просмотреть файл

@ -1,41 +0,0 @@
/* -*- Mode: IDL; 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/. */
#include "nsISupports.idl"
interface nsIWebBrowserPersistDocumentReceiver;
/**
* Interface for objects which represent a document that can be
* serialized with nsIWebBrowserPersist. This interface is
* asynchronous because the actual document can be in another process
* (e.g., if this object is an nsFrameLoader for an out-of-process
* frame).
*
* Warning: this is currently implemented only by nsFrameLoader, and
* may change in the future to become more frame-loader-specific or be
* merged into nsFrameLoader. See bug 1101100 comment #34.
*
* @see nsIWebBrowserPersistDocumentReceiver
* @see nsIWebBrowserPersistDocument
* @see nsIWebBrowserPersist
*
* @param aOuterWindowID
* The outer window ID of the subframe we'd like to persist.
* If set at 0, nsIWebBrowserPersistable will attempt to persist
* the top-level document. If the outer window ID is for a subframe
* that does not exist, or is not held beneath the nsIWebBrowserPersistable,
* aRecv's onError method will be called with NS_ERROR_NO_CONTENT.
* @param aRecv
* The nsIWebBrowserPersistDocumentReceiver is a callback that
* will be fired once the document is ready for persisting.
*/
[uuid(f4c3fa8e-83e9-49f8-ac6f-951fc7541fe4)]
interface nsIWebBrowserPersistable : nsISupports
{
void startPersistence(in unsigned long long aOuterWindowID,
in nsIWebBrowserPersistDocumentReceiver aRecv);
};

Просмотреть файл

@ -55,7 +55,6 @@
#include "nsIStringBundle.h"
#include "nsIProtocolHandler.h"
#include "nsIWebBrowserPersistable.h"
#include "nsWebBrowserPersist.h"
#include "WebBrowserPersistLocalDocument.h"

Просмотреть файл

@ -179,6 +179,29 @@ interface FrameLoader {
readonly attribute boolean isDead;
};
/**
* Interface for objects which represent a document that can be
* serialized with nsIWebBrowserPersist. This interface is
* asynchronous because the actual document can be in another process
* (e.g., if this object is a FrameLoader for an out-of-process
* frame).
*
* XXXbz This method should really just return a Promise...
*
* @see nsIWebBrowserPersistDocumentReceiver
* @see nsIWebBrowserPersistDocument
* @see nsIWebBrowserPersist
*
* @param aOuterWindowID
* The outer window ID of the subframe we'd like to persist.
* If set at 0, WebBrowserPersistable will attempt to persist
* the top-level document. If the outer window ID is for a subframe
* that does not exist, or is not held beneath the WebBrowserPersistable,
* aRecv's onError method will be called with NS_ERROR_NO_CONTENT.
* @param aRecv
* The nsIWebBrowserPersistDocumentReceiver is a callback that
* will be fired once the document is ready for persisting.
*/
[NoInterfaceObject]
interface WebBrowserPersistable
{

Просмотреть файл

@ -11,8 +11,7 @@ function one_test(delay, continuation) {
BrowserTestUtils.openNewForegroundTab(gBrowser, testPageURL).then((tab) => {
browser = tab.linkedBrowser;
let persistable = browser.QueryInterface(Ci.nsIFrameLoaderOwner)
.frameLoader
.QueryInterface(Ci.nsIWebBrowserPersistable);
.frameLoader;
persistable.startPersistence(/* outer window ID: */ 0, {
onDocumentReady,
onError(status) {

Просмотреть файл

@ -25,7 +25,6 @@
#include "nsIMessageManager.h"
#include "nsISelection.h"
#include "nsITreeBoxObject.h"
#include "nsIWebBrowserPersistable.h"
#include "mozilla/dom/CSSPrimitiveValueBinding.h"
#include "mozilla/dom/CSSStyleDeclarationBinding.h"
@ -39,7 +38,6 @@
#include "mozilla/dom/ElementBinding.h"
#include "mozilla/dom/EventBinding.h"
#include "mozilla/dom/EventTargetBinding.h"
#include "mozilla/dom/FrameLoaderBinding.h"
#include "mozilla/dom/HTMLAnchorElementBinding.h"
#include "mozilla/dom/HTMLAreaElementBinding.h"
#include "mozilla/dom/HTMLButtonElementBinding.h"
@ -138,7 +136,6 @@ const ComponentsInterfaceShimEntry kComponentsInterfaceShimMap[] =
DEFINE_SHIM_WITH_CUSTOM_INTERFACE(nsIDOMParser, DOMParser),
DEFINE_SHIM(Range),
DEFINE_SHIM_WITH_CUSTOM_INTERFACE(nsITreeBoxObject, TreeBoxObject),
DEFINE_SHIM_WITH_CUSTOM_INTERFACE(nsIWebBrowserPersistable, FrameLoader),
DEFINE_SHIM(XMLDocument),
DEFINE_SHIM_WITH_CUSTOM_INTERFACE(nsISelection, Selection),
};