Bug 1434399 part 11. Remove nsIDOMXULDocument::LoadOverlay. r=mystor

MozReview-Commit-ID: 4ad9AbkMcl0
This commit is contained in:
Boris Zbarsky 2018-01-31 14:49:28 -05:00
Родитель 2152c06e6d
Коммит 550b138859
4 изменённых файлов: 35 добавлений и 29 удалений

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

@ -13,22 +13,4 @@ interface nsIBoxObject;
[uuid(7790d4c3-e8f0-4e29-9887-d683ed2b2a44)]
interface nsIDOMXULDocument : nsIDOMDocument
{
/**
* Loads a XUL overlay and merges it with the current document, notifying an
* observer when the merge is complete.
* @param url
* The URL of the overlay to load and merge
* @param observer
* An object implementing nsIObserver that will be notified with a
* message of topic "xul-overlay-merged" when the merge is complete.
* The subject parameter of |observe| will QI to a nsIURI - the URI
* of the merged overlay. This parameter is optional and may be null.
*
* NOTICE: In the 2.0 timeframe this API will change such that the
* implementation will fire a DOMXULOverlayMerged event upon merge
* completion rather than notifying an observer. Do not rely on this
* API's behavior _not_ to change because it will!
* - Ben Goodger (8/23/2005)
*/
void loadOverlay(in DOMString url, in nsIObserver aObserver);
};

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

@ -52,6 +52,23 @@ interface XULDocument : Document {
[Throws]
BoxObject? getBoxObjectFor(Element? element);
/**
* Loads a XUL overlay and merges it with the current document, notifying an
* observer when the merge is complete.
* @param url
* The URL of the overlay to load and merge
* @param observer
* An object implementing nsIObserver that will be notified with a
* message of topic "xul-overlay-merged" when the merge is complete.
* The subject parameter of |observe| will QI to a nsIURI - the URI
* of the merged overlay. This parameter is optional and may be null.
*
* NOTICE: In the 2.0 timeframe this API will change such that the
* implementation will fire a DOMXULOverlayMerged event upon merge
* completion rather than notifying an observer. Do not rely on this
* API's behavior _not_ to change because it will!
* - Ben Goodger (8/23/2005)
*/
[Throws]
void loadOverlay(DOMString url, MozObserver? observer);
};

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

@ -2175,14 +2175,18 @@ XULDocument::AddChromeOverlays()
return rv;
}
NS_IMETHODIMP
XULDocument::LoadOverlay(const nsAString& aURL, nsIObserver* aObserver)
void
XULDocument::LoadOverlay(const nsAString& aURL, nsIObserver* aObserver,
ErrorResult& aRv)
{
nsresult rv;
nsCOMPtr<nsIURI> uri;
rv = NS_NewURI(getter_AddRefs(uri), aURL, nullptr);
if (NS_FAILED(rv)) return rv;
if (NS_FAILED(rv)) {
aRv.Throw(rv);
return;
}
if (aObserver) {
nsIObserver* obs = nullptr;
@ -2194,15 +2198,21 @@ XULDocument::LoadOverlay(const nsAString& aURL, nsIObserver* aObserver)
if (obs) {
// We don't support loading the same overlay twice into the same
// document - that doesn't make sense anyway.
return NS_ERROR_FAILURE;
aRv.Throw(NS_ERROR_FAILURE);
return;
}
mOverlayLoadObservers->Put(uri, aObserver);
}
bool shouldReturn, failureFromContent;
rv = LoadOverlayInternal(uri, true, &shouldReturn, &failureFromContent);
if (NS_FAILED(rv) && mOverlayLoadObservers)
mOverlayLoadObservers->Remove(uri); // remove the observer if LoadOverlayInternal generated an error
return rv;
if (NS_FAILED(rv)) {
// remove the observer if LoadOverlayInternal generated an error
if (mOverlayLoadObservers) {
mOverlayLoadObservers->Remove(uri);
}
aRv.Throw(rv);
return;
}
}
nsresult

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

@ -177,10 +177,7 @@ public:
ErrorResult& aRv);
using nsDocument::GetBoxObjectFor;
void LoadOverlay(const nsAString& aURL, nsIObserver* aObserver,
ErrorResult& aRv)
{
aRv = LoadOverlay(aURL, aObserver);
}
ErrorResult& aRv);
protected:
virtual ~XULDocument();