Changeset 212178 in webkit


Ignore:
Timestamp:
Feb 10, 2017 8:40:38 PM (7 years ago)
Author:
Chris Dumez
Message:

document.origin doesn't match spec
https://bugs.webkit.org/show_bug.cgi?id=168022

Reviewed by Sam Weinig.

LayoutTests/imported/w3c:

Rebaseline test now that document.origin has the right format.

  • web-platform-tests/dom/nodes/Node-cloneNode-expected.txt:

Source/WebCore:

Update document.origin to return the origin in the expected format:

Change: "https_webkit.org_0 -> "https://webkit.org".

The new behavior matches Firefox and Chrome.

No new tests, updated existing tests.

  • dom/Document.cpp:

(WebCore::Document::origin):

LayoutTests:

  • http/tests/media/media-stream/enumerate-devices-source-id-persistent.html:

Fix test that was passing only because the document.origin would never match the
expected string:

  • Move idCounts to the global scope has the handler function is called 3 times and we need to properly update the same idCounts object in all 3 calls.
  • Fix initialization of idCounts to start at 1, not 0. Otherwise, idCounts[uniqueID] is 0 instead of 1.
  • Use a Map instead of an array since the ids are UUID strings, not integers.
  • Fix check for non-unique ids, was idCounts[deviceId] == 1 instead of idCounts[deviceId] != 1.
  • http/tests/security/contentSecurityPolicy/upgrade-insecure-requests/form-upgrade.html:
  • http/tests/security/contentSecurityPolicy/upgrade-insecure-requests/iframe-upgrade.https.html:
  • http/tests/ssl/iframe-upgrade.https.html:

Update / rebaseline now that document.origin has the right format.

Location:
trunk
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r212172 r212178  
     12017-02-10  Chris Dumez  <cdumez@apple.com>
     2
     3        document.origin doesn't match spec
     4        https://bugs.webkit.org/show_bug.cgi?id=168022
     5
     6        Reviewed by Sam Weinig.
     7
     8        * http/tests/media/media-stream/enumerate-devices-source-id-persistent.html:
     9        Fix test that was passing only because the document.origin would never match the
     10        expected string:
     11        - Move idCounts to the global scope has the handler function is called 3 times
     12          and we need to properly update the same idCounts object in all 3 calls.
     13        - Fix initialization of idCounts to start at 1, not 0. Otherwise, idCounts[uniqueID]
     14          is 0 instead of 1.
     15        - Use a Map instead of an array since the ids are UUID strings, not integers.
     16        - Fix check for non-unique ids, was idCounts[deviceId] == 1 instead of
     17         idCounts[deviceId] != 1.
     18
     19        * http/tests/security/contentSecurityPolicy/upgrade-insecure-requests/form-upgrade.html:
     20        * http/tests/security/contentSecurityPolicy/upgrade-insecure-requests/iframe-upgrade.https.html:
     21        * http/tests/ssl/iframe-upgrade.https.html:
     22        Update / rebaseline now that document.origin has the right format.
     23
    1242017-02-10  Simon Fraser  <simon.fraser@apple.com>
    225
  • trunk/LayoutTests/http/tests/media/media-stream/enumerate-devices-source-id-persistent.html

    r209082 r212178  
    88        <script>
    99            var frameInfos = [];
     10            var idCounts = new Map();
    1011            window.jsTestIsAsync = true;
    1112
     
    2324            function handler(event)
    2425            {
    25                 var idCounts = [];
    26 
    2726                event.data.deviceIds.forEach(function(id) {
    2827                    frameInfos.push({origin : event.data.origin, deviceId : id});
    29                     idCounts[id] = idCounts[id] === undefined ? 0 : ++idCounts[id];
     28                    if (idCounts.has(id))
     29                        idCounts.set(id, idCounts.get(id) + 1);
     30                    else
     31                        idCounts.set(id, 1);
    3032                });
    3133
     
    3739                    var deviceId = frameInfos[i].deviceId;
    3840                    if (frameInfos[i].origin.indexOf("http://localhost:8000") == 0) {
    39                         if (idCounts[deviceId] < 2) {
     41                        if (idCounts.get(deviceId) < 2) {
    4042                            testFailed(`: device ID in ${frameInfos[i].origin} is unique`);
    4143                            success = false;
    4244                        }
    4345                    } else {
    44                         if (idCounts[deviceId] == 1) {
     46                        if (idCounts.get(deviceId) != 1) {
    4547                            testFailed(`: device ID in ${frameInfos[i].origin} is not unique`);
    4648                            success = false;
  • trunk/LayoutTests/http/tests/security/contentSecurityPolicy/upgrade-insecure-requests/form-upgrade.html

    r201753 r212178  
    1515    window.addEventListener('message', t.step_func(e => {
    1616        if (e.source == iframe.contentWindow) {
    17             assert_equals("https_127.0.0.1_8443", e.data.origin);
     17            assert_equals("https://127.0.0.1:8443", e.data.origin);
    1818            t.done();
    1919        }
     
    3131    window.addEventListener('message', t.step_func(e => {
    3232        if (e.source == iframe.contentWindow) {
    33             assert_equals(e.data.origin, "https_localhost_8443");
     33            assert_equals("https://localhost:8443", e.data.origin);
    3434            t.done();
    3535        }
  • trunk/LayoutTests/http/tests/security/contentSecurityPolicy/upgrade-insecure-requests/iframe-upgrade.https.html

    r201753 r212178  
    1818    window.addEventListener('message', t.step_func(e => {
    1919        if (e.source == iframe.contentWindow) {
    20             assert_equals(e.data.origin, "https_127.0.0.1_8443");
     20            assert_equals("https://127.0.0.1:8443", e.data.origin);
    2121            t.done();
    2222        }
     
    3232    window.addEventListener('message', t.step_func(e => {
    3333        if (e.source == iframe.contentWindow) {
    34             assert_equals(e.data.origin, "https_localhost_8443");
     34            assert_equals("https://localhost:8443", e.data.origin);
    3535            t.done();
    3636        }
     
    4747    window.addEventListener('message', t.step_func(e => {
    4848        if (e.source == iframe.contentWindow) {
    49             assert_equals(e.data.origin, "http_localhost_8000");
     49            assert_equals("http://localhost:8000", e.data.origin);
    5050            t.done();
    5151        }
  • trunk/LayoutTests/http/tests/ssl/iframe-upgrade.https.html

    r201753 r212178  
    1818    window.addEventListener('message', t.step_func(e => {
    1919        if (e.source == iframe.contentWindow) {
    20             assert_equals(e.data.origin, "https_127.0.0.1_8443");
     20            assert_equals("https://127.0.0.1:8443", e.data.origin);
    2121            t.done();
    2222        }
     
    3232    window.addEventListener('message', t.step_func(e => {
    3333        if (e.source == iframe.contentWindow) {
    34             assert_equals(e.data.origin, "https_localhost_8443");
     34            assert_equals("https://localhost:8443", e.data.origin);
    3535            t.done();
    3636        }
     
    4747    window.addEventListener('message', t.step_func(e => {
    4848        if (e.source == iframe.contentWindow) {
    49             assert_equals(e.data.origin, "https_127.0.0.1_8443");
     49            assert_equals("https://127.0.0.1:8443", e.data.origin);
    5050            t.done();
    5151        }
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r212162 r212178  
     12017-02-10  Chris Dumez  <cdumez@apple.com>
     2
     3        document.origin doesn't match spec
     4        https://bugs.webkit.org/show_bug.cgi?id=168022
     5
     6        Reviewed by Sam Weinig.
     7
     8        Rebaseline test now that document.origin has the right format.
     9
     10        * web-platform-tests/dom/nodes/Node-cloneNode-expected.txt:
     11
    1122017-02-10  Youenn Fablet  <youenn@apple.com>
    213
  • trunk/LayoutTests/imported/w3c/web-platform-tests/dom/nodes/Node-cloneNode-expected.txt

    r210823 r212178  
    130130PASS createProcessingInstruction
    131131PASS implementation.createDocumentType
    132 FAIL implementation.createDocument assert_equals: expected "null" but got "http_localhost_8800"
     132FAIL implementation.createDocument assert_equals: expected "null" but got "http://localhost:8800"
    133133PASS implementation.createHTMLDocument
    134134PASS node with children
  • trunk/Source/WebCore/ChangeLog

    r212174 r212178  
     12017-02-10  Chris Dumez  <cdumez@apple.com>
     2
     3        document.origin doesn't match spec
     4        https://bugs.webkit.org/show_bug.cgi?id=168022
     5
     6        Reviewed by Sam Weinig.
     7
     8        Update document.origin to return the origin in the expected format:
     9        - https://dom.spec.whatwg.org/#dom-document-origin
     10
     11        Change: "https_webkit.org_0 -> "https://webkit.org".
     12
     13        The new behavior matches Firefox and Chrome.
     14
     15        No new tests, updated existing tests.
     16
     17        * dom/Document.cpp:
     18        (WebCore::Document::origin):
     19
    1202017-02-10  Daniel Bates  <dabates@apple.com>
    221
  • trunk/Source/WebCore/dom/Document.cpp

    r212174 r212178  
    42894289String Document::origin() const
    42904290{
    4291     return SecurityOriginData::fromSecurityOrigin(securityOrigin()).databaseIdentifier();
     4291    return securityOrigin().toString();
    42924292}
    42934293
Note: See TracChangeset for help on using the changeset viewer.