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,17 +190,14 @@ function initExtension(uuid) {
return; return;
} }
if (!extensionModule.init) { if (extensionModule.init) {
logExtensionError(uuid, 'missing \'init\' function');
return;
}
try { try {
extensionState = extensionModule.init(extension); extensionState = extensionModule.init(extension);
} catch (e) { } catch (e) {
logExtensionError(uuid, 'Failed to evaluate init function:' + e); logExtensionError(uuid, 'Failed to evaluate init function:' + e);
return; return;
} }
}
if (!extensionState) if (!extensionState)
extensionState = extensionModule; extensionState = extensionModule;