Title: [197288] releases/WebKitGTK/webkit-2.4
Revision
197288
Author
[email protected]
Date
2016-02-28 06:01:55 -0800 (Sun, 28 Feb 2016)

Log Message

Merge r182284 - Clean up access checks in JSHistoryCustom.cpp
https://bugs.webkit.org/show_bug.cgi?id=143227

Reviewed by Sam Weinig.

Source/WebCore:

* bindings/js/JSHistoryCustom.cpp:
(WebCore::JSHistory::putDelegate):
(WebCore::JSHistory::deleteProperty):
(WebCore::JSHistory::deletePropertyByIndex):
(WebCore::JSHistory::getOwnPropertyNames):
(WebCore::JSHistory::pushState):
(WebCore::JSHistory::replaceState):

LayoutTests:

* http/tests/security/cross-frame-access-call-expected.txt:
* http/tests/security/cross-frame-access-call.html:

Modified Paths

Diff

Modified: releases/WebKitGTK/webkit-2.4/LayoutTests/ChangeLog (197287 => 197288)


--- releases/WebKitGTK/webkit-2.4/LayoutTests/ChangeLog	2016-02-28 14:00:00 UTC (rev 197287)
+++ releases/WebKitGTK/webkit-2.4/LayoutTests/ChangeLog	2016-02-28 14:01:55 UTC (rev 197288)
@@ -1,3 +1,13 @@
+2015-04-02  Alexey Proskuryakov  <[email protected]>
+
+        Clean up access checks in JSHistoryCustom.cpp
+        https://bugs.webkit.org/show_bug.cgi?id=143227
+
+        Reviewed by Sam Weinig.
+
+        * http/tests/security/cross-frame-access-call-expected.txt:
+        * http/tests/security/cross-frame-access-call.html:
+
 2014-08-27  Daniel Bates  <[email protected]>
 
         Scrollbar corner can be drawn outside containing frame

Modified: releases/WebKitGTK/webkit-2.4/LayoutTests/http/tests/security/cross-frame-access-call-expected.txt (197287 => 197288)


--- releases/WebKitGTK/webkit-2.4/LayoutTests/http/tests/security/cross-frame-access-call-expected.txt	2016-02-28 14:00:00 UTC (rev 197287)
+++ releases/WebKitGTK/webkit-2.4/LayoutTests/http/tests/security/cross-frame-access-call-expected.txt	2016-02-28 14:01:55 UTC (rev 197288)
@@ -59,4 +59,6 @@
 PASS: window.showModalDialog.call(targetWindow); should be 'undefined' and is.
 PASS: window.eval.call(targetWindow, '1+2'); should be '3' and is.
 PASS: window.location.toString.call(targetWindow.location) should be 'undefined' and is.
+PASS: history.pushState.call(targetWindow.history, {}, '', 'http://localhost:8000/foobar') should be 'undefined' and is.
+PASS: history.replaceState.call(targetWindow.history, {}, '', 'http://localhost:8000/foobar') should be 'undefined' and is.
 

Modified: releases/WebKitGTK/webkit-2.4/LayoutTests/http/tests/security/cross-frame-access-call.html (197287 => 197288)


--- releases/WebKitGTK/webkit-2.4/LayoutTests/http/tests/security/cross-frame-access-call.html	2016-02-28 14:00:00 UTC (rev 197287)
+++ releases/WebKitGTK/webkit-2.4/LayoutTests/http/tests/security/cross-frame-access-call.html	2016-02-28 14:01:55 UTC (rev 197288)
@@ -63,6 +63,10 @@
     // undefined value indicates failure
     shouldBe("window.location.toString.call(targetWindow.location)", "undefined");
 
+    // - Tests for the History object -
+    shouldBe("history.pushState.call(targetWindow.history, {}, '', 'http://localhost:8000/foobar')", "undefined"), 
+    shouldBe("history.replaceState.call(targetWindow.history, {}, '', 'http://localhost:8000/foobar')", "undefined"), 
+
     // Work around DRT bug that causes subsequent tests to fail.
     window.stop();
 }

Modified: releases/WebKitGTK/webkit-2.4/Source/WebCore/ChangeLog (197287 => 197288)


--- releases/WebKitGTK/webkit-2.4/Source/WebCore/ChangeLog	2016-02-28 14:00:00 UTC (rev 197287)
+++ releases/WebKitGTK/webkit-2.4/Source/WebCore/ChangeLog	2016-02-28 14:01:55 UTC (rev 197288)
@@ -1,3 +1,18 @@
+2015-04-02  Alexey Proskuryakov  <[email protected]>
+
+        Clean up access checks in JSHistoryCustom.cpp
+        https://bugs.webkit.org/show_bug.cgi?id=143227
+
+        Reviewed by Sam Weinig.
+
+        * bindings/js/JSHistoryCustom.cpp:
+        (WebCore::JSHistory::putDelegate):
+        (WebCore::JSHistory::deleteProperty):
+        (WebCore::JSHistory::deletePropertyByIndex):
+        (WebCore::JSHistory::getOwnPropertyNames):
+        (WebCore::JSHistory::pushState):
+        (WebCore::JSHistory::replaceState):
+
 2014-08-27  Daniel Bates  <[email protected]>
 
         Scrollbar corner can be drawn outside containing frame

Modified: releases/WebKitGTK/webkit-2.4/Source/WebCore/bindings/js/JSHistoryCustom.cpp (197287 => 197288)


--- releases/WebKitGTK/webkit-2.4/Source/WebCore/bindings/js/JSHistoryCustom.cpp	2016-02-28 14:00:00 UTC (rev 197287)
+++ releases/WebKitGTK/webkit-2.4/Source/WebCore/bindings/js/JSHistoryCustom.cpp	2016-02-28 14:01:55 UTC (rev 197288)
@@ -96,7 +96,6 @@
 
 bool JSHistory::putDelegate(ExecState* exec, PropertyName, JSValue, PutPropertySlot&)
 {
-    // Only allow putting by frames in the same origin.
     if (!shouldAllowAccessToFrame(exec, impl().frame()))
         return true;
     return false;
@@ -105,7 +104,6 @@
 bool JSHistory::deleteProperty(JSCell* cell, ExecState* exec, PropertyName propertyName)
 {
     JSHistory* thisObject = jsCast<JSHistory*>(cell);
-    // Only allow deleting by frames in the same origin.
     if (!shouldAllowAccessToFrame(exec, thisObject->impl().frame()))
         return false;
     return Base::deleteProperty(thisObject, exec, propertyName);
@@ -114,7 +112,6 @@
 bool JSHistory::deletePropertyByIndex(JSCell* cell, ExecState* exec, unsigned propertyName)
 {
     JSHistory* thisObject = jsCast<JSHistory*>(cell);
-    // Only allow deleting by frames in the same origin.
     if (!shouldAllowAccessToFrame(exec, thisObject->impl().frame()))
         return false;
     return Base::deletePropertyByIndex(thisObject, exec, propertyName);
@@ -123,7 +120,6 @@
 void JSHistory::getOwnPropertyNames(JSObject* object, ExecState* exec, PropertyNameArray& propertyNames, EnumerationMode mode)
 {
     JSHistory* thisObject = jsCast<JSHistory*>(object);
-    // Only allow the history object to enumerated by frames in the same origin.
     if (!shouldAllowAccessToFrame(exec, thisObject->impl().frame()))
         return;
     Base::getOwnPropertyNames(thisObject, exec, propertyNames, mode);
@@ -145,6 +141,9 @@
 
 JSValue JSHistory::pushState(ExecState* exec)
 {
+    if (!shouldAllowAccessToFrame(exec, impl().frame()))
+        return jsUndefined();
+
     RefPtr<SerializedScriptValue> historyState = SerializedScriptValue::create(exec, exec->argument(0), 0, 0);
     if (exec->hadException())
         return jsUndefined();
@@ -171,6 +170,9 @@
 
 JSValue JSHistory::replaceState(ExecState* exec)
 {
+    if (!shouldAllowAccessToFrame(exec, impl().frame()))
+        return jsUndefined();
+
     RefPtr<SerializedScriptValue> historyState = SerializedScriptValue::create(exec, exec->argument(0), 0, 0);
     if (exec->hadException())
         return jsUndefined();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to