browser/devtools/webconsole/test/browser_webconsole_bug_578437_page_reload.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/browser/devtools/webconsole/test/browser_webconsole_bug_578437_page_reload.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,38 @@
     1.4 +/* vim:set ts=2 sw=2 sts=2 et: */
     1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +// Tests that the console object still exists after a page reload.
    1.10 +const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-console.html";
    1.11 +
    1.12 +function test() {
    1.13 +  addTab(TEST_URI);
    1.14 +  browser.addEventListener("DOMContentLoaded", onLoad, false);
    1.15 +}
    1.16 +
    1.17 +function onLoad() {
    1.18 +  browser.removeEventListener("DOMContentLoaded", onLoad, false);
    1.19 +
    1.20 +  openConsole();
    1.21 +
    1.22 +  browser.addEventListener("DOMContentLoaded", testPageReload, false);
    1.23 +  content.location.reload();
    1.24 +}
    1.25 +
    1.26 +function testPageReload() {
    1.27 +
    1.28 +  browser.removeEventListener("DOMContentLoaded", testPageReload, false);
    1.29 +
    1.30 +  let console = browser.contentWindow.wrappedJSObject.console;
    1.31 +
    1.32 +  is(typeof console, "object", "window.console is an object, after page reload");
    1.33 +  is(typeof console.log, "function", "console.log is a function");
    1.34 +  is(typeof console.info, "function", "console.info is a function");
    1.35 +  is(typeof console.warn, "function", "console.warn is a function");
    1.36 +  is(typeof console.error, "function", "console.error is a function");
    1.37 +  is(typeof console.exception, "function", "console.exception is a function");
    1.38 +
    1.39 +  finishTest();
    1.40 +}
    1.41 +

mercurial