Changeset 109599 in webkit


Ignore:
Timestamp:
Mar 2, 2012 12:30:59 PM (12 years ago)
Author:
arv@chromium.org
Message:

[V8] Make inline event attributes use evt for SVG and event otherwise
https://bugs.webkit.org/show_bug.cgi?id=80167

Reviewed by Ojan Vafai.

Source/WebCore:

Test: fast/dom/inline-event-attributes-event-param-name.html

  • bindings/v8/V8LazyEventListener.cpp:

(WebCore::V8LazyEventListener::prepareListenerObject):

LayoutTests:

  • fast/dom/inline-event-attributes-event-param-name-expected.txt: Added.
  • fast/dom/inline-event-attributes-event-param-name.html: Added.
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r109597 r109599  
     12012-03-02  Erik Arvidsson  <arv@chromium.org>
     2
     3        [V8] Make inline event attributes use evt for SVG and event otherwise
     4        https://bugs.webkit.org/show_bug.cgi?id=80167
     5
     6        Reviewed by Ojan Vafai.
     7
     8        * fast/dom/inline-event-attributes-event-param-name-expected.txt: Added.
     9        * fast/dom/inline-event-attributes-event-param-name.html: Added.
     10
    1112012-03-02  Dirk Pranke  <dpranke@chromium.org>
    212
  • trunk/Source/WebCore/ChangeLog

    r109598 r109599  
     12012-03-02  Erik Arvidsson  <arv@chromium.org>
     2
     3        [V8] Make inline event attributes use evt for SVG and event otherwise
     4        https://bugs.webkit.org/show_bug.cgi?id=80167
     5
     6        Reviewed by Ojan Vafai.
     7
     8        Test: fast/dom/inline-event-attributes-event-param-name.html
     9
     10        * bindings/v8/V8LazyEventListener.cpp:
     11        (WebCore::V8LazyEventListener::prepareListenerObject):
     12
    1132012-03-02  Gavin Peters  <gavinp@chromium.org>
    214
  • trunk/Source/WebCore/bindings/v8/V8LazyEventListener.cpp

    r106680 r109599  
    116116    // Don't use new lines so that lines in the modified handler
    117117    // have the same numbers as in the original code.
    118     // FIXME: What about m_eventParameterName from JSLazyEventListener?
    119118    // FIXME: This approach is a giant hack! What if m_code escapes to run
    120119    //        arbitrary script?
    121     String code = "(function (evt) {" \
     120    String eventParameterName = m_isSVGEvent ? "evt" : "event";
     121    String code = "(function(";
     122    code.append(eventParameterName);
     123    code.append(") {" \
    122124            "with (this.ownerDocument ? this.ownerDocument : {}) {" \
    123125            "with (this.form ? this.form : {}) {" \
    124126            "with (this) {" \
    125             "return (function(evt){";
     127            "return (function(");
     128    code.append(eventParameterName);
     129    code.append("){");
    126130    code.append(m_code);
    127131    // Insert '\n' otherwise //-style comments could break the handler.
    128     code.append(  "\n}).call(this, evt);}}}})");
     132    code.append("\n}).call(this, ");
     133    code.append(eventParameterName);
     134    code.append(");}}}})");
    129135    v8::Handle<v8::String> codeExternalString = v8ExternalString(code);
    130136    v8::Handle<v8::Script> script = V8Proxy::compileScript(codeExternalString, m_sourceURL, m_position);
     
    157163                toStringResult.append(m_functionName);
    158164                toStringResult.append("(");
    159                 toStringResult.append(m_isSVGEvent ? "evt" : "event");
     165                toStringResult.append(eventParameterName);
    160166                toStringResult.append(") {\n  ");
    161167                toStringResult.append(m_code);
Note: See TracChangeset for help on using the changeset viewer.