From be2b3635ad7f21582a5cfd5a25fc4ec41653c1c7 Mon Sep 17 00:00:00 2001 From: JustOff Date: Mon, 23 Apr 2018 14:52:50 +0300 Subject: Fix accessing the bootstrap methods when they are declared in the new lexical scope --- .../test/addons/test_bootstrap_const/bootstrap.js | 5 +++++ .../test/addons/test_bootstrap_const/install.rdf | 24 ++++++++++++++++++++++ .../test/xpcshell/test_bootstrap_const.js | 17 +++++++++++++++ .../extensions/test/xpcshell/xpcshell-shared.ini | 1 + 4 files changed, 47 insertions(+) create mode 100644 toolkit/mozapps/extensions/test/addons/test_bootstrap_const/bootstrap.js create mode 100644 toolkit/mozapps/extensions/test/addons/test_bootstrap_const/install.rdf create mode 100644 toolkit/mozapps/extensions/test/xpcshell/test_bootstrap_const.js (limited to 'toolkit/mozapps/extensions/test') diff --git a/toolkit/mozapps/extensions/test/addons/test_bootstrap_const/bootstrap.js b/toolkit/mozapps/extensions/test/addons/test_bootstrap_const/bootstrap.js new file mode 100644 index 000000000..498b76526 --- /dev/null +++ b/toolkit/mozapps/extensions/test/addons/test_bootstrap_const/bootstrap.js @@ -0,0 +1,5 @@ +Components.utils.import("resource://gre/modules/Services.jsm"); + +const install = function() { + Services.obs.notifyObservers(null, "addon-install", ""); +} \ No newline at end of file diff --git a/toolkit/mozapps/extensions/test/addons/test_bootstrap_const/install.rdf b/toolkit/mozapps/extensions/test/addons/test_bootstrap_const/install.rdf new file mode 100644 index 000000000..af3a749ce --- /dev/null +++ b/toolkit/mozapps/extensions/test/addons/test_bootstrap_const/install.rdf @@ -0,0 +1,24 @@ + + + + + + bootstrap@tests.mozilla.org + 1.0 + true + + + Test Bootstrap + Test Description + + + + xpcshell@tests.mozilla.org + 1 + 1 + + + + + \ No newline at end of file diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_bootstrap_const.js b/toolkit/mozapps/extensions/test/xpcshell/test_bootstrap_const.js new file mode 100644 index 000000000..fb02b59be --- /dev/null +++ b/toolkit/mozapps/extensions/test/xpcshell/test_bootstrap_const.js @@ -0,0 +1,17 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ + */ + +createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1"); +startupManager(); + +add_task(function*() { + let sawInstall = false; + Services.obs.addObserver(function() { + sawInstall = true; + }, "addon-install", false); + + yield promiseInstallAllFiles([do_get_addon("test_bootstrap_const")]); + + ok(sawInstall); +}); \ No newline at end of file diff --git a/toolkit/mozapps/extensions/test/xpcshell/xpcshell-shared.ini b/toolkit/mozapps/extensions/test/xpcshell/xpcshell-shared.ini index bab072e83..2a12f147a 100644 --- a/toolkit/mozapps/extensions/test/xpcshell/xpcshell-shared.ini +++ b/toolkit/mozapps/extensions/test/xpcshell/xpcshell-shared.ini @@ -29,6 +29,7 @@ skip-if = os == "android" [test_bootstrap.js] # Bug 676992: test consistently hangs on Android skip-if = os == "android" +[test_bootstrap_const.js] [test_bootstrap_resource.js] [test_bug299716.js] # Bug 676992: test consistently hangs on Android -- cgit v1.2.3