Bug 1362003 - nsGlobalWindow::GetLocation doesn't need to receive an ErrorResult param, r=bz

Renaming nsGlobalWindow::GetLocation() to Location().
This commit is contained in:
Andrea Marchesini 2017-05-08 15:49:31 +02:00
parent 28cfe0edb3
commit a67a0a31e8
10 changed files with 16 additions and 28 deletions

View File

@ -19,7 +19,6 @@
#include "nsIConsoleService.h"
#include "nsIDocument.h"
#include "nsIDOMDocument.h"
#include "nsIDOMLocation.h"
#include "nsIDOMWindowCollection.h"
#include "nsIDOMWindow.h"
#include "nsIObserverService.h"
@ -31,6 +30,7 @@
#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"
@ -42,6 +42,7 @@ nsChromeRegistry* nsChromeRegistry::gChromeRegistry;
// mozilla::TextRange and a TextRange in OSX headers.
using mozilla::StyleSheet;
using mozilla::dom::IsChromeURI;
using mozilla::dom::Location;
////////////////////////////////////////////////////////////////////////////////
@ -508,7 +509,7 @@ nsChromeRegistry::ReloadChrome()
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;

View File

@ -6877,9 +6877,7 @@ nsIDocument::GetLocation() const
}
nsGlobalWindow* window = nsGlobalWindow::Cast(w);
ErrorResult dummy;
RefPtr<Location> loc = window->GetLocation(dummy);
dummy.SuppressException();
RefPtr<Location> loc = window->Location();
return loc.forget();
}

View File

@ -10438,28 +10438,17 @@ nsGlobalWindow::GetPrivateRoot()
}
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)
{

View File

@ -855,8 +855,7 @@ public:
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);

View File

@ -91,6 +91,9 @@ enum class FullscreenReason
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
@ -570,7 +573,7 @@ public:
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;

View File

@ -7,7 +7,6 @@
interface nsIControllers;
interface nsIDOMBlob;
interface nsIDOMLocation;
interface nsIDOMOfflineResourceList;
interface nsIPrompt;
interface nsISelection;

View File

@ -8,7 +8,6 @@
#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

View File

@ -35,7 +35,7 @@ interface nsIDOMCrypto;
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"]

View File

@ -60,6 +60,7 @@
#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"
@ -74,7 +75,6 @@
#include "nsNetUtil.h"
#include "nsIURLParser.h"
#include "nsIDOMDataChannel.h"
#include "nsIDOMLocation.h"
#include "NullPrincipal.h"
#include "mozilla/PeerIdentity.h"
#include "mozilla/dom/RTCCertificate.h"
@ -609,7 +609,7 @@ PeerConnectionImpl::Initialize(PeerConnectionObserver& aObserver,
nsAutoCString locationCStr;
if (nsCOMPtr<nsIDOMLocation> location = mWindow->GetLocation()) {
if (RefPtr<Location> location = mWindow->Location()) {
nsAutoString locationAStr;
location->ToString(locationAStr);

View File

@ -35,11 +35,11 @@
#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>
@ -967,7 +967,7 @@ nsNativeAppSupportWin::HandleDDENotification( UINT uType, // transaction t
break;
}
// Get location.
nsCOMPtr<nsIDOMLocation> location = internalContent->GetLocation();
RefPtr<dom::Location> location = internalContent->Location();
if ( !location ) {
break;
}