Bug 1473865 part 2 - Remove unused nsContentUtils::GetDocumentFromCaller. r=bz
authorJan de Mooij <jdemooij@mozilla.com>
Mon, 09 Jul 2018 12:26:49 +0200
changeset 425517 bf38bf7d87c6543c350f7a3a2d29f67e07188171
parent 425516 33dd027449633b0031acea1440a1f336cec9ae56
child 425518 4b42a006f52ad2ce42bb2cf953ca693ea8e6ed41
push id34256
push useraciure@mozilla.com
push dateMon, 09 Jul 2018 21:59:26 +0000
treeherdermozilla-central@19edc7c22303 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz
bugs1473865
milestone63.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 1473865 part 2 - Remove unused nsContentUtils::GetDocumentFromCaller. r=bz
dom/base/nsContentUtils.cpp
dom/base/nsContentUtils.h
--- a/dom/base/nsContentUtils.cpp
+++ b/dom/base/nsContentUtils.cpp
@@ -2226,30 +2226,16 @@ nsContentUtils::InProlog(nsINode *aNode)
   }
 
   nsIDocument* doc = parent->AsDocument();
   nsIContent* root = doc->GetRootElement();
 
   return !root || doc->ComputeIndexOf(aNode) < doc->ComputeIndexOf(root);
 }
 
-nsIDocument*
-nsContentUtils::GetDocumentFromCaller()
-{
-  AutoJSContext cx;
-
-  nsCOMPtr<nsPIDOMWindowInner> win =
-    do_QueryInterface(nsJSUtils::GetStaticScriptGlobal(JS::CurrentGlobalOrNull(cx)));
-  if (!win) {
-    return nullptr;
-  }
-
-  return win->GetExtantDoc();
-}
-
 bool
 nsContentUtils::IsCallerChrome()
 {
   MOZ_ASSERT(NS_IsMainThread());
   if (SubjectPrincipal() == sSystemPrincipal) {
     return true;
   }
 
--- a/dom/base/nsContentUtils.h
+++ b/dom/base/nsContentUtils.h
@@ -625,28 +625,16 @@ public:
    * which is known to the IO service, and has the URI_NORELATIVE flag.
    *
    * If the URL may be treated as absolute in some cases, but relative in others
    * (for instance, "http:foo", which can be either an absolute or relative URL,
    * depending on the context), this function returns false.
    */
   static bool IsAbsoluteURL(const nsACString& aURL);
 
-  /**
-   * GetDocumentFromCaller gets its document by looking at the last called
-   * function and finding the document that the function itself relates to.
-   * For example, consider two windows A and B in the same origin. B has a
-   * function which does something that ends up needing the current document.
-   * If a script in window A were to call B's function, GetDocumentFromCaller
-   * would find that function (in B) and return B's document.
-   *
-   * @return The document or null if no JS Context.
-   */
-  static nsIDocument* GetDocumentFromCaller();
-
   // Check if a node is in the document prolog, i.e. before the document
   // element.
   static bool InProlog(nsINode *aNode);
 
   static nsNameSpaceManager* NameSpaceManager()
   {
     return sNameSpaceManager;
   }