Bug 1362003 - nsGlobalWindow::GetLocation doesn't need to receive an ErrorResult param, r=bz
authorAndrea Marchesini <amarchesini@mozilla.com>
Mon, 08 May 2017 15:49:31 +0200
changeset 357023 9e2bc7a6959b2b9de8bfec2370c66e1d3a6d0cdc
parent 357022 79890abc6ff5b948d3508739a13d2064952fa40d
child 357024 48282ae47cf7651d1fca38d024a2d2e33688d0c8
push id90014
push useramarchesini@mozilla.com
push dateMon, 08 May 2017 13:54:52 +0000
treeherdermozilla-inbound@48282ae47cf7 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz
bugs1362003
milestone55.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 1362003 - nsGlobalWindow::GetLocation doesn't need to receive an ErrorResult param, r=bz Renaming nsGlobalWindow::GetLocation() to Location().
chrome/nsChromeRegistry.cpp
dom/base/nsDocument.cpp
dom/base/nsGlobalWindow.cpp
dom/base/nsGlobalWindow.h
dom/base/nsPIDOMWindow.h
dom/interfaces/base/nsIDOMWindow.idl
dom/ipc/TelemetryScrollProbe.cpp
dom/webidl/Window.webidl
media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp
toolkit/xre/nsNativeAppSupportWin.cpp
--- a/chrome/nsChromeRegistry.cpp
+++ b/chrome/nsChromeRegistry.cpp
@@ -14,39 +14,40 @@
 #include "nsNetUtil.h"
 #include "nsString.h"
 #include "nsQueryObject.h"
 
 #include "mozilla/dom/URL.h"
 #include "nsIConsoleService.h"
 #include "nsIDocument.h"
 #include "nsIDOMDocument.h"
-#include "nsIDOMLocation.h"
 #include "nsIDOMWindowCollection.h"
 #include "nsIDOMWindow.h"
 #include "nsIObserverService.h"
 #include "nsIPresShell.h"
 #include "nsIScriptError.h"
 #include "nsIWindowMediator.h"
 #include "nsIPrefService.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/Printf.h"
 #include "mozilla/StyleSheet.h"
 #include "mozilla/StyleSheetInlines.h"
+#include "mozilla/dom/Location.h"
 
 #ifdef ENABLE_INTL_API
 #include "unicode/uloc.h"
 #endif
 
 nsChromeRegistry* nsChromeRegistry::gChromeRegistry;
 
 // DO NOT use namespace mozilla; it'll break due to a naming conflict between
 // mozilla::TextRange and a TextRange in OSX headers.
 using mozilla::StyleSheet;
 using mozilla::dom::IsChromeURI;
+using mozilla::dom::Location;
 
 ////////////////////////////////////////////////////////////////////////////////
 
 void
 nsChromeRegistry::LogMessage(const char* aMsg, ...)
 {
   nsCOMPtr<nsIConsoleService> console 
     (do_GetService(NS_CONSOLESERVICE_CONTRACTID));
@@ -503,17 +504,17 @@ nsChromeRegistry::ReloadChrome()
       rv = windowEnumerator->HasMoreElements(&more);
       if (NS_FAILED(rv)) return rv;
       while (more) {
         nsCOMPtr<nsISupports> protoWindow;
         rv = windowEnumerator->GetNext(getter_AddRefs(protoWindow));
         if (NS_SUCCEEDED(rv)) {
           nsCOMPtr<nsPIDOMWindowOuter> domWindow = do_QueryInterface(protoWindow);
           if (domWindow) {
-            nsIDOMLocation* location = domWindow->GetLocation();
+            Location* location = domWindow->Location();
             if (location) {
               rv = location->Reload(false);
               if (NS_FAILED(rv)) return rv;
             }
           }
         }
         rv = windowEnumerator->HasMoreElements(&more);
         if (NS_FAILED(rv)) return rv;
--- a/dom/base/nsDocument.cpp
+++ b/dom/base/nsDocument.cpp
@@ -6872,19 +6872,17 @@ nsIDocument::GetLocation() const
 {
   nsCOMPtr<nsPIDOMWindowInner> w = do_QueryInterface(mScriptGlobalObject);
 
   if (!w) {
     return nullptr;
   }
 
   nsGlobalWindow* window = nsGlobalWindow::Cast(w);
-  ErrorResult dummy;
-  RefPtr<Location> loc = window->GetLocation(dummy);
-  dummy.SuppressException();
+  RefPtr<Location> loc = window->Location();
   return loc.forget();
 }
 
 Element*
 nsIDocument::GetHtmlElement() const
 {
   Element* rootElement = GetRootElement();
   if (rootElement && rootElement->IsHTMLElement(nsGkAtoms::html))
--- a/dom/base/nsGlobalWindow.cpp
+++ b/dom/base/nsGlobalWindow.cpp
@@ -10433,38 +10433,27 @@ nsGlobalWindow::GetPrivateRoot()
       }
     }
   }
 
   return top;
 }
 
 Location*
-nsGlobalWindow::GetLocation(ErrorResult& aError)
+nsGlobalWindow::Location()
 {
   MOZ_RELEASE_ASSERT(IsInnerWindow());
 
   if (!mLocation) {
-    mLocation = new Location(AsInner(), GetDocShell());
+    mLocation = new dom::Location(AsInner(), GetDocShell());
   }
 
   return mLocation;
 }
 
-nsIDOMLocation*
-nsGlobalWindow::GetLocation()
-{
-  FORWARD_TO_INNER(GetLocation, (), nullptr);
-
-  ErrorResult dummy;
-  nsIDOMLocation* location = GetLocation(dummy);
-  dummy.SuppressException();
-  return location;
-}
-
 void
 nsGlobalWindow::ActivateOrDeactivate(bool aActivate)
 {
   MOZ_ASSERT(IsOuterWindow());
 
   if (!mDoc) {
     return;
   }
--- a/dom/base/nsGlobalWindow.h
+++ b/dom/base/nsGlobalWindow.h
@@ -850,18 +850,17 @@ public:
   nsIDocument* GetDocument()
   {
     return GetDoc();
   }
   void GetNameOuter(nsAString& aName);
   void GetName(nsAString& aName, mozilla::ErrorResult& aError);
   void SetNameOuter(const nsAString& aName, mozilla::ErrorResult& aError);
   void SetName(const nsAString& aName, mozilla::ErrorResult& aError);
-  mozilla::dom::Location* GetLocation(mozilla::ErrorResult& aError);
-  nsIDOMLocation* GetLocation() override;
+  mozilla::dom::Location* Location() override;
   nsHistory* GetHistory(mozilla::ErrorResult& aError);
   mozilla::dom::CustomElementRegistry* CustomElements() override;
   mozilla::dom::BarProp* GetLocationbar(mozilla::ErrorResult& aError);
   mozilla::dom::BarProp* GetMenubar(mozilla::ErrorResult& aError);
   mozilla::dom::BarProp* GetPersonalbar(mozilla::ErrorResult& aError);
   mozilla::dom::BarProp* GetScrollbars(mozilla::ErrorResult& aError);
   mozilla::dom::BarProp* GetStatusbar(mozilla::ErrorResult& aError);
   mozilla::dom::BarProp* GetToolbar(mozilla::ErrorResult& aError);
--- a/dom/base/nsPIDOMWindow.h
+++ b/dom/base/nsPIDOMWindow.h
@@ -86,16 +86,19 @@ enum class FullscreenReason
   // This reason can only be used with exiting fullscreen.
   // It is otherwise identical to eForFullscreenAPI except it would
   // suppress the fullscreen transition.
   ForForceExitFullscreen
 };
 
 namespace mozilla {
 namespace dom {
+
+class Location;
+
 // The states in this enum represent the different possible outcomes which the
 // window could be experiencing of loading a document with the
 // Large-Allocation header. The NONE case represents the case where no
 // Large-Allocation header was set.
 enum class LargeAllocStatus : uint8_t
 {
   // These are the OK states, NONE means that no large allocation status message
   // should be printed, while SUCCESS means that the success message should be
@@ -565,17 +568,17 @@ public:
 
   uint32_t GetMarkedCCGeneration()
   {
     return mMarkedCCGeneration;
   }
 
   virtual nsIDOMScreen* GetScreen() = 0;
   virtual nsIDOMNavigator* GetNavigator() = 0;
-  virtual nsIDOMLocation* GetLocation() = 0;
+  virtual mozilla::dom::Location* Location() = 0;
   virtual nsresult GetPrompter(nsIPrompt** aPrompt) = 0;
   virtual nsresult GetControllers(nsIControllers** aControllers) = 0;
   virtual already_AddRefed<nsISelection> GetSelection() = 0;
   virtual already_AddRefed<nsPIDOMWindowOuter> GetOpener() = 0;
   virtual already_AddRefed<nsIDOMWindowCollection> GetFrames() = 0;
   // aLoadInfo will be passed on through to the windowwatcher.
   // aForceNoOpener will act just like a "noopener" feature in aOptions except
   //                will not affect any other window features.
--- a/dom/interfaces/base/nsIDOMWindow.idl
+++ b/dom/interfaces/base/nsIDOMWindow.idl
@@ -2,17 +2,16 @@
 /* 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 "domstubs.idl"
 
 interface nsIControllers;
 interface nsIDOMBlob;
-interface nsIDOMLocation;
 interface nsIDOMOfflineResourceList;
 interface nsIPrompt;
 interface nsISelection;
 interface nsIVariant;
 
 /**
  * Empty interface for compatibility with older versions.
  * @deprecated Use WebIDL for script visible features,
--- a/dom/ipc/TelemetryScrollProbe.cpp
+++ b/dom/ipc/TelemetryScrollProbe.cpp
@@ -3,17 +3,16 @@
 /* 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 "TelemetryScrollProbe.h"
 
 #include "nsIDOMDocument.h"     // for nsIDOMDocument
 #include "nsIDOMEvent.h"        // for nsIDOMEvent
-#include "nsIDOMLocation.h"     // for nsIDOMLocation
 #include "nsIURI.h"             // for nsIURI
 #include "TabChild.h"           // for TabChildGlobal, TabChildBase
 #include "mozilla/Telemetry.h"  // for mozilla::Telemetry
 
 namespace mozilla {
 namespace dom {
 
 /* static */ void
--- a/dom/webidl/Window.webidl
+++ b/dom/webidl/Window.webidl
@@ -30,17 +30,17 @@ interface nsIDOMCrypto;
 /*sealed*/ interface Window : EventTarget {
   // the current browsing context
   [Unforgeable, Constant, StoreInSlot,
    CrossOriginReadable] readonly attribute Window window;
   [Replaceable, Constant, StoreInSlot,
    CrossOriginReadable] readonly attribute Window self;
   [Unforgeable, StoreInSlot, Pure] readonly attribute Document? document;
   [Throws] attribute DOMString name;
-  [PutForwards=href, Unforgeable, Throws,
+  [PutForwards=href, Unforgeable,
    CrossOriginReadable, CrossOriginWritable] readonly attribute Location location;
   [Throws] readonly attribute History history;
   [Func="CustomElementRegistry::IsCustomElementEnabled"]
   readonly attribute CustomElementRegistry customElements;
   [Replaceable, Throws] readonly attribute BarProp locationbar;
   [Replaceable, Throws] readonly attribute BarProp menubar;
   [Replaceable, Throws] readonly attribute BarProp personalbar;
   [Replaceable, Throws] readonly attribute BarProp scrollbars;
--- a/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp
+++ b/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp
@@ -55,31 +55,31 @@
 #ifdef CreateEvent
 #undef CreateEvent
 #endif
 #endif // XP_WIN
 
 #include "nsIDocument.h"
 #include "nsGlobalWindow.h"
 #include "nsDOMDataChannel.h"
+#include "mozilla/dom/Location.h"
 #include "mozilla/dom/Performance.h"
 #include "mozilla/TimeStamp.h"
 #include "mozilla/Telemetry.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/PublicSSL.h"
 #include "nsXULAppAPI.h"
 #include "nsContentUtils.h"
 #include "nsDOMJSUtils.h"
 #include "nsIScriptError.h"
 #include "nsPrintfCString.h"
 #include "nsURLHelper.h"
 #include "nsNetUtil.h"
 #include "nsIURLParser.h"
 #include "nsIDOMDataChannel.h"
-#include "nsIDOMLocation.h"
 #include "NullPrincipal.h"
 #include "mozilla/PeerIdentity.h"
 #include "mozilla/dom/RTCCertificate.h"
 #include "mozilla/dom/RTCConfigurationBinding.h"
 #include "mozilla/dom/RTCDTMFSenderBinding.h"
 #include "mozilla/dom/RTCDTMFToneChangeEvent.h"
 #include "mozilla/dom/RTCRtpSenderBinding.h"
 #include "mozilla/dom/RTCStatsReportBinding.h"
@@ -604,17 +604,17 @@ PeerConnectionImpl::Initialize(PeerConne
   NS_ENSURE_STATE(mWindow);
 
   PRTime timestamp = PR_Now();
   // Ok if we truncate this.
   char temp[128];
 
   nsAutoCString locationCStr;
 
-  if (nsCOMPtr<nsIDOMLocation> location = mWindow->GetLocation()) {
+  if (RefPtr<Location> location = mWindow->Location()) {
     nsAutoString locationAStr;
     location->ToString(locationAStr);
 
     CopyUTF16toUTF8(locationAStr, locationCStr);
   }
 
   SprintfLiteral(temp,
                  "%" PRIu64 " (id=%" PRIu64 " url=%s)",
--- a/toolkit/xre/nsNativeAppSupportWin.cpp
+++ b/toolkit/xre/nsNativeAppSupportWin.cpp
@@ -30,21 +30,21 @@
 #include "nsIInterfaceRequestorUtils.h"
 #include "nsIPromptService.h"
 #include "nsNetCID.h"
 #include "nsNetUtil.h"
 #include "mozilla/Services.h"
 #include "nsIFile.h"
 #include "nsIObserver.h"
 #include "nsIObserverService.h"
-#include "nsIDOMLocation.h"
 #include "nsIWebNavigation.h"
 #include "nsIWindowMediator.h"
 #include "nsNativeCharsetUtils.h"
 #include "nsIAppStartup.h"
+#include "mozilla/dom/Location.h"
 
 #include <windows.h>
 #include <shellapi.h>
 #include <ddeml.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <io.h>
 #include <direct.h>
@@ -962,17 +962,17 @@ nsNativeAppSupportWin::HandleDDENotifica
                         }
 
                         // Get content window.
                         nsCOMPtr<nsPIDOMWindowOuter> internalContent = nsGlobalWindow::Cast(piNavWin)->GetContent();
                         if ( !internalContent ) {
                             break;
                         }
                         // Get location.
-                        nsCOMPtr<nsIDOMLocation> location = internalContent->GetLocation();
+                        RefPtr<dom::Location> location = internalContent->Location();
                         if ( !location ) {
                             break;
                         }
                         // Get href for URL.
                         nsAutoString url;
                         if ( NS_FAILED( location->GetHref( url ) ) ) {
                             break;
                         }