Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #269 from Gozala/bug/undefined-options.699564

fix Bug 699564 - "ReferenceError: options is not defined" in cuddlefish.js unload function when quitting Firefox r=@ochameau
  • Loading branch information...
commit d32b895239c7991f1705608aec36bb6b80b8912c 2 parents 0497353 + a6e7a73
Irakli Gozalishvili Gozala authored
4 packages/api-utils/lib/cuddlefish.js
View
@@ -308,10 +308,6 @@ const Loader = {
},
unload: function unload(reason, callback) {
this.require('api-utils/unload').send(reason, callback);
- // `cfx run` expects to see 'OK' or 'FAIL' to be written into a `resultFile`
- // as a signal of quit.
- if ('resultFile' in options && reason === 'shutdown')
- this.require('api-utils/system').exit(0);
}
};
exports.Loader = Loader;
7 packages/api-utils/lib/process.js
View
@@ -62,11 +62,14 @@ function process(target, id, uri, scope) {
// the same turn of event loop).
loadScript(target, packaging.loader, false);
- loadScript(target, 'data:,let options = ' + JSON.stringify(packaging));
- loadScript(target, 'data:,let loader = Loader.new(options);\n' +
+ loadScript(target, 'data:,let loader = Loader.new(' +
+ JSON.stringify(packaging) + ');\n' +
'loader.main("' + id + '", "' + uri + '");', false);
when(function (reason) {
+ // Please note that it's important to unload remote loader
+ // synchronously (using synchronous frame script), to make sure that we
+ // don't stop during unload.
loadScript(target, 'data:,loader.unload("' + reason + '")', true);
});
11 python-lib/cuddlefish/app-extension/bootstrap.js
View
@@ -179,6 +179,13 @@ function startup(data, reason) {
function shutdown(data, reason) {
// If loader is already present unload it, since add-on is disabled.
- if (loader)
- loader.unload(REASON[reason]);
+ if (loader) {
+ reason = REASON[reason]
+ let options = loader.require('@packaging');
+ loader.unload(reason);
+ // `cfx run` expects to see 'OK' or 'FAIL' to be written into a `resultFile`
+ // as a signal of quit.
+ if ('resultFile' in options && reason === 'shutdown')
+ loader.require('api-utils/system').exit(0);
+ }
};
Please sign in to comment.
Something went wrong with that request. Please try again.