Diff
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (205137 => 205138)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2016-08-29 19:44:48 UTC (rev 205137)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2016-08-29 19:55:11 UTC (rev 205138)
@@ -1,5 +1,18 @@
2016-08-29 Chris Dumez <[email protected]>
+ document.createEvent("popstateevent") should create a PopStateEvent
+ https://bugs.webkit.org/show_bug.cgi?id=161321
+
+ Reviewed by Darin Adler.
+
+ Rebaseline several W3C tests now that more checks are passing.
+
+ * web-platform-tests/dom/events/EventTarget-dispatchEvent-expected.txt:
+ * web-platform-tests/dom/nodes/Document-createEvent-expected.txt:
+ * web-platform-tests/html/browsers/browsing-the-web/history-traversal/PopStateEvent-expected.txt:
+
+2016-08-29 Chris Dumez <[email protected]>
+
We should throw a SecurityError when denying access to cross-origin Window properties
https://bugs.webkit.org/show_bug.cgi?id=161316
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/dom/events/EventTarget-dispatchEvent-expected.txt (205137 => 205138)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/dom/events/EventTarget-dispatchEvent-expected.txt 2016-08-29 19:44:48 UTC (rev 205137)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/dom/events/EventTarget-dispatchEvent-expected.txt 2016-08-29 19:55:11 UTC (rev 205138)
@@ -21,7 +21,7 @@
PASS If the event's initialized flag is not set, an InvalidStateError must be thrown (MouseEvent).
PASS If the event's initialized flag is not set, an InvalidStateError must be thrown (MouseEvents).
FAIL If the event's initialized flag is not set, an InvalidStateError must be thrown (PageTransitionEvent). The operation is not supported.
-FAIL If the event's initialized flag is not set, an InvalidStateError must be thrown (PopStateEvent). The operation is not supported.
+PASS If the event's initialized flag is not set, an InvalidStateError must be thrown (PopStateEvent).
FAIL If the event's initialized flag is not set, an InvalidStateError must be thrown (ProgressEvent). The operation is not supported.
PASS If the event's initialized flag is not set, an InvalidStateError must be thrown (StorageEvent).
FAIL If the event's initialized flag is not set, an InvalidStateError must be thrown (SVGEvents). The operation is not supported.
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/dom/nodes/Document-createEvent-expected.txt (205137 => 205138)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/dom/nodes/Document-createEvent-expected.txt 2016-08-29 19:44:48 UTC (rev 205137)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/dom/nodes/Document-createEvent-expected.txt 2016-08-29 19:55:11 UTC (rev 205138)
@@ -135,12 +135,12 @@
FAIL PAGETRANSITIONEVENT should be an alias for PageTransitionEvent. The operation is not supported.
FAIL createEvent('PAGETRANSITIONEVENT') should be initialized correctly. undefined is not an object (evaluating 'ev.type')
PASS Should throw NOT_SUPPORTED_ERR for pluralized legacy event interface "PageTransitionEvents"
-FAIL PopStateEvent should be an alias for PopStateEvent. The operation is not supported.
-FAIL createEvent('PopStateEvent') should be initialized correctly. undefined is not an object (evaluating 'ev.type')
-FAIL popstateevent should be an alias for PopStateEvent. The operation is not supported.
-FAIL createEvent('popstateevent') should be initialized correctly. undefined is not an object (evaluating 'ev.type')
-FAIL POPSTATEEVENT should be an alias for PopStateEvent. The operation is not supported.
-FAIL createEvent('POPSTATEEVENT') should be initialized correctly. undefined is not an object (evaluating 'ev.type')
+PASS PopStateEvent should be an alias for PopStateEvent.
+PASS createEvent('PopStateEvent') should be initialized correctly.
+PASS popstateevent should be an alias for PopStateEvent.
+PASS createEvent('popstateevent') should be initialized correctly.
+PASS POPSTATEEVENT should be an alias for PopStateEvent.
+PASS createEvent('POPSTATEEVENT') should be initialized correctly.
PASS Should throw NOT_SUPPORTED_ERR for pluralized legacy event interface "PopStateEvents"
FAIL ProgressEvent should be an alias for ProgressEvent. The operation is not supported.
FAIL createEvent('ProgressEvent') should be initialized correctly. undefined is not an object (evaluating 'ev.type')
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/browsing-the-web/history-traversal/PopStateEvent-expected.txt (205137 => 205138)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/browsing-the-web/history-traversal/PopStateEvent-expected.txt 2016-08-29 19:44:48 UTC (rev 205137)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/browsing-the-web/history-traversal/PopStateEvent-expected.txt 2016-08-29 19:55:11 UTC (rev 205138)
@@ -1,5 +1,5 @@
-FAIL document.createEvent The operation is not supported.
+PASS document.createEvent
PASS initPopStateEvent
PASS Dispatching a synthetic PopStateEvent
Modified: trunk/Source/WebCore/ChangeLog (205137 => 205138)
--- trunk/Source/WebCore/ChangeLog 2016-08-29 19:44:48 UTC (rev 205137)
+++ trunk/Source/WebCore/ChangeLog 2016-08-29 19:55:11 UTC (rev 205138)
@@ -1,5 +1,26 @@
2016-08-29 Chris Dumez <[email protected]>
+ document.createEvent("popstateevent") should create a PopStateEvent
+ https://bugs.webkit.org/show_bug.cgi?id=161321
+
+ Reviewed by Darin Adler.
+
+ document.createEvent("popstateevent") should create a PopStateEvent as per:
+ - https://dom.spec.whatwg.org/#dom-document-createevent
+
+ Firefox and Chrome match the specification but WebKit throws an exception,
+ which is risky compatibility-wise.
+
+ No new tests, rebaselined existing tests.
+
+ * dom/Document.cpp:
+ (WebCore::Document::createEvent):
+ * dom/PopStateEvent.cpp:
+ (WebCore::PopStateEvent::createForBindings):
+ * dom/PopStateEvent.h:
+
+2016-08-29 Chris Dumez <[email protected]>
+
We should throw a SecurityError when denying access to cross-origin Window properties
https://bugs.webkit.org/show_bug.cgi?id=161316
Modified: trunk/Source/WebCore/dom/Document.cpp (205137 => 205138)
--- trunk/Source/WebCore/dom/Document.cpp 2016-08-29 19:44:48 UTC (rev 205137)
+++ trunk/Source/WebCore/dom/Document.cpp 2016-08-29 19:55:11 UTC (rev 205138)
@@ -4303,6 +4303,8 @@
return MouseEvent::createForBindings();
if (equalLettersIgnoringASCIICase(type, "uievent") || equalLettersIgnoringASCIICase(type, "uievents"))
return UIEvent::createForBindings();
+ if (equalLettersIgnoringASCIICase(type, "popstateevent"))
+ return PopStateEvent::createForBindings();
#if ENABLE(TOUCH_EVENTS)
if (equalLettersIgnoringASCIICase(type, "touchevent"))
Modified: trunk/Source/WebCore/dom/PopStateEvent.cpp (205137 => 205138)
--- trunk/Source/WebCore/dom/PopStateEvent.cpp 2016-08-29 19:44:48 UTC (rev 205137)
+++ trunk/Source/WebCore/dom/PopStateEvent.cpp 2016-08-29 19:55:11 UTC (rev 205138)
@@ -60,6 +60,11 @@
return adoptRef(*new PopStateEvent(type, initializer));
}
+Ref<PopStateEvent> PopStateEvent::createForBindings()
+{
+ return adoptRef(*new PopStateEvent);
+}
+
RefPtr<SerializedScriptValue> PopStateEvent::trySerializeState(JSC::ExecState* exec)
{
ASSERT(!m_state.hasNoValue());
Modified: trunk/Source/WebCore/dom/PopStateEvent.h (205137 => 205138)
--- trunk/Source/WebCore/dom/PopStateEvent.h 2016-08-29 19:44:48 UTC (rev 205137)
+++ trunk/Source/WebCore/dom/PopStateEvent.h 2016-08-29 19:55:11 UTC (rev 205138)
@@ -43,6 +43,7 @@
virtual ~PopStateEvent();
static Ref<PopStateEvent> create(RefPtr<SerializedScriptValue>&&, PassRefPtr<History>);
static Ref<PopStateEvent> createForBindings(const AtomicString&, const PopStateEventInit&);
+ static Ref<PopStateEvent> createForBindings();
JSC::JSValue state() const { return m_state; }
SerializedScriptValue* serializedState() const { return m_serializedState.get(); }
@@ -54,6 +55,7 @@
EventInterface eventInterface() const override;
private:
+ PopStateEvent() = default;
PopStateEvent(const AtomicString&, const PopStateEventInit&);
explicit PopStateEvent(PassRefPtr<SerializedScriptValue>, PassRefPtr<History>);