Title: [153495] trunk
Revision
153495
Author
[email protected]
Date
2013-07-30 14:44:51 -0700 (Tue, 30 Jul 2013)

Log Message

Add 'colno' attribute to ErrorEvent interface
https://bugs.webkit.org/show_bug.cgi?id=119257

Reviewed by Darin Adler.

Source/WebCore:

Add 'colno' attribute to ErrorEvent interface to match the latest specification:
http://www.whatwg.org/specs/web-apps/current-work/multipage/webappapis.html#errorevent

The 'colno' attribute is already supported by IE10 and Blink.

No new tests, covered by existing tests.

* dom/ErrorEvent.cpp:
(WebCore::ErrorEventInit::ErrorEventInit):
(WebCore::ErrorEvent::ErrorEvent):
* dom/ErrorEvent.h:
* dom/ErrorEvent.idl:

LayoutTests:

Update several test cases to check the new ErrorEvent.colno
attribute.

* fast/events/constructors/error-event-constructor-expected.txt:
* fast/events/constructors/error-event-constructor.html:
* fast/events/window-onerror9-expected.txt:
* fast/events/window-onerror9.html:
* fast/workers/worker-script-error-expected.txt:
* fast/workers/worker-script-error.html:
* http/tests/workers/worker-importScriptsOnError-expected.txt:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (153494 => 153495)


--- trunk/LayoutTests/ChangeLog	2013-07-30 21:32:54 UTC (rev 153494)
+++ trunk/LayoutTests/ChangeLog	2013-07-30 21:44:51 UTC (rev 153495)
@@ -1,5 +1,23 @@
 2013-07-30  Christophe Dumez  <[email protected]>
 
+        Add 'colno' attribute to ErrorEvent interface
+        https://bugs.webkit.org/show_bug.cgi?id=119257
+
+        Reviewed by Darin Adler.
+
+        Update several test cases to check the new ErrorEvent.colno
+        attribute.
+
+        * fast/events/constructors/error-event-constructor-expected.txt:
+        * fast/events/constructors/error-event-constructor.html:
+        * fast/events/window-onerror9-expected.txt:
+        * fast/events/window-onerror9.html:
+        * fast/workers/worker-script-error-expected.txt:
+        * fast/workers/worker-script-error.html:
+        * http/tests/workers/worker-importScriptsOnError-expected.txt:
+
+2013-07-30  Christophe Dumez  <[email protected]>
+
         Pass column as 4th argument to WorkerGlobalScope.onerror and Window.onerror handlers
         https://bugs.webkit.org/show_bug.cgi?id=119251
 

Modified: trunk/LayoutTests/fast/events/constructors/error-event-constructor-expected.txt (153494 => 153495)


--- trunk/LayoutTests/fast/events/constructors/error-event-constructor-expected.txt	2013-07-30 21:32:54 UTC (rev 153494)
+++ trunk/LayoutTests/fast/events/constructors/error-event-constructor-expected.txt	2013-07-30 21:44:51 UTC (rev 153495)
@@ -60,11 +60,34 @@
 PASS new ErrorEvent('eventType', { lineno: {} }).lineno is 0
 PASS new ErrorEvent('eventType', { lineno: {moemoe: 12345} }).lineno is 0
 PASS new ErrorEvent('eventType', { lineno: {valueOf: function () { return 12345; }} }).lineno is 12345
-PASS new ErrorEvent('eventType', { bubbles: true, cancelable: true, message: 'sakuranbo', filename: 'amaenbo', lineno: 12345 }).bubbles is true
-PASS new ErrorEvent('eventType', { bubbles: true, cancelable: true, message: 'sakuranbo', filename: 'amaenbo', lineno: 12345 }).cancelable is true
-PASS new ErrorEvent('eventType', { bubbles: true, cancelable: true, message: 'sakuranbo', filename: 'amaenbo', lineno: 12345 }).message is "sakuranbo"
-PASS new ErrorEvent('eventType', { bubbles: true, cancelable: true, message: 'sakuranbo', filename: 'amaenbo', lineno: 12345 }).filename is "amaenbo"
-PASS new ErrorEvent('eventType', { bubbles: true, cancelable: true, message: 'sakuranbo', filename: 'amaenbo', lineno: 12345 }).lineno is 12345
+PASS new ErrorEvent('eventType', { colno: 0 }).colno is 0
+PASS new ErrorEvent('eventType', { colno: 1 }).colno is 1
+PASS new ErrorEvent('eventType', { colno: 4294967294 }).colno is 4294967294
+PASS new ErrorEvent('eventType', { colno: 4294967295 }).colno is 4294967295
+PASS new ErrorEvent('eventType', { colno: 9007199254740991 }).colno is 4294967295
+PASS new ErrorEvent('eventType', { colno: 18446744073709551615 }).colno is 0
+PASS new ErrorEvent('eventType', { colno: 12345678901234567890 }).colno is 3944679424
+PASS new ErrorEvent('eventType', { colno: -1 }).colno is 4294967295
+PASS new ErrorEvent('eventType', { colno: 123.45 }).colno is 123
+PASS new ErrorEvent('eventType', { colno: NaN }).colno is 0
+PASS new ErrorEvent('eventType', { colno: undefined }).colno is 0
+PASS new ErrorEvent('eventType', { colno: null }).colno is 0
+PASS new ErrorEvent('eventType', { colno: '' }).colno is 0
+PASS new ErrorEvent('eventType', { colno: '12345' }).colno is 12345
+PASS new ErrorEvent('eventType', { colno: '12345a' }).colno is 0
+PASS new ErrorEvent('eventType', { colno: 'abc' }).colno is 0
+PASS new ErrorEvent('eventType', { colno: [] }).colno is 0
+PASS new ErrorEvent('eventType', { colno: [12345] }).colno is 12345
+PASS new ErrorEvent('eventType', { colno: [12345, 67890] }).colno is 0
+PASS new ErrorEvent('eventType', { colno: {} }).colno is 0
+PASS new ErrorEvent('eventType', { colno: {moemoe: 12345} }).colno is 0
+PASS new ErrorEvent('eventType', { colno: {valueOf: function () { return 12345; }} }).colno is 12345
+PASS new ErrorEvent('eventType', { bubbles: true, cancelable: true, message: 'sakuranbo', filename: 'amaenbo', lineno: 12345, colno: 23456 }).bubbles is true
+PASS new ErrorEvent('eventType', { bubbles: true, cancelable: true, message: 'sakuranbo', filename: 'amaenbo', lineno: 12345, colno: 23456 }).cancelable is true
+PASS new ErrorEvent('eventType', { bubbles: true, cancelable: true, message: 'sakuranbo', filename: 'amaenbo', lineno: 12345, colno: 23456 }).message is "sakuranbo"
+PASS new ErrorEvent('eventType', { bubbles: true, cancelable: true, message: 'sakuranbo', filename: 'amaenbo', lineno: 12345, colno: 23456 }).filename is "amaenbo"
+PASS new ErrorEvent('eventType', { bubbles: true, cancelable: true, message: 'sakuranbo', filename: 'amaenbo', lineno: 12345, colno: 23456 }).lineno is 12345
+PASS new ErrorEvent('eventType', { bubbles: true, cancelable: true, message: 'sakuranbo', filename: 'amaenbo', lineno: 12345, colno: 23456 }).colno is 23456
 PASS successfullyParsed is true
 
 TEST COMPLETE

Modified: trunk/LayoutTests/fast/events/constructors/error-event-constructor.html (153494 => 153495)


--- trunk/LayoutTests/fast/events/constructors/error-event-constructor.html	2013-07-30 21:32:54 UTC (rev 153494)
+++ trunk/LayoutTests/fast/events/constructors/error-event-constructor.html	2013-07-30 21:44:51 UTC (rev 153495)
@@ -74,12 +74,44 @@
 shouldBe("new ErrorEvent('eventType', { lineno: {moemoe: 12345} }).lineno", "0");
 shouldBe("new ErrorEvent('eventType', { lineno: {valueOf: function () { return 12345; }} }).lineno", "12345");
 
+// colno is passed.
+// numbers within the unsigned long range.
+shouldBe("new ErrorEvent('eventType', { colno: 0 }).colno", "0");
+shouldBe("new ErrorEvent('eventType', { colno: 1 }).colno", "1");
+shouldBe("new ErrorEvent('eventType', { colno: 4294967294 }).colno", "4294967294");
+shouldBe("new ErrorEvent('eventType', { colno: 4294967295 }).colno", "4294967295");
+
+// numbers out of the unsigned long range.
+// 2^{53}-1, the largest number that can be exactly represented by double.
+shouldBe("new ErrorEvent('eventType', { colno: 9007199254740991 }).colno", "4294967295");
+// 2^{64}-1
+shouldBe("new ErrorEvent('eventType', { colno: 18446744073709551615 }).colno", "0");
+shouldBe("new ErrorEvent('eventType', { colno: 12345678901234567890 }).colno", "3944679424");
+shouldBe("new ErrorEvent('eventType', { colno: -1 }).colno", "4294967295");
+shouldBe("new ErrorEvent('eventType', { colno: 123.45 }).colno", "123");
+shouldBe("new ErrorEvent('eventType', { colno: NaN }).colno", "0");
+
+// Non-numeric values.
+shouldBe("new ErrorEvent('eventType', { colno: undefined }).colno", "0");
+shouldBe("new ErrorEvent('eventType', { colno: null }).colno", "0");
+shouldBe("new ErrorEvent('eventType', { colno: '' }).colno", "0");
+shouldBe("new ErrorEvent('eventType', { colno: '12345' }).colno", "12345");
+shouldBe("new ErrorEvent('eventType', { colno: '12345a' }).colno", "0");
+shouldBe("new ErrorEvent('eventType', { colno: 'abc' }).colno", "0");
+shouldBe("new ErrorEvent('eventType', { colno: [] }).colno", "0");
+shouldBe("new ErrorEvent('eventType', { colno: [12345] }).colno", "12345");
+shouldBe("new ErrorEvent('eventType', { colno: [12345, 67890] }).colno", "0");
+shouldBe("new ErrorEvent('eventType', { colno: {} }).colno", "0");
+shouldBe("new ErrorEvent('eventType', { colno: {moemoe: 12345} }).colno", "0");
+shouldBe("new ErrorEvent('eventType', { colno: {valueOf: function () { return 12345; }} }).colno", "12345");
+
 // All initializers are passed.
-shouldBe("new ErrorEvent('eventType', { bubbles: true, cancelable: true, message: 'sakuranbo', filename: 'amaenbo', lineno: 12345 }).bubbles", "true");
-shouldBe("new ErrorEvent('eventType', { bubbles: true, cancelable: true, message: 'sakuranbo', filename: 'amaenbo', lineno: 12345 }).cancelable", "true");
-shouldBeEqualToString("new ErrorEvent('eventType', { bubbles: true, cancelable: true, message: 'sakuranbo', filename: 'amaenbo', lineno: 12345 }).message", "sakuranbo");
-shouldBeEqualToString("new ErrorEvent('eventType', { bubbles: true, cancelable: true, message: 'sakuranbo', filename: 'amaenbo', lineno: 12345 }).filename", "amaenbo");
-shouldBe("new ErrorEvent('eventType', { bubbles: true, cancelable: true, message: 'sakuranbo', filename: 'amaenbo', lineno: 12345 }).lineno", "12345");
+shouldBe("new ErrorEvent('eventType', { bubbles: true, cancelable: true, message: 'sakuranbo', filename: 'amaenbo', lineno: 12345, colno: 23456 }).bubbles", "true");
+shouldBe("new ErrorEvent('eventType', { bubbles: true, cancelable: true, message: 'sakuranbo', filename: 'amaenbo', lineno: 12345, colno: 23456 }).cancelable", "true");
+shouldBeEqualToString("new ErrorEvent('eventType', { bubbles: true, cancelable: true, message: 'sakuranbo', filename: 'amaenbo', lineno: 12345, colno: 23456 }).message", "sakuranbo");
+shouldBeEqualToString("new ErrorEvent('eventType', { bubbles: true, cancelable: true, message: 'sakuranbo', filename: 'amaenbo', lineno: 12345, colno: 23456 }).filename", "amaenbo");
+shouldBe("new ErrorEvent('eventType', { bubbles: true, cancelable: true, message: 'sakuranbo', filename: 'amaenbo', lineno: 12345, colno: 23456 }).lineno", "12345");
+shouldBe("new ErrorEvent('eventType', { bubbles: true, cancelable: true, message: 'sakuranbo', filename: 'amaenbo', lineno: 12345, colno: 23456 }).colno", "23456");
 </script>
 <script src=""
 </body>

Modified: trunk/LayoutTests/fast/events/window-onerror9-expected.txt (153494 => 153495)


--- trunk/LayoutTests/fast/events/window-onerror9-expected.txt	2013-07-30 21:32:54 UTC (rev 153494)
+++ trunk/LayoutTests/fast/events/window-onerror9-expected.txt	2013-07-30 21:44:51 UTC (rev 153495)
@@ -1,8 +1,9 @@
 Test that when window.onerror handler is called, window.event is the corresponding ErrorEvent object. Bug 8519.
 
-Main frame window.onerror: Error: 2010 at window-onerror9.html, line: 31, column: 22
+Main frame window.onerror: Error: 2010 at window-onerror9.html, line: 32, column: 22
 window.event.type = error
 window.event.message = Error: 2010
 window.event.filename = window-onerror9.html
-window.event.lineno = 31
+window.event.lineno = 32
+window.event.colno = 22
 

Modified: trunk/LayoutTests/fast/events/window-onerror9.html (153494 => 153495)


--- trunk/LayoutTests/fast/events/window-onerror9.html	2013-07-30 21:32:54 UTC (rev 153494)
+++ trunk/LayoutTests/fast/events/window-onerror9.html	2013-07-30 21:44:51 UTC (rev 153495)
@@ -23,6 +23,7 @@
     log("window.event.message = " + window.event.message);
     log("window.event.filename = " + lastPathComponent(window.event.filename));
     log("window.event.lineno = " + window.event.lineno);
+    log("window.event.colno = " + window.event.colno);
     if (window.testRunner)
         testRunner.notifyDone();
     return true;

Modified: trunk/LayoutTests/fast/workers/worker-script-error-expected.txt (153494 => 153495)


--- trunk/LayoutTests/fast/workers/worker-script-error-expected.txt	2013-07-30 21:32:54 UTC (rev 153494)
+++ trunk/LayoutTests/fast/workers/worker-script-error-expected.txt	2013-07-30 21:44:51 UTC (rev 153495)
@@ -2,13 +2,13 @@
 Test Worker script error handling functionality. Should print a series of PASS messages, followed with DONE.
 
 PASS: onerror invoked for a script that has invalid syntax.
-PASS: onerror invoked for a script that has script error 'ReferenceError: Can't find variable: foo' at line 1.
-PASS: event listener invoked for a script that has script error 'ReferenceError: Can't find variable: foo' at line 1.
-PASS: onerror invoked for a script that has script error 'ReferenceError: Can't find variable: foo' at line 7.
-PASS: onerror invoked for a script that has script error 'ReferenceError: Can't find variable: bar' at line 3.
+PASS: onerror invoked for a script that has script error 'ReferenceError: Can't find variable: foo' at line 1 and column 4.
+PASS: event listener invoked for a script that has script error 'ReferenceError: Can't find variable: foo' at line 1 and column 4.
+PASS: onerror invoked for a script that has script error 'ReferenceError: Can't find variable: foo' at line 7 and column 4.
+PASS: onerror invoked for a script that has script error 'ReferenceError: Can't find variable: bar' at line 3 and column 8.
 message from worker: "PASS: onerror in worker context invoked for a script that has script error 'ReferenceError: Can't find variable: foo' at line 10 in worker-script-error-bubbled.js".
-PASS: onerror invoked for a script that has script error 'ReferenceError: Can't find variable: foo' at line 10.
-PASS: onerror invoked for a script that has script error 'ReferenceError: Can't find variable: foo' at line 10.
+PASS: onerror invoked for a script that has script error 'ReferenceError: Can't find variable: foo' at line 10 and column 4.
+PASS: onerror invoked for a script that has script error 'ReferenceError: Can't find variable: foo' at line 10 and column 4.
 PASS: message received from WorkerGlobalScope.onerror: onerror invoked for a script that has script error 'ReferenceError: Can't find variable: foo' at line 7 and column 14.
 PASS: onerror invoked for an exception in setTimeout callback.
 DONE

Modified: trunk/LayoutTests/fast/workers/worker-script-error.html (153494 => 153495)


--- trunk/LayoutTests/fast/workers/worker-script-error.html	2013-07-30 21:32:54 UTC (rev 153494)
+++ trunk/LayoutTests/fast/workers/worker-script-error.html	2013-07-30 21:44:51 UTC (rev 153495)
@@ -51,7 +51,7 @@
     try {
         var worker = new Worker("resources/worker-script-error-unhandled.js");
         worker._onerror_ = function(evt) {
-            log("PASS: onerror invoked for a script that has script error '" + evt.message + "' at line " + evt.lineno + ".");
+            log("PASS: onerror invoked for a script that has script error '" + evt.message + "' at line " + evt.lineno + " and column " + evt.colno + ".");
             runNextTest();
             return false;
         }
@@ -67,7 +67,7 @@
         var worker = new Worker("resources/worker-script-error-unhandled.js");
         worker.addEventListener("error",
             function(evt) {
-                log("PASS: event listener invoked for a script that has script error '" + evt.message + "' at line " + evt.lineno + ".");
+                log("PASS: event listener invoked for a script that has script error '" + evt.message + "' at line " + evt.lineno + " and column " + evt.colno + ".");
                 runNextTest();
                 evt.preventDefault();
             }, false);
@@ -83,7 +83,7 @@
         var worker = new Worker("resources/worker-error-in-handling-script-error.js");
         var errorCount = 0;
         worker._onerror_ = function(evt) {
-            log("PASS: onerror invoked for a script that has script error '" + evt.message + "' at line " + evt.lineno + ".");
+            log("PASS: onerror invoked for a script that has script error '" + evt.message + "' at line " + evt.lineno + " and column " + evt.colno + ".");
             ++errorCount;
             // Second error happens in the onerror handler. Run next test only when it's reported.
             if (errorCount == 2)
@@ -104,7 +104,7 @@
             log("message from worker: \"" + evt.data + "\".");
         }
         worker._onerror_ = function(evt) {
-            log("PASS: onerror invoked for a script that has script error '" + evt.message + "' at line " + evt.lineno + ".");
+            log("PASS: onerror invoked for a script that has script error '" + evt.message + "' at line " + evt.lineno + " and column " + evt.colno + ".");
             runNextTest();
             return false;
         }
@@ -119,7 +119,7 @@
     try {
         var worker = new Worker("resources/worker-script-error-bubbled.js");
         worker._onerror_ = function(evt) {
-            log("PASS: onerror invoked for a script that has script error '" + evt.message + "' at line " + evt.lineno + ".");
+            log("PASS: onerror invoked for a script that has script error '" + evt.message + "' at line " + evt.lineno + " and column " + evt.colno + ".");
             runNextTest();
             return true;
         }
@@ -134,7 +134,7 @@
     try {
         var worker = new Worker("resources/worker-script-error-handled.js");
         worker._onerror_ = function(evt) {
-            log("FAIL: onerror invoked for a script that has script error '" + evt.message + "' at line " + evt.lineno + ".");
+            log("FAIL: onerror invoked for a script that has script error '" + evt.message + "' at line " + evt.lineno + " and column " + evt.colno + ".");
             runNextTest();
             return false;
         }

Modified: trunk/LayoutTests/http/tests/workers/worker-importScriptsOnError-expected.txt (153494 => 153495)


--- trunk/LayoutTests/http/tests/workers/worker-importScriptsOnError-expected.txt	2013-07-30 21:32:54 UTC (rev 153494)
+++ trunk/LayoutTests/http/tests/workers/worker-importScriptsOnError-expected.txt	2013-07-30 21:44:51 UTC (rev 153495)
@@ -26,6 +26,7 @@
 cancelBubble: false,
 cancelable: true,
 clipboardData: undefined,
+colno: 0,
 currentTarget: [object Worker],
 defaultPrevented: false,
 eventPhase: 2,

Modified: trunk/Source/WebCore/ChangeLog (153494 => 153495)


--- trunk/Source/WebCore/ChangeLog	2013-07-30 21:32:54 UTC (rev 153494)
+++ trunk/Source/WebCore/ChangeLog	2013-07-30 21:44:51 UTC (rev 153495)
@@ -1,3 +1,23 @@
+2013-07-30  Christophe Dumez  <[email protected]>
+
+        Add 'colno' attribute to ErrorEvent interface
+        https://bugs.webkit.org/show_bug.cgi?id=119257
+
+        Reviewed by Darin Adler.
+
+        Add 'colno' attribute to ErrorEvent interface to match the latest specification:
+        http://www.whatwg.org/specs/web-apps/current-work/multipage/webappapis.html#errorevent
+
+        The 'colno' attribute is already supported by IE10 and Blink.
+
+        No new tests, covered by existing tests.
+
+        * dom/ErrorEvent.cpp:
+        (WebCore::ErrorEventInit::ErrorEventInit):
+        (WebCore::ErrorEvent::ErrorEvent):
+        * dom/ErrorEvent.h:
+        * dom/ErrorEvent.idl:
+
 2013-07-30  Andreas Kling  <[email protected]>
 
         Inactive style sheets should not trigger style recalc when loaded.

Modified: trunk/Source/WebCore/dom/ErrorEvent.cpp (153494 => 153495)


--- trunk/Source/WebCore/dom/ErrorEvent.cpp	2013-07-30 21:32:54 UTC (rev 153494)
+++ trunk/Source/WebCore/dom/ErrorEvent.cpp	2013-07-30 21:44:51 UTC (rev 153495)
@@ -39,6 +39,7 @@
     : message()
     , filename()
     , lineno(0)
+    , colno(0)
 {
 }
 
@@ -51,7 +52,7 @@
     , m_message(initializer.message)
     , m_fileName(initializer.filename)
     , m_lineNumber(initializer.lineno)
-    , m_columnNumber(0)
+    , m_columnNumber(initializer.colno)
 {
 }
 

Modified: trunk/Source/WebCore/dom/ErrorEvent.h (153494 => 153495)


--- trunk/Source/WebCore/dom/ErrorEvent.h	2013-07-30 21:32:54 UTC (rev 153494)
+++ trunk/Source/WebCore/dom/ErrorEvent.h	2013-07-30 21:44:51 UTC (rev 153495)
@@ -42,6 +42,7 @@
     String message;
     String filename;
     unsigned lineno;
+    unsigned colno;
 };
 
 class ErrorEvent : public Event {

Modified: trunk/Source/WebCore/dom/ErrorEvent.idl (153494 => 153495)


--- trunk/Source/WebCore/dom/ErrorEvent.idl	2013-07-30 21:32:54 UTC (rev 153494)
+++ trunk/Source/WebCore/dom/ErrorEvent.idl	2013-07-30 21:44:51 UTC (rev 153495)
@@ -35,5 +35,6 @@
     [InitializedByEventConstructor] readonly attribute DOMString message;
     [InitializedByEventConstructor] readonly attribute DOMString filename;
     [InitializedByEventConstructor] readonly attribute unsigned long lineno;
+    [InitializedByEventConstructor] readonly attribute unsigned long colno;
 };
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to