2
## 50_mozilla-firebird-mips-xptcstubs-gcc3.dpatch by Alexander Sack <asac@jwsdot.com>
4
## All lines beginning with `## DP:' are a description of the patch.
8
echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
12
[ -f debian/patches/00patch-opts ] && . debian/patches/00patch-opts
13
patch_opts="${patch_opts:--f --no-backup-if-mismatch}"
16
-patch) patch $patch_opts -p1 < $0;;
17
-unpatch) patch $patch_opts -p1 -R < $0;;
19
echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
26
--- mozilla.orig/toolkit/mozapps/extensions/content/extensions.js
27
+++ mozilla/toolkit/mozapps/extensions/content/extensions.js
29
return !selectedItem ||
31
selectedItem.getAttribute("toBeUninstalled") != "true" &&
32
- selectedItem.getAttribute("toBeInstalled") != "true");
33
+ selectedItem.getAttribute("toBeInstalled") != "true" &&
34
+ selectedItem.getAttribute("locked") != "true");
35
case "cmd_reallyEnable":
36
// controls whether to show Enable or Disable in extensions' context menu
37
return selectedItem &&
38
--- mozilla.orig/toolkit/mozapps/extensions/src/nsExtensionManager.js.in
39
+++ mozilla/toolkit/mozapps/extensions/src/nsExtensionManager.js.in
43
* Ben Goodger <ben@bengoodger.com>
44
+ * Mike Hommey <mh@glandium.org>
46
* Alternatively, the contents of this file may be used under the terms of
47
* either the GNU General Public License Version 2 or later (the "GPL"), or
51
// Returns the file at the appropriate point in a directory hierarchy under
52
+// the specified key. Does NOT create the file NOR the directories along the
54
+function getFileNoCreateDir(aKey, aPathToFile)
57
+ for (var i = 0; i < aPathToFile.length - 1; ++i)
58
+ subdirs.push(aPathToFile[i]);
59
+ var file = getDirNoCreate(aKey, subdirs);
60
+ file.append(aPathToFile[aPathToFile.length - 1]);
64
+// Returns the file at the appropriate point in a directory hierarchy under
65
// the specified key, creating directories along the way if necessary. Does
66
// NOT create the file.
67
function getFile(aKey, aPathToFile)
69
function nsInstallLogReader(aExtensionID, aIsProfile, aListener)
71
this._isProfile = aIsProfile;
72
- this.uninstallLog = getFile(getDirKey(aIsProfile),
73
+ this.uninstallLog = getFileNoCreateDir(getDirKey(aIsProfile),
74
[DIR_EXTENSIONS, aExtensionID,
75
DIR_UNINSTALL, FILE_UNINSTALL_LOG]);
76
this._listener = aListener
79
// extension,{GUID} or theme,{GUID}
80
var parts = aLine.split(",");
81
- var manifest = getFile(KEY_APPDIR,
82
+ var manifest = getFileNoCreateDir(KEY_APPDIR,
83
[DIR_EXTENSIONS, parts[1], FILE_INSTALL_MANIFEST]);
84
if (parts.length != 2)
87
- if (!manifest.exists()) {
88
- defaultManifest = defaultFile = getFile(KEY_DEFAULTS,
89
- [DIR_DEFAULTS_EXTENSIONS, parts[1], FILE_INSTALL_MANIFEST]);
90
- var extensionDir = getDir(KEY_APPDIR, [DIR_EXTENSIONS, parts[1]]);
91
- defaultManifest.copyTo(extensionDir, FILE_INSTALL_MANIFEST);
92
- manifest = getFile(KEY_APPDIR,
93
- [DIR_EXTENSIONS, parts[1], FILE_INSTALL_MANIFEST]);
96
- case this.TOKEN_EXTENSION:
97
- this._manager.ensurePreConfiguredItem(parts[1], nsIUpdateItem.TYPE_EXTENSION, manifest);
99
- case this.TOKEN_THEME:
100
- this._manager.ensurePreConfiguredItem(parts[1], nsIUpdateItem.TYPE_THEME, manifest);
102
+ if (manifest.exists()) {
103
+ switch (parts[0]) {
104
+ case this.TOKEN_EXTENSION:
105
+ this._manager.ensurePreConfiguredItem(parts[1], nsIUpdateItem.TYPE_EXTENSION, manifest);
107
+ case this.TOKEN_THEME:
108
+ this._manager.ensurePreConfiguredItem(parts[1], nsIUpdateItem.TYPE_THEME, manifest);
114
@@ -917,21 +925,26 @@
115
this._writer = new nsInstallLogWriter(this._extensionID, this._isProfile);
118
- // Move files from the staging dir into the extension's final home.
119
- // This function generates uninstall log files and creates backups of
121
- // XXXben - would like to add exception handling here to test for file
122
- // I/O failures on uninstall log so that if there's a crash
123
- // and the uninstall log is incorrectly/incompletely written
124
- // we can roll back. It's not critical that we do so right now
125
- // since if this throws the extension's chrome is never
127
- this._installExtensionFiles();
129
// Load the metadata datasource
130
- var metadataFile = getFile(this._extDirKey,
131
+ var metadataFile = getFileNoCreateDir(this._extDirKey,
132
[DIR_EXTENSIONS, aExtensionID, FILE_INSTALL_MANIFEST]);
134
+ // If the metadata file exists, it means we don't have to to extract the xpi.
135
+ // Useful for pre-configured extensions.
137
+ if (aIsProfile && !metadataFile.exists()) {
138
+ // Move files from the staging dir into the extension's final home.
139
+ // This function generates uninstall log files and creates backups of
141
+ // XXXben - would like to add exception handling here to test for file
142
+ // I/O failures on uninstall log so that if there's a crash
143
+ // and the uninstall log is incorrectly/incompletely written
144
+ // we can roll back. It's not critical that we do so right now
145
+ // since if this throws the extension's chrome is never
147
+ this._installExtensionFiles();
150
this._metadataDS = getInstallManifest(metadataFile);
151
if (!this._metadataDS) return;
153
@@ -1752,6 +1765,9 @@
154
// Write bin/components.ini
155
var manifest = getFile(KEY_APPDIR, [FILE_COMPONENT_MANIFEST]);
156
this._writeProfileFile(manifest, this._getComponentsDir, false);
158
+ // Update the Defaults Manifest
159
+ this._writeDefaults(false);
163
@@ -1823,7 +1839,7 @@
164
cr.selectSkin(KEY_DEFAULT_THEME, true);
167
- dump("*** nsExtensionManager::_disableObsoleteExtensions - failure, catching exception so finalize window can close\n");
168
+// dump("*** nsExtensionManager::_disableObsoleteExtensions - failure, catching exception so finalize window can close\n");
172
@@ -2002,6 +2018,34 @@
173
this._ds.insertForthcomingItem(aItemID, aItemType, false);
174
var metadataDS = getInstallManifest(aManifest);
175
this._ds.addItemMetadata(aItemID, aItemType, metadataDS, false);
177
+ // Check whether the extension is installable (thunderbird_version fitting between
178
+ // em:MaxVersion and em:MinVersion)
179
+ var extensionID = this.canInstallItem(metadataDS);
180
+ // |extensionID| must be a GUID string, not a number - a number means failure.
181
+ if (isNaN(parseInt(extensionID))) {
182
+ // Do install the extension, meaning we register its chrome and components
183
+ if (!this._extInstaller)
184
+ this._extInstaller = new nsExtensionInstaller(this._ds);
186
+ this._extInstaller.install(aItemID, false);
189
+ // If the installation failed, we disable the extension in addition
190
+ // to _not_ uninstalling it (which would fail anyway because it
191
+ // would be done at launch time... as a user).
192
+ this._ds.setItemProperty(aItemID, this._ds._emR("toBeUninstalled"),
193
+ null, false, aItemType);
194
+ this._ds.setItemProperty(aItemID, this._ds._emR("disabled"),
195
+ this._ds._emL("true"), false, aItemType);
198
+ // disable extensions that aren't installable
199
+ this._ds.setItemProperty(aItemID, this._ds._emR("disabled"),
200
+ this._ds._emL("true"), false, aItemType);
202
+ // Force locking pre-configured items.
203
+ this._ds.lockUnlockItem(aItemID, true);
206
checkForMismatches: function nsExtensionManager_checkForMismatches ()
207
@@ -2028,22 +2072,31 @@
208
if (items.length > 0) {
209
for (var i = 0; i < items.length; ++i) {
210
// Now disable the extension so it won't hurt anything.
211
+ var alreadyDisabled = this._ds.getItemProperty(items[i].id, "disabled");
212
var itemType = getItemType(this._ds._getResourceForItem(items[i].id).Value);
213
if (itemType != -1 && itemType & nsIUpdateItem.TYPE_EXTENSION)
214
- this.disableExtension(items[i].id);
215
+ if (!alreadyDisabled) this.disableExtension(items[i].id);
216
else if (itemType & nsIUpdateItem.TYPE_THEME) {
217
if (gPref.prefHasUserValue(PREF_GENERAL_SKINS_SELECTEDSKIN))
218
gPref.clearUserPref(PREF_GENERAL_SKINS_SELECTEDSKIN);
219
- this._ds.disableTheme(items[i].id);
220
+ if (!alreadyDisabled) this._ds.disableTheme(items[i].id);
223
- var updates = Components.classes["@mozilla.org/updates/update-service;1"]
224
- .getService(Components.interfaces.nsIUpdateService);
225
- updates.checkForUpdates(items, items.length, nsIUpdateItem.TYPE_ADDON,
226
- nsIUpdateService.SOURCE_EVENT_MISMATCH,
228
+ // We want to eliminate locked extensions
230
+ for (var i = 0; i < items.length; ++i) {
231
+ if (!this._ds.getItemProperty(items[i].id, "locked"))
232
+ newitems.push(items[i]);
234
+ if (newitems.length > 0) {
235
+ var updates = Components.classes["@mozilla.org/updates/update-service;1"]
236
+ .getService(Components.interfaces.nsIUpdateService);
237
+ updates.checkForUpdates(newitems, newitems.length, nsIUpdateItem.TYPE_ADDON,
238
+ nsIUpdateService.SOURCE_EVENT_MISMATCH,
241
- needsRestart = true;
242
+ needsRestart = true;
247
@@ -2087,7 +2140,7 @@
248
this._writeDefaults(false);
251
- dump("*** ExtensionManager:_updateManifests: no access privileges to application directory, skipping.\n");
252
+// dump("*** ExtensionManager:_updateManifests: no access privileges to application directory, skipping.\n");
254
this._writeComponentManifest(true);
255
this._writeDefaults(true);
256
@@ -2133,6 +2186,11 @@
257
validExtensions.push({ sourceDir: sourceDir, isProfile: isProfile });
260
+ // Debian hook to insert defaults/syspref into defaults.ini
261
+ if ((aFile.leafName == FILE_DEFAULTS) && aIsProfile == false) {
262
+ validExtensions.push({ sourceDir: getDirNoCreate(getDirKey(false), [DIR_DEFAULTS, "syspref"]), isProfile: false });
265
var lines = ["[Extra Files]\r\n",
266
"Count=" + validExtensions.length + "\r\n"];
267
for (i = 0; i < lines.length; ++i)
268
@@ -3090,8 +3148,10 @@
269
checkForUpdates: function (aItem, aVersionUpdateOnly)
271
// A preference setting can disable updating for this item
272
+ // We'll also skip locked items.
274
- if (!gPref.getBoolPref(PREF_EM_ITEM_UPDATE_ENABLED.replace(/%UUID%/, aItem.id))) {
275
+ if (this._updater._emDS.getItemProperty(aItem.id, "locked") ||
276
+ !gPref.getBoolPref(PREF_EM_ITEM_UPDATE_ENABLED.replace(/%UUID%/, aItem.id))) {
277
gOS.notifyObservers(null, "Update:Extension:Item-Ended", "");
278
this._updater._checkForDone();
280
@@ -3557,7 +3617,7 @@
282
isProfileItem: function nsExtensionsDataSource_isProfileItem (aItemID)
284
- return this.getItemProperty(aItemID, "installLocation") != "global";
285
+ return this.getItemProperty(aItemID, "installLocation") == "profile";
288
_setProperty: function nsExtensionsDataSource__setProperty (aDS, aSource, aProperty, aNewValue)
289
--- mozilla.orig/toolkit/mozapps/update/src/nsUpdateService.js.in
290
+++ mozilla/toolkit/mozapps/update/src/nsUpdateService.js.in
292
if (aRequestedTypes & nsIUpdateItem.TYPE_THEME)
293
types |= nsIUpdateItem.TYPE_THEME;
295
- if (appUpdateEnabled &&
296
- (aRequestedTypes & nsIUpdateItem.TYPE_APP))
297
- types |= nsIUpdateItem.TYPE_APP;
298
+ // Disable application updates
299
+ //if (appUpdateEnabled &&
300
+ // (aRequestedTypes & nsIUpdateItem.TYPE_APP))
301
+ // types |= nsIUpdateItem.TYPE_APP;