LGTM

https://codereview.chromium.org/11635033/diff/1/test/cctest/test-object-observe.cc
File test/cctest/test-object-observe.cc (right):

https://codereview.chromium.org/11635033/diff/1/test/cctest/test-object-observe.cc#newcode372
test/cctest/test-object-observe.cc:372: "Object.observe(obj, function(r)
{ records = r });"
On 2012/12/21 01:53:46, adamk wrote:
On 2012/12/20 15:18:35, rossberg wrote:
> How about also adding the dual test, where you observe the hidden
prototype
but
> not the object?

Added. The result is...unfortunate. But in most uses of hidden
prototypes I
wouldn't expect user code to even have access to the hidden proto in
order to
call observe()!

I'm not so sure. From V8DOMWindowShell.cpp:

// To implement split-window, see
//   1) https://bugs.webkit.org/show_bug.cgi?id=17249
//   2) https://wiki.mozilla.org/Gecko:SplitWindow
//   3) https://bugzilla.mozilla.org/show_bug.cgi?id=296639
// we need to split the shadow object further into two objects:
// an outer window and an inner window. The inner window is the hidden
// prototype of the outer window. The inner window is the default
// global object of the context. A variable declared in the global
// scope is a property of the inner window.
//
// The outer window sticks to a Frame, it is exposed to JavaScript
// via window.window, window.self, window.parent, etc. The outer window
// has a security token which is the domain. The outer window cannot
// have its own properties. window.foo = 'x' is delegated to the
// inner window.
//
// When a frame navigates to a new page, the inner window is cut off
// the outer window, and the outer window identify is preserved for
// the frame. However, a new inner window is created for the new page.
// If there are JS code holds a closure to the old inner window,
// it won't be able to reach the outer window via its global object.

That seems to imply that you can get a handle on both the outer and the
inner window, and try to observe either. Now, I have always thought that
this is an abomination, and one that fundamentally violates the JS
object model. But it seems to reflect the reality of the web, and the
awful requirements of the DOM spec.

https://codereview.chromium.org/11635033/

--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to