Changeset 125656 in webkit


Ignore:
Timestamp:
Aug 15, 2012 1:26:06 AM (12 years ago)
Author:
abarth@webkit.org
Message:

[Chromium] fast/dom/Window/dom-access-from-closure-window.html is flaky on Linux
https://bugs.webkit.org/show_bug.cgi?id=94060

Reviewed by Kentaro Hara.

Source/WebCore:

Previously, the V8 garbage collector might have collected the Document
wrapper before the DOMWindow wrapper because we overwrite the
"document" property of the DOMWindow during navigation.

This patch adds a hidden document property on the global object to
ensure that the Document wrapper lives at least as long as the
DOMWindow wrapper, ensuring that DOMWindows that we obtain from V8
always have non-null Document objects.

The JavaScriptCore bindings already have this behavior.

Test: fast/dom/Window/dom-access-from-closure-window-with-gc.html

  • bindings/v8/V8DOMWindowShell.cpp:

(WebCore::V8DOMWindowShell::updateDocumentWrapperCache):

  • bindings/v8/V8HiddenPropertyName.h:

(WebCore):

LayoutTests:

Ensure that collecting garbage doesn't change the behavior of this test
(compared with dom-access-from-closure-window.html).

  • fast/dom/Window/dom-access-from-closure-window-with-gc-expected.txt: Added.
  • fast/dom/Window/dom-access-from-closure-window-with-gc.html: Added.
Location:
trunk
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r125655 r125656  
     12012-08-15  Adam Barth  <abarth@webkit.org>
     2
     3        [Chromium] fast/dom/Window/dom-access-from-closure-window.html is flaky on Linux
     4        https://bugs.webkit.org/show_bug.cgi?id=94060
     5
     6        Reviewed by Kentaro Hara.
     7
     8        Ensure that collecting garbage doesn't change the behavior of this test
     9        (compared with dom-access-from-closure-window.html).
     10
     11        * fast/dom/Window/dom-access-from-closure-window-with-gc-expected.txt: Added.
     12        * fast/dom/Window/dom-access-from-closure-window-with-gc.html: Added.
     13
    1142012-08-15  Yuta Kitamura  <yutak@google.com>
    215
  • trunk/Source/WebCore/ChangeLog

    r125654 r125656  
     12012-08-15  Adam Barth  <abarth@webkit.org>
     2
     3        [Chromium] fast/dom/Window/dom-access-from-closure-window.html is flaky on Linux
     4        https://bugs.webkit.org/show_bug.cgi?id=94060
     5
     6        Reviewed by Kentaro Hara.
     7
     8        Previously, the V8 garbage collector might have collected the Document
     9        wrapper before the DOMWindow wrapper because we overwrite the
     10        "document" property of the DOMWindow during navigation.
     11
     12        This patch adds a hidden document property on the global object to
     13        ensure that the Document wrapper lives at least as long as the
     14        DOMWindow wrapper, ensuring that DOMWindows that we obtain from V8
     15        always have non-null Document objects.
     16
     17        The JavaScriptCore bindings already have this behavior.
     18
     19        Test: fast/dom/Window/dom-access-from-closure-window-with-gc.html
     20
     21        * bindings/v8/V8DOMWindowShell.cpp:
     22        (WebCore::V8DOMWindowShell::updateDocumentWrapperCache):
     23        * bindings/v8/V8HiddenPropertyName.h:
     24        (WebCore):
     25
    1262012-08-14  Andrey Kosyakov  <caseq@chromium.org>
    227
  • trunk/Source/WebCore/bindings/v8/V8DOMWindowShell.cpp

    r125615 r125656  
    489489    ASSERT(documentWrapper->IsObject());
    490490    m_context->Global()->ForceSet(v8::String::New("document"), documentWrapper, static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontDelete));
     491
     492    // We also stash a reference to the document on the real global object so that
     493    // DOMWindow objects we obtain from JavaScript references are guaranteed to have
     494    // live Document objects.
     495    v8::Handle<v8::Object> v8RealGlobal = v8::Handle<v8::Object>::Cast(m_context->Global()->GetPrototype());
     496    v8RealGlobal->SetHiddenValue(V8HiddenPropertyName::document(), documentWrapper);
    491497}
    492498
  • trunk/Source/WebCore/bindings/v8/V8HiddenPropertyName.h

    r120347 r125656  
    3737
    3838#define V8_HIDDEN_PROPERTIES(V) \
     39    V(attributeListener) \
     40    V(document) \
     41    V(domStringMap) \
     42    V(domTokenList) \
     43    V(event) \
    3944    V(listener) \
    40     V(attributeListener) \
     45    V(ownerNode) \
    4146    V(scriptState) \
    4247    V(sleepFunction) \
    43     V(toStringString) \
    44     V(event) \
    4548    V(state) \
    46     V(domStringMap) \
    47     V(domTokenList) \
    48     V(ownerNode) \
    49     V(textTracks)
     49    V(textTracks) \
     50    V(toStringString)
    5051
    5152    class V8HiddenPropertyName {
Note: See TracChangeset for help on using the changeset viewer.