haikuwebkit/LayoutTests/js/navigator-set-geolocation.html

30 lines
740 B
HTML
Raw Permalink Normal View History

Navigator.geolocation should not be marked a [Replaceable] and should be on the prototype https://bugs.webkit.org/show_bug.cgi?id=154304 <rdar://problem/24685092> Reviewed by Gavin Barraclough. LayoutTests/imported/w3c: Rebaseline test now that more checks are passing. * web-platform-tests/html/dom/interfaces-expected.txt: Source/WebCore: 1. Drop the [Replaceable] IDL extended attribute for navigator.geolocation as this does not match other browsers or the specification: - https://dev.w3.org/geo/api/spec-source.html#geolocation_interface 2. Move Navigator attributes to the prototype, where they should be as per the Web IDL specification. The previous behavior was meant as a workaround for a bug in the Amazon iOS app (rdar://problem/16332749). However, I have confirmed that the latest Amazon App no longer has any issue with those changes. Test: js/navigator-set-geolocation.html * Modules/geolocation/NavigatorGeolocation.idl: * bindings/scripts/CodeGeneratorJS.pm: (InterfaceRequiresAttributesOnInstanceForCompatibility): Deleted. LayoutTests: * fast/dom/Geolocation/enabled-expected.txt: * fast/dom/Geolocation/script-tests/enabled.js: * js/dom/delete-syntax-expected.txt: * js/dom/script-tests/delete-syntax.js: Update tests as they expected the navigator properties to be on the instance rather than the prototype. * js/dom/script-tests/shadow-navigator-geolocation-in-strict-mode-does-not-throw.js: Removed. * js/dom/shadow-navigator-geolocation-in-strict-mode-does-not-throw-expected.txt: Removed. * js/dom/shadow-navigator-geolocation-in-strict-mode-does-not-throw.html: Removed. Drop outdated test. * js/navigator-set-geolocation-expected.txt: Added. * js/navigator-set-geolocation.html: Added. Add test to make sure that Navigator.geolocation cannot be set. I verified that this test passes in both Firefox and Chrome. Canonical link: https://commits.webkit.org/172433@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@196673 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-02-17 01:11:29 +00:00
<script src="../resources/js-test-pre.js"></script>
<script>
description("Tests that navigator.geolocation cannot be shadowed.");
function testInStrictMode()
{
"use strict";
try {
navigator.geolocation = 1;
testFailed("navigator.geolocation = 1 did not throw exception.");
} catch (e) {
testPassed("navigator.geolocation = 1 threw exception " + e + ".");
}
shouldNotBe("navigator.geolocation", "1");
}
function testInNonStrictMode()
{
shouldNotThrow("navigator.geolocation = 1");
shouldNotBe("navigator.geolocation", "1");
}
debug("* Strict mode");
testInStrictMode();
debug ("* Non-Strict mode");
testInNonStrictMode();
</script>
<script src="../resources/js-test-post.js"></script>