Bug 940783 - Throw when accessing properties and methods on history objects in non-active documents. r=bz

This commit is contained in:
Bobby Holley 2013-11-20 08:47:59 -08:00
parent d31ab43b77
commit d4d3011edd

View File

@ -70,7 +70,7 @@ uint32_t
nsHistory::GetLength(ErrorResult& aRv) const
{
nsCOMPtr<nsPIDOMWindow> win(do_QueryReferent(mInnerWindow));
if (!win || !nsContentUtils::CanCallerAccess(win->GetOuterWindow())) {
if (!win || !win->IsCurrentInnerWindow()) {
aRv.Throw(NS_ERROR_DOM_SECURITY_ERR);
return 0;
@ -106,7 +106,7 @@ nsHistory::GetState(JSContext* aCx, ErrorResult& aRv) const
return JS::UndefinedValue();
}
if (!nsContentUtils::CanCallerAccess(win->GetOuterWindow())) {
if (!win->IsCurrentInnerWindow()) {
aRv.Throw(NS_ERROR_DOM_SECURITY_ERR);
return JS::UndefinedValue();
@ -146,7 +146,7 @@ void
nsHistory::Go(int32_t aDelta, ErrorResult& aRv)
{
nsCOMPtr<nsPIDOMWindow> win(do_QueryReferent(mInnerWindow));
if (!win || !nsContentUtils::CanCallerAccess(win->GetOuterWindow())) {
if (!win || !win->IsCurrentInnerWindow()) {
aRv.Throw(NS_ERROR_DOM_SECURITY_ERR);
return;
@ -202,7 +202,7 @@ void
nsHistory::Back(ErrorResult& aRv)
{
nsCOMPtr<nsPIDOMWindow> win(do_QueryReferent(mInnerWindow));
if (!win || !nsContentUtils::CanCallerAccess(win->GetOuterWindow())) {
if (!win || !win->IsCurrentInnerWindow()) {
aRv.Throw(NS_ERROR_DOM_SECURITY_ERR);
return;
@ -223,7 +223,7 @@ void
nsHistory::Forward(ErrorResult& aRv)
{
nsCOMPtr<nsPIDOMWindow> win(do_QueryReferent(mInnerWindow));
if (!win || !nsContentUtils::CanCallerAccess(win->GetOuterWindow())) {
if (!win || !win->IsCurrentInnerWindow()) {
aRv.Throw(NS_ERROR_DOM_SECURITY_ERR);
return;
@ -268,7 +268,7 @@ nsHistory::PushOrReplaceState(JSContext* aCx, JS::Handle<JS::Value> aData,
return;
}
if (!nsContentUtils::CanCallerAccess(win->GetOuterWindow())) {
if (!win->IsCurrentInnerWindow()) {
aRv.Throw(NS_ERROR_DOM_SECURITY_ERR);
return;