From e6a3a37bdf5276fa4f3b76652dbce8256cbf4683 Mon Sep 17 00:00:00 2001 From: "Glen E. Ivey" Date: Mon, 17 Aug 2009 11:10:05 -0700 Subject: [PATCH] Fixed bug causing window.parent to be mis-assigned for nested iframe's. --- dist/env.rhino.js | 5 ++--- src/platform/core.js | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/dist/env.rhino.js b/dist/env.rhino.js index eebd340b..64afd969 100644 --- a/dist/env.rhino.js +++ b/dist/env.rhino.js @@ -177,7 +177,6 @@ var Envjs = function(){ $env.loadFrame = function(frame, url){ try { - /* this code semi-duplicated in dom/implementation.js -- sorry */ var frameWindow, makingNewWinFlag = !(frame._content); if (makingNewWinFlag) @@ -194,7 +193,7 @@ var Envjs = function(){ // global/window and won't be able to get at them.... var local__window__ = $env.window, local_env = $env, - local_window = window; + local_window = frame.ownerDocument.parentWindow; // a local function gives us something whose scope // is easy to change @@ -213,7 +212,7 @@ var Envjs = function(){ // change scope of window object creation // functions, so that functions/code they create // will be scoped to new window object - // *FunctionObjectsScope() from EnvjsRhinoSupraGlobal.java + // getScope()/setScope() from Window.java var scopes = { frame : $env.getScope(__frame__), window : $env.getScope(local__window__), diff --git a/src/platform/core.js b/src/platform/core.js index e02f1ff1..c72c1ff8 100644 --- a/src/platform/core.js +++ b/src/platform/core.js @@ -172,7 +172,6 @@ var Envjs = function(){ $env.loadFrame = function(frame, url){ try { - /* this code semi-duplicated in dom/implementation.js -- sorry */ var frameWindow, makingNewWinFlag = !(frame._content); if (makingNewWinFlag) @@ -189,7 +188,7 @@ var Envjs = function(){ // global/window and won't be able to get at them.... var local__window__ = $env.window, local_env = $env, - local_window = window; + local_window = frame.ownerDocument.parentWindow; // a local function gives us something whose scope // is easy to change @@ -208,7 +207,7 @@ var Envjs = function(){ // change scope of window object creation // functions, so that functions/code they create // will be scoped to new window object - // *FunctionObjectsScope() from EnvjsRhinoSupraGlobal.java + // getScope()/setScope() from Window.java var scopes = { frame : $env.getScope(__frame__), window : $env.getScope(local__window__),