B2G/gecko/browser/components/preferences/tests/privacypane_tests.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 runTestOnPrivacyPrefPane(testFunc) {
  let observer = {
    observe: function(aSubject, aTopic, aData) {
      if (aTopic == "domwindowopened") {
        Services.ww.unregisterNotification(this);
        let win = aSubject.QueryInterface(Ci.nsIDOMEventTarget);
        win.addEventListener("load", function() {
          win.removeEventListener("load", arguments.callee, false);
          testFunc(dialog.document.defaultView);
          Services.ww.registerNotification(observer);
          dialog.close();
        }, false);
      } else if (aTopic == "domwindowclosed") {
        Services.ww.unregisterNotification(this);
        testRunner.runNext();
      }
    }
  };
  Services.ww.registerNotification(observer);
  let dialog = openDialog("chrome://browser/content/preferences/preferences.xul", "Preferences",
                          "chrome,titlebar,toolbar,centerscreen,dialog=no", "panePrivacy");
}
function runTestOnPrivacyPrefPane ( testFunc ) { let observer = { observe : function ( aSubject , aTopic , aData ) { if ( aTopic == "domwindowopened" ) { Services . ww . unregisterNotification ( this ) ; let win = aSubject . QueryInterface ( Ci . nsIDOMEventTarget ) ; win . addEventListener ( "load" , function ( ) { win . removeEventListener ( "load" , arguments . callee , false ) ; testFunc ( dialog . document . defaultView ) ; Services . ww . registerNotification ( observer ) ; dialog . close ( ) ; } , false ) ; } else if ( aTopic == "domwindowclosed" ) { Services . ww . unregisterNotification ( this ) ; testRunner . runNext ( ) ; } } } ; Services . ww . registerNotification ( observer ) ; let dialog = openDialog ( "chrome://browser/content/preferences/preferences.xul" , "Preferences" , "chrome,titlebar,toolbar,centerscreen,dialog=no" , "panePrivacy" ) ; }
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 .