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.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@113945
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2012-04-11 Adam Barth <abarth@webkit.org>
+
+ Implement Location.ancestorOrigins
+ https://bugs.webkit.org/show_bug.cgi?id=83493
+
+ Reviewed by David Levin.
+
+ * fast/dom/Window/Location/ancestor-origins-expected.txt: Added.
+ * fast/dom/Window/Location/ancestor-origins.html: Added.
+
2012-04-11 Antonio Gomes <agomes@rim.com>
Unreviewed rebaseline.
--- /dev/null
+ancestorOrigins.length = 0
+
+--------
+Frame: '<!--framePath //<!--frame0-->-->'
+--------
+ancestorOrigins.length = 1
+ancestorOrigins[0] = file://
--- /dev/null
+<script>
+if (window.layoutTestController) {
+ layoutTestController.dumpAsText();
+ layoutTestController.dumpChildFramesAsText();
+}
+
+var origins = location.ancestorOrigins;
+document.write('ancestorOrigins.length = ' + origins.length);
+</script>
+<iframe srcdoc="
+ <script>
+ var origins = location.ancestorOrigins;
+ document.write('ancestorOrigins.length = ' + origins.length + '<br>');
+ document.write('ancestorOrigins[0] = ' + origins[0]);
+ </script>
+"></iframe>
PASS history.pushState == "LEFTOVER" is false
PASS history.replaceState == "LEFTOVER" is false
PASS history.state == "LEFTOVER" is false
+PASS location.ancestorOrigins == "LEFTOVER" is false
PASS location.assign == "LEFTOVER" is false
PASS location.hash == "LEFTOVER" is false
PASS location.host == "LEFTOVER" is false
+2012-04-11 Adam Barth <abarth@webkit.org>
+
+ Implement Location.ancestorOrigins
+ https://bugs.webkit.org/show_bug.cgi?id=83493
+
+ Reviewed by David Levin.
+
+ 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:
+
2012-04-11 Raymond Liu <raymond.liu@intel.com>
AudioContext createChannelSplitter() method should have optional argument for number of outputs
return SecurityOrigin::create(url())->toString();
}
+PassRefPtr<DOMStringList> Location::ancestorOrigins() const
+{
+ RefPtr<DOMStringList> origins = DOMStringList::create();
+ if (!m_frame)
+ return origins.release();
+ for (Frame* frame = m_frame->tree()->parent(true); frame; frame = frame->tree()->parent(true))
+ origins->append(frame->document()->securityOrigin()->toString());
+ return origins.release();
+}
+
String Location::hash() const
{
if (!m_frame)
#ifndef Location_h
#define Location_h
+#include "DOMStringList.h"
#include "DOMWindowProperty.h"
#include <wtf/PassRefPtr.h>
#include <wtf/RefCounted.h>
String toString() const { return href(); }
+ PassRefPtr<DOMStringList> ancestorOrigins() const;
+
private:
explicit Location(Frame*);
readonly attribute DOMString origin;
#endif
+ readonly attribute DOMStringList ancestorOrigins;
+
#if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT
[NotEnumerable, Custom, V8Unforgeable, V8ReadOnly, ImplementedAs=toStringFunction] DOMString toString();
#endif