author Gene Lian <>
Fri, 28 Sep 2012 14:02:28 +0800
changeset 108418 cba5ba69091f52840af3d8f738ac43bbcc256e6d
parent 74314 95496a360748609134a5c666d57c7f48aa23393e
child 138088 d134dbb62202fa527750efbd995fe6f84c84db23
permissions -rw-r--r--
Bug 789973 - B2G system time: adjust system clock after receiving NITZ timestamp (part 1). r=jlebar

  <title>Test for Bug 366770</title>
  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
<body onload=";">
  <a target="_blank" href="">Mozilla Bug 366770</a>
  <p id="display">
    Note: In order to re-run this test correctly you need to shift-reload
    rather than simply reload. If you just reload we will restore the
    previous url in the iframe which will result in an extra unexpected
  <div id="content" style="display: none"></div>
  <iframe id="f"></iframe>

  <pre id="test">
    <script class="testbody" type="application/javascript;version=1.7">

gen = runTest();
var messages = 0;

function receiveMessage(e)
  is(e.origin, "http://mochi.test:8888", "wrong sender!");

window.addEventListener("message", receiveMessage, false);

const prefName = "layout.debug.enable_data_xbl";

function runTest() {
  iframe = document.getElementById('f');

  // Turn on loads of data-urls"UniversalXPConnect");
  var prefs = Components.classes[";1"]
  var oldPrefVal = undefined;
  if (prefs.prefHasUserValue(prefName)) {
    oldPrefVal = prefs.getBoolPref(prefName);

  // Test with data-urls off
  prefs.setBoolPref(prefName, false);
  iframe.src = "file_bug379959_data.html";
  is((yield), 0, "data-url load should have failed");

  // Test with data-urls on
  prefs.setBoolPref(prefName, true);
  iframe.src = "file_bug379959_data.html";
  is((yield), 1, "data-url load should have been successful");

  // Try a cross-site load
  iframe.src = "file_bug379959_cross.html";
  is((yield), 1, "same site load should have succeeded");
  is((yield), 0, "cross site load should have failed");

  // Check that we got the right number of messages to make sure that
  // the right message has aligned with the right test
  is(messages, 4, "wrong number of messages");

  // We're done
  if (oldPrefVal === undefined) {
  else {
    prefs.setBoolPref(prefName, oldPrefVal);