Changeset 153495 in webkit


Ignore:
Timestamp:
Jul 30, 2013 2:44:51 PM (11 years ago)
Author:
Christophe Dumez
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:
Location:
trunk
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r153480 r153495  
     12013-07-30  Christophe Dumez  <ch.dumez@sisa.samsung.com>
     2
     3        Add 'colno' attribute to ErrorEvent interface
     4        https://bugs.webkit.org/show_bug.cgi?id=119257
     5
     6        Reviewed by Darin Adler.
     7
     8        Update several test cases to check the new ErrorEvent.colno
     9        attribute.
     10
     11        * fast/events/constructors/error-event-constructor-expected.txt:
     12        * fast/events/constructors/error-event-constructor.html:
     13        * fast/events/window-onerror9-expected.txt:
     14        * fast/events/window-onerror9.html:
     15        * fast/workers/worker-script-error-expected.txt:
     16        * fast/workers/worker-script-error.html:
     17        * http/tests/workers/worker-importScriptsOnError-expected.txt:
     18
    1192013-07-30  Christophe Dumez  <ch.dumez@sisa.samsung.com>
    220
  • trunk/LayoutTests/fast/events/constructors/error-event-constructor-expected.txt

    r95352 r153495  
    6161PASS new ErrorEvent('eventType', { lineno: {moemoe: 12345} }).lineno is 0
    6262PASS new ErrorEvent('eventType', { lineno: {valueOf: function () { return 12345; }} }).lineno is 12345
    63 PASS new ErrorEvent('eventType', { bubbles: true, cancelable: true, message: 'sakuranbo', filename: 'amaenbo', lineno: 12345 }).bubbles is true
    64 PASS new ErrorEvent('eventType', { bubbles: true, cancelable: true, message: 'sakuranbo', filename: 'amaenbo', lineno: 12345 }).cancelable is true
    65 PASS new ErrorEvent('eventType', { bubbles: true, cancelable: true, message: 'sakuranbo', filename: 'amaenbo', lineno: 12345 }).message is "sakuranbo"
    66 PASS new ErrorEvent('eventType', { bubbles: true, cancelable: true, message: 'sakuranbo', filename: 'amaenbo', lineno: 12345 }).filename is "amaenbo"
    67 PASS new ErrorEvent('eventType', { bubbles: true, cancelable: true, message: 'sakuranbo', filename: 'amaenbo', lineno: 12345 }).lineno is 12345
     63PASS new ErrorEvent('eventType', { colno: 0 }).colno is 0
     64PASS new ErrorEvent('eventType', { colno: 1 }).colno is 1
     65PASS new ErrorEvent('eventType', { colno: 4294967294 }).colno is 4294967294
     66PASS new ErrorEvent('eventType', { colno: 4294967295 }).colno is 4294967295
     67PASS new ErrorEvent('eventType', { colno: 9007199254740991 }).colno is 4294967295
     68PASS new ErrorEvent('eventType', { colno: 18446744073709551615 }).colno is 0
     69PASS new ErrorEvent('eventType', { colno: 12345678901234567890 }).colno is 3944679424
     70PASS new ErrorEvent('eventType', { colno: -1 }).colno is 4294967295
     71PASS new ErrorEvent('eventType', { colno: 123.45 }).colno is 123
     72PASS new ErrorEvent('eventType', { colno: NaN }).colno is 0
     73PASS new ErrorEvent('eventType', { colno: undefined }).colno is 0
     74PASS new ErrorEvent('eventType', { colno: null }).colno is 0
     75PASS new ErrorEvent('eventType', { colno: '' }).colno is 0
     76PASS new ErrorEvent('eventType', { colno: '12345' }).colno is 12345
     77PASS new ErrorEvent('eventType', { colno: '12345a' }).colno is 0
     78PASS new ErrorEvent('eventType', { colno: 'abc' }).colno is 0
     79PASS new ErrorEvent('eventType', { colno: [] }).colno is 0
     80PASS new ErrorEvent('eventType', { colno: [12345] }).colno is 12345
     81PASS new ErrorEvent('eventType', { colno: [12345, 67890] }).colno is 0
     82PASS new ErrorEvent('eventType', { colno: {} }).colno is 0
     83PASS new ErrorEvent('eventType', { colno: {moemoe: 12345} }).colno is 0
     84PASS new ErrorEvent('eventType', { colno: {valueOf: function () { return 12345; }} }).colno is 12345
     85PASS new ErrorEvent('eventType', { bubbles: true, cancelable: true, message: 'sakuranbo', filename: 'amaenbo', lineno: 12345, colno: 23456 }).bubbles is true
     86PASS new ErrorEvent('eventType', { bubbles: true, cancelable: true, message: 'sakuranbo', filename: 'amaenbo', lineno: 12345, colno: 23456 }).cancelable is true
     87PASS new ErrorEvent('eventType', { bubbles: true, cancelable: true, message: 'sakuranbo', filename: 'amaenbo', lineno: 12345, colno: 23456 }).message is "sakuranbo"
     88PASS new ErrorEvent('eventType', { bubbles: true, cancelable: true, message: 'sakuranbo', filename: 'amaenbo', lineno: 12345, colno: 23456 }).filename is "amaenbo"
     89PASS new ErrorEvent('eventType', { bubbles: true, cancelable: true, message: 'sakuranbo', filename: 'amaenbo', lineno: 12345, colno: 23456 }).lineno is 12345
     90PASS new ErrorEvent('eventType', { bubbles: true, cancelable: true, message: 'sakuranbo', filename: 'amaenbo', lineno: 12345, colno: 23456 }).colno is 23456
    6891PASS successfullyParsed is true
    6992
  • trunk/LayoutTests/fast/events/constructors/error-event-constructor.html

    r98407 r153495  
    7575shouldBe("new ErrorEvent('eventType', { lineno: {valueOf: function () { return 12345; }} }).lineno", "12345");
    7676
     77// colno is passed.
     78// numbers within the unsigned long range.
     79shouldBe("new ErrorEvent('eventType', { colno: 0 }).colno", "0");
     80shouldBe("new ErrorEvent('eventType', { colno: 1 }).colno", "1");
     81shouldBe("new ErrorEvent('eventType', { colno: 4294967294 }).colno", "4294967294");
     82shouldBe("new ErrorEvent('eventType', { colno: 4294967295 }).colno", "4294967295");
     83
     84// numbers out of the unsigned long range.
     85// 2^{53}-1, the largest number that can be exactly represented by double.
     86shouldBe("new ErrorEvent('eventType', { colno: 9007199254740991 }).colno", "4294967295");
     87// 2^{64}-1
     88shouldBe("new ErrorEvent('eventType', { colno: 18446744073709551615 }).colno", "0");
     89shouldBe("new ErrorEvent('eventType', { colno: 12345678901234567890 }).colno", "3944679424");
     90shouldBe("new ErrorEvent('eventType', { colno: -1 }).colno", "4294967295");
     91shouldBe("new ErrorEvent('eventType', { colno: 123.45 }).colno", "123");
     92shouldBe("new ErrorEvent('eventType', { colno: NaN }).colno", "0");
     93
     94// Non-numeric values.
     95shouldBe("new ErrorEvent('eventType', { colno: undefined }).colno", "0");
     96shouldBe("new ErrorEvent('eventType', { colno: null }).colno", "0");
     97shouldBe("new ErrorEvent('eventType', { colno: '' }).colno", "0");
     98shouldBe("new ErrorEvent('eventType', { colno: '12345' }).colno", "12345");
     99shouldBe("new ErrorEvent('eventType', { colno: '12345a' }).colno", "0");
     100shouldBe("new ErrorEvent('eventType', { colno: 'abc' }).colno", "0");
     101shouldBe("new ErrorEvent('eventType', { colno: [] }).colno", "0");
     102shouldBe("new ErrorEvent('eventType', { colno: [12345] }).colno", "12345");
     103shouldBe("new ErrorEvent('eventType', { colno: [12345, 67890] }).colno", "0");
     104shouldBe("new ErrorEvent('eventType', { colno: {} }).colno", "0");
     105shouldBe("new ErrorEvent('eventType', { colno: {moemoe: 12345} }).colno", "0");
     106shouldBe("new ErrorEvent('eventType', { colno: {valueOf: function () { return 12345; }} }).colno", "12345");
     107
    77108// All initializers are passed.
    78 shouldBe("new ErrorEvent('eventType', { bubbles: true, cancelable: true, message: 'sakuranbo', filename: 'amaenbo', lineno: 12345 }).bubbles", "true");
    79 shouldBe("new ErrorEvent('eventType', { bubbles: true, cancelable: true, message: 'sakuranbo', filename: 'amaenbo', lineno: 12345 }).cancelable", "true");
    80 shouldBeEqualToString("new ErrorEvent('eventType', { bubbles: true, cancelable: true, message: 'sakuranbo', filename: 'amaenbo', lineno: 12345 }).message", "sakuranbo");
    81 shouldBeEqualToString("new ErrorEvent('eventType', { bubbles: true, cancelable: true, message: 'sakuranbo', filename: 'amaenbo', lineno: 12345 }).filename", "amaenbo");
    82 shouldBe("new ErrorEvent('eventType', { bubbles: true, cancelable: true, message: 'sakuranbo', filename: 'amaenbo', lineno: 12345 }).lineno", "12345");
     109shouldBe("new ErrorEvent('eventType', { bubbles: true, cancelable: true, message: 'sakuranbo', filename: 'amaenbo', lineno: 12345, colno: 23456 }).bubbles", "true");
     110shouldBe("new ErrorEvent('eventType', { bubbles: true, cancelable: true, message: 'sakuranbo', filename: 'amaenbo', lineno: 12345, colno: 23456 }).cancelable", "true");
     111shouldBeEqualToString("new ErrorEvent('eventType', { bubbles: true, cancelable: true, message: 'sakuranbo', filename: 'amaenbo', lineno: 12345, colno: 23456 }).message", "sakuranbo");
     112shouldBeEqualToString("new ErrorEvent('eventType', { bubbles: true, cancelable: true, message: 'sakuranbo', filename: 'amaenbo', lineno: 12345, colno: 23456 }).filename", "amaenbo");
     113shouldBe("new ErrorEvent('eventType', { bubbles: true, cancelable: true, message: 'sakuranbo', filename: 'amaenbo', lineno: 12345, colno: 23456 }).lineno", "12345");
     114shouldBe("new ErrorEvent('eventType', { bubbles: true, cancelable: true, message: 'sakuranbo', filename: 'amaenbo', lineno: 12345, colno: 23456 }).colno", "23456");
    83115</script>
    84116<script src="../../js/resources/js-test-post.js"></script>
  • trunk/LayoutTests/fast/events/window-onerror9-expected.txt

    r153480 r153495  
    11Test that when window.onerror handler is called, window.event is the corresponding ErrorEvent object. Bug 8519.
    22
    3 Main frame window.onerror: Error: 2010 at window-onerror9.html, line: 31, column: 22
     3Main frame window.onerror: Error: 2010 at window-onerror9.html, line: 32, column: 22
    44window.event.type = error
    55window.event.message = Error: 2010
    66window.event.filename = window-onerror9.html
    7 window.event.lineno = 31
     7window.event.lineno = 32
     8window.event.colno = 22
    89
  • trunk/LayoutTests/fast/events/window-onerror9.html

    r153480 r153495  
    2424    log("window.event.filename = " + lastPathComponent(window.event.filename));
    2525    log("window.event.lineno = " + window.event.lineno);
     26    log("window.event.colno = " + window.event.colno);
    2627    if (window.testRunner)
    2728        testRunner.notifyDone();
  • trunk/LayoutTests/fast/workers/worker-script-error-expected.txt

    r153480 r153495  
    33
    44PASS: onerror invoked for a script that has invalid syntax.
    5 PASS: onerror invoked for a script that has script error 'ReferenceError: Can't find variable: foo' at line 1.
    6 PASS: event listener invoked for a script that has script error 'ReferenceError: Can't find variable: foo' at line 1.
    7 PASS: onerror invoked for a script that has script error 'ReferenceError: Can't find variable: foo' at line 7.
    8 PASS: onerror invoked for a script that has script error 'ReferenceError: Can't find variable: bar' at line 3.
     5PASS: onerror invoked for a script that has script error 'ReferenceError: Can't find variable: foo' at line 1 and column 4.
     6PASS: event listener invoked for a script that has script error 'ReferenceError: Can't find variable: foo' at line 1 and column 4.
     7PASS: onerror invoked for a script that has script error 'ReferenceError: Can't find variable: foo' at line 7 and column 4.
     8PASS: onerror invoked for a script that has script error 'ReferenceError: Can't find variable: bar' at line 3 and column 8.
    99message 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".
    10 PASS: onerror invoked for a script that has script error 'ReferenceError: Can't find variable: foo' at line 10.
    11 PASS: onerror invoked for a script that has script error 'ReferenceError: Can't find variable: foo' at line 10.
     10PASS: onerror invoked for a script that has script error 'ReferenceError: Can't find variable: foo' at line 10 and column 4.
     11PASS: onerror invoked for a script that has script error 'ReferenceError: Can't find variable: foo' at line 10 and column 4.
    1212PASS: 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.
    1313PASS: onerror invoked for an exception in setTimeout callback.
  • trunk/LayoutTests/fast/workers/worker-script-error.html

    r124680 r153495  
    5252        var worker = new Worker("resources/worker-script-error-unhandled.js");
    5353        worker.onerror = function(evt) {
    54             log("PASS: onerror invoked for a script that has script error '" + evt.message + "' at line " + evt.lineno + ".");
     54            log("PASS: onerror invoked for a script that has script error '" + evt.message + "' at line " + evt.lineno + " and column " + evt.colno + ".");
    5555            runNextTest();
    5656            return false;
     
    6868        worker.addEventListener("error",
    6969            function(evt) {
    70                 log("PASS: event listener invoked for a script that has script error '" + evt.message + "' at line " + evt.lineno + ".");
     70                log("PASS: event listener invoked for a script that has script error '" + evt.message + "' at line " + evt.lineno + " and column " + evt.colno + ".");
    7171                runNextTest();
    7272                evt.preventDefault();
     
    8484        var errorCount = 0;
    8585        worker.onerror = function(evt) {
    86             log("PASS: onerror invoked for a script that has script error '" + evt.message + "' at line " + evt.lineno + ".");
     86            log("PASS: onerror invoked for a script that has script error '" + evt.message + "' at line " + evt.lineno + " and column " + evt.colno + ".");
    8787            ++errorCount;
    8888            // Second error happens in the onerror handler. Run next test only when it's reported.
     
    105105        }
    106106        worker.onerror = function(evt) {
    107             log("PASS: onerror invoked for a script that has script error '" + evt.message + "' at line " + evt.lineno + ".");
     107            log("PASS: onerror invoked for a script that has script error '" + evt.message + "' at line " + evt.lineno + " and column " + evt.colno + ".");
    108108            runNextTest();
    109109            return false;
     
    120120        var worker = new Worker("resources/worker-script-error-bubbled.js");
    121121        worker.onerror = function(evt) {
    122             log("PASS: onerror invoked for a script that has script error '" + evt.message + "' at line " + evt.lineno + ".");
     122            log("PASS: onerror invoked for a script that has script error '" + evt.message + "' at line " + evt.lineno + " and column " + evt.colno + ".");
    123123            runNextTest();
    124124            return true;
     
    135135        var worker = new Worker("resources/worker-script-error-handled.js");
    136136        worker.onerror = function(evt) {
    137             log("FAIL: onerror invoked for a script that has script error '" + evt.message + "' at line " + evt.lineno + ".");
     137            log("FAIL: onerror invoked for a script that has script error '" + evt.message + "' at line " + evt.lineno + " and column " + evt.colno + ".");
    138138            runNextTest();
    139139            return false;
  • trunk/LayoutTests/http/tests/workers/worker-importScriptsOnError-expected.txt

    r116070 r153495  
    2727cancelable: true,
    2828clipboardData: undefined,
     29colno: 0,
    2930currentTarget: [object Worker],
    3031defaultPrevented: false,
  • trunk/Source/WebCore/ChangeLog

    r153494 r153495  
     12013-07-30  Christophe Dumez  <ch.dumez@sisa.samsung.com>
     2
     3        Add 'colno' attribute to ErrorEvent interface
     4        https://bugs.webkit.org/show_bug.cgi?id=119257
     5
     6        Reviewed by Darin Adler.
     7
     8        Add 'colno' attribute to ErrorEvent interface to match the latest specification:
     9        http://www.whatwg.org/specs/web-apps/current-work/multipage/webappapis.html#errorevent
     10
     11        The 'colno' attribute is already supported by IE10 and Blink.
     12
     13        No new tests, covered by existing tests.
     14
     15        * dom/ErrorEvent.cpp:
     16        (WebCore::ErrorEventInit::ErrorEventInit):
     17        (WebCore::ErrorEvent::ErrorEvent):
     18        * dom/ErrorEvent.h:
     19        * dom/ErrorEvent.idl:
     20
    1212013-07-30  Andreas Kling  <akling@apple.com>
    222
  • trunk/Source/WebCore/dom/ErrorEvent.cpp

    r153480 r153495  
    4040    , filename()
    4141    , lineno(0)
     42    , colno(0)
    4243{
    4344}
     
    5253    , m_fileName(initializer.filename)
    5354    , m_lineNumber(initializer.lineno)
    54     , m_columnNumber(0)
     55    , m_columnNumber(initializer.colno)
    5556{
    5657}
  • trunk/Source/WebCore/dom/ErrorEvent.h

    r153480 r153495  
    4343    String filename;
    4444    unsigned lineno;
     45    unsigned colno;
    4546};
    4647
  • trunk/Source/WebCore/dom/ErrorEvent.idl

    r131172 r153495  
    3636    [InitializedByEventConstructor] readonly attribute DOMString filename;
    3737    [InitializedByEventConstructor] readonly attribute unsigned long lineno;
     38    [InitializedByEventConstructor] readonly attribute unsigned long colno;
    3839};
    3940
Note: See TracChangeset for help on using the changeset viewer.