From 133e16ecf443246d00918c3185c9113dc2d12a78 Mon Sep 17 00:00:00 2001 From: Brendan Dahl Date: Wed, 28 Mar 2018 18:20:04 -0700 Subject: [PATCH] Bug 1449791 - Remove platform support of overlays. r=bz The following was removed: - the main meat of the overlays and interface in XULDocument - all overlay observers and forward references - the notion of a master document - XUL overlay provider - manifest parsing of overlay attribute - references to "overlay" atom - restrictions on persistence (only need because of overlays) - unused code that the above referenced I also attempted to update comments that referenced overlays, but there is still some work to be done here. MozReview-Commit-ID: 8lrirzcgSuJ --HG-- extra : rebase_source : 25b4e1d3fb2af6f02d894887271fd345c9c2083b --- chrome/nsChromeRegistry.cpp | 3 - chrome/nsChromeRegistry.h | 9 - chrome/nsChromeRegistryChrome.cpp | 76 -- chrome/nsChromeRegistryChrome.h | 41 - chrome/nsChromeRegistryContent.cpp | 14 - chrome/nsChromeRegistryContent.h | 4 - .../checkout/deqp/temp_externs/gecko_dom.js | 1 - dom/webidl/XULDocument.webidl | 20 - dom/xul/XULDocument.cpp | 1190 +---------------- dom/xul/XULDocument.h | 124 -- dom/xul/XULFrameElement.cpp | 4 +- dom/xul/moz.build | 4 - dom/xul/nsIXULOverlayProvider.idl | 26 - dom/xul/nsXULContentSink.cpp | 7 - dom/xul/nsXULElement.cpp | 3 +- xpcom/build/Services.py | 3 - xpcom/components/ManifestParser.cpp | 4 - 17 files changed, 62 insertions(+), 1471 deletions(-) delete mode 100644 dom/xul/nsIXULOverlayProvider.idl diff --git a/chrome/nsChromeRegistry.cpp b/chrome/nsChromeRegistry.cpp index 0dd803771cfc..5850c011aafb 100644 --- a/chrome/nsChromeRegistry.cpp +++ b/chrome/nsChromeRegistry.cpp @@ -108,9 +108,6 @@ NS_INTERFACE_MAP_BEGIN(nsChromeRegistry) NS_INTERFACE_MAP_ENTRY(nsIChromeRegistry) NS_INTERFACE_MAP_ENTRY(nsIXULChromeRegistry) NS_INTERFACE_MAP_ENTRY(nsIToolkitChromeRegistry) -#ifdef MOZ_XUL - NS_INTERFACE_MAP_ENTRY(nsIXULOverlayProvider) -#endif NS_INTERFACE_MAP_ENTRY(nsIObserver) NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference) NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIChromeRegistry) diff --git a/chrome/nsChromeRegistry.h b/chrome/nsChromeRegistry.h index 4aeecd8a2e89..9d70d3678509 100644 --- a/chrome/nsChromeRegistry.h +++ b/chrome/nsChromeRegistry.h @@ -10,10 +10,6 @@ #include "nsIObserver.h" #include "nsWeakReference.h" -#ifdef MOZ_XUL -#include "nsIXULOverlayProvider.h" -#endif - #include "nsString.h" #include "nsURIHashKey.h" #include "nsInterfaceHashtable.h" @@ -36,9 +32,6 @@ class nsIURL; { 0x47049e42, 0x1d87, 0x482a, { 0x98, 0x4d, 0x56, 0xae, 0x18, 0x5e, 0x36, 0x7a } } class nsChromeRegistry : public nsIToolkitChromeRegistry, -#ifdef MOZ_XUL - public nsIXULOverlayProvider, -#endif public nsIObserver, public nsSupportsWeakReference { @@ -128,8 +121,6 @@ public: char *const * argv, int flags) = 0; virtual void ManifestSkin(ManifestProcessingContext& cx, int lineno, char *const * argv, int flags) = 0; - virtual void ManifestOverlay(ManifestProcessingContext& cx, int lineno, - char *const * argv, int flags) = 0; virtual void ManifestOverride(ManifestProcessingContext& cx, int lineno, char *const * argv, int flags) = 0; virtual void ManifestResource(ManifestProcessingContext& cx, int lineno, diff --git a/chrome/nsChromeRegistryChrome.cpp b/chrome/nsChromeRegistryChrome.cpp index 8a62ab34f3d4..41b4d90bd771 100644 --- a/chrome/nsChromeRegistryChrome.cpp +++ b/chrome/nsChromeRegistryChrome.cpp @@ -307,7 +307,6 @@ NS_IMETHODIMP nsChromeRegistryChrome::CheckForNewChrome() { mPackagesHash.Clear(); - mOverlayHash.Clear(); mOverrideTable.Clear(); mDynamicRegistration = false; @@ -543,54 +542,6 @@ nsChromeRegistryChrome::nsProviderArray::EnumerateToArray(nsTArray *a } } -void -nsChromeRegistryChrome::OverlayListEntry::AddURI(nsIURI* aURI) -{ - int32_t i = mArray.Count(); - while (i--) { - bool equals; - if (NS_SUCCEEDED(aURI->Equals(mArray[i], &equals)) && equals) - return; - } - - mArray.AppendObject(aURI); -} - -void -nsChromeRegistryChrome::OverlayListHash::Add(nsIURI* aBase, nsIURI* aOverlay) -{ - OverlayListEntry* entry = mTable.PutEntry(aBase); - if (entry) - entry->AddURI(aOverlay); -} - -const nsCOMArray* -nsChromeRegistryChrome::OverlayListHash::GetArray(nsIURI* aBase) -{ - OverlayListEntry* entry = mTable.GetEntry(aBase); - if (!entry) - return nullptr; - - return &entry->mArray; -} - -#ifdef MOZ_XUL -NS_IMETHODIMP -nsChromeRegistryChrome::GetXULOverlays(nsIURI *aChromeURL, - nsISimpleEnumerator **aResult) -{ - nsCOMPtr chromeURLWithoutHash; - if (aChromeURL) { - aChromeURL->CloneIgnoringRef(getter_AddRefs(chromeURLWithoutHash)); - } - const nsCOMArray* parray = mOverlayHash.GetArray(chromeURLWithoutHash); - if (!parray) - return NS_NewEmptyEnumerator(aResult); - - return NS_NewArrayEnumerator(aResult, *parray); -} -#endif // MOZ_XUL - nsIURI* nsChromeRegistry::ManifestProcessingContext::GetManifestURI() { @@ -757,33 +708,6 @@ nsChromeRegistryChrome::ManifestSkin(ManifestProcessingContext& cx, int lineno, } } -void -nsChromeRegistryChrome::ManifestOverlay(ManifestProcessingContext& cx, int lineno, - char *const * argv, int flags) -{ - char* base = argv[0]; - char* overlay = argv[1]; - - nsCOMPtr baseuri = cx.ResolveURI(base); - nsCOMPtr overlayuri = cx.ResolveURI(overlay); - if (!baseuri || !overlayuri) { - LogMessageWithContext(cx.GetManifestURI(), lineno, nsIScriptError::warningFlag, - "During chrome registration, unable to create URI."); - return; - } - - if (!CanLoadResource(overlayuri)) { - LogMessageWithContext(cx.GetManifestURI(), lineno, nsIScriptError::warningFlag, - "Cannot register non-local URI '%s' as an overlay.", overlay); - return; - } - - nsCOMPtr baseuriWithoutHash; - baseuri->CloneIgnoringRef(getter_AddRefs(baseuriWithoutHash)); - - mOverlayHash.Add(baseuriWithoutHash, overlayuri); -} - void nsChromeRegistryChrome::ManifestOverride(ManifestProcessingContext& cx, int lineno, char *const * argv, int flags) diff --git a/chrome/nsChromeRegistryChrome.h b/chrome/nsChromeRegistryChrome.h index 47606867f96c..57c3fa1dd10b 100644 --- a/chrome/nsChromeRegistryChrome.h +++ b/chrome/nsChromeRegistryChrome.h @@ -41,11 +41,6 @@ class nsChromeRegistryChrome : public nsChromeRegistry NS_IMETHOD Observe(nsISupports *aSubject, const char *aTopic, const char16_t *someData) override; -#ifdef MOZ_XUL - NS_IMETHOD GetXULOverlays(nsIURI *aURI, - nsISimpleEnumerator **_retval) override; -#endif - // If aChild is non-null then it is a new child to notify. If aChild is // null, then we have installed new chrome and we are resetting all of our // children's registered chrome. @@ -114,40 +109,6 @@ class nsChromeRegistryChrome : public nsChromeRegistry nsProviderArray skins; }; - class OverlayListEntry : public nsURIHashKey - { - public: - typedef nsURIHashKey::KeyType KeyType; - typedef nsURIHashKey::KeyTypePointer KeyTypePointer; - - explicit OverlayListEntry(KeyTypePointer aKey) : nsURIHashKey(aKey) { } - OverlayListEntry(OverlayListEntry&& toMove) : nsURIHashKey(std::move(toMove)), - mArray(std::move(toMove.mArray)) { } - ~OverlayListEntry() { } - - void AddURI(nsIURI* aURI); - - nsCOMArray mArray; - }; - - class OverlayListHash - { - public: - OverlayListHash() { } - ~OverlayListHash() { } - - void Add(nsIURI* aBase, nsIURI* aOverlay); - void Clear() { mTable.Clear(); } - const nsCOMArray* GetArray(nsIURI* aBase); - - private: - nsTHashtable mTable; - }; - - // Hashes on the file to be overlaid (chrome://browser/content/browser.xul) - // to a list of overlays - OverlayListHash mOverlayHash; - bool mProfileLoaded; bool mDynamicRegistration; @@ -162,8 +123,6 @@ class nsChromeRegistryChrome : public nsChromeRegistry char *const * argv, int flags) override; virtual void ManifestSkin(ManifestProcessingContext& cx, int lineno, char *const * argv, int flags) override; - virtual void ManifestOverlay(ManifestProcessingContext& cx, int lineno, - char *const * argv, int flags) override; virtual void ManifestOverride(ManifestProcessingContext& cx, int lineno, char *const * argv, int flags) override; virtual void ManifestResource(ManifestProcessingContext& cx, int lineno, diff --git a/chrome/nsChromeRegistryContent.cpp b/chrome/nsChromeRegistryContent.cpp index b0c8a7fcac5b..03f88bc51206 100644 --- a/chrome/nsChromeRegistryContent.cpp +++ b/chrome/nsChromeRegistryContent.cpp @@ -238,13 +238,6 @@ nsChromeRegistryContent::Observe(nsISupports* aSubject, const char* aTopic, CONTENT_NOT_IMPLEMENTED(); } -NS_IMETHODIMP -nsChromeRegistryContent::GetXULOverlays(nsIURI *aChromeURL, - nsISimpleEnumerator **aResult) -{ - CONTENT_NOT_IMPLEMENTED(); -} - void nsChromeRegistryContent::ManifestContent(ManifestProcessingContext& cx, int lineno, char *const * argv, @@ -269,13 +262,6 @@ nsChromeRegistryContent::ManifestSkin(ManifestProcessingContext& cx, CONTENT_NOTREACHED(); } -void -nsChromeRegistryContent::ManifestOverlay(ManifestProcessingContext& cx, int lineno, - char *const * argv, int flags) -{ - CONTENT_NOTREACHED(); -} - void nsChromeRegistryContent::ManifestOverride(ManifestProcessingContext& cx, int lineno, diff --git a/chrome/nsChromeRegistryContent.h b/chrome/nsChromeRegistryContent.h index dd6c167d89de..33570069c3fb 100644 --- a/chrome/nsChromeRegistryContent.h +++ b/chrome/nsChromeRegistryContent.h @@ -35,8 +35,6 @@ class nsChromeRegistryContent : public nsChromeRegistry NS_IMETHOD GetSelectedLocale(const nsACString& aPackage, bool aAsBCP47, nsACString& aLocale) override; - NS_IMETHOD GetXULOverlays(nsIURI *aChromeURL, - nsISimpleEnumerator **aResult) override; void RegisterPackage(const ChromePackage& aPackage); void RegisterOverride(const OverrideMapping& aOverride); @@ -68,8 +66,6 @@ class nsChromeRegistryContent : public nsChromeRegistry char *const * argv, int flags) override; virtual void ManifestSkin(ManifestProcessingContext& cx, int lineno, char *const * argv, int flags) override; - virtual void ManifestOverlay(ManifestProcessingContext& cx, int lineno, - char *const * argv, int flags) override; virtual void ManifestOverride(ManifestProcessingContext& cx, int lineno, char *const * argv, int flags) override; virtual void ManifestResource(ManifestProcessingContext& cx, int lineno, diff --git a/dom/canvas/test/webgl-conf/checkout/deqp/temp_externs/gecko_dom.js b/dom/canvas/test/webgl-conf/checkout/deqp/temp_externs/gecko_dom.js index a3314d812342..a506d1d87103 100644 --- a/dom/canvas/test/webgl-conf/checkout/deqp/temp_externs/gecko_dom.js +++ b/dom/canvas/test/webgl-conf/checkout/deqp/temp_externs/gecko_dom.js @@ -507,7 +507,6 @@ Document.prototype.importNode = function(externalNode, deep) {}; /** @param {string} uri */ Document.prototype.load = function(uri) {}; -Document.prototype.loadOverlay; /** * @see https://developer.mozilla.org/en/DOM/document.open diff --git a/dom/webidl/XULDocument.webidl b/dom/webidl/XULDocument.webidl index 61280f91560b..f47d9c189ba5 100644 --- a/dom/webidl/XULDocument.webidl +++ b/dom/webidl/XULDocument.webidl @@ -48,24 +48,4 @@ 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); }; diff --git a/dom/xul/XULDocument.cpp b/dom/xul/XULDocument.cpp index 8b55540bdd98..584eb12e859a 100644 --- a/dom/xul/XULDocument.cpp +++ b/dom/xul/XULDocument.cpp @@ -38,7 +38,6 @@ #include "nsXMLContentSink.h" #include "nsXULContentSink.h" #include "nsXULContentUtils.h" -#include "nsIXULOverlayProvider.h" #include "nsIStringEnumerator.h" #include "nsDocElementCreatedNotificationRunner.h" #include "nsNetUtil.h" @@ -106,16 +105,6 @@ using namespace mozilla::dom; static NS_DEFINE_CID(kParserCID, NS_PARSER_CID); -static bool IsOverlayAllowed(nsIURI* aURI) -{ - bool canOverlay = false; - if (NS_SUCCEEDED(aURI->SchemeIs("about", &canOverlay)) && canOverlay) - return true; - if (NS_SUCCEEDED(aURI->SchemeIs("chrome", &canOverlay)) && canOverlay) - return true; - return false; -} - //---------------------------------------------------------------------- // // Miscellaneous Constants @@ -164,10 +153,8 @@ XULDocument::XULDocument(void) mIsWritingFastLoad(false), mDocumentLoaded(false), mStillWalking(false), - mRestrictPersistence(false), mPendingSheets(0), mDocLWTheme(Doc_Theme_Uninitialized), - mState(eState_Master), mCurrentScriptProto(nullptr), mOffThreadCompiling(false), mOffThreadCompileStringBuf(nullptr), @@ -197,9 +184,6 @@ XULDocument::~XULDocument() // In case we failed somewhere early on and the forward observer // decls never got resolved. mForwardReferences.Clear(); - // Likewise for any references we have to IDs where we might - // look for persisted data: - mPersistenceIds.Clear(); // Destroy our broadcaster map. delete mBroadcasterMap; @@ -251,27 +235,10 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(XULDocument, XMLDocument) // XXX tmp->mContextStack? NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mCurrentPrototype) - NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mMasterPrototype) NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mCommandDispatcher) NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mPrototypes) NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mLocalStore) - if (tmp->mOverlayLoadObservers) { - for (auto iter = tmp->mOverlayLoadObservers->Iter(); - !iter.Done(); - iter.Next()) { - NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mOverlayLoadObservers value"); - cb.NoteXPCOMChild(iter.Data()); - } - } - if (tmp->mPendingOverlayLoadNotifications) { - for (auto iter = tmp->mPendingOverlayLoadNotifications->Iter(); - !iter.Done(); - iter.Next()) { - NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mPendingOverlayLoadNotifications value"); - cb.NoteXPCOMChild(iter.Data()); - } - } NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(XULDocument, XMLDocument) @@ -393,7 +360,7 @@ XULDocument::StartDocumentLoad(const char* aCommand, nsIChannel* aChannel, rv = proto->AwaitLoadDone(this, &loaded); if (NS_FAILED(rv)) return rv; - mMasterPrototype = mCurrentPrototype = proto; + mCurrentPrototype = proto; // Set up the right principal on ourselves. SetPrincipal(proto->DocumentPrincipal()); @@ -443,15 +410,11 @@ XULDocument::StartDocumentLoad(const char* aCommand, nsIChannel* aChannel, return NS_OK; } -// This gets invoked after a prototype for this document or one of -// its overlays is fully built in the content sink. +// This gets invoked after the prototype for this document is fully built in the +// content sink. void XULDocument::EndLoad() { - // This can happen if an overlay fails to load - if (!mCurrentPrototype) - return; - nsresult rv; // Whack the prototype document into the cache so that the next @@ -463,16 +426,7 @@ XULDocument::EndLoad() // Remember if the XUL cache is on bool useXULCache = nsXULPrototypeCache::GetInstance()->IsEnabled(); - // If the current prototype is an overlay document (non-master prototype) - // and we're filling the FastLoad disk cache, tell the cache we're done - // loading it, and write the prototype. The master prototype is put into - // the cache earlier in XULDocument::StartDocumentLoad. - if (useXULCache && mIsWritingFastLoad && isChrome && - mMasterPrototype != mCurrentPrototype) { - nsXULPrototypeCache::GetInstance()->WritePrototype(mCurrentPrototype); - } - - if (IsOverlayAllowed(uri) && isChrome && useXULCache) { + if (isChrome && useXULCache) { // If it's a chrome prototype document, then notify any // documents that raced to load the prototype, and awaited // its load completion via proto->AwaitLoadDone(). @@ -506,27 +460,6 @@ XULDocument::OnPrototypeLoadDone(bool aResumeWalk) return rv; } -// called when an error occurs parsing a document -bool -XULDocument::OnDocumentParserError() -{ - // don't report errors that are from overlays - if (mCurrentPrototype && mMasterPrototype != mCurrentPrototype) { - nsCOMPtr uri = mCurrentPrototype->GetURI(); - if (IsChromeURI(uri)) { - nsCOMPtr os = - mozilla::services::GetObserverService(); - if (os) - os->NotifyObservers(uri, "xul-overlay-parsererror", - EmptyString().get()); - } - - return false; - } - - return true; -} - static void ClearBroadcasterMapEntry(PLDHashTable* aTable, PLDHashEntryHdr* aEntry) { @@ -1002,13 +935,6 @@ XULDocument::ResolveForwardReferences() // do nothing. we'll try again later ; } - - if (mResolutionPhase == nsForwardReference::eStart) { - // Resolve() loaded a dynamic overlay, - // (see XULDocument::LoadOverlayInternal()). - // Return for now, we will be called again. - return NS_OK; - } } } } @@ -1594,15 +1520,10 @@ XULDocument::PrepareToLoadPrototype(nsIURI* aURI, const char* aCommand, return rv; } - // Bootstrap the master document prototype. - if (! mMasterPrototype) { - mMasterPrototype = mCurrentPrototype; - // Set our principal based on the master proto. - SetPrincipal(aDocumentPrincipal); - } + SetPrincipal(aDocumentPrincipal); // Create a XUL content sink, a parser, and kick off a load for - // the overlay. + // the document. RefPtr sink = new XULContentSinkImpl(); rv = sink->Init(this, mCurrentPrototype); @@ -1645,11 +1566,6 @@ XULDocument::ApplyPersistentAttributes() ApplyPersistentAttributesInternal(); mApplyingPersistedAttrs = false; - // After we've applied persistence once, we should only reapply - // it to nodes created by overlays - mRestrictPersistence = true; - mPersistenceIds.Clear(); - return NS_OK; } @@ -1683,10 +1599,6 @@ XULDocument::ApplyPersistentAttributesInternal() nsAutoString id; ids->GetNext(id); - if (mRestrictPersistence && !mPersistenceIds.Contains(id)) { - continue; - } - nsIdentifierMapEntry* entry = mIdentifierMap.GetEntry(id); if (!entry) { continue; @@ -1898,9 +1810,6 @@ XULDocument::PrepareToWalk() } nsINode* nodeToInsertBefore = nsINode::GetFirstChild(); - if (mState != eState_Master) { - nodeToInsertBefore = GetRootElement(); - } const nsTArray >& processingInstructions = mCurrentPrototype->GetProcessingInstructions(); @@ -1912,37 +1821,27 @@ XULDocument::PrepareToWalk() if (NS_FAILED(rv)) return rv; } - // Now check the chrome registry for any additional overlays. - rv = AddChromeOverlays(); - if (NS_FAILED(rv)) return rv; - - // Do one-time initialization if we're preparing to walk the - // master document's prototype. + // Do one-time initialization. RefPtr root; - if (mState == eState_Master) { - // Add the root element - rv = CreateElementFromPrototype(proto, getter_AddRefs(root), true); - if (NS_FAILED(rv)) return rv; + // Add the root element + rv = CreateElementFromPrototype(proto, getter_AddRefs(root), true); + if (NS_FAILED(rv)) return rv; - rv = AppendChildTo(root, false); - if (NS_FAILED(rv)) return rv; + rv = AppendChildTo(root, false); + if (NS_FAILED(rv)) return rv; - // Block onload until we've finished building the complete - // document content model. - BlockOnload(); + // Block onload until we've finished building the complete + // document content model. + BlockOnload(); - nsContentUtils::AddScriptRunner( - new nsDocElementCreatedNotificationRunner(this)); - } + nsContentUtils::AddScriptRunner( + new nsDocElementCreatedNotificationRunner(this)); // There'd better not be anything on the context stack at this // point! This is the basis case for our "induction" in // ResumeWalk(), below, which'll assume that there's always a - // content element on the context stack if either 1) we're in the - // "master" document, or 2) we're in an overlay, and we've got - // more than one prototype element (the single, root "overlay" - // element) on the stack. + // content element on the context stack if we're in the document. NS_ASSERTION(mContextStack.Depth() == 0, "something's on the context stack already"); if (mContextStack.Depth() != 0) return NS_ERROR_UNEXPECTED; @@ -1967,8 +1866,6 @@ XULDocument::CreateAndInsertPI(const nsXULPrototypePI* aProtoPI, nsresult rv; if (aProtoPI->mTarget.EqualsLiteral("xml-stylesheet")) { rv = InsertXMLStylesheetPI(aProtoPI, aParent, aBeforeThis, node); - } else if (aProtoPI->mTarget.EqualsLiteral("xul-overlay")) { - rv = InsertXULOverlayPI(aProtoPI, aParent, aBeforeThis, node); } else { // No special processing, just add the PI to the document. rv = aParent->InsertChildBefore(node->AsContent(), @@ -2027,326 +1924,6 @@ XULDocument::InsertXMLStylesheetPI(const nsXULPrototypePI* aProtoPI, return NS_OK; } -nsresult -XULDocument::InsertXULOverlayPI(const nsXULPrototypePI* aProtoPI, - nsINode* aParent, - nsINode* aBeforeThis, - nsIContent* aPINode) -{ - nsresult rv; - - rv = aParent->InsertChildBefore(aPINode->AsContent(), - aBeforeThis - ? aBeforeThis->AsContent() : nullptr, - false); - if (NS_FAILED(rv)) return rv; - - // xul-overlay PI is special only in prolog - if (!nsContentUtils::InProlog(aPINode)) { - return NS_OK; - } - - nsAutoString href; - nsContentUtils::GetPseudoAttributeValue(aProtoPI->mData, - nsGkAtoms::href, - href); - - // If there was no href, we can't do anything with this PI - if (href.IsEmpty()) { - return NS_OK; - } - - // Add the overlay to our list of overlays that need to be processed. - nsCOMPtr uri; - - rv = NS_NewURI(getter_AddRefs(uri), href, nullptr, - mCurrentPrototype->GetURI()); - if (NS_SUCCEEDED(rv)) { - // We insert overlays into mUnloadedOverlays at the same index in - // document order, so they end up in the reverse of the document - // order in mUnloadedOverlays. - // This is needed because the code in ResumeWalk loads the overlays - // by processing the last item of mUnloadedOverlays and removing it - // from the array. - mUnloadedOverlays.InsertElementAt(0, uri); - rv = NS_OK; - } else if (rv == NS_ERROR_MALFORMED_URI) { - // The URL is bad, move along. Don't propagate for now. - // XXX report this to the Error Console (bug 359846) - rv = NS_OK; - } - - return rv; -} - -nsresult -XULDocument::AddChromeOverlays() -{ - nsresult rv; - - nsCOMPtr docUri = mCurrentPrototype->GetURI(); - - /* overlays only apply to chrome or about URIs */ - if (!IsOverlayAllowed(docUri)) return NS_OK; - - nsCOMPtr chromeReg = - mozilla::services::GetXULOverlayProviderService(); - // In embedding situations, the chrome registry may not provide overlays, - // or even exist at all; that's OK. - NS_ENSURE_TRUE(chromeReg, NS_OK); - - nsCOMPtr overlays; - rv = chromeReg->GetXULOverlays(docUri, getter_AddRefs(overlays)); - NS_ENSURE_SUCCESS(rv, rv); - - bool moreOverlays; - nsCOMPtr next; - nsCOMPtr uri; - - while (NS_SUCCEEDED(rv = overlays->HasMoreElements(&moreOverlays)) && - moreOverlays) { - - rv = overlays->GetNext(getter_AddRefs(next)); - if (NS_FAILED(rv) || !next) break; - - uri = do_QueryInterface(next); - if (!uri) { - NS_ERROR("Chrome registry handed me a non-nsIURI object!"); - continue; - } - - // Same comment as in XULDocument::InsertXULOverlayPI - mUnloadedOverlays.InsertElementAt(0, uri); - } - - return rv; -} - -void -XULDocument::LoadOverlay(const nsAString& aURL, nsIObserver* aObserver, - ErrorResult& aRv) -{ - nsresult rv; - - nsCOMPtr uri; - rv = NS_NewURI(getter_AddRefs(uri), aURL, nullptr); - if (NS_FAILED(rv)) { - aRv.Throw(rv); - return; - } - - if (aObserver) { - nsIObserver* obs = nullptr; - if (!mOverlayLoadObservers) { - mOverlayLoadObservers = new nsInterfaceHashtable; - } - obs = mOverlayLoadObservers->GetWeak(uri); - - if (obs) { - // We don't support loading the same overlay twice into the same - // document - that doesn't make sense anyway. - aRv.Throw(NS_ERROR_FAILURE); - return; - } - mOverlayLoadObservers->Put(uri, aObserver); - } - bool shouldReturn, failureFromContent; - rv = LoadOverlayInternal(uri, true, &shouldReturn, &failureFromContent); - if (NS_FAILED(rv)) { - // remove the observer if LoadOverlayInternal generated an error - if (mOverlayLoadObservers) { - mOverlayLoadObservers->Remove(uri); - } - aRv.Throw(rv); - return; - } -} - -nsresult -XULDocument::LoadOverlayInternal(nsIURI* aURI, bool aIsDynamic, - bool* aShouldReturn, - bool* aFailureFromContent) -{ - nsresult rv; - - // XUL overlays are in the process of being removed. In a Firefox build, - // loading an overlay will no longer work and display an error in the - // console. In automation, doing so will cause a crash. - // However, overlays are allowed in other applications (e.g. Thunderbird) - // while they work on removing them. See bug 1448162. -#ifdef MOZ_BREAK_XUL_OVERLAYS - nsCString docSpec; - mCurrentPrototype->GetURI()->GetSpec(docSpec); - nsCString overlaySpec; - aURI->GetSpec(overlaySpec); - nsPrintfCString msg("Attempt to load overlay %s into %s\n", - overlaySpec.get(), - docSpec.get()); - nsCOMPtr consoleSvc = - do_GetService("@mozilla.org/consoleservice;1"); - if (consoleSvc) { - consoleSvc->LogStringMessage(NS_ConvertASCIItoUTF16(msg).get()); - } - printf("%s", msg.get()); - if (xpc::IsInAutomation()) { - MOZ_CRASH("Attempt to load overlay."); - } - return NS_ERROR_NOT_AVAILABLE; -#endif - - *aShouldReturn = false; - *aFailureFromContent = false; - - if (MOZ_LOG_TEST(gXULLog, LogLevel::Debug)) { - nsCOMPtr uri; - mChannel->GetOriginalURI(getter_AddRefs(uri)); - - MOZ_LOG(gXULLog, LogLevel::Debug, - ("xul: %s loading overlay %s", - uri ? uri->GetSpecOrDefault().get() : "", - aURI->GetSpecOrDefault().get())); - } - - if (aIsDynamic) - mResolutionPhase = nsForwardReference::eStart; - - // Look in the prototype cache for the prototype document with - // the specified overlay URI. Only use the cache if the containing - // document is chrome otherwise it may not have a system principal and - // the cached document will, see bug 565610. - bool overlayIsChrome = IsChromeURI(aURI); - bool documentIsChrome = mDocumentURI ? - IsChromeURI(mDocumentURI) : false; - mCurrentPrototype = overlayIsChrome && documentIsChrome ? - nsXULPrototypeCache::GetInstance()->GetPrototype(aURI) : nullptr; - - // Same comment as nsChromeProtocolHandler::NewChannel and - // XULDocument::StartDocumentLoad - // - Ben Goodger - // - // We don't abort on failure here because there are too many valid - // cases that can return failure, and the null-ness of |proto| is - // enough to trigger the fail-safe parse-from-disk solution. - // Example failure cases (for reference) include: - // - // NS_ERROR_NOT_AVAILABLE: the URI was not found in the FastLoad file, - // parse from disk - // other: the FastLoad file, XUL.mfl, could not be found, probably - // due to being accessed before a profile has been selected - // (e.g. loading chrome for the profile manager itself). - // The .xul file must be parsed from disk. - - bool useXULCache = nsXULPrototypeCache::GetInstance()->IsEnabled(); - if (useXULCache && mCurrentPrototype) { - bool loaded; - rv = mCurrentPrototype->AwaitLoadDone(this, &loaded); - if (NS_FAILED(rv)) return rv; - - if (! loaded) { - // Return to the main event loop and eagerly await the - // prototype overlay load's completion. When the content - // sink completes, it will trigger an EndLoad(), which'll - // wind us back up here, in ResumeWalk(). - *aShouldReturn = true; - return NS_OK; - } - - MOZ_LOG(gXULLog, LogLevel::Debug, ("xul: overlay was cached")); - - // Found the overlay's prototype in the cache, fully loaded. If - // this is a dynamic overlay, this will call ResumeWalk. - // Otherwise, we'll return to ResumeWalk, which called us. - return OnPrototypeLoadDone(aIsDynamic); - } - else { - // Not there. Initiate a load. - MOZ_LOG(gXULLog, LogLevel::Debug, ("xul: overlay was not cached")); - - if (mIsGoingAway) { - MOZ_LOG(gXULLog, LogLevel::Debug, ("xul: ...and document already destroyed")); - return NS_ERROR_NOT_AVAILABLE; - } - - // We'll set the right principal on the proto doc when we get - // OnStartRequest from the parser, so just pass in a null principal for - // now. - nsCOMPtr parser; - rv = PrepareToLoadPrototype(aURI, "view", nullptr, getter_AddRefs(parser)); - if (NS_FAILED(rv)) return rv; - - // Predicate mIsWritingFastLoad on the XUL cache being enabled, - // so we don't have to re-check whether the cache is enabled all - // the time. - mIsWritingFastLoad = useXULCache; - - nsCOMPtr listener = do_QueryInterface(parser); - if (! listener) - return NS_ERROR_UNEXPECTED; - - // Add an observer to the parser; this'll get called when - // Necko fires its On[Start|Stop]Request() notifications, - // and will let us recover from a missing overlay. - RefPtr parserObserver = - new ParserObserver(this, mCurrentPrototype); - parser->Parse(aURI, parserObserver); - parserObserver = nullptr; - - nsCOMPtr group = do_QueryReferent(mDocumentLoadGroup); - nsCOMPtr channel; - // Set the owner of the channel to be our principal so - // that the overlay's JSObjects etc end up being created - // with the right principal and in the correct - // compartment. - rv = NS_NewChannel(getter_AddRefs(channel), - aURI, - NodePrincipal(), - nsILoadInfo::SEC_REQUIRE_SAME_ORIGIN_DATA_INHERITS | - nsILoadInfo::SEC_FORCE_INHERIT_PRINCIPAL, - nsIContentPolicy::TYPE_OTHER, - nullptr, // PerformanceStorage - group); - - if (NS_SUCCEEDED(rv)) { - rv = channel->AsyncOpen2(listener); - } - - if (NS_FAILED(rv)) { - // Abandon this prototype - mCurrentPrototype = nullptr; - - // The parser won't get an OnStartRequest and - // OnStopRequest, so it needs a Terminate. - parser->Terminate(); - - // Just move on to the next overlay. - ReportMissingOverlay(aURI); - - // XXX the error could indicate an internal error as well... - *aFailureFromContent = true; - return rv; - } - - // If it's a 'chrome:' prototype document, then put it into - // the prototype cache; other XUL documents will be reloaded - // each time. We must do this after AsyncOpen, - // or chrome code will wrongly create a cached chrome channel - // instead of a real one. Prototypes are only cached when the - // document to be overlayed is chrome to avoid caching overlay - // scripts with incorrect principals, see bug 565610. - if (useXULCache && overlayIsChrome && documentIsChrome) { - nsXULPrototypeCache::GetInstance()->PutPrototype(mCurrentPrototype); - } - - // Return to the main event loop and eagerly await the - // overlay load's completion. When the content sink - // completes, it will trigger an EndLoad(), which'll wind - // us back in ResumeWalk(). - if (!aIsDynamic) - *aShouldReturn = true; - } - return NS_OK; -} - nsresult XULDocument::ResumeWalk() { @@ -2360,7 +1937,7 @@ XULDocument::ResumeWalk() // ) can be properly re-loaded if the // cached copy of the document becomes stale. nsresult rv; - nsCOMPtr overlayURI = + nsCOMPtr docURI = mCurrentPrototype ? mCurrentPrototype->GetURI() : nullptr; while (1) { @@ -2382,24 +1959,20 @@ XULDocument::ResumeWalk() if (element) { // We've processed all of the prototype's children. If // we're in the master prototype, do post-order - // document-level hookup. (An overlay will get its - // document hookup done when it's successfully - // resolved.) - if (mState == eState_Master) { - AddElementToDocumentPost(element->AsElement()); + // document-level hookup. + AddElementToDocumentPost(element->AsElement()); - if (element->NodeInfo()->Equals(nsGkAtoms::style, - kNameSpaceID_XHTML) || - element->NodeInfo()->Equals(nsGkAtoms::style, - kNameSpaceID_SVG)) { - // XXX sucks that we have to do this - - // see bug 370111 - nsCOMPtr ssle = - do_QueryInterface(element); - NS_ASSERTION(ssle, " doesn't implement " - "nsIStyleSheetLinkingElement?"); - Unused << ssle->UpdateStyleSheet(nullptr); - } + if (element->NodeInfo()->Equals(nsGkAtoms::style, + kNameSpaceID_XHTML) || + element->NodeInfo()->Equals(nsGkAtoms::style, + kNameSpaceID_SVG)) { + // XXX sucks that we have to do this - + // see bug 370111 + nsCOMPtr ssle = + do_QueryInterface(element); + NS_ASSERTION(ssle, " doesn't implement " + "nsIStyleSheetLinkingElement?"); + Unused << ssle->UpdateStyleSheet(nullptr); } } // Now pop the context stack back up to the parent @@ -2413,16 +1986,7 @@ XULDocument::ResumeWalk() nsXULPrototypeNode* childproto = proto->mChildren[indx]; mContextStack.SetTopIndex(++indx); - // Whether we're in the "first ply" of an overlay: - // the "hookup" nodes. In the case !processingOverlayHookupNodes, - // we're in the master document -or- we're in an overlay, and far - // enough down into the overlay's content that we can simply build - // the delegates and attach them to the parent node. - bool processingOverlayHookupNodes = (mState == eState_Overlay) && - (mContextStack.Depth() == 1); - - NS_ASSERTION(element || processingOverlayHookupNodes, - "no element on context stack"); + NS_ASSERTION(element, "no element on context stack"); switch (childproto->mType) { case nsXULPrototypeNode::eType_Element: { @@ -2432,41 +1996,18 @@ XULDocument::ResumeWalk() RefPtr child; - if (!processingOverlayHookupNodes) { - rv = CreateElementFromPrototype(protoele, - getter_AddRefs(child), - false); - if (NS_FAILED(rv)) return rv; - // ...and append it to the content model. - rv = element->AppendChildTo(child, false); - if (NS_FAILED(rv)) return rv; + rv = CreateElementFromPrototype(protoele, + getter_AddRefs(child), + false); + if (NS_FAILED(rv)) return rv; - // If we're only restoring persisted things on - // some elements, store the ID here to do that. - if (mRestrictPersistence) { - nsAtom* id = child->GetID(); - if (id) { - mPersistenceIds.PutEntry(nsDependentAtomString(id)); - } - } + // ...and append it to the content model. + rv = element->AppendChildTo(child, false); + if (NS_FAILED(rv)) return rv; - // do pre-order document-level hookup, but only if - // we're in the master document. For an overlay, - // this will happen when the overlay is - // successfully resolved. - if (mState == eState_Master) - AddElementToDocumentPre(child); - } - else { - // We're in the "first ply" of an overlay: the - // "hookup" nodes. Create an 'overlay' element so - // that we can continue to build content, and - // enter a forward reference so we can hook it up - // later. - rv = CreateOverlayElement(protoele, getter_AddRefs(child)); - if (NS_FAILED(rv)) return rv; - } + // do pre-order document-level hookup. + AddElementToDocumentPre(child); // If it has children, push the element onto the context // stack and begin to process them. @@ -2475,12 +2016,9 @@ XULDocument::ResumeWalk() if (NS_FAILED(rv)) return rv; } else { - if (mState == eState_Master) { - // If there are no children, and we're in the - // master document, do post-order document hookup - // immediately. - AddElementToDocumentPost(child); - } + // If there are no children, do post-order document hookup + // immediately. + AddElementToDocumentPost(child); } } break; @@ -2513,21 +2051,15 @@ XULDocument::ResumeWalk() case nsXULPrototypeNode::eType_Text: { // A simple text node. + RefPtr text = + new nsTextNode(mNodeInfoManager); - if (!processingOverlayHookupNodes) { - // This does mean that text nodes that are direct children - // of get ignored. + nsXULPrototypeText* textproto = + static_cast(childproto); + text->SetText(textproto->mValue, false); - RefPtr text = - new nsTextNode(mNodeInfoManager); - - nsXULPrototypeText* textproto = - static_cast(childproto); - text->SetText(textproto->mValue, false); - - rv = element->AppendChildTo(text, false); - NS_ENSURE_SUCCESS(rv, rv); - } + rv = element->AppendChildTo(text, false); + NS_ENSURE_SUCCESS(rv, rv); } break; @@ -2535,11 +2067,10 @@ XULDocument::ResumeWalk() nsXULPrototypePI* piProto = static_cast(childproto); - // and don't have effect - // outside the prolog, like they used to. Issue a warning. + // doesn't have an effect + // outside the prolog, like it used to. Issue a warning. - if (piProto->mTarget.EqualsLiteral("xml-stylesheet") || - piProto->mTarget.EqualsLiteral("xul-overlay")) { + if (piProto->mTarget.EqualsLiteral("xml-stylesheet")) { const char16_t* params[] = { piProto->mTarget.get() }; @@ -2549,11 +2080,10 @@ XULDocument::ResumeWalk() nsContentUtils::eXUL_PROPERTIES, "PINotInProlog", params, ArrayLength(params), - overlayURI); + docURI); } - nsIContent* parent = processingOverlayHookupNodes ? - GetRootElement() : element.get(); + nsIContent* parent = element.get(); if (parent) { // an inline script could have removed the root element @@ -2571,43 +2101,7 @@ XULDocument::ResumeWalk() // Once we get here, the context stack will have been // depleted. That means that the entire prototype has been // walked and content has been constructed. - - // If we're not already, mark us as now processing overlays. - mState = eState_Overlay; - - // If there are no overlay URIs, then we're done. - uint32_t count = mUnloadedOverlays.Length(); - if (! count) - break; - - nsCOMPtr uri = mUnloadedOverlays[count-1]; - mUnloadedOverlays.RemoveElementAt(count - 1); - - bool shouldReturn, failureFromContent; - rv = LoadOverlayInternal(uri, false, &shouldReturn, - &failureFromContent); - if (failureFromContent) - // The failure |rv| was the result of a problem in the content - // rather than an unexpected problem in our implementation, so - // just continue with the next overlay. - continue; - if (NS_FAILED(rv)) - return rv; - if (mOverlayLoadObservers) { - nsIObserver *obs = mOverlayLoadObservers->GetWeak(overlayURI); - if (obs) { - // This overlay has an unloaded overlay, so it will never - // notify. The best we can do is to notify for the unloaded - // overlay instead, assuming nobody is already notifiable - // for it. Note that this will confuse the observer. - if (!mOverlayLoadObservers->GetWeak(uri)) - mOverlayLoadObservers->Put(uri, obs); - mOverlayLoadObservers->Remove(overlayURI); - } - } - if (shouldReturn) - return NS_OK; - overlayURI.swap(uri); + break; } // If we get here, there is nothing left for us to walk. The content @@ -2663,7 +2157,7 @@ XULDocument::DoneWalking() StartLayout(); if (mIsWritingFastLoad && IsChromeURI(mDocumentURI)) - nsXULPrototypeCache::GetInstance()->WritePrototype(mMasterPrototype); + nsXULPrototypeCache::GetInstance()->WritePrototype(mCurrentPrototype); NS_ASSERTION(mDelayFrameLoaderInitialization, "mDelayFrameLoaderInitialization should be true!"); @@ -2682,69 +2176,6 @@ XULDocument::DoneWalking() DispatchContentLoadedEvents(); mInitialLayoutComplete = true; - - // Walk the set of pending load notifications and notify any observers. - // See below for detail. - if (mPendingOverlayLoadNotifications) { - nsInterfaceHashtable* observers = - mOverlayLoadObservers.get(); - for (auto iter = mPendingOverlayLoadNotifications->Iter(); - !iter.Done(); - iter.Next()) { - nsIURI* aKey = iter.Key(); - iter.Data()->Observe(aKey, "xul-overlay-merged", - EmptyString().get()); - - if (observers) { - observers->Remove(aKey); - } - - iter.Remove(); - } - } - } - else { - if (mOverlayLoadObservers) { - nsCOMPtr overlayURI = mCurrentPrototype->GetURI(); - nsCOMPtr obs; - if (mInitialLayoutComplete) { - // We have completed initial layout, so just send the notification. - mOverlayLoadObservers->Get(overlayURI, getter_AddRefs(obs)); - if (obs) - obs->Observe(overlayURI, "xul-overlay-merged", EmptyString().get()); - mOverlayLoadObservers->Remove(overlayURI); - } - else { - // If we have not yet displayed the document for the first time - // (i.e. we came in here as the result of a dynamic overlay load - // which was spawned by a binding-attached event caused by - // StartLayout() on the master prototype - we must remember that - // this overlay has been merged and tell the listeners after - // StartLayout() is completely finished rather than doing so - // immediately - otherwise we may be executing code that needs to - // access XBL Binding implementations on nodes for which frames - // have not yet been constructed because their bindings have not - // yet been attached. This can be a race condition because dynamic - // overlay loading can take varying amounts of time depending on - // whether or not the overlay prototype is in the XUL cache. The - // most likely effect of this bug is odd UI initialization due to - // methods and properties that do not work. - // XXXbz really, we shouldn't be firing binding constructors - // until after StartLayout returns! - - if (!mPendingOverlayLoadNotifications) { - mPendingOverlayLoadNotifications = - new nsInterfaceHashtable; - } - - mPendingOverlayLoadNotifications->Get(overlayURI, getter_AddRefs(obs)); - if (!obs) { - mOverlayLoadObservers->Get(overlayURI, getter_AddRefs(obs)); - NS_ASSERTION(obs, "null overlay load observer?"); - mPendingOverlayLoadNotifications->Put(overlayURI, obs); - } - } - } } return NS_OK; @@ -2833,20 +2264,6 @@ XULDocument::EndUpdate() MaybeBroadcast(); } -void -XULDocument::ReportMissingOverlay(nsIURI* aURI) -{ - MOZ_ASSERT(aURI, "Must have a URI"); - - NS_ConvertUTF8toUTF16 utfSpec(aURI->GetSpecOrDefault()); - const char16_t* params[] = { utfSpec.get() }; - nsContentUtils::ReportToConsole(nsIScriptError::warningFlag, - NS_LITERAL_CSTRING("XUL Document"), this, - nsContentUtils::eXUL_PROPERTIES, - "MissingOverlay", - params, ArrayLength(params)); -} - nsresult XULDocument::LoadScript(nsXULPrototypeScript* aScriptProto, bool* aBlock) { @@ -3082,21 +2499,6 @@ XULDocument::OnScriptCompileComplete(JSScript* aScript, nsresult aStatus) nsXULPrototypeCache::GetInstance()->PutScript( scriptProto->mSrcURI, script); } - - if (mIsWritingFastLoad && mCurrentPrototype != mMasterPrototype) { - // If we are loading an overlay script, try to serialize - // it to the FastLoad file here. Master scripts will be - // serialized when the master prototype document gets - // written, at the bottom of ResumeWalk. That way, master - // out-of-line scripts are serialized in the same order that - // they'll be read, in the FastLoad file, which reduces the - // number of seeks that dump the underlying stream's buffer. - // - // Ignore the return value, as we don't need to propagate - // a failure to write to the FastLoad file, because this - // method aborts that whole process on error. - scriptProto->SerializeOutOfLine(nullptr, mCurrentPrototype); - } // ignore any evaluation errors } @@ -3230,27 +2632,6 @@ XULDocument::CreateElementFromPrototype(nsXULPrototypeElement* aPrototype, return NS_OK; } -nsresult -XULDocument::CreateOverlayElement(nsXULPrototypeElement* aPrototype, - Element** aResult) -{ - nsresult rv; - - RefPtr element; - rv = CreateElementFromPrototype(aPrototype, getter_AddRefs(element), false); - if (NS_FAILED(rv)) return rv; - - OverlayForwardReference* fwdref = - new OverlayForwardReference(this, element); - - // transferring ownership to ya... - rv = AddForwardReference(fwdref); - if (NS_FAILED(rv)) return rv; - - element.forget(aResult); - return NS_OK; -} - nsresult XULDocument::AddAttributes(nsXULPrototypeElement* aPrototype, Element* aElement) @@ -3274,251 +2655,6 @@ XULDocument::AddAttributes(nsXULPrototypeElement* aPrototype, } -//---------------------------------------------------------------------- -// -// XULDocument::OverlayForwardReference -// - -nsForwardReference::Result -XULDocument::OverlayForwardReference::Resolve() -{ - // Resolve a forward reference from an overlay element; attempt to - // hook it up into the main document. - nsresult rv; - RefPtr target; - - nsIPresShell *shell = mDocument->GetShell(); - bool notify = shell && shell->DidInitialize(); - - nsAutoString id; - mOverlay->GetAttr(kNameSpaceID_None, nsGkAtoms::id, id); - if (id.IsEmpty()) { - // mOverlay is a direct child of and has no id. - // Insert it under the root element in the base document. - Element* root = mDocument->GetRootElement(); - if (!root) { - return eResolve_Error; - } - - rv = XULDocument::InsertElement(root, mOverlay, notify); - if (NS_FAILED(rv)) return eResolve_Error; - - target = mOverlay; - } - else { - // The hook-up element has an id, try to match it with an element - // with the same id in the base document. - target = mDocument->GetElementById(id); - - // If we can't find the element in the document, defer the hookup - // until later. - if (!target) - return eResolve_Later; - - rv = Merge(target, mOverlay, notify); - if (NS_FAILED(rv)) return eResolve_Error; - } - - // Check if 'target' is still in our document --- it might not be! - if (!notify && target->GetUncomposedDoc() == mDocument) { - // Add child and any descendants to the element map - // XXX this is bogus, the content in 'target' might already be - // in the document - rv = mDocument->AddSubtreeToDocument(target); - if (NS_FAILED(rv)) return eResolve_Error; - } - - if (MOZ_LOG_TEST(gXULLog, LogLevel::Debug)) { - nsAutoCString idC; - LossyCopyUTF16toASCII(id, idC); - MOZ_LOG(gXULLog, LogLevel::Debug, - ("xul: overlay resolved '%s'", - idC.get())); - } - - mResolved = true; - return eResolve_Succeeded; -} - - - -nsresult -XULDocument::OverlayForwardReference::Merge(Element* aTargetElement, - Element* aOverlayElement, - bool aNotify) -{ - // This function is given: - // aTargetElement: the element in the document whose 'id' attribute - // matches a toplevel node in our overlay. - // aOverlayElement: the element in the overlay document that matches - // an element in the actual document. - // aNotify: whether or not content manipulation methods should - // use the aNotify parameter. After the initial - // reflow (i.e. in the dynamic overlay merge case), - // we want all the content manipulation methods we - // call to notify so that frames are constructed - // etc. Otherwise do not, since that's during initial - // document construction before StartLayout has been - // called which will do everything for us. - // - // This function merges the tree from the overlay into the tree in - // the document, overwriting attributes and appending child content - // nodes appropriately. (See XUL overlay reference for details) - - nsresult rv; - - // Merge attributes from the overlay content node to that of the - // actual document. - uint32_t i; - const nsAttrName* name; - for (i = 0; (name = aOverlayElement->GetAttrNameAt(i)); ++i) { - // We don't want to swap IDs, they should be the same. - if (name->Equals(nsGkAtoms::id)) - continue; - - // In certain cases merging command or observes is unsafe, so don't. - if (!aNotify) { - if (aTargetElement->NodeInfo()->Equals(nsGkAtoms::observes, - kNameSpaceID_XUL)) - continue; - - if (name->Equals(nsGkAtoms::observes) && - aTargetElement->HasAttr(kNameSpaceID_None, nsGkAtoms::observes)) - continue; - - if (name->Equals(nsGkAtoms::command) && - aTargetElement->HasAttr(kNameSpaceID_None, nsGkAtoms::command) && - !aTargetElement->NodeInfo()->Equals(nsGkAtoms::key, - kNameSpaceID_XUL) && - !aTargetElement->NodeInfo()->Equals(nsGkAtoms::menuitem, - kNameSpaceID_XUL)) - continue; - } - - int32_t nameSpaceID = name->NamespaceID(); - nsAtom* attr = name->LocalName(); - nsAtom* prefix = name->GetPrefix(); - - nsAutoString value; - aOverlayElement->GetAttr(nameSpaceID, attr, value); - - // Element in the overlay has the 'removeelement' attribute set - // so remove it from the actual document. - if (attr == nsGkAtoms::removeelement && value.EqualsLiteral("true")) { - nsCOMPtr parent = aTargetElement->GetParentNode(); - if (!parent) return NS_ERROR_FAILURE; - parent->RemoveChildNode(aTargetElement, true); - return NS_OK; - } - - rv = aTargetElement->SetAttr(nameSpaceID, attr, prefix, value, aNotify); - if (!NS_FAILED(rv) && !aNotify) { - rv = mDocument->BroadcastAttributeChangeFromOverlay( - aTargetElement, nameSpaceID, attr, prefix, value); - } - if (NS_FAILED(rv)) return rv; - } - - - // Walk our child nodes, looking for elements that have the 'id' - // attribute set. If we find any, we must do a parent check in the - // actual document to ensure that the structure matches that of - // the actual document. If it does, we can call ourselves and attempt - // to merge inside that subtree. If not, we just append the tree to - // the parent like any other. - - uint32_t childCount = aOverlayElement->GetChildCount(); - - // This must be a strong reference since it will be the only - // reference to a content object during part of this loop. - nsCOMPtr currContent; - - for (i = 0; i < childCount; ++i) { - currContent = aOverlayElement->GetFirstChild(); - - nsAtom *idAtom = currContent->GetID(); - - Element* elementInDocument = nullptr; - if (idAtom) { - nsDependentAtomString id(idAtom); - - if (!id.IsEmpty()) { - nsIDocument *doc = aTargetElement->GetUncomposedDoc(); - //XXXsmaug should we use ShadowRoot::GetElementById() - // if doc is null? - if (!doc) return NS_ERROR_FAILURE; - - elementInDocument = doc->GetElementById(id); - } - } - - // The item has an 'id' attribute set, and we need to check with - // the actual document to see if an item with this id exists at - // this locale. If so, we want to merge the subtree under that - // node. Otherwise, we just do an append as if the element had - // no id attribute. - if (elementInDocument) { - // Given two parents, aTargetElement and aOverlayElement, we want - // to call merge on currContent if we find an associated - // node in the document with the same id as currContent that - // also has aTargetNode as its parent. - - nsIContent* elementParent = elementInDocument->GetParent(); - - nsAtom *parentID = elementParent->GetID(); - if (parentID && aTargetElement->GetID() == parentID) { - // The element matches. "Go Deep!" - // - // Note that currContent is necessarily an element, because - // elementInDocument can only be non-null when currContent has a - // non-null ID. - rv = Merge(elementInDocument, currContent->AsElement(), aNotify); - if (NS_FAILED(rv)) return rv; - nsIContent* firstChild = aOverlayElement->GetFirstChild(); - if (firstChild) { - aOverlayElement->RemoveChildNode(firstChild, false); - } - - continue; - } - } - - nsIContent* firstChild = aOverlayElement->GetFirstChild(); - if (firstChild) { - aOverlayElement->RemoveChildNode(firstChild, false); - } - - rv = InsertElement(aTargetElement, currContent, aNotify); - if (NS_FAILED(rv)) return rv; - } - - return NS_OK; -} - - - -XULDocument::OverlayForwardReference::~OverlayForwardReference() -{ - if (MOZ_LOG_TEST(gXULLog, LogLevel::Warning) && !mResolved) { - nsAutoString id; - mOverlay->GetAttr(kNameSpaceID_None, nsGkAtoms::id, id); - - nsAutoCString idC; - LossyCopyUTF16toASCII(id, idC); - - nsIURI *protoURI = mDocument->mCurrentPrototype->GetURI(); - - nsCOMPtr docURI; - mDocument->mChannel->GetOriginalURI(getter_AddRefs(docURI)); - - MOZ_LOG(gXULLog, LogLevel::Warning, - ("xul: %s overlay failed to resolve '%s' in %s", - protoURI->GetSpecOrDefault().get(), idC.get(), - docURI ? docURI->GetSpecOrDefault().get() : "")); - } -} - - //---------------------------------------------------------------------- // // XULDocument::BroadcasterHookup @@ -3567,44 +2703,6 @@ XULDocument::BroadcasterHookup::~BroadcasterHookup() //---------------------------------------------------------------------- -nsresult -XULDocument::BroadcastAttributeChangeFromOverlay(nsIContent* aNode, - int32_t aNameSpaceID, - nsAtom* aAttribute, - nsAtom* aPrefix, - const nsAString& aValue) -{ - nsresult rv = NS_OK; - - if (!mBroadcasterMap || !CanBroadcast(aNameSpaceID, aAttribute)) - return rv; - - if (!aNode->IsElement()) - return rv; - - auto entry = static_cast - (mBroadcasterMap->Search(aNode->AsElement())); - if (!entry) - return rv; - - // We've got listeners: push the value. - for (size_t i = entry->mListeners.Length() - 1; i != (size_t)-1; --i) { - BroadcastListener* bl = entry->mListeners[i]; - - if ((bl->mAttribute != aAttribute) && - (bl->mAttribute != nsGkAtoms::_asterisk)) - continue; - - nsCOMPtr l = do_QueryReferent(bl->mListener); - if (l) { - rv = l->SetAttr(aNameSpaceID, aAttribute, - aPrefix, aValue, false); - if (NS_FAILED(rv)) return rv; - } - } - return rv; -} - nsresult XULDocument::FindBroadcaster(Element* aElement, Element** aListener, @@ -3628,13 +2726,6 @@ XULDocument::FindBroadcaster(Element* aElement, return NS_FINDBROADCASTER_NOT_FOUND; } - // If we're still parented by an 'overlay' tag, then we haven't - // made it into the real document yet. Defer hookup. - if (parent->NodeInfo()->Equals(nsGkAtoms::overlay, - kNameSpaceID_XUL)) { - return NS_FINDBROADCASTER_AWAIT_OVERLAYS; - } - *aListener = Element::FromNode(parent); NS_IF_ADDREF(*aListener); @@ -3683,8 +2774,7 @@ XULDocument::FindBroadcaster(Element* aElement, *aBroadcaster = GetElementById(aBroadcasterID); // If we can't find the broadcaster, then we'll need to defer the - // hookup. We may need to resolve some of the other overlays - // first. + // hookup. We may need to resolve some more content first. if (! *aBroadcaster) { return NS_FINDBROADCASTER_AWAIT_OVERLAYS; } @@ -3757,95 +2847,6 @@ XULDocument::CheckBroadcasterHookup(Element* aElement, return NS_OK; } -nsresult -XULDocument::InsertElement(nsINode* aParent, nsIContent* aChild, bool aNotify) -{ - // Insert aChild appropriately into aParent, accounting for a - // 'pos' attribute set on aChild. - - nsAutoString posStr; - bool wasInserted = false; - - // insert after an element of a given id - if (Element* element = Element::FromNode(aChild)) { - element->GetAttr(kNameSpaceID_None, nsGkAtoms::insertafter, posStr); - } - - bool isInsertAfter = true; - if (posStr.IsEmpty()) { - if (Element* element = Element::FromNode(aChild)) { - element->GetAttr(kNameSpaceID_None, nsGkAtoms::insertbefore, posStr); - } - isInsertAfter = false; - } - - if (!posStr.IsEmpty()) { - nsIDocument *document = aParent->OwnerDoc(); - - nsIContent *content = nullptr; - - char* str = ToNewCString(posStr); - char* rest; - char* token = nsCRT::strtok(str, ", ", &rest); - - while (token) { - content = document->GetElementById(NS_ConvertASCIItoUTF16(token)); - if (content) - break; - - token = nsCRT::strtok(rest, ", ", &rest); - } - free(str); - - if (content) { - if (content->GetParent() == aParent) { - nsIContent* nodeToInsertBefore = - isInsertAfter ? content->GetNextSibling() : content; - nsresult rv = aParent->InsertChildBefore(aChild, - nodeToInsertBefore, - aNotify); - if (NS_FAILED(rv)) { - return rv; - } - - wasInserted = true; - } - } - } - - if (!wasInserted) { - if (aChild->IsElement() && - aChild->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::position, posStr) && - !posStr.IsEmpty()) { - nsresult rv; - // Positions are one-indexed. - int32_t pos = posStr.ToInteger(&rv); - // Note: if the insertion index (which is |pos - 1|) would be less - // than 0 or greater than the number of children aParent has, then - // don't insert, since the position is bogus. Just skip on to - // appending. - if (NS_SUCCEEDED(rv) && pos > 0 && - uint32_t(pos - 1) <= aParent->GetChildCount()) { - nsIContent* nodeToInsertBefore = - aParent->GetChildAt_Deprecated(pos - 1); - rv = aParent->InsertChildBefore(aChild, nodeToInsertBefore, - aNotify); - if (NS_SUCCEEDED(rv)) - wasInserted = true; - // If the insertion fails, then we should still - // attempt an append. Thus, rather than returning rv - // immediately, we fall through to the final - // "catch-all" case that just does an AppendChildTo. - } - } - } - - if (!wasInserted) { - return aParent->AppendChildTo(aChild, aNotify); - } - return NS_OK; -} - //---------------------------------------------------------------------- // // CachedChromeStreamListener @@ -3897,77 +2898,6 @@ XULDocument::CachedChromeStreamListener::OnDataAvailable(nsIRequest *request, return NS_ERROR_UNEXPECTED; } -//---------------------------------------------------------------------- -// -// ParserObserver -// - -XULDocument::ParserObserver::ParserObserver(XULDocument* aDocument, - nsXULPrototypeDocument* aPrototype) - : mDocument(aDocument), mPrototype(aPrototype) -{ -} - -XULDocument::ParserObserver::~ParserObserver() -{ -} - -NS_IMPL_ISUPPORTS(XULDocument::ParserObserver, nsIRequestObserver) - -NS_IMETHODIMP -XULDocument::ParserObserver::OnStartRequest(nsIRequest *request, - nsISupports* aContext) -{ - // Guard against buggy channels calling OnStartRequest multiple times. - if (mPrototype) { - nsCOMPtr channel = do_QueryInterface(request); - nsIScriptSecurityManager* secMan = nsContentUtils::GetSecurityManager(); - if (channel && secMan) { - nsCOMPtr principal; - secMan->GetChannelResultPrincipal(channel, getter_AddRefs(principal)); - - principal = mDocument->MaybeDowngradePrincipal(principal); - // Failure there is ok -- it'll just set a (safe) null principal - mPrototype->SetDocumentPrincipal(principal); - } - - // Make sure to avoid cycles - mPrototype = nullptr; - } - - return NS_OK; -} - -NS_IMETHODIMP -XULDocument::ParserObserver::OnStopRequest(nsIRequest *request, - nsISupports* aContext, - nsresult aStatus) -{ - nsresult rv = NS_OK; - - if (NS_FAILED(aStatus)) { - // If an overlay load fails, we need to nudge the prototype - // walk along. - nsCOMPtr aChannel = do_QueryInterface(request); - if (aChannel) { - nsCOMPtr uri; - aChannel->GetOriginalURI(getter_AddRefs(uri)); - if (uri) { - mDocument->ReportMissingOverlay(uri); - } - } - - rv = mDocument->ResumeWalk(); - } - - // Drop the reference to the document to break cycle between the - // document, the parser, the content sink, and the parser - // observer. - mDocument = nullptr; - - return rv; -} - already_AddRefed XULDocument::GetWindowRoot() { diff --git a/dom/xul/XULDocument.h b/dom/xul/XULDocument.h index 68d9928d9b74..da1f5d5c80c1 100644 --- a/dom/xul/XULDocument.h +++ b/dom/xul/XULDocument.h @@ -106,10 +106,6 @@ public: * Sometimes the caller of OnPrototypeLoadDone resumes the walk itself */ nsresult OnPrototypeLoadDone(bool aResumeWalk); - /** - * Callback notifying when a document could not be parsed properly. - */ - bool OnDocumentParserError(); // nsINode interface overrides virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult, @@ -174,8 +170,6 @@ public: void Persist(const nsAString& aId, const nsAString& aAttr, ErrorResult& aRv); using nsDocument::GetBoxObjectFor; - void LoadOverlay(const nsAString& aURL, nsIObserver* aObserver, - ErrorResult& aRv); protected: virtual ~XULDocument(); @@ -201,10 +195,6 @@ protected: nsIPrincipal* aDocumentPrincipal, nsIParser** aResult); - nsresult - LoadOverlayInternal(nsIURI* aURI, bool aIsDynamic, bool* aShouldReturn, - bool* aFailureFromContent); - nsresult ApplyPersistentAttributes(); nsresult ApplyPersistentAttributesInternal(); nsresult ApplyPersistentAttributesToElements(const nsAString &aID, @@ -221,13 +211,6 @@ protected: Element* aListener, nsAtom* aAttr); - nsresult - BroadcastAttributeChangeFromOverlay(nsIContent* aNode, - int32_t aNameSpaceID, - nsAtom* aAttribute, - nsAtom* aPrefix, - const nsAString& aValue); - already_AddRefed GetWindowRoot(); static void DirectionChanged(const char* aPrefName, void* aData); @@ -275,12 +258,6 @@ protected: */ bool mStillWalking; - /** - * These two values control where persistent attributes get applied. - */ - bool mRestrictPersistence; - nsTHashtable mPersistenceIds; - nsCOMPtr mCommandDispatcher; // [OWNER] of the focus tracker uint32_t mPendingSheets; @@ -323,22 +300,6 @@ protected: friend class ContextStack; ContextStack mContextStack; - enum State { eState_Master, eState_Overlay }; - State mState; - - /** - * An array of overlay nsIURIs that have yet to be resolved. The - * order of the array is significant: overlays at the _end_ of the - * array are resolved before overlays earlier in the array (i.e., - * it is a stack). - * - * In the current implementation the order the overlays are loaded - * in is as follows: first overlays from xul-overlay PIs, in the - * same order as in the document, then the overlays from the chrome - * registry. - */ - nsTArray > mUnloadedOverlays; - /** * Load the transcluded script at the specified URI. If the * prototype construction must 'block' until the load has @@ -360,13 +321,6 @@ protected: Element** aResult, bool aIsRoot); - /** - * Create a hook-up element to which content nodes can be attached for - * later resolution. - */ - nsresult CreateOverlayElement(nsXULPrototypeElement* aPrototype, - Element** aResult); - /** * Add attributes from the prototype to the element. */ @@ -450,30 +404,6 @@ protected: friend class BroadcasterHookup; - /** - * Used to hook up overlays - */ - class OverlayForwardReference : public nsForwardReference - { - protected: - XULDocument* mDocument; // [WEAK] - nsCOMPtr mOverlay; // [OWNER] - bool mResolved; - - nsresult Merge(Element* aTargetNode, Element* aOverlayNode, bool aNotify); - - public: - OverlayForwardReference(XULDocument* aDocument, Element* aOverlay) - : mDocument(aDocument), mOverlay(aOverlay), mResolved(false) {} - - virtual ~OverlayForwardReference(); - - virtual Phase GetPhase() override { return eConstruction; } - virtual Result Resolve() override; - }; - - friend class OverlayForwardReference; - // The out params of FindBroadcaster only have values that make sense when // the method returns NS_FINDBROADCASTER_FOUND. In all other cases, the // values of the out params should not be relied on (though *aListener and @@ -495,24 +425,12 @@ protected: Element *aListener, const nsAString &aAttr); - // FIXME: This should probably be renamed, there's nothing guaranteeing that - // aChild is an Element as far as I can tell! - static - nsresult - InsertElement(nsINode* aParent, nsIContent* aChild, bool aNotify); - /** * The current prototype that we are walking to construct the * content model. */ RefPtr mCurrentPrototype; - /** - * The master document (outermost, .xul) prototype, from which - * all subdocuments get their security principals. - */ - RefPtr mMasterPrototype; - /** * Owning references to all of the prototype documents that were * used to construct this document. @@ -547,22 +465,6 @@ protected: nsINode* aBeforeThis, nsIContent* aPINode); - /** - * Inserts the passed PI at the specified index. - * Schedules the referenced overlay URI for further processing. - */ - nsresult - InsertXULOverlayPI(const nsXULPrototypePI* aProtoPI, - nsINode* aParent, - nsINode* aBeforeThis, - nsIContent* aPINode); - - /** - * Add overlays from the chrome registry to the set of unprocessed - * overlays still to do. - */ - nsresult AddChromeOverlays(); - /** * Resume (or initiate) an interrupted (or newly prepared) * prototype walk. @@ -576,12 +478,6 @@ protected: */ nsresult DoneWalking(); - /** - * Report that an overlay failed to load - * @param aURI the URI of the overlay that failed to load - */ - void ReportMissingOverlay(nsIURI* aURI); - class CachedChromeStreamListener : public nsIStreamListener { protected: RefPtr mDocument; @@ -600,31 +496,11 @@ protected: friend class CachedChromeStreamListener; - - class ParserObserver : public nsIRequestObserver { - protected: - RefPtr mDocument; - RefPtr mPrototype; - virtual ~ParserObserver(); - - public: - ParserObserver(XULDocument* aDocument, - nsXULPrototypeDocument* aPrototype); - - NS_DECL_ISUPPORTS - NS_DECL_NSIREQUESTOBSERVER - }; - - friend class ParserObserver; - /** * A map from a broadcaster element to a list of listener elements. */ PLDHashTable* mBroadcasterMap; - nsAutoPtr > mOverlayLoadObservers; - nsAutoPtr > mPendingOverlayLoadNotifications; - bool mInitialLayoutComplete; class nsDelayedBroadcastUpdate diff --git a/dom/xul/XULFrameElement.cpp b/dom/xul/XULFrameElement.cpp index 5c54b8982d54..a0d6b7d4dab6 100644 --- a/dom/xul/XULFrameElement.cpp +++ b/dom/xul/XULFrameElement.cpp @@ -79,9 +79,7 @@ void XULFrameElement::LoadSrc() { if (!IsInUncomposedDoc() || - !OwnerDoc()->GetRootElement() || - OwnerDoc()->GetRootElement()-> - NodeInfo()->Equals(nsGkAtoms::overlay, kNameSpaceID_XUL)) { + !OwnerDoc()->GetRootElement()) { return; } RefPtr frameLoader = GetFrameLoader(); diff --git a/dom/xul/moz.build b/dom/xul/moz.build index 72aec7142887..6e409e96d814 100644 --- a/dom/xul/moz.build +++ b/dom/xul/moz.build @@ -15,10 +15,6 @@ MOCHITEST_MANIFESTS += ['test/mochitest.ini'] MOCHITEST_CHROME_MANIFESTS += ['test/chrome.ini'] if CONFIG['MOZ_XUL']: - XPIDL_SOURCES += [ - 'nsIXULOverlayProvider.idl', - ] - EXPORTS += [ 'nsXULElement.h', ] diff --git a/dom/xul/nsIXULOverlayProvider.idl b/dom/xul/nsIXULOverlayProvider.idl deleted file mode 100644 index 79f5fd92022f..000000000000 --- a/dom/xul/nsIXULOverlayProvider.idl +++ /dev/null @@ -1,26 +0,0 @@ -/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* 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 nsISimpleEnumerator; -interface nsIURI; - -/** - * The chrome registry implements this interface to give overlays - * to the gecko XUL engine. - */ - -[scriptable, uuid(1d5b5b94-dc47-4050-93b7-ac092e383cad)] -interface nsIXULOverlayProvider : nsISupports -{ - /** - * Get the XUL overlays for a particular chrome URI. - * - * @param aURI The URI being loaded - * @return An enumerator of nsIURI for the overlays of this URI - */ - nsISimpleEnumerator /*nsIURI*/ getXULOverlays(in nsIURI aURI); -}; diff --git a/dom/xul/nsXULContentSink.cpp b/dom/xul/nsXULContentSink.cpp index 49acb6439140..7e0b33e7408f 100644 --- a/dom/xul/nsXULContentSink.cpp +++ b/dom/xul/nsXULContentSink.cpp @@ -651,13 +651,6 @@ XULContentSinkImpl::ReportError(const char16_t* aErrorText, return NS_OK; }; - if (idoc && - idoc->IsXULDocument() && - !idoc->AsXULDocument()->OnDocumentParserError()) { - // The overlay was broken. Don't add a messy element to the master doc. - return NS_OK; - } - const char16_t* noAtts[] = { 0, 0 }; NS_NAMED_LITERAL_STRING(errorNs, diff --git a/dom/xul/nsXULElement.cpp b/dom/xul/nsXULElement.cpp index bf95b69d7b9f..adcea3b5da80 100644 --- a/dom/xul/nsXULElement.cpp +++ b/dom/xul/nsXULElement.cpp @@ -426,8 +426,7 @@ nsXULElement::GetEventListenerManagerForAttr(nsAtom* aAttrName, bool* aDefer) nsPIDOMWindowInner *window; Element *root = doc->GetRootElement(); - if ((!root || root == this) && !mNodeInfo->Equals(nsGkAtoms::overlay) && - (window = doc->GetInnerWindow())) { + if ((!root || root == this) && (window = doc->GetInnerWindow())) { nsCOMPtr piTarget = do_QueryInterface(window); diff --git a/xpcom/build/Services.py b/xpcom/build/Services.py index 0817da4f9ad3..01d147da1188 100644 --- a/xpcom/build/Services.py +++ b/xpcom/build/Services.py @@ -14,8 +14,6 @@ service('ToolkitChromeRegistryService', 'nsIToolkitChromeRegistry', "@mozilla.org/chrome/chrome-registry;1") service('XULChromeRegistryService', 'nsIXULChromeRegistry', "@mozilla.org/chrome/chrome-registry;1") -service('XULOverlayProviderService', 'nsIXULOverlayProvider', - "@mozilla.org/chrome/chrome-registry;1") service('IOService', 'nsIIOService', "@mozilla.org/network/io-service;1") service('ObserverService', 'nsIObserverService', @@ -66,7 +64,6 @@ CPP_INCLUDES = """ #include "nsIChromeRegistry.h" #include "nsIStringBundle.h" #include "nsIToolkitChromeRegistry.h" -#include "nsIXULOverlayProvider.h" #include "IHistory.h" #include "nsIXPConnect.h" #include "nsIPermissionManager.h" diff --git a/xpcom/components/ManifestParser.cpp b/xpcom/components/ManifestParser.cpp index cb9fa127dc50..86c21e73f545 100644 --- a/xpcom/components/ManifestParser.cpp +++ b/xpcom/components/ManifestParser.cpp @@ -103,10 +103,6 @@ static const ManifestDirective kParsingTable[] = { "skin", 3, false, false, true, true, false, nullptr, &nsChromeRegistry::ManifestSkin, }, - { - "overlay", 2, false, true, true, false, false, - nullptr, &nsChromeRegistry::ManifestOverlay, - }, { // NB: note that while skin manifests can use this, they are only allowed // to use it for chrome://../skin/ URLs