Skip to content

Commit

Permalink
Wrapping bot.frame.defaultContent in anonymous function
Browse files Browse the repository at this point in the history
In the injected case, we are not interested in the returned wrapped window
object. In point of fact, other atoms can get confused by this. Wrapping
in an anonymous function prevents this.
  • Loading branch information
jimevans committed Jan 6, 2014
1 parent 8b36b07 commit acf49c8
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion javascript/webdriver/atoms/inject/frame.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,11 @@ webdriver.atoms.inject.frame.findFrameByIndex = function(index, opt_root) {
* which is the top window.
*/
webdriver.atoms.inject.frame.defaultContent = function() {
return webdriver.atoms.inject.executeScript(bot.frame.defaultContent, []);
// When calling bot.frame.defaultContent in the injected case,
// we don't care about the wrapped window object, so we can
// wrap the atom here.
return webdriver.atoms.inject.executeScript(
function() { bot.frame.defaultContent(); }, []);
};


Expand Down

0 comments on commit acf49c8

Please sign in to comment.