extensionSystem: Make the init function optional

A large amount of extensions have something like this in them:

    function init() {}

Since we have encouraged extension authors to try and not make any
changes in init, it feels weird and strange to have to create an
initialization function that does nothing. From now on, don't require
it.

https://bugzilla.gnome.org/show_bug.cgi?id=677586
This commit is contained in:
Jasper St. Pierre 2012-06-04 18:43:52 -04:00
parent 11278a0814
commit 0805d7a35f

View File

@ -190,16 +190,13 @@ function initExtension(uuid) {
return;
}
if (!extensionModule.init) {
logExtensionError(uuid, 'missing \'init\' function');
return;
}
try {
extensionState = extensionModule.init(extension);
} catch (e) {
logExtensionError(uuid, 'Failed to evaluate init function:' + e);
return;
if (extensionModule.init) {
try {
extensionState = extensionModule.init(extension);
} catch (e) {
logExtensionError(uuid, 'Failed to evaluate init function:' + e);
return;
}
}
if (!extensionState)