summaryrefslogtreecommitdiffstats
path: root/webkit
diff options
context:
space:
mode:
Diffstat (limited to 'webkit')
-rw-r--r--webkit/data/layout_tests/chrome/fast/forms/var-name-conflict-in-form-event-handler-expected.txt4
-rw-r--r--webkit/data/layout_tests/chrome/fast/forms/var-name-conflict-in-form-event-handler.html28
-rw-r--r--webkit/port/bindings/v8/v8_events.cpp4
3 files changed, 34 insertions, 2 deletions
diff --git a/webkit/data/layout_tests/chrome/fast/forms/var-name-conflict-in-form-event-handler-expected.txt b/webkit/data/layout_tests/chrome/fast/forms/var-name-conflict-in-form-event-handler-expected.txt
new file mode 100644
index 0000000..7456b9a
--- /dev/null
+++ b/webkit/data/layout_tests/chrome/fast/forms/var-name-conflict-in-form-event-handler-expected.txt
@@ -0,0 +1,4 @@
+This tests that a locally scoped variable in an event handler of a form takes precedence over items of form.
+
+
+This test: PASSED!
diff --git a/webkit/data/layout_tests/chrome/fast/forms/var-name-conflict-in-form-event-handler.html b/webkit/data/layout_tests/chrome/fast/forms/var-name-conflict-in-form-event-handler.html
new file mode 100644
index 0000000..77d3da6
--- /dev/null
+++ b/webkit/data/layout_tests/chrome/fast/forms/var-name-conflict-in-form-event-handler.html
@@ -0,0 +1,28 @@
+<html>
+<body>
+<p>This tests that a locally scoped variable in an event handler of a form
+takes precedence over items of form.
+
+<form>
+<select onChange="var value = this.value;this.options[0].selected=true; if(value=='C') document.getElementById('sourceViewDiv').innerHTML='This test: PASSED!'">
+<option value="A">A</option>
+<option value="B">B</option>
+<option value="C">C</option>
+</select>
+
+<div id='sourceViewDiv'>This test: FAILED</div>
+
+<script>
+if (window.layoutTestController)
+ layoutTestController.dumpAsText();
+
+var x=document.getElementsByTagName('select')[0];
+x.options[2].selected=true;
+var evt = document.createEvent("HTMLEvents");
+evt.initEvent("change", true, true);
+x.dispatchEvent(evt);
+</script>
+</form>
+
+</body>
+</html>
diff --git a/webkit/port/bindings/v8/v8_events.cpp b/webkit/port/bindings/v8/v8_events.cpp
index 38e3802..47a9b39 100644
--- a/webkit/port/bindings/v8/v8_events.cpp
+++ b/webkit/port/bindings/v8/v8_events.cpp
@@ -437,9 +437,9 @@ v8::Local<v8::Function> V8LazyEventListener::GetWrappedListenerFunction() {
code.append(" with (this.ownerDocument ? this.ownerDocument : {}) {\n");
code.append(" with (this.form ? this.form : {}) {\n");
code.append(" with (this) {\n");
- code.append(" ");
+ code.append(" return (function(evt){");
code.append(m_code);
- code.append("\n");
+ code.append("}).call(this, evt);\n");
code.append(" }\n");
code.append(" }\n");
code.append(" }\n");