Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Unified Diff: LayoutTests/fast/dom/Geolocation/script-tests/invalid-internals-arguments.js

Issue 925953003: Make Geolocation internal test methods more resilient. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: LayoutTests/fast/dom/Geolocation/script-tests/invalid-internals-arguments.js
diff --git a/LayoutTests/fast/dom/Geolocation/script-tests/invalid-internals-arguments.js b/LayoutTests/fast/dom/Geolocation/script-tests/invalid-internals-arguments.js
new file mode 100644
index 0000000000000000000000000000000000000000..d5e3d43caa4fcb4d16da7a3fef2986535f718dbb
--- /dev/null
+++ b/LayoutTests/fast/dom/Geolocation/script-tests/invalid-internals-arguments.js
@@ -0,0 +1,23 @@
+description("Verify that using invalid or detached documents on internal test methods does not crash.");
+
+// The internals object and these test methods aren't available in production
+// builds, but they are exposed to fuzzers.
+
+if (!window.testRunner || !window.internals)
+ debug('This test can not run without testRunner or internals');
+
+shouldThrow("internals.setGeolocationClientMock(null);");
+shouldThrow("internals.setGeolocationPosition(null, 1, 2, 3);");
+shouldThrow("internals.setGeolocationPermission(window.notThere, true);");
+shouldThrow("internals.setGeolocationPositionUnavailableError(null, 'not available');");
+shouldThrow("internals.numberOfPendingGeolocationPermissionRequests(null)");
+
+var ifr = document.getElementById("ifr");
+var iframe = ifr.contentWindow;
+ifr.remove();
+// Verify that detached documents do not crash.
+shouldBeUndefined("iframe.internals.setGeolocationClientMock(iframe.document)");
+shouldBeUndefined("iframe.internals.setGeolocationPosition(iframe.document, 1, 2, 3)");
+shouldBeUndefined("iframe.internals.setGeolocationPermission(iframe.document, true)");
+shouldBeUndefined("iframe.internals.setGeolocationPositionUnavailableError(iframe.document, 'not available')");
+shouldBe("iframe.internals.numberOfPendingGeolocationPermissionRequests(iframe.document)", "-1");

Powered by Google App Engine
This is Rietveld 408576698