author Igor Bukanov <>
Fri, 20 Jun 2008 11:46:36 +0200
changeset 15452 056158a4c1e84b8621d066d1d4f1fc92db37ae06
parent 14902 da3a8e06916f8c2ecdf7c50892d6a7eab75326c2
child 28048 8f7b73d88f6bbedec99c6c8ef48b243ab922d05c
permissions -rw-r--r--
Backed out changeset 97977f224aff due to build breakage

  <title>Test for Bug 366770</title>
  <script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
  <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://localhost: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);