1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/addon-sdk/source/python-lib/cuddlefish/tests/addons/simplest-test/main.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,17 @@ 1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.7 + 1.8 +const { Cc, Ci } = require("chrome"); 1.9 + 1.10 +exports.main = function(options, callbacks) { 1.11 + // Close Firefox window. Firefox should quit. 1.12 + require("sdk/deprecated/window-utils").activeBrowserWindow.close(); 1.13 + 1.14 + // But not on Mac where it stay alive! We have to request application quit. 1.15 + if (require("sdk/system/runtime").OS == "Darwin") { 1.16 + let appStartup = Cc['@mozilla.org/toolkit/app-startup;1']. 1.17 + getService(Ci.nsIAppStartup); 1.18 + appStartup.quit(appStartup.eAttemptQuit); 1.19 + } 1.20 +}