Changeset 192810 in webkit


Ignore:
Timestamp:
Nov 30, 2015 11:27:26 AM (8 years ago)
Author:
Chris Dumez
Message:

location.origin is undefined in a web worker
https://bugs.webkit.org/show_bug.cgi?id=151614

Reviewed by Darin Adler.

Source/WebCore:

Expose location.origin to web workers, as per:
https://html.spec.whatwg.org/multipage/workers.html#workerlocation

This behavior is consistent with the behavior of Firefox and Chrome.

Test: fast/workers/worker-location.html

  • workers/WorkerLocation.cpp:

(WebCore::WorkerLocation::origin):

  • workers/WorkerLocation.h:
  • workers/WorkerLocation.idl:

LayoutTests:

Update existing layout test to confirm the existence of location.origin when in a
WorkerGlobalScope.

  • fast/workers/resources/worker-location.js:
  • fast/workers/worker-location-expected.txt:
Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r192806 r192810  
     12015-11-30  Chris Dumez  <cdumez@apple.com>
     2
     3        location.origin is undefined in a web worker
     4        https://bugs.webkit.org/show_bug.cgi?id=151614
     5
     6        Reviewed by Darin Adler.
     7
     8        Update existing layout test to confirm the existence of location.origin when in a
     9        WorkerGlobalScope.
     10
     11        * fast/workers/resources/worker-location.js:
     12        * fast/workers/worker-location-expected.txt:
     13
    1142015-11-30  Brady Eidson  <beidson@apple.com>
    215
  • trunk/LayoutTests/fast/workers/resources/worker-location.js

    r124680 r192810  
    3131worker.postMessage("eval location.search");
    3232worker.postMessage("eval location.hash");
     33worker.postMessage("eval location.origin");
    3334worker.postMessage("eval foo//bar");
    3435
  • trunk/LayoutTests/fast/workers/worker-location-expected.txt

    r39289 r192810  
    1212location.search:
    1313location.hash:
     14location.origin: file://
    1415DONE
    1516
  • trunk/Source/WebCore/ChangeLog

    r192806 r192810  
     12015-11-30  Chris Dumez  <cdumez@apple.com>
     2
     3        location.origin is undefined in a web worker
     4        https://bugs.webkit.org/show_bug.cgi?id=151614
     5
     6        Reviewed by Darin Adler.
     7
     8        Expose location.origin to web workers, as per:
     9        https://html.spec.whatwg.org/multipage/workers.html#workerlocation
     10
     11        This behavior is consistent with the behavior of Firefox and Chrome.
     12
     13        Test: fast/workers/worker-location.html
     14
     15        * workers/WorkerLocation.cpp:
     16        (WebCore::WorkerLocation::origin):
     17        * workers/WorkerLocation.h:
     18        * workers/WorkerLocation.idl:
     19
    1202015-11-30  Brady Eidson  <beidson@apple.com>
    221
  • trunk/Source/WebCore/workers/WorkerLocation.cpp

    r165676 r192810  
    2626
    2727#include "config.h"
    28 
    2928#include "WorkerLocation.h"
    3029
     30#include "SecurityOrigin.h"
    3131#include <wtf/text/WTFString.h>
    3232
     
    7373}
    7474
     75String WorkerLocation::origin() const
     76{
     77    return SecurityOrigin::create(m_url)->toString();
     78}
    7579
    7680} // namespace WebCore
  • trunk/Source/WebCore/workers/WorkerLocation.h

    r177733 r192810  
    5555        String search() const;
    5656        String hash() const;
     57        String origin() const;
    5758
    5859        String toString() const { return href(); }
  • trunk/Source/WebCore/workers/WorkerLocation.idl

    r171824 r192810  
    4040    readonly attribute DOMString search;
    4141    readonly attribute DOMString hash;
     42    readonly attribute DOMString origin;
    4243
    4344    [NotEnumerable] DOMString toString();
Note: See TracChangeset for help on using the changeset viewer.