Changeset 113945 in webkit


Ignore:
Timestamp:
Apr 11, 2012 11:35:40 PM (12 years ago)
Author:
abarth@webkit.org
Message:

Implement Location.ancestorOrigins
https://bugs.webkit.org/show_bug.cgi?id=83493

Reviewed by David Levin.

Source/WebCore:

Test: fast/dom/Window/Location/ancestor-origins.html

This patch implements Location.ancestorOrigins(), which returns a list
of the origins of the enclosing frames. This API has been discussed
both on webkit-dev (see discussion following
https://lists.webkit.org/pipermail/webkit-dev/2012-March/020090.html)
and on the whatwg list (see discussion following
http://lists.whatwg.org/htdig.cgi/whatwg-whatwg.org/2012-March/035188.html).

  • page/Location.cpp:

(WebCore::Location::ancestorOrigins):
(WebCore):

  • page/Location.h:

(Location):

  • page/Location.idl:

LayoutTests:

  • fast/dom/Window/Location/ancestor-origins-expected.txt: Added.
  • fast/dom/Window/Location/ancestor-origins.html: Added.
Location:
trunk
Files:
2 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r113944 r113945  
     12012-04-11  Adam Barth  <abarth@webkit.org>
     2
     3        Implement Location.ancestorOrigins
     4        https://bugs.webkit.org/show_bug.cgi?id=83493
     5
     6        Reviewed by David Levin.
     7
     8        * fast/dom/Window/Location/ancestor-origins-expected.txt: Added.
     9        * fast/dom/Window/Location/ancestor-origins.html: Added.
     10
    1112012-04-11  Antonio Gomes  <agomes@rim.com>
    212
  • trunk/LayoutTests/fast/dom/Window/window-appendages-cleared-expected.txt

    r107058 r113945  
    66PASS history.replaceState == "LEFTOVER" is false
    77PASS history.state == "LEFTOVER" is false
     8PASS location.ancestorOrigins == "LEFTOVER" is false
    89PASS location.assign == "LEFTOVER" is false
    910PASS location.hash == "LEFTOVER" is false
  • trunk/Source/WebCore/ChangeLog

    r113940 r113945  
     12012-04-11  Adam Barth  <abarth@webkit.org>
     2
     3        Implement Location.ancestorOrigins
     4        https://bugs.webkit.org/show_bug.cgi?id=83493
     5
     6        Reviewed by David Levin.
     7
     8        Test: fast/dom/Window/Location/ancestor-origins.html
     9
     10        This patch implements Location.ancestorOrigins(), which returns a list
     11        of the origins of the enclosing frames.  This API has been discussed
     12        both on webkit-dev (see discussion following
     13        https://lists.webkit.org/pipermail/webkit-dev/2012-March/020090.html)
     14        and on the whatwg list (see discussion following
     15        http://lists.whatwg.org/htdig.cgi/whatwg-whatwg.org/2012-March/035188.html).
     16
     17        * page/Location.cpp:
     18        (WebCore::Location::ancestorOrigins):
     19        (WebCore):
     20        * page/Location.h:
     21        (Location):
     22        * page/Location.idl:
     23
    1242012-04-11  Raymond Liu  <raymond.liu@intel.com>
    225
  • trunk/Source/WebCore/page/Location.cpp

    r104380 r113945  
    125125}
    126126
     127PassRefPtr<DOMStringList> Location::ancestorOrigins() const
     128{
     129    RefPtr<DOMStringList> origins = DOMStringList::create();
     130    if (!m_frame)
     131        return origins.release();
     132    for (Frame* frame = m_frame->tree()->parent(true); frame; frame = frame->tree()->parent(true))
     133        origins->append(frame->document()->securityOrigin()->toString());
     134    return origins.release();
     135}
     136
    127137String Location::hash() const
    128138{
  • trunk/Source/WebCore/page/Location.h

    r104380 r113945  
    3030#define Location_h
    3131
     32#include "DOMStringList.h"
    3233#include "DOMWindowProperty.h"
    3334#include <wtf/PassRefPtr.h>
     
    7273    String toString() const { return href(); }
    7374
     75    PassRefPtr<DOMStringList> ancestorOrigins() const;
     76
    7477private:
    7578    explicit Location(Frame*);
  • trunk/Source/WebCore/page/Location.idl

    r108201 r113945  
    6565#endif
    6666
     67        readonly attribute DOMStringList ancestorOrigins;
     68
    6769#if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT
    6870        [NotEnumerable, Custom, V8Unforgeable, V8ReadOnly, ImplementedAs=toStringFunction] DOMString toString();
Note: See TracChangeset for help on using the changeset viewer.