Bug 1524683 - Move all nsIFrameLoaderOwner references to nsFrameLoaderOwner; r=nika

Depends on D19728

Differential Revision: https://phabricator.services.mozilla.com/D19729

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Kyle Machulis 2019-02-15 22:20:53 +00:00
Родитель 623c5a81b8
Коммит 2bb286e58e
33 изменённых файлов: 111 добавлений и 124 удалений

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

@ -228,7 +228,7 @@ void InProcessTabChildMessageManager::GetEventTargetParent(
#ifdef DEBUG
if (mOwner) {
nsCOMPtr<nsIFrameLoaderOwner> owner = do_QueryInterface(mOwner);
RefPtr<nsFrameLoaderOwner> owner = do_QueryObject(mOwner);
RefPtr<nsFrameLoader> fl = owner->GetFrameLoader();
if (fl) {
NS_ASSERTION(this == fl->GetTabChildMessageManager(),
@ -293,7 +293,7 @@ void InProcessTabChildMessageManager::LoadFrameScript(const nsAString& aURL,
already_AddRefed<nsFrameLoader>
InProcessTabChildMessageManager::GetFrameLoader() {
nsCOMPtr<nsIFrameLoaderOwner> owner = do_QueryInterface(mOwner);
RefPtr<nsFrameLoaderOwner> owner = do_QueryObject(mOwner);
RefPtr<nsFrameLoader> fl = owner ? owner->GetFrameLoader() : nullptr;
if (!fl) {
fl = mFrameLoader;

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

@ -25,6 +25,7 @@
#include "nsNetUtil.h"
#include "nsIFile.h"
#include "nsFrameLoader.h"
#include "nsFrameLoaderOwner.h"
#include "nsIWebNavigation.h"
#include "nsIDocShell.h"
#include "nsIContent.h"
@ -53,6 +54,7 @@
#include "mozilla/dom/HTMLAnchorElement.h"
#include "mozilla/dom/Selection.h"
#include "nsVariant.h"
#include "nsQueryObject.h"
using namespace mozilla::dom;
using mozilla::IgnoreErrors;
@ -546,7 +548,7 @@ nsresult DragDataProducer::Produce(DataTransfer* aDataTransfer, bool* aCanDrag,
// In chrome shells, only allow dragging inside editable areas.
if (isChromeShell && !editingElement) {
nsCOMPtr<nsIFrameLoaderOwner> flo = do_QueryInterface(mTarget);
RefPtr<nsFrameLoaderOwner> flo = do_QueryObject(mTarget);
if (flo) {
RefPtr<nsFrameLoader> fl = flo->GetFrameLoader();
if (fl) {

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

@ -119,6 +119,7 @@
#include "nsDOMMutationObserver.h"
#include "nsError.h"
#include "nsFocusManager.h"
#include "nsFrameLoaderOwner.h"
#include "nsGenericHTMLElement.h"
#include "nsGenericHTMLFrameElement.h"
#include "nsGkAtoms.h"
@ -201,6 +202,7 @@
#include "nsPIDOMWindow.h"
#include "nsPresContext.h"
#include "nsPrintfCString.h"
#include "nsQueryObject.h"
#include "nsSandboxFlags.h"
#include "nsScriptSecurityManager.h"
#include "nsSerializationHelper.h"
@ -10423,7 +10425,7 @@ static Result<Ok, nsresult> ExtractExceptionValues(
/* static */ already_AddRefed<ContentFrameMessageManager>
nsContentUtils::TryGetTabChildGlobal(nsISupports* aFrom) {
nsCOMPtr<nsIFrameLoaderOwner> frameLoaderOwner = do_QueryInterface(aFrom);
RefPtr<nsFrameLoaderOwner> frameLoaderOwner = do_QueryObject(aFrom);
if (!frameLoaderOwner) {
return nullptr;
}

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

@ -35,6 +35,7 @@
#include "nsIScriptSecurityManager.h"
#include "nsIScrollable.h"
#include "nsFrameLoader.h"
#include "nsFrameLoaderOwner.h"
#include "nsIFrame.h"
#include "nsIScrollableFrame.h"
#include "nsSubDocumentFrame.h"
@ -904,8 +905,8 @@ void nsFrameLoader::ForceLayoutIfNecessary() {
}
nsresult nsFrameLoader::SwapWithOtherRemoteLoader(
nsFrameLoader* aOther, nsIFrameLoaderOwner* aThisOwner,
nsIFrameLoaderOwner* aOtherOwner) {
nsFrameLoader* aOther, nsFrameLoaderOwner* aThisOwner,
nsFrameLoaderOwner* aOtherOwner) {
MOZ_ASSERT(NS_IsMainThread());
#ifdef DEBUG
@ -1082,8 +1083,8 @@ nsresult nsFrameLoader::SwapWithOtherRemoteLoader(
// to ourselves to make sure we don't die while we overwrite our reference to
// ourself.
RefPtr<nsFrameLoader> kungFuDeathGrip(this);
aThisOwner->InternalSetFrameLoader(aOther);
aOtherOwner->InternalSetFrameLoader(kungFuDeathGrip);
aThisOwner->SetFrameLoader(aOther);
aOtherOwner->SetFrameLoader(kungFuDeathGrip);
ourFrameFrame->EndSwapDocShells(otherFrame);
@ -1165,8 +1166,8 @@ class MOZ_RAII AutoResetInFrameSwap final {
};
nsresult nsFrameLoader::SwapWithOtherLoader(nsFrameLoader* aOther,
nsIFrameLoaderOwner* aThisOwner,
nsIFrameLoaderOwner* aOtherOwner) {
nsFrameLoaderOwner* aThisOwner,
nsFrameLoaderOwner* aOtherOwner) {
#ifdef DEBUG
RefPtr<nsFrameLoader> first = aThisOwner->GetFrameLoader();
RefPtr<nsFrameLoader> second = aOtherOwner->GetFrameLoader();
@ -1488,8 +1489,8 @@ nsresult nsFrameLoader::SwapWithOtherLoader(nsFrameLoader* aOther,
// to ourselves to make sure we don't die while we overwrite our reference to
// ourself.
RefPtr<nsFrameLoader> kungFuDeathGrip(this);
aThisOwner->InternalSetFrameLoader(aOther);
aOtherOwner->InternalSetFrameLoader(kungFuDeathGrip);
aThisOwner->SetFrameLoader(aOther);
aOtherOwner->SetFrameLoader(kungFuDeathGrip);
// Drop any cached content viewers in the two session histories.
if (ourHistory) {

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

@ -14,7 +14,6 @@
#include "nsDocShell.h"
#include "nsStringFwd.h"
#include "nsIFrameLoaderOwner.h"
#include "nsPoint.h"
#include "nsSize.h"
#include "nsWrapperCache.h"
@ -35,6 +34,7 @@ class nsSubDocumentFrame;
class nsView;
class AutoResetInShow;
class AutoResetInFrameSwap;
class nsFrameLoaderOwner;
class nsITabParent;
class nsIDocShellTreeItem;
class nsIDocShellTreeOwner;
@ -245,16 +245,16 @@ class nsFrameLoader final : public nsStubMutationObserver,
// dimensions for the content area.
void ForceLayoutIfNecessary();
// The guts of an nsIFrameLoaderOwner::SwapFrameLoader implementation. A
// The guts of an nsFrameLoaderOwner::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.
nsresult SwapWithOtherLoader(nsFrameLoader* aOther,
nsIFrameLoaderOwner* aThisOwner,
nsIFrameLoaderOwner* aOtherOwner);
nsFrameLoaderOwner* aThisOwner,
nsFrameLoaderOwner* aOtherOwner);
nsresult SwapWithOtherRemoteLoader(nsFrameLoader* aOther,
nsIFrameLoaderOwner* aThisOwner,
nsIFrameLoaderOwner* aOtherOwner);
nsFrameLoaderOwner* aThisOwner,
nsFrameLoaderOwner* aOtherOwner);
/**
* Return the primary frame for our owning content, or null if it

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

@ -1073,25 +1073,11 @@ nsObjectLoadingContent::OnDataAvailable(nsIRequest* aRequest,
return NS_ERROR_UNEXPECTED;
}
// nsIFrameLoaderOwner
NS_IMETHODIMP_(already_AddRefed<nsFrameLoader>)
nsObjectLoadingContent::GetFrameLoader() {
RefPtr<nsFrameLoader> loader = mFrameLoader;
return loader.forget();
}
void nsObjectLoadingContent::PresetOpenerWindow(
const Nullable<WindowProxyHolder>& aOpenerWindow, ErrorResult& aRv) {
aRv.Throw(NS_ERROR_FAILURE);
}
void nsObjectLoadingContent::InternalSetFrameLoader(
nsFrameLoader* aNewFrameLoader) {
MOZ_CRASH(
"You shouldn't be calling this function, it doesn't make any sense on "
"this type.");
}
NS_IMETHODIMP
nsObjectLoadingContent::GetActualType(nsACString& aType) {
aType = mContentType;

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

@ -23,7 +23,7 @@
#include "nsIRunnable.h"
#include "nsIThreadInternal.h"
#include "nsIFrame.h"
#include "nsIFrameLoaderOwner.h"
#include "nsFrameLoaderOwner.h"
class nsAsyncInstantiateEvent;
class nsStopPluginRunnable;
@ -48,7 +48,7 @@ class XULFrameElement;
class nsObjectLoadingContent : public nsImageLoadingContent,
public nsIStreamListener,
public nsIFrameLoaderOwner,
public nsFrameLoaderOwner,
public nsIObjectLoadingContent,
public nsIChannelEventSink {
friend class AutoSetInstantiatingToFalse;
@ -116,7 +116,6 @@ class nsObjectLoadingContent : public nsImageLoadingContent,
NS_DECL_NSIREQUESTOBSERVER
NS_DECL_NSISTREAMLISTENER
NS_DECL_NSIFRAMELOADEROWNER
NS_DECL_NSIOBJECTLOADINGCONTENT
NS_DECL_NSICHANNELEVENTSINK
@ -610,9 +609,6 @@ class nsObjectLoadingContent : public nsImageLoadingContent,
// The final listener for mChannel (uriloader, pluginstreamlistener, etc.)
nsCOMPtr<nsIStreamListener> mFinalListener;
// Frame loader, for content documents we load.
RefPtr<nsFrameLoader> mFrameLoader;
// Track if we have a pending AsyncInstantiateEvent
nsCOMPtr<nsIRunnable> mPendingInstantiateEvent;

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

@ -21,7 +21,7 @@ NS_IMPL_CYCLE_COLLECTING_RELEASE(nsOpenURIInFrameParams)
nsOpenURIInFrameParams::nsOpenURIInFrameParams(
const mozilla::OriginAttributes& aOriginAttributes,
nsIFrameLoaderOwner* aOpener)
Element* aOpener)
: mOpenerOriginAttributes(aOriginAttributes),
mOpenerBrowser(aOpener),
mReferrerPolicy(mozilla::net::RP_Unset) {}
@ -74,9 +74,9 @@ nsOpenURIInFrameParams::SetTriggeringPrincipal(
return NS_OK;
}
NS_IMETHODIMP
nsOpenURIInFrameParams::GetOpenerBrowser(nsIFrameLoaderOwner** aOpenerBrowser) {
nsCOMPtr<nsIFrameLoaderOwner> owner = mOpenerBrowser;
nsresult
nsOpenURIInFrameParams::GetOpenerBrowser(Element** aOpenerBrowser) {
RefPtr<Element> owner = mOpenerBrowser;
owner.forget(aOpenerBrowser);
return NS_OK;
}

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

@ -7,7 +7,7 @@
#include "mozilla/BasePrincipal.h"
#include "nsCycleCollectionParticipant.h"
#include "nsIBrowserDOMWindow.h"
#include "nsIFrameLoaderOwner.h"
#include "nsFrameLoaderOwner.h"
#include "nsString.h"
namespace mozilla {
@ -22,13 +22,13 @@ class nsOpenURIInFrameParams final : public nsIOpenURIInFrameParams {
explicit nsOpenURIInFrameParams(
const mozilla::OriginAttributes& aOriginAttributes,
nsIFrameLoaderOwner* aOpener);
Element* aOpener);
private:
~nsOpenURIInFrameParams();
mozilla::OriginAttributes mOpenerOriginAttributes;
nsCOMPtr<nsIFrameLoaderOwner> mOpenerBrowser;
RefPtr<Element> mOpenerBrowser;
nsString mReferrer;
uint32_t mReferrerPolicy;
nsCOMPtr<nsIPrincipal> mTriggeringPrincipal;

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

@ -42,6 +42,7 @@
#include "nsIContentInlines.h"
#include "mozilla/dom/Document.h"
#include "nsIFrame.h"
#include "nsFrameLoaderOwner.h"
#include "nsITextControlElement.h"
#include "nsIWidget.h"
#include "nsPresContext.h"
@ -1343,7 +1344,7 @@ bool EventStateManager::HandleCrossProcessEvent(WidgetEvent* aEvent,
// then dispatch the event to the remote content they represent.
for (uint32_t i = 0; i < targets.Length(); ++i) {
nsIContent* target = targets[i];
nsCOMPtr<nsIFrameLoaderOwner> loaderOwner = do_QueryInterface(target);
RefPtr<nsFrameLoaderOwner> loaderOwner = do_QueryObject(target);
if (!loaderOwner) {
continue;
}

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

@ -54,7 +54,7 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_IMPL_ISUPPORTS_CYCLE_COLLECTION_INHERITED(
HTMLEmbedElement, nsGenericHTMLElement, nsIRequestObserver,
nsIStreamListener, nsIFrameLoaderOwner, nsIObjectLoadingContent,
nsIStreamListener, nsFrameLoaderOwner, nsIObjectLoadingContent,
imgINotificationObserver, nsIImageLoadingContent, nsIChannelEventSink)
NS_IMPL_ELEMENT_CLONE(HTMLEmbedElement)

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

@ -104,8 +104,6 @@ class HTMLEmbedElement final : public nsGenericHTMLElement,
*/
void StartObjectLoad(bool aNotify, bool aForceLoad);
NS_FORWARD_NSIFRAMELOADEROWNER(nsObjectLoadingContent::)
protected:
// Override for nsImageLoadingContent.
nsIContent* AsContent() override { return this; }

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

@ -90,8 +90,6 @@ class HTMLFrameElement final : public nsGenericHTMLFrameElement {
using nsGenericHTMLFrameElement::GetContentDocument;
using nsGenericHTMLFrameElement::GetContentWindow;
NS_FORWARD_NSIFRAMELOADEROWNER(nsGenericHTMLFrameElement::)
protected:
virtual ~HTMLFrameElement();

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

@ -87,7 +87,7 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_END
NS_IMPL_ISUPPORTS_CYCLE_COLLECTION_INHERITED(
HTMLObjectElement, nsGenericHTMLFormElement, imgINotificationObserver,
nsIRequestObserver, nsIStreamListener, nsIFrameLoaderOwner,
nsIRequestObserver, nsIStreamListener, nsFrameLoaderOwner,
nsIObjectLoadingContent, nsIImageLoadingContent, nsIChannelEventSink,
nsIConstraintValidation)

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

@ -186,8 +186,6 @@ class HTMLObjectElement final : public nsGenericHTMLFormElement,
*/
void StartObjectLoad(bool aNotify, bool aForceLoad);
NS_FORWARD_NSIFRAMELOADEROWNER(nsObjectLoadingContent::)
protected:
// Override for nsImageLoadingContent.
nsIContent* AsContent() override { return this; }

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

@ -42,7 +42,7 @@ class nsBrowserElement {
already_AddRefed<dom::Promise> GetCanGoForward(ErrorResult& aRv);
protected:
NS_IMETHOD_(already_AddRefed<nsFrameLoader>) GetFrameLoader() = 0;
virtual already_AddRefed<nsFrameLoader> GetFrameLoader() = 0;
void InitBrowserElementAPI();
void DestroyBrowserElementFrameScripts();

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

@ -49,7 +49,7 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(nsGenericHTMLFrameElement,
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
NS_IMPL_ISUPPORTS_CYCLE_COLLECTION_INHERITED(
nsGenericHTMLFrameElement, nsGenericHTMLElement, nsIFrameLoaderOwner,
nsGenericHTMLFrameElement, nsGenericHTMLElement, nsFrameLoaderOwner,
nsIDOMMozBrowserFrame, nsIMozBrowserFrame, nsGenericHTMLFrameElement)
NS_IMETHODIMP
@ -155,12 +155,6 @@ nsresult nsGenericHTMLFrameElement::CreateRemoteFrameLoader(
return NS_OK;
}
NS_IMETHODIMP_(already_AddRefed<nsFrameLoader>)
nsGenericHTMLFrameElement::GetFrameLoader() {
RefPtr<nsFrameLoader> loader = mFrameLoader;
return loader.forget();
}
void nsGenericHTMLFrameElement::PresetOpenerWindow(
const Nullable<WindowProxyHolder>& aOpenerWindow, ErrorResult& aRv) {
MOZ_ASSERT(!mFrameLoader);
@ -168,11 +162,6 @@ void nsGenericHTMLFrameElement::PresetOpenerWindow(
aOpenerWindow.IsNull() ? nullptr : aOpenerWindow.Value().get();
}
void nsGenericHTMLFrameElement::InternalSetFrameLoader(
nsFrameLoader* aNewFrameLoader) {
mFrameLoader = aNewFrameLoader;
}
void nsGenericHTMLFrameElement::SwapFrameLoaders(
HTMLIFrameElement& aOtherLoaderOwner, ErrorResult& rv) {
if (&aOtherLoaderOwner == this) {
@ -189,7 +178,7 @@ void nsGenericHTMLFrameElement::SwapFrameLoaders(
}
void nsGenericHTMLFrameElement::SwapFrameLoaders(
nsIFrameLoaderOwner* aOtherLoaderOwner, mozilla::ErrorResult& rv) {
nsFrameLoaderOwner* aOtherLoaderOwner, mozilla::ErrorResult& rv) {
RefPtr<nsFrameLoader> loader = GetFrameLoader();
RefPtr<nsFrameLoader> otherLoader = aOtherLoaderOwner->GetFrameLoader();
if (!loader || !otherLoader) {

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

@ -12,9 +12,9 @@
#include "mozilla/dom/nsBrowserElement.h"
#include "nsFrameLoader.h"
#include "nsFrameLoaderOwner.h"
#include "nsGenericHTMLElement.h"
#include "nsIDOMEventListener.h"
#include "nsIFrameLoaderOwner.h"
#include "nsIMozBrowserFrame.h"
namespace mozilla {
@ -37,7 +37,7 @@ class XULFrameElement;
* A helper class for frame elements
*/
class nsGenericHTMLFrameElement : public nsGenericHTMLElement,
public nsIFrameLoaderOwner,
public nsFrameLoaderOwner,
public mozilla::nsBrowserElement,
public nsIMozBrowserFrame {
public:
@ -54,7 +54,6 @@ class nsGenericHTMLFrameElement : public nsGenericHTMLElement,
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_NSIFRAMELOADEROWNER
NS_DECL_NSIDOMMOZBROWSERFRAME
NS_DECL_NSIMOZBROWSERFRAME
@ -84,7 +83,7 @@ class nsGenericHTMLFrameElement : public nsGenericHTMLElement,
void SwapFrameLoaders(mozilla::dom::XULFrameElement& aOtherLoaderOwner,
mozilla::ErrorResult& aError);
void SwapFrameLoaders(nsIFrameLoaderOwner* aOtherLoaderOwner,
void SwapFrameLoaders(nsFrameLoaderOwner* aOtherLoaderOwner,
mozilla::ErrorResult& rv);
void PresetOpenerWindow(const mozilla::dom::Nullable<
@ -108,6 +107,10 @@ class nsGenericHTMLFrameElement : public nsGenericHTMLElement,
return mSrcTriggeringPrincipal;
}
// Needed for nsBrowserElement
already_AddRefed<nsFrameLoader> GetFrameLoader() override {
return nsFrameLoaderOwner::GetFrameLoader();
}
protected:
virtual ~nsGenericHTMLFrameElement();
@ -127,7 +130,6 @@ class nsGenericHTMLFrameElement : public nsGenericHTMLElement,
const nsAttrValueOrString& aValue,
bool aNotify) override;
RefPtr<nsFrameLoader> mFrameLoader;
RefPtr<mozilla::dom::BrowsingContext> mOpenerWindow;
nsCOMPtr<nsIPrincipal> mSrcTriggeringPrincipal;

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

@ -8,8 +8,8 @@
interface mozIDOMWindowProxy;
interface nsIDOMWindow;
interface nsIURI;
interface nsIFrameLoaderOwner;
interface nsIPrincipal;
webidl Element;
[scriptable, uuid(e774db14-79ac-4156-a7a3-aa3fd0a22c10)]
interface nsIOpenURIInFrameParams : nsISupports
@ -21,7 +21,7 @@ interface nsIOpenURIInFrameParams : nsISupports
// The browser or frame element in the parent process which holds the
// opener window in the content process. May be null.
readonly attribute nsIFrameLoaderOwner openerBrowser;
readonly attribute Element openerBrowser;
[implicit_jscontext]
readonly attribute jsval openerOriginAttributes;
@ -113,14 +113,15 @@ interface nsIBrowserDOMWindow : nsISupports
in nsIPrincipal aTriggeringPrincipal);
/**
* As above, but return the nsIFrameLoaderOwner for the new window.
* As above, but return the nsFrameLoaderOwner for the new window. Value is
* returned as Element, QI'd back to nsFrameLoaderOwner as needed.
*
* Additional Parameters:
* @param aNextTabParentId The TabParent to associate the window with.
* @param aName The name to give the window opened in the new tab.
* @return The nsIFrameLoaderOwner for the newly opened window.
* @return The frame element for the newly opened window.
*/
nsIFrameLoaderOwner
Element
createContentWindowInFrame(in nsIURI aURI, in nsIOpenURIInFrameParams params,
in short aWhere, in long aFlags,
in unsigned long long aNextTabParentId,
@ -144,16 +145,17 @@ interface nsIBrowserDOMWindow : nsISupports
in short aWhere, in long aFlags, in nsIPrincipal aTriggeringPrincipal);
/**
* As above, but return the nsIFrameLoaderOwner for the new window.
* As above, but return the nsFrameLoaderOwner for the new window. Value is
* returned as Element, QI'd back to nsFrameLoaderOwner as needed.
*
* Additional Parameters:
* @param aNextTabParentId The TabParent to associate the window with.
* @param aName The name to give the window opened in the new tab.
* @return The nsIFrameLoaderOwner for the newly opened window.
* @return The frame element for the newly opened window.
// XXXbz is this the right API?
// See bug 537428
*/
nsIFrameLoaderOwner
Element
openURIInFrame(in nsIURI aURI, in nsIOpenURIInFrameParams params,
in short aWhere, in long aFlags,
in unsigned long long aNextTabParentId,

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

@ -178,6 +178,7 @@
#include "mozilla/dom/nsMixedContentBlocker.h"
#include "nsMemoryInfoDumper.h"
#include "nsMemoryReporterManager.h"
#include "nsQueryObject.h"
#include "nsScriptError.h"
#include "nsServiceManagerUtils.h"
#include "nsStyleSheetService.h"
@ -4680,25 +4681,27 @@ mozilla::ipc::IPCResult ContentParent::CommonCreateWindow(
return IPC_OK();
}
nsCOMPtr<nsIFrameLoaderOwner> opener = do_QueryInterface(frame);
RefPtr<Element> openerElement = do_QueryObject(frame);
nsCOMPtr<nsIOpenURIInFrameParams> params =
new nsOpenURIInFrameParams(openerOriginAttributes, opener);
new nsOpenURIInFrameParams(openerOriginAttributes, openerElement);
params->SetReferrer(NS_ConvertUTF8toUTF16(aBaseURI));
MOZ_ASSERT(aTriggeringPrincipal, "need a valid triggeringPrincipal");
params->SetTriggeringPrincipal(aTriggeringPrincipal);
params->SetReferrerPolicy(aReferrerPolicy);
nsCOMPtr<nsIFrameLoaderOwner> frameLoaderOwner;
RefPtr<Element> el;
if (aLoadURI) {
aResult = browserDOMWin->OpenURIInFrame(
aURIToLoad, params, aOpenLocation, nsIBrowserDOMWindow::OPEN_NEW,
aNextTabParentId, aName, getter_AddRefs(frameLoaderOwner));
aNextTabParentId, aName, getter_AddRefs(el));
} else {
aResult = browserDOMWin->CreateContentWindowInFrame(
aURIToLoad, params, aOpenLocation, nsIBrowserDOMWindow::OPEN_NEW,
aNextTabParentId, aName, getter_AddRefs(frameLoaderOwner));
aNextTabParentId, aName, getter_AddRefs(el));
}
RefPtr<nsFrameLoaderOwner> frameLoaderOwner = do_QueryObject(el);
if (NS_SUCCEEDED(aResult) && frameLoaderOwner) {
RefPtr<nsFrameLoader> frameLoader = frameLoaderOwner->GetFrameLoader();
if (frameLoader) {
@ -4752,8 +4755,8 @@ mozilla::ipc::IPCResult ContentParent::CommonCreateWindow(
nsCOMPtr<Element> frameElement =
TabParent::GetFrom(aNewTabParent)->GetOwnerElement();
MOZ_ASSERT(frameElement);
nsCOMPtr<nsIFrameLoaderOwner> frameLoaderOwner =
do_QueryInterface(frameElement);
RefPtr<nsFrameLoaderOwner> frameLoaderOwner =
do_QueryObject(frameElement);
MOZ_ASSERT(frameLoaderOwner);
RefPtr<nsFrameLoader> frameLoader = frameLoaderOwner->GetFrameLoader();
MOZ_ASSERT(frameLoader);

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

@ -49,6 +49,7 @@
#include "nsDebug.h"
#include "nsFocusManager.h"
#include "nsFrameLoader.h"
#include "nsFrameLoaderOwner.h"
#include "nsFrameManager.h"
#include "nsIBaseWindow.h"
#include "nsIBrowser.h"
@ -76,6 +77,7 @@
#endif
#include "nsPIDOMWindow.h"
#include "nsPrintfCString.h"
#include "nsQueryObject.h"
#include "nsServiceManagerUtils.h"
#include "nsThreadUtils.h"
#include "PermissionMessageUtils.h"
@ -455,7 +457,7 @@ void TabParent::ActorDestroy(ActorDestroyReason why) {
if (why == AbnormalShutdown && os) {
os->NotifyObservers(ToSupports(frameLoader), "oop-frameloader-crashed",
nullptr);
nsCOMPtr<nsIFrameLoaderOwner> owner = do_QueryInterface(frameElement);
RefPtr<nsFrameLoaderOwner> owner = do_QueryObject(frameElement);
if (owner) {
RefPtr<nsFrameLoader> currentFrameLoader = owner->GetFrameLoader();
// It's possible that the frameloader owner has already moved on
@ -1741,10 +1743,17 @@ mozilla::ipc::IPCResult TabParent::RecvShowTooltip(const uint32_t& aX,
return IPC_OK();
}
nsCOMPtr<nsIFrameLoaderOwner> frame = do_QueryInterface(mFrameElement);
if (!frame) return IPC_OK();
// ShowTooltip will end up accessing XULElement properties in JS (specifically
// BoxObject). However, to get it to JS, we need to make sure we're a
// nsFrameLoaderOwner, which implies we're a XULFrameElement. We can then
// safely pass Element into JS.
RefPtr<nsFrameLoaderOwner> flo = do_QueryObject(mFrameElement);
if (!flo) return IPC_OK();
xulBrowserWindow->ShowTooltip(aX, aY, aTooltip, aDirection, frame);
nsCOMPtr<Element> el = do_QueryInterface(flo);
if (!el) return IPC_OK();
xulBrowserWindow->ShowTooltip(aX, aY, aTooltip, aDirection, el);
return IPC_OK();
}
@ -2247,7 +2256,7 @@ bool TabParent::SendPasteTransferable(
}
/*static*/ TabParent* TabParent::GetFrom(nsIContent* aContent) {
nsCOMPtr<nsIFrameLoaderOwner> loaderOwner = do_QueryInterface(aContent);
RefPtr<nsFrameLoaderOwner> loaderOwner = do_QueryObject(aContent);
if (!loaderOwner) {
return nullptr;
}
@ -2459,8 +2468,8 @@ already_AddRefed<nsFrameLoader> TabParent::GetFrameLoader(
RefPtr<nsFrameLoader> fl = mFrameLoader;
return fl.forget();
}
nsCOMPtr<nsIFrameLoaderOwner> frameLoaderOwner =
do_QueryInterface(mFrameElement);
RefPtr<nsFrameLoaderOwner> frameLoaderOwner =
do_QueryObject(mFrameElement);
return frameLoaderOwner ? frameLoaderOwner->GetFrameLoader() : nullptr;
}

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

@ -12,6 +12,7 @@
#include "mozJSComponentLoader.h"
#include "nsContentUtils.h"
#include "nsError.h"
#include "nsQueryObject.h"
#include "mozilla/dom/JSWindowActorBinding.h"
#include "mozilla/dom/JSWindowActorParent.h"
@ -97,7 +98,7 @@ void WindowGlobalParent::Init(const WindowGlobalInit& aInit) {
// Extract the nsFrameLoader from the current frame element. We may not have a
// nsFrameLoader if we are a chrome document.
nsCOMPtr<nsIFrameLoaderOwner> flOwner = do_QueryInterface(frameElement);
RefPtr<nsFrameLoaderOwner> flOwner = do_QueryObject(frameElement);
if (flOwner) {
mFrameLoader = flOwner->GetFrameLoader();
}

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

@ -14,11 +14,13 @@
#include "nsGlobalWindow.h"
#include "nsIDocShell.h"
#include "nsFrameLoader.h"
#include "nsFrameLoaderOwner.h"
#include "nsIMutableArray.h"
#include "nsINetAddr.h"
#include "nsISocketTransport.h"
#include "nsISupportsPrimitives.h"
#include "nsNetCID.h"
#include "nsQueryObject.h"
#include "nsServiceManagerUtils.h"
#include "nsThreadUtils.h"
#include "PresentationLog.h"
@ -1489,7 +1491,7 @@ void PresentationPresentingInfo::ResolvedCallback(
return;
}
nsCOMPtr<nsIFrameLoaderOwner> owner = do_QueryInterface(frame);
RefPtr<nsFrameLoaderOwner> owner = do_QueryObject(frame);
if (NS_WARN_IF(!owner)) {
ReplyError(NS_ERROR_DOM_OPERATION_ERR);
return;

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

@ -45,6 +45,7 @@
#include "nsIWebNavigation.h"
#include "nsIWebPageDescriptor.h"
#include "nsNetUtil.h"
#include "nsQueryObject.h"
namespace mozilla {
@ -283,7 +284,7 @@ void ResourceReader::DocumentDone(nsresult aStatus) {
}
nsresult ResourceReader::OnWalkSubframe(nsINode* aNode) {
nsCOMPtr<nsIFrameLoaderOwner> loaderOwner = do_QueryInterface(aNode);
RefPtr<nsFrameLoaderOwner> loaderOwner = do_QueryObject(aNode);
NS_ENSURE_STATE(loaderOwner);
RefPtr<nsFrameLoader> loader = loaderOwner->GetFrameLoader();
NS_ENSURE_STATE(loader);

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

@ -1,4 +1,9 @@
// And the things from nsIFrameLoaderOwner
/* -*- Mode: IDL; tab-width: 2; 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/.
*/
[NoInterfaceObject]
interface MozFrameLoaderOwner {
[ChromeOnly]

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

@ -31,7 +31,7 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(XULFrameElement, nsXULElement)
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
NS_IMPL_ISUPPORTS_CYCLE_COLLECTION_INHERITED(XULFrameElement, nsXULElement,
nsIFrameLoaderOwner)
nsFrameLoaderOwner)
JSObject* XULFrameElement::WrapNode(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto) {
@ -121,7 +121,7 @@ void XULFrameElement::SwapFrameLoaders(XULFrameElement& aOtherLoaderOwner,
aOtherLoaderOwner.SwapFrameLoaders(this, rv);
}
void XULFrameElement::SwapFrameLoaders(nsIFrameLoaderOwner* aOtherLoaderOwner,
void XULFrameElement::SwapFrameLoaders(nsFrameLoaderOwner* aOtherLoaderOwner,
mozilla::ErrorResult& rv) {
RefPtr<nsFrameLoader> loader = GetFrameLoader();
RefPtr<nsFrameLoader> otherLoader = aOtherLoaderOwner->GetFrameLoader();

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

@ -16,6 +16,7 @@
#include "nsWrapperCache.h"
#include "nsString.h"
#include "nsXULElement.h"
#include "nsFrameLoaderOwner.h"
class nsIWebNavigation;
class nsFrameLoader;
@ -25,7 +26,7 @@ namespace dom {
class BrowsingContext;
class XULFrameElement final : public nsXULElement, public nsIFrameLoaderOwner {
class XULFrameElement final : public nsXULElement, public nsFrameLoaderOwner {
public:
explicit XULFrameElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
: nsXULElement(std::move(aNodeInfo)) {}
@ -39,16 +40,6 @@ class XULFrameElement final : public nsXULElement, public nsIFrameLoaderOwner {
Nullable<WindowProxyHolder> GetContentWindow();
Document* GetContentDocument();
// nsIFrameLoaderOwner / MozFrameLoaderOwner
NS_IMETHOD_(already_AddRefed<nsFrameLoader>) GetFrameLoader() override {
return do_AddRef(mFrameLoader);
}
NS_IMETHOD_(void)
InternalSetFrameLoader(nsFrameLoader* aFrameLoader) override {
mFrameLoader = aFrameLoader;
}
void PresetOpenerWindow(const Nullable<WindowProxyHolder>& aWindow,
ErrorResult& aRv) {
mOpener = aWindow.IsNull() ? nullptr : aWindow.Value().get();
@ -58,7 +49,7 @@ class XULFrameElement final : public nsXULElement, public nsIFrameLoaderOwner {
mozilla::ErrorResult& rv);
void SwapFrameLoaders(XULFrameElement& aOtherLoaderOwner,
mozilla::ErrorResult& rv);
void SwapFrameLoaders(nsIFrameLoaderOwner* aOtherLoaderOwner,
void SwapFrameLoaders(nsFrameLoaderOwner* aOtherLoaderOwner,
mozilla::ErrorResult& rv);
// nsIContent
@ -76,7 +67,6 @@ class XULFrameElement final : public nsXULElement, public nsIFrameLoaderOwner {
protected:
virtual ~XULFrameElement() {}
RefPtr<nsFrameLoader> mFrameLoader;
RefPtr<BrowsingContext> mOpener;
JSObject* WrapNode(JSContext* aCx,

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

@ -41,6 +41,7 @@
#include "nsContentUtils.h"
#include "nsIPermissionManager.h"
#include "nsServiceManagerUtils.h"
#include "nsQueryObject.h"
#include "mozilla/Preferences.h"
#include "mozilla/dom/HTMLFrameElement.h"
#include "RetainedDisplayListBuilder.h"
@ -987,7 +988,7 @@ nsFrameLoader* nsSubDocumentFrame::FrameLoader() const {
if (!content) return nullptr;
if (!mFrameLoader) {
nsCOMPtr<nsIFrameLoaderOwner> loaderOwner = do_QueryInterface(content);
RefPtr<nsFrameLoaderOwner> loaderOwner = do_QueryObject(content);
if (loaderOwner) {
mFrameLoader = loaderOwner->GetFrameLoader();
}

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

@ -16,10 +16,10 @@
#include "mozilla/NullPrincipal.h"
#include "mozIThirdPartyUtil.h"
#include "nsFrameLoader.h"
#include "nsFrameLoaderOwner.h"
#include "nsIContentSecurityPolicy.h"
#include "nsIDocShell.h"
#include "mozilla/dom/Document.h"
#include "nsIFrameLoaderOwner.h"
#include "nsIInterfaceRequestorUtils.h"
#include "nsISupportsImpl.h"
#include "nsISupportsUtils.h"
@ -28,6 +28,7 @@
#include "nsDocShell.h"
#include "nsGlobalWindow.h"
#include "nsMixedContentBlocker.h"
#include "nsQueryObject.h"
#include "nsRedirectHistoryEntry.h"
#include "nsSandboxFlags.h"
#include "LoadInfo.h"
@ -222,8 +223,8 @@ LoadInfo::LoadInfo(
// must be coming from an object (such as a plugin) that's loaded into it
// instead of a document being loaded. In that case, treat this object like
// any other non-document-loading element.
nsCOMPtr<nsIFrameLoaderOwner> frameLoaderOwner =
do_QueryInterface(aLoadingContext);
RefPtr<nsFrameLoaderOwner> frameLoaderOwner =
do_QueryObject(aLoadingContext);
RefPtr<nsFrameLoader> fl =
frameLoaderOwner ? frameLoaderOwner->GetFrameLoader() : nullptr;
if (fl) {

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

@ -620,7 +620,7 @@ interface nsILoadInfo : nsISupports
/**
* Only when the element being loaded is <frame src="foo.html">
* (or, more generally, if the element QIs to nsIFrameLoaderOwner),
* (or, more generally, if the element QIs to nsFrameLoaderOwner),
* the frameOuterWindowID is the outer window containing the
* foo.html document.
*

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

@ -1882,6 +1882,6 @@ class MozBrowser extends MozElementMixin(XULFrameElement) {
}
}
MozXULElement.implementCustomInterface(MozBrowser, [Ci.nsIBrowser, Ci.nsIFrameLoaderOwner]);
MozXULElement.implementCustomInterface(MozBrowser, [Ci.nsIBrowser]);
customElements.define("browser", MozBrowser);
}

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

@ -15,6 +15,7 @@
#include "nsCOMPtr.h"
#include "nsIInterfaceRequestorUtils.h"
#include "nsIFrame.h"
#include "nsFrameLoaderOwner.h"
#include "mozilla/dom/Document.h"
#include "nsIContent.h"
#include "nsIPresShell.h"
@ -540,7 +541,7 @@ nsresult nsBaseDragService::DrawDrag(nsINode* aDOMNode,
*aPresContext = presShell->GetPresContext();
nsCOMPtr<nsIFrameLoaderOwner> flo = do_QueryInterface(dragNode);
RefPtr<nsFrameLoaderOwner> flo = do_QueryObject(dragNode);
if (flo) {
RefPtr<nsFrameLoader> fl = flo->GetFrameLoader();
if (fl) {

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

@ -11,11 +11,9 @@ interface nsIBrowser;
interface nsIRequest;
interface nsIInputStream;
interface nsIDocShell;
interface nsIFrameLoaderOwner;
interface nsITabParent;
interface nsIPrincipal;
interface mozIDOMWindowProxy;
webidl Element;
webidl Node;
@ -73,7 +71,7 @@ interface nsIXULBrowserWindow : nsISupports
* Show/hide a tooltip (when the user mouses over a link, say).
*/
void showTooltip(in long x, in long y, in AString tooltip, in AString direction,
in nsIFrameLoaderOwner browser);
in Element browser);
void hideTooltip();
/**