mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-28 05:10:49 +00:00
Backed out changeset 21276955f659 (bug 1720926) for causing hybrid bustages on nsIPrincipal. CLOSED TREE
This commit is contained in:
parent
9e2d25382b
commit
56b294e821
@ -29,7 +29,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1314912
|
|||||||
"history.back": () => win.history.back(),
|
"history.back": () => win.history.back(),
|
||||||
"history.forward": () => win.history.forward(),
|
"history.forward": () => win.history.forward(),
|
||||||
"history.go": () => win.history.go(-1),
|
"history.go": () => win.history.go(-1),
|
||||||
"location.href": () => win.location.href = win.location.href + "",
|
|
||||||
"location.hash": () => win.location.hash = inc++,
|
"location.hash": () => win.location.hash = inc++,
|
||||||
"location.host": () => win.location.host = win.location.host + "",
|
"location.host": () => win.location.host = win.location.host + "",
|
||||||
"location.hostname": () => win.location.hostname = win.location.hostname + "",
|
"location.hostname": () => win.location.hostname = win.location.hostname + "",
|
||||||
@ -37,9 +36,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1314912
|
|||||||
"location.port": () => win.location.port = win.location.port + "",
|
"location.port": () => win.location.port = win.location.port + "",
|
||||||
"location.protocol": () => win.location.protocol = win.location.protocol + "",
|
"location.protocol": () => win.location.protocol = win.location.protocol + "",
|
||||||
"location.search": () => win.location.search = win.location.search + "",
|
"location.search": () => win.location.search = win.location.search + "",
|
||||||
"location.assign": () => win.location.assign(`${win.location.href}#${inc++}`),
|
|
||||||
"location.replace": () => win.location.replace(`${win.location.href}#${inc++}`),
|
|
||||||
"location.reload": () => win.location.reload(),
|
|
||||||
});
|
});
|
||||||
|
|
||||||
async function test() {
|
async function test() {
|
||||||
|
@ -548,13 +548,7 @@ void Location::SetSearch(const nsAString& aSearch,
|
|||||||
SetURI(uri, aSubjectPrincipal, aRv);
|
SetURI(uri, aSubjectPrincipal, aRv);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Location::Reload(bool aForceget, nsIPrincipal& aSubjectPrincipal,
|
void Location::Reload(bool aForceget, ErrorResult& aRv) {
|
||||||
ErrorResult& aRv) {
|
|
||||||
if (!CallerSubsumes(&aSubjectPrincipal)) {
|
|
||||||
aRv.Throw(NS_ERROR_DOM_SECURITY_ERR);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsCOMPtr<nsIDocShell> docShell(GetDocShell());
|
nsCOMPtr<nsIDocShell> docShell(GetDocShell());
|
||||||
if (!docShell) {
|
if (!docShell) {
|
||||||
return aRv.Throw(NS_ERROR_FAILURE);
|
return aRv.Throw(NS_ERROR_FAILURE);
|
||||||
@ -580,21 +574,6 @@ void Location::Reload(bool aForceget, nsIPrincipal& aSubjectPrincipal,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RefPtr<BrowsingContext> bc = GetBrowsingContext();
|
|
||||||
if (!bc || bc->IsDiscarded()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
CallerType callerType = aSubjectPrincipal.IsSystemPrincipal()
|
|
||||||
? CallerType::System
|
|
||||||
: CallerType::NonSystem;
|
|
||||||
|
|
||||||
nsresult rv = bc->CheckLocationChangeRateLimit(callerType);
|
|
||||||
if (NS_FAILED(rv)) {
|
|
||||||
aRv.Throw(rv);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t reloadFlags = nsIWebNavigation::LOAD_FLAGS_NONE;
|
uint32_t reloadFlags = nsIWebNavigation::LOAD_FLAGS_NONE;
|
||||||
|
|
||||||
if (aForceget) {
|
if (aForceget) {
|
||||||
@ -602,7 +581,7 @@ void Location::Reload(bool aForceget, nsIPrincipal& aSubjectPrincipal,
|
|||||||
nsIWebNavigation::LOAD_FLAGS_BYPASS_PROXY;
|
nsIWebNavigation::LOAD_FLAGS_BYPASS_PROXY;
|
||||||
}
|
}
|
||||||
|
|
||||||
rv = nsDocShell::Cast(docShell)->Reload(reloadFlags);
|
nsresult rv = nsDocShell::Cast(docShell)->Reload(reloadFlags);
|
||||||
if (NS_FAILED(rv) && rv != NS_BINDING_ABORTED) {
|
if (NS_FAILED(rv) && rv != NS_BINDING_ABORTED) {
|
||||||
// NS_BINDING_ABORTED is returned when we attempt to reload a POST result
|
// NS_BINDING_ABORTED is returned when we attempt to reload a POST result
|
||||||
// and the user says no at the "do you want to reload?" prompt. Don't
|
// and the user says no at the "do you want to reload?" prompt. Don't
|
||||||
|
@ -43,7 +43,14 @@ class Location final : public nsISupports,
|
|||||||
ErrorResult& aError);
|
ErrorResult& aError);
|
||||||
|
|
||||||
void Reload(bool aForceget, nsIPrincipal& aSubjectPrincipal,
|
void Reload(bool aForceget, nsIPrincipal& aSubjectPrincipal,
|
||||||
ErrorResult& aError);
|
ErrorResult& aError) {
|
||||||
|
if (!CallerSubsumes(&aSubjectPrincipal)) {
|
||||||
|
aError.Throw(NS_ERROR_DOM_SECURITY_ERR);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Reload(aForceget, aError);
|
||||||
|
}
|
||||||
|
|
||||||
void GetHref(nsAString& aHref, nsIPrincipal& aSubjectPrincipal,
|
void GetHref(nsAString& aHref, nsIPrincipal& aSubjectPrincipal,
|
||||||
ErrorResult& aError) {
|
ErrorResult& aError) {
|
||||||
@ -111,6 +118,8 @@ class Location final : public nsISupports,
|
|||||||
|
|
||||||
nsresult ToString(nsAString& aString) { return GetHref(aString); }
|
nsresult ToString(nsAString& aString) { return GetHref(aString); }
|
||||||
|
|
||||||
|
void Reload(bool aForceget, ErrorResult& aRv);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual ~Location();
|
virtual ~Location();
|
||||||
|
|
||||||
|
@ -137,8 +137,7 @@ void nsHistory::GetState(JSContext* aCx, JS::MutableHandle<JS::Value> aResult,
|
|||||||
aResult.setNull();
|
aResult.setNull();
|
||||||
}
|
}
|
||||||
|
|
||||||
void nsHistory::Go(int32_t aDelta, nsIPrincipal& aSubjectPrincipal,
|
void nsHistory::Go(int32_t aDelta, CallerType aCallerType, ErrorResult& aRv) {
|
||||||
ErrorResult& aRv) {
|
|
||||||
LOG(("nsHistory::Go(%d)", aDelta));
|
LOG(("nsHistory::Go(%d)", aDelta));
|
||||||
nsCOMPtr<nsPIDOMWindowInner> win(do_QueryReferent(mInnerWindow));
|
nsCOMPtr<nsPIDOMWindowInner> win(do_QueryReferent(mInnerWindow));
|
||||||
if (!win || !win->HasActiveDocument()) {
|
if (!win || !win->HasActiveDocument()) {
|
||||||
@ -150,7 +149,7 @@ void nsHistory::Go(int32_t aDelta, nsIPrincipal& aSubjectPrincipal,
|
|||||||
// "When the go(delta) method is invoked, if delta is zero, the user agent
|
// "When the go(delta) method is invoked, if delta is zero, the user agent
|
||||||
// must act as if the location.reload() method was called instead."
|
// must act as if the location.reload() method was called instead."
|
||||||
RefPtr<Location> location = win->Location();
|
RefPtr<Location> location = win->Location();
|
||||||
return location->Reload(false, aSubjectPrincipal, aRv);
|
return location->Reload(false, aRv);
|
||||||
}
|
}
|
||||||
|
|
||||||
RefPtr<ChildSHistory> session_history = GetSessionHistory();
|
RefPtr<ChildSHistory> session_history = GetSessionHistory();
|
||||||
@ -164,16 +163,12 @@ void nsHistory::Go(int32_t aDelta, nsIPrincipal& aSubjectPrincipal,
|
|||||||
? win->GetWindowContext()->HasValidTransientUserGestureActivation()
|
? win->GetWindowContext()->HasValidTransientUserGestureActivation()
|
||||||
: false;
|
: false;
|
||||||
|
|
||||||
CallerType callerType = aSubjectPrincipal.IsSystemPrincipal()
|
|
||||||
? CallerType::System
|
|
||||||
: CallerType::NonSystem;
|
|
||||||
|
|
||||||
// Ignore the return value from Go(), since returning errors from Go() can
|
// Ignore the return value from Go(), since returning errors from Go() can
|
||||||
// lead to exceptions and a possible leak of history length
|
// lead to exceptions and a possible leak of history length
|
||||||
// AsyncGo throws if we hit the location change rate limit.
|
// AsyncGo throws if we hit the location change rate limit.
|
||||||
if (StaticPrefs::dom_window_history_async()) {
|
if (StaticPrefs::dom_window_history_async()) {
|
||||||
session_history->AsyncGo(aDelta, /* aRequireUserInteraction = */ false,
|
session_history->AsyncGo(aDelta, /* aRequireUserInteraction = */ false,
|
||||||
userActivation, callerType, aRv);
|
userActivation, aCallerType, aRv);
|
||||||
} else {
|
} else {
|
||||||
session_history->Go(aDelta, /* aRequireUserInteraction = */ false,
|
session_history->Go(aDelta, /* aRequireUserInteraction = */ false,
|
||||||
userActivation, IgnoreErrors());
|
userActivation, IgnoreErrors());
|
||||||
|
@ -45,7 +45,7 @@ class nsHistory final : public nsISupports, public nsWrapperCache {
|
|||||||
mozilla::ErrorResult& aRv);
|
mozilla::ErrorResult& aRv);
|
||||||
void GetState(JSContext* aCx, JS::MutableHandle<JS::Value> aResult,
|
void GetState(JSContext* aCx, JS::MutableHandle<JS::Value> aResult,
|
||||||
mozilla::ErrorResult& aRv) const;
|
mozilla::ErrorResult& aRv) const;
|
||||||
void Go(int32_t aDelta, nsIPrincipal& aSubjectPrincipal,
|
void Go(int32_t aDelta, mozilla::dom::CallerType aCallerType,
|
||||||
mozilla::ErrorResult& aRv);
|
mozilla::ErrorResult& aRv);
|
||||||
void Back(mozilla::dom::CallerType aCallerType, mozilla::ErrorResult& aRv);
|
void Back(mozilla::dom::CallerType aCallerType, mozilla::ErrorResult& aRv);
|
||||||
void Forward(mozilla::dom::CallerType aCallerType, mozilla::ErrorResult& aRv);
|
void Forward(mozilla::dom::CallerType aCallerType, mozilla::ErrorResult& aRv);
|
||||||
|
@ -21,7 +21,7 @@ interface History {
|
|||||||
attribute ScrollRestoration scrollRestoration;
|
attribute ScrollRestoration scrollRestoration;
|
||||||
[Throws]
|
[Throws]
|
||||||
readonly attribute any state;
|
readonly attribute any state;
|
||||||
[Throws, NeedsSubjectPrincipal]
|
[Throws, NeedsCallerType]
|
||||||
void go(optional long delta = 0);
|
void go(optional long delta = 0);
|
||||||
[Throws, NeedsCallerType]
|
[Throws, NeedsCallerType]
|
||||||
void back();
|
void back();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user