B2G/gecko/browser/components/sessionstore/test/browser_485482.js
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
This Source Code Form is subject to the terms of the Mozilla Public
License, v.
This Source Code Form is subject to the terms of the Mozilla Public License v .
function test() {
  waitForExplicitFinish();
  let uniqueValue = Math.random();
  let rootDir = getRootDirectory(gTestPath);
  let testURL = rootDir + "browser_485482_sample.html";
  let tab = gBrowser.addTab(testURL);
  tab.linkedBrowser.addEventListener("load", function(aEvent) {
    tab.linkedBrowser.removeEventListener("load", arguments.callee, true);
    let doc = tab.linkedBrowser.contentDocument;
    doc.querySelector("input[type=text]").value = uniqueValue;
    doc.querySelector("input[type=checkbox]").checked = true;
    let tab2 = gBrowser.duplicateTab(tab);
    tab2.linkedBrowser.addEventListener("load", function(aEvent) {
      tab2.linkedBrowser.removeEventListener("load", arguments.callee, true);
      doc = tab2.linkedBrowser.contentDocument;
      is(doc.querySelector("input[type=text]").value, uniqueValue,
         "generated XPath expression was valid");
      ok(doc.querySelector("input[type=checkbox]").checked,
         "generated XPath expression was valid");
      gBrowser.removeTab(tab2);
      gBrowser.removeTab(tab);
      finish();
    }, true);
  }, true);
}
function test ( ) { waitForExplicitFinish ( ) ; let uniqueValue = Math . random ( ) ; let rootDir = getRootDirectory ( gTestPath ) ; let testURL = rootDir + "browser_485482_sample.html" ; let tab = gBrowser . addTab ( testURL ) ; tab . linkedBrowser . addEventListener ( "load" , function ( aEvent ) { tab . linkedBrowser . removeEventListener ( "load" , arguments . callee , true ) ; let doc = tab . linkedBrowser . contentDocument ; doc . querySelector ( "input[type=text]" ) . value = uniqueValue ; doc . querySelector ( "input[type=checkbox]" ) . checked = true ; let tab2 = gBrowser . duplicateTab ( tab ) ; tab2 . linkedBrowser . addEventListener ( "load" , function ( aEvent ) { tab2 . linkedBrowser . removeEventListener ( "load" , arguments . callee , true ) ; doc = tab2 . linkedBrowser . contentDocument ; is ( doc . querySelector ( "input[type=text]" ) . value , uniqueValue , "generated XPath expression was valid" ) ; ok ( doc . querySelector ( "input[type=checkbox]" ) . checked , "generated XPath expression was valid" ) ; gBrowser . removeTab ( tab2 ) ; gBrowser . removeTab ( tab ) ; finish ( ) ; } , true ) ; } , true ) ; }
This Source Code Form is subject to the terms of the Mozilla Public
 License, v. 2.0.
This Source Code Form is subject to the terms of the Mozilla Public License v . 2 . 0 .
/** Test for Bug 485482 **/ // clean up