Bug 1444143 part 13. Remove nsIFrameLoader. r=mystor

MozReview-Commit-ID: 4LG8nIePsMH
This commit is contained in:
Boris Zbarsky 2018-03-21 22:43:17 -04:00
Родитель e15f8f10ff
Коммит 35d4bc91ec
16 изменённых файлов: 38 добавлений и 76 удалений

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

@ -152,13 +152,12 @@ NS_IMPL_CYCLE_COLLECTING_RELEASE(nsFrameLoader)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsFrameLoader)
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
NS_INTERFACE_MAP_ENTRY(nsIFrameLoader)
if (aIID.Equals(NS_GET_IID(nsFrameLoader))) {
// We want to end up with a pointer that can then be reinterpret_cast
// from nsISupports* to nsFrameLoader* and end up with |this|.
foundInterface = reinterpret_cast<nsISupports*>(this);
} else
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIFrameLoader)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIWebBrowserPersistable)
NS_INTERFACE_MAP_ENTRY(nsIWebBrowserPersistable)
NS_INTERFACE_MAP_END
@ -979,7 +978,7 @@ nsFrameLoader::ShowRemoteFrame(const ScreenIntSize& size,
nsCOMPtr<nsIObserverService> os = services::GetObserverService();
if (os) {
os->NotifyObservers(NS_ISUPPORTS_CAST(nsIFrameLoader*, this),
os->NotifyObservers(ToSupports(this),
"remote-browser-shown", nullptr);
}
} else {
@ -2257,7 +2256,7 @@ nsFrameLoader::MaybeCreateDocShell()
nsCOMPtr<nsIObserverService> os = services::GetObserverService();
if (os) {
os->NotifyObservers(NS_ISUPPORTS_CAST(nsIFrameLoader*, this),
os->NotifyObservers(ToSupports(this),
"inprocess-browser-shown", nullptr);
}
@ -2785,17 +2784,16 @@ nsFrameLoader::ActivateFrameEvent(const nsAString& aType, bool aCapture, ErrorRe
}
nsresult
nsFrameLoader::CreateStaticClone(nsIFrameLoader* aDest)
nsFrameLoader::CreateStaticClone(nsFrameLoader* aDest)
{
nsFrameLoader* dest = static_cast<nsFrameLoader*>(aDest);
dest->MaybeCreateDocShell();
NS_ENSURE_STATE(dest->mDocShell);
aDest->MaybeCreateDocShell();
NS_ENSURE_STATE(aDest->mDocShell);
nsCOMPtr<nsIDocument> kungFuDeathGrip = dest->mDocShell->GetDocument();
nsCOMPtr<nsIDocument> kungFuDeathGrip = aDest->mDocShell->GetDocument();
Unused << kungFuDeathGrip;
nsCOMPtr<nsIContentViewer> viewer;
dest->mDocShell->GetContentViewer(getter_AddRefs(viewer));
aDest->mDocShell->GetContentViewer(getter_AddRefs(viewer));
NS_ENSURE_STATE(viewer);
nsIDocShell* origDocShell = GetDocShell(IgnoreErrors());
@ -2804,7 +2802,7 @@ nsFrameLoader::CreateStaticClone(nsIFrameLoader* aDest)
nsCOMPtr<nsIDocument> doc = origDocShell->GetDocument();
NS_ENSURE_STATE(doc);
nsCOMPtr<nsIDocument> clonedDoc = doc->CreateStaticClone(dest->mDocShell);
nsCOMPtr<nsIDocument> clonedDoc = doc->CreateStaticClone(aDest->mDocShell);
viewer->SetDocument(clonedDoc);
return NS_OK;

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

@ -38,6 +38,10 @@ class AutoResetInFrameSwap;
class nsITabParent;
class nsIDocShellTreeItem;
class nsIDocShellTreeOwner;
class nsILoadContext;
class nsIMessageSender;
class nsIPrintSettings;
class nsIWebProgressListener;
namespace mozilla {
@ -71,10 +75,7 @@ typedef struct _GtkWidget GtkWidget;
{ 0x297fd0ea, 0x1b4a, 0x4c9a, \
{ 0xa4, 0x04, 0xe5, 0x8b, 0xe8, 0x95, 0x10, 0x50 } }
// If nsIFrameLoader stops being the first interface we implement, fix
// our impl of QI to nsFrameLoader.
class nsFrameLoader final : public nsIFrameLoader,
public nsIWebBrowserPersistable,
class nsFrameLoader final : public nsIWebBrowserPersistable,
public nsStubMutationObserver,
public mozilla::dom::ipc::MessageManagerCallback,
public nsWrapperCache
@ -94,8 +95,8 @@ public:
NS_DECLARE_STATIC_IID_ACCESSOR(NS_FRAMELOADER_IID)
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_AMBIGUOUS(nsFrameLoader, nsIFrameLoader)
NS_DECL_NSIFRAMELOADER
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_AMBIGUOUS(nsFrameLoader,
nsIWebBrowserPersistable)
NS_DECL_NSIMUTATIONOBSERVER_ATTRIBUTECHANGED
NS_DECL_NSIWEBBROWSERPERSISTABLE
nsresult CheckForRecursiveLoad(nsIURI* aURI);
@ -105,7 +106,7 @@ public:
void DestroyComplete();
nsIDocShell* GetExistingDocShell() { return mDocShell; }
mozilla::dom::EventTarget* GetTabChildGlobalAsEventTarget();
nsresult CreateStaticClone(nsIFrameLoader* aDest);
nsresult CreateStaticClone(nsFrameLoader* aDest);
nsresult UpdatePositionAndSize(nsSubDocumentFrame *aIFrame);
// WebIDL methods
@ -246,8 +247,6 @@ public:
*/
void Hide();
nsresult CloneForStatic(nsIFrameLoader* aOriginal);
// The guts of an nsIFrameLoaderOwner::SwapFrameLoader implementation. A
// frame loader owner needs to call this, and pass in the two references to
// nsRefPtrs for frame loaders that need to be swapped.
@ -518,7 +517,7 @@ NS_DEFINE_STATIC_IID_ACCESSOR(nsFrameLoader, NS_FRAMELOADER_IID)
inline nsISupports*
ToSupports(nsFrameLoader* aFrameLoader)
{
return static_cast<nsIFrameLoader*>(aFrameLoader);
return static_cast<nsIWebBrowserPersistable*>(aFrameLoader);
}
#endif

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

@ -1030,7 +1030,7 @@ public:
nsresult
nsFrameMessageManager::ReceiveMessage(nsISupports* aTarget,
nsIFrameLoader* aTargetFrameLoader,
nsFrameLoader* aTargetFrameLoader,
const nsAString& aMessage,
bool aIsSync,
StructuredCloneData* aCloneData,
@ -1044,7 +1044,7 @@ nsFrameMessageManager::ReceiveMessage(nsISupports* aTarget,
nsresult
nsFrameMessageManager::ReceiveMessage(nsISupports* aTarget,
nsIFrameLoader* aTargetFrameLoader,
nsFrameLoader* aTargetFrameLoader,
bool aTargetClosed,
const nsAString& aMessage,
bool aIsSync,
@ -2190,7 +2190,7 @@ nsSameProcessAsyncMessageBase::Init(const nsAString& aMessage,
void
nsSameProcessAsyncMessageBase::ReceiveMessage(nsISupports* aTarget,
nsIFrameLoader* aTargetFrameLoader,
nsFrameLoader* aTargetFrameLoader,
nsFrameMessageManager* aManager)
{
// Make sure that we have called Init() and it has succeeded.

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

@ -34,7 +34,7 @@
#include "mozilla/dom/ipc/StructuredCloneData.h"
#include "mozilla/jsipc/CpowHolder.h"
class nsIFrameLoader;
class nsFrameLoader;
namespace mozilla {
namespace dom {
@ -265,7 +265,7 @@ public:
static mozilla::dom::ChromeMessageSender*
NewProcessMessageManager(bool aIsRemote);
nsresult ReceiveMessage(nsISupports* aTarget, nsIFrameLoader* aTargetFrameLoader,
nsresult ReceiveMessage(nsISupports* aTarget, nsFrameLoader* aTargetFrameLoader,
const nsAString& aMessage,
bool aIsSync, StructuredCloneData* aCloneData,
mozilla::jsipc::CpowHolder* aCpows, nsIPrincipal* aPrincipal,
@ -351,7 +351,7 @@ protected:
nsIPrincipal* aPrincipal, bool aIsSync,
nsTArray<JS::Value>& aResult, mozilla::ErrorResult& aError);
nsresult ReceiveMessage(nsISupports* aTarget, nsIFrameLoader* aTargetFrameLoader,
nsresult ReceiveMessage(nsISupports* aTarget, nsFrameLoader* aTargetFrameLoader,
bool aTargetClosed, const nsAString& aMessage,
bool aIsSync, StructuredCloneData* aCloneData,
mozilla::jsipc::CpowHolder* aCpows, nsIPrincipal* aPrincipal,
@ -438,7 +438,7 @@ public:
StructuredCloneData& aData,
nsIPrincipal* aPrincipal);
void ReceiveMessage(nsISupports* aTarget, nsIFrameLoader* aTargetFrameLoader,
void ReceiveMessage(nsISupports* aTarget, nsFrameLoader* aTargetFrameLoader,
nsFrameMessageManager* aManager);
private:
nsSameProcessAsyncMessageBase(const nsSameProcessAsyncMessageBase&);

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

@ -6,21 +6,6 @@
#include "nsISupports.idl"
interface nsFrameLoader;
interface nsIDocShell;
interface nsIURI;
interface nsIFrame;
interface nsIMessageSender;
interface nsIVariant;
interface nsIDOMElement;
interface nsITabParent;
interface nsILoadContext;
interface nsIPrintSettings;
interface nsIWebProgressListener;
[builtinclass, uuid(1645af04-1bc7-4363-8f2c-eb9679220ab1)]
interface nsIFrameLoader : nsISupports
{
};
%{C++
class nsFrameLoader;

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

@ -39,7 +39,7 @@ nsInProcessTabChildGlobal::DoSendBlockingMessage(JSContext* aCx,
if (mChromeMessageManager) {
SameProcessCpowHolder cpows(JS::RootingContext::get(aCx), aCpows);
RefPtr<nsFrameMessageManager> mm = mChromeMessageManager;
nsCOMPtr<nsIFrameLoader> fl = GetFrameLoader();
RefPtr<nsFrameLoader> fl = GetFrameLoader();
mm->ReceiveMessage(mOwner, fl, aMessage, true, &aData, &cpows, aPrincipal,
aRetVal);
}
@ -59,7 +59,7 @@ public:
virtual nsresult HandleMessage() override
{
nsCOMPtr<nsIFrameLoader> fl = mTabChild->GetFrameLoader();
RefPtr<nsFrameLoader> fl = mTabChild->GetFrameLoader();
ReceiveMessage(mTabChild->mOwner, fl, mTabChild->mChromeMessageManager);
return NS_OK;
}
@ -382,11 +382,11 @@ nsInProcessTabChildGlobal::LoadFrameScript(const nsAString& aURL, bool aRunInGlo
mLoadingScript = tmp;
}
already_AddRefed<nsIFrameLoader>
already_AddRefed<nsFrameLoader>
nsInProcessTabChildGlobal::GetFrameLoader()
{
nsCOMPtr<nsIFrameLoaderOwner> owner = do_QueryInterface(mOwner);
nsCOMPtr<nsIFrameLoader> fl = owner ? owner->GetFrameLoader() : nullptr;
RefPtr<nsFrameLoader> fl = owner ? owner->GetFrameLoader() : nullptr;
if (!fl) {
fl = mFrameLoader;
}

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

@ -121,7 +121,7 @@ public:
return GetWrapper();
}
already_AddRefed<nsIFrameLoader> GetFrameLoader();
already_AddRefed<nsFrameLoader> GetFrameLoader();
protected:
virtual ~nsInProcessTabChildGlobal();

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

@ -2572,8 +2572,7 @@ void
nsObjectLoadingContent::Traverse(nsObjectLoadingContent *tmp,
nsCycleCollectionTraversalCallback &cb)
{
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mFrameLoader");
cb.NoteXPCOMChild(static_cast<nsIFrameLoader*>(tmp->mFrameLoader));
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mFrameLoader);
}
void

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

@ -1719,7 +1719,6 @@ addExternalIface('LoadInfo', nativeType='nsILoadInfo',
headerFile='nsILoadInfo.h', notflattened=True)
addExternalIface('MenuBuilder', nativeType='nsIMenuBuilder', notflattened=True)
addExternalIface('XULControllers', nativeType='nsIControllers', notflattened=True)
addExternalIface('MozFrameLoader', nativeType='nsIFrameLoader', notflattened=True)
addExternalIface('MozObserver', nativeType='nsIObserver', notflattened=True)
addExternalIface('MozRDFCompositeDataSource', nativeType='nsIRDFCompositeDataSource',
notflattened=True)

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

@ -3,7 +3,6 @@
* 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/. */
interface MozFrameLoader;
interface nsIEventTarget;
interface Principal;
@ -44,7 +43,7 @@ dictionary ReceiveMessageArgument
*/
required Principal? principal;
MozFrameLoader targetFrameLoader;
FrameLoader targetFrameLoader;
};
callback interface MessageListener

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

@ -427,7 +427,7 @@ nsGenericHTMLFrameElement::CopyInnerTo(Element* aDest,
nsFrameLoader* fl = nsFrameLoader::Create(dest, nullptr, false);
NS_ENSURE_STATE(fl);
dest->mFrameLoader = fl;
static_cast<nsFrameLoader*>(mFrameLoader.get())->CreateStaticClone(fl);
mFrameLoader->CreateStaticClone(fl);
}
return rv;

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

@ -460,7 +460,7 @@ TabParent::ActorDestroy(ActorDestroyReason why)
frameLoader->DestroyComplete();
if (why == AbnormalShutdown && os) {
os->NotifyObservers(NS_ISUPPORTS_CAST(nsIFrameLoader*, frameLoader),
os->NotifyObservers(ToSupports(frameLoader),
"oop-frameloader-crashed", nullptr);
nsCOMPtr<nsIFrameLoaderOwner> owner = do_QueryInterface(frameElement);
if (owner) {
@ -2331,14 +2331,6 @@ TabParent::GetFrom(nsFrameLoader* aFrameLoader)
return static_cast<TabParent*>(remoteBrowser);
}
/*static*/ TabParent*
TabParent::GetFrom(nsIFrameLoader* aFrameLoader)
{
if (!aFrameLoader)
return nullptr;
return GetFrom(static_cast<nsFrameLoader*>(aFrameLoader));
}
/*static*/ TabParent*
TabParent::GetFrom(nsITabParent* aTabParent)
{

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

@ -35,7 +35,6 @@
#include "nsIWidget.h"
class nsFrameLoader;
class nsIFrameLoader;
class nsIContent;
class nsIPrincipal;
class nsIURI;
@ -502,8 +501,6 @@ public:
static TabParent* GetFrom(nsFrameLoader* aFrameLoader);
static TabParent* GetFrom(nsIFrameLoader* aFrameLoader);
static TabParent* GetFrom(nsITabParent* aTabParent);
static TabParent* GetFrom(PBrowserParent* aTabParent);

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

@ -1531,7 +1531,7 @@ nsXULElement::LoadSrc()
// Usually xul elements are used in chrome, which doesn't have
// session history at all.
frameLoader = nsFrameLoader::Create(this, opener, false);
slots->mFrameLoaderOrOpener = static_cast<nsIFrameLoader*>(frameLoader);
slots->mFrameLoaderOrOpener = ToSupports(frameLoader);
if (NS_WARN_IF(!frameLoader)) {
return;
}
@ -1551,8 +1551,8 @@ nsXULElement::GetFrameLoader()
if (!slots)
return nullptr;
nsCOMPtr<nsIFrameLoader> loader = do_QueryInterface(slots->mFrameLoaderOrOpener);
return already_AddRefed<nsFrameLoader>(static_cast<nsFrameLoader*>(loader.forget().take()));
RefPtr<nsFrameLoader> loader = do_QueryObject(slots->mFrameLoaderOrOpener);
return loader.forget();
}
void

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

@ -29,17 +29,13 @@
#include "nsStringFwd.h"
#include "nsStyledElement.h"
#include "nsIFrameLoader.h"
#include "nsFrameLoader.h" // Needed because we return an
// already_AddRefed<nsFrameLoader> where bindings
// want an already_AddRefed<nsIFrameLoader> and hence
// bindings need to know that the former can cast to
// the latter.
#include "mozilla/dom/DOMRect.h"
#include "mozilla/dom/Element.h"
#include "mozilla/dom/DOMString.h"
#include "mozilla/dom/FromParser.h"
class nsIDocument;
class nsFrameLoader;
class nsXULPrototypeDocument;
class nsIObjectInputStream;

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

@ -33,7 +33,6 @@
#include "nsIDOMUIEvent.h"
#include "nsIDOMXMLDocument.h"
#include "nsIDOMXULElement.h"
#include "nsIFrameLoader.h"
#include "nsIListBoxObject.h"
#include "nsIMessageManager.h"
#include "nsISelection.h"
@ -155,7 +154,6 @@ const ComponentsInterfaceShimEntry kComponentsInterfaceShimMap[] =
DEFINE_SHIM(Element),
DEFINE_SHIM(Event),
DEFINE_SHIM(EventTarget),
DEFINE_SHIM_WITH_CUSTOM_INTERFACE(nsIFrameLoader, FrameLoader),
DEFINE_SHIM_WITH_CUSTOM_INTERFACE(nsIDOMGeoPositionError, PositionError),
DEFINE_SHIM(HTMLInputElement),
DEFINE_SHIM_WITH_CUSTOM_INTERFACE(nsIListBoxObject, ListBoxObject),