1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/settings/tests/test_settings_navigator_object.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,43 @@ 1.4 +<!DOCTYPE html> 1.5 +<html> 1.6 +<!-- 1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=898512 1.8 +--> 1.9 +<head> 1.10 + <title>Test for Bug 898512 Settings API</title> 1.11 + <script type="text/javascript" src="/MochiKit/MochiKit.js"></script> 1.12 + <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> 1.13 + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> 1.14 +</head> 1.15 +<body> 1.16 + 1.17 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=898512">Mozilla Bug 898512</a> 1.18 +<p id="display"></p> 1.19 +<div id="content" style="display: none"> 1.20 +<iframe></iframe> 1.21 +</div> 1.22 +<pre id="test"> 1.23 +<script class="testbody" type="text/javascript;version=1.7"> 1.24 + 1.25 +SimpleTest.waitForExplicitFinish(); 1.26 + 1.27 +function testPref() { 1.28 + SpecialPowers.pushPrefEnv({ 1.29 + set: [["dom.mozSettings.enabled", false]] 1.30 + }, function() { 1.31 + ise(navigator.mozSettings, undefined, "navigator.mozSettings is undefined"); 1.32 + SimpleTest.finish(); 1.33 + }); 1.34 +} 1.35 + 1.36 +SpecialPowers.pushPermissions([ 1.37 + {type: "settings-read", allow: 0, context: document}, 1.38 + {type: "settings-write", allow: 0, context: document} 1.39 +], function() { 1.40 + ise(frames[0].navigator.mozSettings, null, "navigator.mozSettings is null when the page doesn't have permissions"); 1.41 + testPref(); 1.42 +}); 1.43 +</script> 1.44 +</pre> 1.45 +</body> 1.46 +</html>