Bug 1335368 part 19. Get rid of IsCallerChrome in XMLDocument::Load. r=bholley
authorBoris Zbarsky <bzbarsky@mit.edu>
Wed, 01 Feb 2017 15:43:38 -0500
changeset 332104 65ceed81954925d78bc794d4ca78d041a89b22e4
parent 332103 127a99a30553c8133b65faa13e94607ede70f8de
child 332105 31c167d2724de40a2f4c18dcc85aaf29bea84798
push id31297
push usercbook@mozilla.com
push dateThu, 02 Feb 2017 13:27:06 +0000
treeherdermozilla-central@823dc40ab5fe [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbholley
bugs1335368
milestone54.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1335368 part 19. Get rid of IsCallerChrome in XMLDocument::Load. r=bholley
dom/webidl/XMLDocument.webidl
dom/xml/XMLDocument.cpp
dom/xml/XMLDocument.h
--- a/dom/webidl/XMLDocument.webidl
+++ b/dom/webidl/XMLDocument.webidl
@@ -8,16 +8,16 @@
  * http://www.whatwg.org/specs/web-apps/current-work/#xmldocument
  */
 
 // http://dom.spec.whatwg.org/#xmldocument
 interface XMLDocument : Document {};
 
 // http://www.whatwg.org/specs/web-apps/current-work/#xmldocument
 partial interface XMLDocument {
-  [Throws]
+  [Throws, NeedsCallerType]
   boolean load(DOMString url);
 };
 
 // Gecko extensions?
 partial interface XMLDocument {
   attribute boolean async;
 };
--- a/dom/xml/XMLDocument.cpp
+++ b/dom/xml/XMLDocument.cpp
@@ -272,17 +272,18 @@ XMLDocument::ResetToURI(nsIURI *aURI, ns
     mChannel->Cancel(NS_BINDING_ABORTED);
     mChannelIsPending = false;
   }
 
   nsDocument::ResetToURI(aURI, aLoadGroup, aPrincipal);
 }
 
 bool
-XMLDocument::Load(const nsAString& aUrl, ErrorResult& aRv)
+XMLDocument::Load(const nsAString& aUrl, CallerType aCallerType,
+                  ErrorResult& aRv)
 {
   bool hasHadScriptObject = true;
   nsIScriptGlobalObject* scriptObject =
     GetScriptHandlingObject(hasHadScriptObject);
   if (!scriptObject && hasHadScriptObject) {
     aRv.Throw(NS_ERROR_UNEXPECTED);
     return false;
   }
@@ -303,17 +304,17 @@ XMLDocument::Load(const nsAString& aUrl,
 
   // Reporting a warning on ourselves is rather pointless, because we probably
   // have no window id (and hence the warning won't show up in any web console)
   // and probably aren't considered a "content document" because we're not
   // loaded in a docshell, so won't accumulate telemetry for use counters.  Try
   // warning on our entry document, if any, since that should have things like
   // window ids and associated docshells.
   nsIDocument* docForWarning = callingDoc ? callingDoc.get() : this;
-  if (nsContentUtils::IsCallerChrome()) {
+  if (aCallerType == CallerType::System) {
     docForWarning->WarnOnceAbout(nsIDocument::eChromeUseOfDOM3LoadMethod);
   } else {
     docForWarning->WarnOnceAbout(nsIDocument::eUseOfDOM3LoadMethod);
   } 
 
   nsIURI *baseURI = mDocumentURI;
   nsAutoCString charset;
 
--- a/dom/xml/XMLDocument.h
+++ b/dom/xml/XMLDocument.h
@@ -3,16 +3,17 @@
 /* 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/. */
 
 #ifndef mozilla_dom_XMLDocument_h
 #define mozilla_dom_XMLDocument_h
 
 #include "mozilla/Attributes.h"
+#include "mozilla/dom/BindingDeclarations.h"
 #include "nsDocument.h"
 #include "nsIDOMXMLDocument.h"
 #include "nsIScriptContext.h"
 
 class nsIURI;
 class nsIChannel;
 
 namespace mozilla {
@@ -52,17 +53,17 @@ public:
 
   virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const override;
 
   virtual void DocAddSizeOfExcludingThis(nsWindowSizes* aWindowSizes) const override;
   // DocAddSizeOfIncludingThis is inherited from nsIDocument.
 
 
   // WebIDL API
-  bool Load(const nsAString& aUrl, mozilla::ErrorResult& aRv);
+  bool Load(const nsAString& aUrl, CallerType aCallerType, ErrorResult& aRv);
   bool Async() const
   {
     return mAsync;
   }
   void SetAsync(bool aAsync)
   {
     mAsync = aAsync;
   }