Changeset 47130 in webkit


Ignore:
Timestamp:
Aug 12, 2009 11:43:47 AM (15 years ago)
Author:
Nate Chapin
Message:

2009-08-12 Nate Chapin <Nate Chapin>

Reviewed by Adam Barth.

Add a Custom Setter for DOMWindowEvent in the V8 bindings.
https://bugs.webkit.org/show_bug.cgi?id=27719

Tests: fast/events/set-event-in-another-frame.html

fast/events/set-event-to-null.html

Location:
trunk
Files:
4 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r47128 r47130  
     12009-08-12  Nate Chapin  <japhet@chromium.org>
     2
     3        Reviewed by Adam Barth.
     4
     5        Add a layout test to ensure that window.event can be properly accessed
     6        after it has been nulled by a script on a page.
     7
     8        https://bugs.webkit.org/show_bug.cgi?id=27719
     9
     10        * fast/events/set-event-in-another-frame-expected.txt: Added.
     11        * fast/events/set-event-in-another-frame.html: Added.
     12        * fast/events/set-event-to-null-expected.txt: Added.
     13        * fast/events/set-event-to-null.html: Added.
     14
    1152009-08-12  Eric Seidel  <eric@webkit.org>
    216
  • trunk/WebCore/ChangeLog

    r47127 r47130  
     12009-08-12  Nate Chapin  <japhet@chromium.org>
     2
     3        Reviewed by Adam Barth.
     4
     5        Add a Custom Setter for DOMWindowEvent in the V8 bindings.
     6        https://bugs.webkit.org/show_bug.cgi?id=27719
     7
     8        Tests: fast/events/set-event-in-another-frame.html
     9               fast/events/set-event-to-null.html
     10
     11        * bindings/scripts/CodeGeneratorV8.pm: Clean up custom getter/setter code,
     12            as it currently doesn't support a custom getter
     13            and a v8-specific custom setter simultaneously.
     14        * bindings/v8/custom/V8CustomBinding.h:
     15        * bindings/v8/custom/V8DOMWindowCustom.cpp:
     16        (WebCore::ACCESSOR_SETTER):
     17        * page/DOMWindow.idl:
     18
    1192009-08-12  Peter Kasting  <pkasting@google.com>
    220
  • trunk/WebCore/bindings/scripts/CodeGeneratorV8.pm

    r47001 r47130  
    976976                }
    977977            }
    978 
    979         # Custom Getter and Setter
    980         } elsif ($attrExt->{"Custom"} || $attrExt->{"V8Custom"}) {
    981             $getter = "V8Custom::v8${customAccessor}AccessorGetter";
    982             if ($interfaceName eq "WorkerContext" and $attrName eq "self") {
    983                 $setter = "0";
    984                 $propAttr = "v8::ReadOnly";
    985             } else {
     978        } else {
     979            # Default Getter and Setter
     980            $getter = "${interfaceName}Internal::${attrName}AttrGetter";
     981            $setter = "${interfaceName}Internal::${attrName}AttrSetter";
     982
     983            # Custom Setter
     984            if ($attrExt->{"CustomSetter"} || $attrExt->{"V8CustomSetter"} || $attrExt->{"Custom"} || $attrExt->{"V8Custom"}) {
    986985                $hasCustomSetter = 1;
    987986                $setter = "V8Custom::v8${customAccessor}AccessorSetter";
    988987            }
    989988
    990         # Custom Setter
    991         } elsif ($attrExt->{"CustomSetter"} || $attrExt->{"V8CustomSetter"}) {
    992             $hasCustomSetter = 1;
    993             $getter = "${interfaceName}Internal::${attrName}AttrGetter";
    994             $setter = "V8Custom::v8${customAccessor}AccessorSetter";
    995 
    996         # Custom Getter
    997         } elsif ($attrExt->{"CustomGetter"}) {
    998             $getter = "V8Custom::v8${customAccessor}AccessorGetter";
    999             $setter = "${interfaceName}Internal::${attrName}AttrSetter";
     989            # Custom Getter
     990            if ($attrExt->{"CustomGetter"} || $attrExt->{"Custom"} || $attrExt->{"V8Custom"}) {
     991                $getter = "V8Custom::v8${customAccessor}AccessorGetter";
     992            }
     993        }
    1000994
    1001995        # Replaceable
    1002         } elsif ($attrExt->{"Replaceable"}) {
    1003             # Replaceable accessor is put on instance template with ReadOnly attribute.
    1004             $getter = "${interfaceName}Internal::${attrName}AttrGetter";
    1005             $setter = "0";
    1006 
    1007             # Mark to avoid duplicate v8::ReadOnly flags in output.
    1008             $hasCustomSetter = 1;
    1009 
    1010             # Handle the special case of window.top being marked upstream as Replaceable.
    1011             # FIXME: Investigate why [Replaceable] is not marked as ReadOnly
    1012             # upstream and reach parity.
    1013             if (!($interfaceName eq "DOMWindow" and $attrName eq "top")) {
    1014                 $propAttr .= "|v8::ReadOnly";
    1015             }
    1016 
    1017         # Normal
    1018         } else {
    1019             $getter = "${interfaceName}Internal::${attrName}AttrGetter";
    1020             $setter = "${interfaceName}Internal::${attrName}AttrSetter";
    1021         }
    1022 
    1023996        if ($attrExt->{"Replaceable"} && !$hasCustomSetter) {
    1024997            $setter = "0";
  • trunk/WebCore/bindings/v8/custom/V8CustomBinding.h

    r47001 r47130  
    219219        DECLARE_PROPERTY_ACCESSOR(CanvasRenderingContext2DStrokeStyle);
    220220        DECLARE_PROPERTY_ACCESSOR(CanvasRenderingContext2DFillStyle);
    221         DECLARE_PROPERTY_ACCESSOR_GETTER(DOMWindowEvent);
     221        DECLARE_PROPERTY_ACCESSOR(DOMWindowEvent);
    222222        DECLARE_PROPERTY_ACCESSOR_GETTER(DOMWindowCrypto);
    223223        DECLARE_PROPERTY_ACCESSOR_SETTER(DOMWindowLocation);
  • trunk/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp

    r46850 r47130  
    154154}
    155155
     156ACCESSOR_SETTER(DOMWindowEvent)
     157{
     158    v8::Handle<v8::Object> holder = V8DOMWrapper::lookupDOMWrapper(V8ClassIndex::DOMWINDOW, info.This());
     159    if (holder.IsEmpty())
     160        return;
     161
     162    Frame* frame = V8DOMWrapper::convertToNativeObject<DOMWindow>(V8ClassIndex::DOMWINDOW, holder)->frame();
     163    if (!frame || !V8Proxy::canAccessFrame(frame, true))
     164        return;
     165
     166    v8::Local<v8::Context> context = V8Proxy::context(frame);
     167    v8::Local<v8::String> eventSymbol = v8::String::NewSymbol("event");
     168    context->Global()->SetHiddenValue(eventSymbol, value);
     169}
     170
    156171ACCESSOR_GETTER(DOMWindowCrypto)
    157172{
  • trunk/WebCore/page/DOMWindow.idl

    r47056 r47130  
    5656        attribute [DoNotCheckDomainSecurity, JSCCustom, V8CustomSetter, V8DisallowShadowing] Location location;
    5757
    58         attribute [Replaceable, CustomGetter] Event event;
     58        attribute [Replaceable, CustomGetter, V8CustomSetter] Event event;
    5959
    6060        readonly attribute [Custom] Crypto crypto;
Note: See TracChangeset for help on using the changeset viewer.