Title: [138722] trunk
Revision
138722
Author
sch...@chromium.org
Date
2013-01-03 11:07:17 -0800 (Thu, 03 Jan 2013)

Log Message

Sandbox-blocked pointer lock should log to the console.
https://bugs.webkit.org/show_bug.cgi?id=105794

Reviewed by Adrienne Walker.

Source/WebCore:

When pointer lock is requested and is denied due to sandbox restrictions
a helpful message to web developers is sent to the developer console.

Existing test expectations updated.

* page/PointerLockController.cpp:
(WebCore::PointerLockController::requestPointerLock):

LayoutTests:

* http/tests/pointer-lock/iframe-sandboxed-expected.txt:
* http/tests/pointer-lock/iframe-sandboxed-nested-disallow-then-allow-pointer-lock-expected.txt:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (138721 => 138722)


--- trunk/LayoutTests/ChangeLog	2013-01-03 19:05:44 UTC (rev 138721)
+++ trunk/LayoutTests/ChangeLog	2013-01-03 19:07:17 UTC (rev 138722)
@@ -1,3 +1,13 @@
+2013-01-03  Vincent Scheib  <sch...@chromium.org>
+
+        Sandbox-blocked pointer lock should log to the console.
+        https://bugs.webkit.org/show_bug.cgi?id=105794
+
+        Reviewed by Adrienne Walker.
+
+        * http/tests/pointer-lock/iframe-sandboxed-expected.txt:
+        * http/tests/pointer-lock/iframe-sandboxed-nested-disallow-then-allow-pointer-lock-expected.txt:
+
 2013-01-03  Alexis Menard  <ale...@webkit.org>
 
         Add tests to cover what transition-timing-function accepts for cubic-bezier values.

Modified: trunk/LayoutTests/http/tests/pointer-lock/iframe-sandboxed-expected.txt (138721 => 138722)


--- trunk/LayoutTests/http/tests/pointer-lock/iframe-sandboxed-expected.txt	2013-01-03 19:05:44 UTC (rev 138721)
+++ trunk/LayoutTests/http/tests/pointer-lock/iframe-sandboxed-expected.txt	2013-01-03 19:07:17 UTC (rev 138722)
@@ -1,3 +1,4 @@
+CONSOLE MESSAGE: Blocked pointer lock on an element because the element's frame is sandboxed and the 'allow-pointer-lock' permission is not set.
 Test sandboxed iframe blocks pointer lock.
 
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".

Modified: trunk/LayoutTests/http/tests/pointer-lock/iframe-sandboxed-nested-disallow-then-allow-pointer-lock-expected.txt (138721 => 138722)


--- trunk/LayoutTests/http/tests/pointer-lock/iframe-sandboxed-nested-disallow-then-allow-pointer-lock-expected.txt	2013-01-03 19:05:44 UTC (rev 138721)
+++ trunk/LayoutTests/http/tests/pointer-lock/iframe-sandboxed-nested-disallow-then-allow-pointer-lock-expected.txt	2013-01-03 19:07:17 UTC (rev 138722)
@@ -1,3 +1,4 @@
+CONSOLE MESSAGE: Blocked pointer lock on an element because the element's frame is sandboxed and the 'allow-pointer-lock' permission is not set.
 Test nested sandboxed iframes without and then with allow-pointer-lock disallow pointer lock.
 
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".

Modified: trunk/Source/WebCore/ChangeLog (138721 => 138722)


--- trunk/Source/WebCore/ChangeLog	2013-01-03 19:05:44 UTC (rev 138721)
+++ trunk/Source/WebCore/ChangeLog	2013-01-03 19:07:17 UTC (rev 138722)
@@ -1,3 +1,18 @@
+2013-01-03  Vincent Scheib  <sch...@chromium.org>
+
+        Sandbox-blocked pointer lock should log to the console.
+        https://bugs.webkit.org/show_bug.cgi?id=105794
+
+        Reviewed by Adrienne Walker.
+
+        When pointer lock is requested and is denied due to sandbox restrictions
+        a helpful message to web developers is sent to the developer console.
+
+        Existing test expectations updated.
+
+        * page/PointerLockController.cpp:
+        (WebCore::PointerLockController::requestPointerLock):
+
 2013-01-03  Tom Sepez  <tse...@chromium.org>
 
         PingLoader.h missing virtual and OVERRIDE keywords on its inherited methods.

Modified: trunk/Source/WebCore/page/PointerLockController.cpp (138721 => 138722)


--- trunk/Source/WebCore/page/PointerLockController.cpp	2013-01-03 19:05:44 UTC (rev 138721)
+++ trunk/Source/WebCore/page/PointerLockController.cpp	2013-01-03 19:07:17 UTC (rev 138722)
@@ -48,12 +48,18 @@
 
 void PointerLockController::requestPointerLock(Element* target)
 {
-    if (!target || !target->inDocument() || m_documentOfRemovedElementWhileWaitingForUnlock
-        || target->document()->isSandboxed(SandboxPointerLock)) {
+    if (!target || !target->inDocument() || m_documentOfRemovedElementWhileWaitingForUnlock) {
         enqueueEvent(eventNames().webkitpointerlockerrorEvent, target);
         return;
     }
 
+    if (target->document()->isSandboxed(SandboxPointerLock)) {
+        // FIXME: This message should be moved off the console once a solution to https://bugs.webkit.org/show_bug.cgi?id=103274 exists.
+        target->document()->addConsoleMessage(JSMessageSource, ErrorMessageLevel, "Blocked pointer lock on an element because the element's frame is sandboxed and the 'allow-pointer-lock' permission is not set.");
+        enqueueEvent(eventNames().webkitpointerlockerrorEvent, target);
+        return;
+    }
+
     if (m_element) {
         if (m_element->document() != target->document()) {
             enqueueEvent(eventNames().webkitpointerlockerrorEvent, target);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to