JavaScript objects visible in FireBug not available in code

In my code, I have a line that unloads the current window (which is the YouTube video page):

Firebug.Console.log(myWindow);

You can see that the window object contains the yt property, which is another object that can be easily checked in the debugger:

http://i.imgur.com/lHHns.png

Unfortunately call

 Firebug.Console.log(myWindow.yt);

logs "undefined" - why is this and how can I access this property "yt"?

Edit: one addition that may be important: the code I'm writing is part of the firefox extension, so it doesn’t work inside pgae, but in chrome - I am starting to think that this may be the reason, Can the chrome scripts be limited to that they can see / enter unlike the code in script tags?

+5
3

Firefox -, wrapper. , DOM, , JavaScript, . :

Firebug.Console.log(XPCNativeWrapper.wrappedJSObject.yt);

, - , , - (, : myWindow.location.href = "javascript:...").

+2

Firefox Chrome JavaScript .

0

, , API.

console.log(obj); shows the contents of the entire object, but when accessing the properties of the object in the code, they are not yet filled due to the asynchrony of the call.

Why Chrome and Firefox show that they are all full, this is probably just a synchronization problem, as they probably also handle asynchronously console.log().

0
source

All Articles