From 5bdec7d634ce0058801cd212e9e4ea56e914ca0c Mon Sep 17 00:00:00 2001 From: Mark H Weaver Date: Sat, 3 Dec 2016 12:19:17 -0500 Subject: gnu: icecat: Update to 45.5.1-gnu1. * gnu/packages/gnuzilla.scm (icecat): Update to 45.5.1-gnu1. [source]: Remove temporary URI for 45.3 beta. Fix URI computation. Remove outdated patches. Add more cherry-picked bug fixes from upstream mozilla-esr45. Use 'list' instead of quasiquote in 'patches' field. --- gnu/local.mk | 1 - gnu/packages/gnuzilla.scm | 106 +-- gnu/packages/patches/icecat-CVE-2016-9064.patch | 996 ------------------------ 3 files changed, 32 insertions(+), 1071 deletions(-) delete mode 100644 gnu/packages/patches/icecat-CVE-2016-9064.patch diff --git a/gnu/local.mk b/gnu/local.mk index 2fc4b6cf5b..e5755ec968 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -628,7 +628,6 @@ dist_patch_DATA = \ %D%/packages/patches/hypre-ldflags.patch \ %D%/packages/patches/icecat-avoid-bundled-libraries.patch \ %D%/packages/patches/icecat-binutils.patch \ - %D%/packages/patches/icecat-CVE-2016-9064.patch \ %D%/packages/patches/icu4c-CVE-2014-6585.patch \ %D%/packages/patches/icu4c-CVE-2015-1270.patch \ %D%/packages/patches/icu4c-CVE-2015-4760.patch \ diff --git a/gnu/packages/gnuzilla.scm b/gnu/packages/gnuzilla.scm index 3342a39122..f63e950f29 100644 --- a/gnu/packages/gnuzilla.scm +++ b/gnu/packages/gnuzilla.scm @@ -303,82 +303,41 @@ standards.") (define-public icecat (package (name "icecat") - (version "45.3.0-gnu1-beta") + (version "45.5.1-gnu1") (source (origin (method url-fetch) - (uri (list (string-append "mirror://gnu/gnuzilla/" version "/" - name "-" version ".tar.bz2") - ;; XXX Temporary URI for 45.3 beta release. - ;; Remove when no longer needed. - (string-append "http://jenkins.trisquel.info/icecat/binaries/" - "icecat-45.3.0-gnu1.tar.bz2"))) + (uri (string-append "mirror://gnu/gnuzilla/" + (first (string-split version #\-)) + "/" name "-" version ".tar.bz2")) (sha256 (base32 - "1hk5lwaqm8nkfm43sq521mzyrx0x3iiwvlcy62m7cq7grz9wixp6")) + "1sbfgsibmb8wfmb2g40gmqwq3nikmrgzksf51ydrz7gnafyfaqw1")) (patches - `(,(search-patch "icecat-avoid-bundled-libraries.patch") - ,(search-patch "icecat-binutils.patch") - ,(mozilla-patch "icecat-CVE-2016-5250.patch" "6711ccb0184e" "1p0s91rw1j7ib6hy9gh5p0l33rja32rfgygh29jw4wq1hxfql8rk") - ,(mozilla-patch "icecat-CVE-2016-5257-pt1.patch" "b08f28db372e" "0fmifimavawbff700rzjibsnr16am6902gp965scvi1iy78754ia") - ,(mozilla-patch "icecat-CVE-2016-5257-pt2.patch" "a49fd7eb57ba" "1dyh0pjdmf64sjbj1x0mdjwfispacx9yny1kx9nzpf85myryr640") - ,(mozilla-patch "icecat-CVE-2016-5257-pt3.patch" "9707c3423a1e" "12nn8av0akza4ml1is9mfy8f7368mrkxsl32ly97r4irzh0iryh1") - ,(mozilla-patch "icecat-CVE-2016-5257-pt4.patch" "9d632865560a" "1msp1wqv0c317wqkm82hd9ajbg4a5mcr8pld5j8cx37ccv7f21g3") - ,(mozilla-patch "icecat-CVE-2016-5257-pt5.patch" "90697781ec9f" "1h6gcrw5ykf7r59phxqkhpfs7jsgzqn509qm43sj7mbpcvqvk5mg") - ,(mozilla-patch "icecat-CVE-2016-5257-pt6.patch" "dd9eb81853b9" "1lyqnn40sayziych8gqd5aj7il3zajf318y8ddj8dzz3c8id5dzc") - ,(mozilla-patch "icecat-CVE-2016-5257-pt7.patch" "d91fc76079e0" "022lhixa8dxa6ny9a4bh2di282i0lhyq0glqr9n4q3r8msfmf0ba") - ,(mozilla-patch "icecat-CVE-2016-5257-pt8.patch" "3e37ba5e0867" "1w8lncxaayq4xndhyp1hwlv00zggbayljq6rlypb8kdwgzfpi77w") - ,(mozilla-patch "icecat-CVE-2016-5257-pt9.patch" "3c4958a98908" "16bc6ai5qddnpm3yw24lry5s7i05xs0ycixzxiir4wmcgwcaayiy") - ,(mozilla-patch "icecat-CVE-2016-5261.patch" "bc2f5467b33d" "0i4b8ydmqg4blx541f56g9qrlm7gp6ih4cs7ixbds724cwk83b9f") - ,(mozilla-patch "icecat-CVE-2016-5270.patch" "7cd50d56bb61" "15nbp5axr59mczxgf37nli37jbw0jdknmxz7z71772pzjd2z07r9") - ,(mozilla-patch "icecat-CVE-2016-5272.patch" "6e43a01fee3c" "025xp1wdnz1gc5l2rsgbrwsh1pbysjiyfgz0g6rvr390r7ag1n74") - ,(mozilla-patch "icecat-CVE-2016-5274.patch" "10c9453407de" "1wqh6hj0dpa7r3hhlyrflcv3r3cg0xq4rb0zvhysi6l7lwb8q51r") - ,(mozilla-patch "icecat-CVE-2016-5276.patch" "fc818ab03f15" "1q64ipl172dcmyy9p8p3l3ljpdh1q1jg48lai0qn2xgknl7sdpks") - ,(mozilla-patch "icecat-CVE-2016-5277.patch" "7b668c5cec92" "1qmchn6qifgjakzac6i4hgnivy062pzgz9p1l11c1m3an1rh0isg") - ,(mozilla-patch "icecat-CVE-2016-5278.patch" "fd5052e343df" "1nzmzlnsz61w9aw4mjvgmlkz88aqv1w858rr0mbv07hwyrljfi84") - ,(mozilla-patch "icecat-CVE-2016-5280.patch" "30673bc9730b" "1qz1684v1rp86ngadcaqd68iqf472flnrnk971ryg4fbsyy8g1za") - ,(mozilla-patch "icecat-CVE-2016-5281-pt1.patch" "61405f1fd1df" "1fgmq67arwsl1nrl133fcb5cz6jbbcfjvbv8cd8cadhapin971a7") - ,(mozilla-patch "icecat-CVE-2016-5281-pt2.patch" "7776b6ec7b92" "1f7k8f4lk7nyghwajsxf6nb7yvzsaw3jwpa3316znsva12m548mn") - ,(mozilla-patch "icecat-CVE-2016-5284-pt1.patch" "55e768767416" "1gg7m12njbkn1jqf2gp2y7zd9ik3xhqkjb7znczna4l438h7ki83") - ,(mozilla-patch "icecat-CVE-2016-5284-pt2.patch" "3c42249975a5" "0gnanndkmhsp49rldv4kh0smkdcs7616v46hn567kfw8yfwqvnli") - ,(mozilla-patch "icecat-CVE-2016-5284-pt3.patch" "126e5d574811" "13gr08bzqy23adz0ciihb7cy9wdnkcn71i77a3y5b5apm6k54mwi") - ,(mozilla-patch "icecat-CVE-2016-5284-pt4.patch" "7b8bd7aae1a8" "0mq5gpq6ni8czfcs1rif4is0igh0054aw41ga0jqkq58g7lavkrf") - ,(mozilla-patch "icecat-CVE-2016-5284-pt5.patch" "0799490f4e6f" "1ypv6i48nabbhcqbach8fbgz9bmnhm7q5z9dnfid44z8g54l3f33") - ,(mozilla-patch "icecat-CVE-2016-5284-pt6.patch" "fc990e4ae8bc" "1s2cj505ajwwiy4xvn5zlmyzqpgahxmqqvis0a6xm6mjbjh02gm4") - ,(mozilla-patch "icecat-bug-1251088.patch" "5ffa912ed83e" "0v5lpv3c89c2d4y5acn0kyijv096axdnrvaj5ya5yypzfcaqxv24") - ,(mozilla-patch "icecat-CVE-2016-5290-pt1.patch" "d4b5b8f3e373" "0w8cxn6ryhgxryy8k8i06yw4mknv509ns9ff1avd0hmgxa83mcdp") - ,(mozilla-patch "icecat-CVE-2016-5290-pt2.patch" "adce603ae36d" "0mgs85cwx61bk17r7npl311l4m8yn4667wyhgjmm2ajiys6nn0yl") - ,(mozilla-patch "icecat-CVE-2016-5290-pt3.patch" "97268426bb6f" "1z7hg796cgag025gm9pp2szz7w870s7naagdri1dlsilj797v8hr") - ,(mozilla-patch "icecat-CVE-2016-5290-pt4.patch" "fc055950b6b8" "05iml5k3rzc653jk4imd111sh18625jxfxkcj12kjdihl0gdr4x4") - ,(mozilla-patch "icecat-CVE-2016-5290-pt5.patch" "6f845c23565b" "01dlbnmpsnwr448fajs276y62gl03r74k1hxnwsg6ihwhnfdvn5a") - ,(mozilla-patch "icecat-CVE-2016-5290-pt6.patch" "e5d51ca7a3c0" "0hshcz24hc6pkz5pcqxhajm17ibwrlfn1s00frfnpjjy56vacfz0") - ,(mozilla-patch "icecat-CVE-2016-5290-pt7.patch" "61d1463acd04" "1iig4a79dxmfcr6w82mdhyl88wy7d36g5n4p24632kbabgl9j9sz") - ,(mozilla-patch "icecat-CVE-2016-5290-pt8.patch" "8e0bab4216de" "1knq8h5ni8crfndi3p78b2pyj5lzchqw67vk0yx061r76mq4wp4r") - ,(mozilla-patch "icecat-CVE-2016-5290-pt9.patch" "bb10104dc89e" "1flvagckrzfk7hs2xzb5j3s5i0ck57ygyskh5494xmpa2a1nnsqj") - ,(mozilla-patch "icecat-CVE-2016-5290-pt10.patch" "7006b275b829" "0sqagm247wx94mf51fyhdkn0vf1a1qy9i829shjnhssd79srxmnn") - ,(mozilla-patch "icecat-CVE-2016-5290-pt11.patch" "32ce7be98543" "1y2r9i4p1qpqi75mlwmibr51whz5h1vj28c6mh6ik57dxkqxbclb") - ,(mozilla-patch "icecat-CVE-2016-5291.patch" "3ff0c89f3b26" "1prn74aglshaj27jfrpd2s2i4slpljw4rbzjxc1qgwjvkq4m6j6f") - ,(mozilla-patch "icecat-CVE-2016-5297.patch" "46b07bdbf8b2" "1n8y1c5l0ms81dra7jsx8mp633ak5qvx105drvlg9hn3m0fwv1lj") - ,(search-patch "icecat-CVE-2016-9064.patch") ; adapted for icecat based on: - ; "00c2b7baaa0b" "0y02yb7r62656nq9dji9dnwils2lxqasjz5byv62j1xa87r7f9hp" - ,(mozilla-patch "icecat-CVE-2016-9066.patch" "576f1725a57e" "1lic9d3r8r1vcniw1g3ca71390lw3dmwjsw55dp6z96hyjbcq3fd") - ,(mozilla-patch "icecat-CVE-2016-9079.patch" "e6eb0a3a3c76" "1gfcl58cm255sn3f5fwfhw21c2msbghg9i1b3nc9pp4gafaj2p9i") - ,(mozilla-patch "icecat-bug-1212939.patch" "4a0e851f83e4" "182vx1qxrr7r2175jjf0bcixwwm1khdj4sq0c8wnsyry7p9waq5q") - ,(mozilla-patch "icecat-bug-1168743.patch" "a1e06af61ab3" "07llk1ba6axjasiv30vicz96k55ff4mybxy21vjxk6j0asgyjz23") - ,(mozilla-patch "icecat-bug-1287176.patch" "0569d5dce9db" "1d41sqbq6jc3af73dz9w19win7v7c12kw1mp7j7b1gkadq46c4y7") - ,(mozilla-patch "icecat-bug-1263665.patch" "a79cafee93f4" "0bn7hpm8mh8qmkpz5wiridr792irrs5sjxyvryazy2i0p4pjh62p") - ,(mozilla-patch "icecat-bug-1304962.patch" "f61049d5f373" "04d1na31qqq7yq4jjvhq6vzqq3f23rwac8c6fw4h5fx1pdb3l997") - ,(mozilla-patch "icecat-bug-1314574.patch" "46b2558ca469" "00q8676xg4wb7p371wgi04nl05j7idkb2kna9a0l08k6lks9wdhh") - ,(mozilla-patch "icecat-bug-1301381.patch" "2e5438a92617" "0pyjbzyy04759ldpcar8q8cccv67j1jkxsg46rkq7a3rbhmwmw4p") - ,(mozilla-patch "icecat-bug-1317409.patch" "7391f60fb790" "1hydggpmmm2cs9lb15micnkxn4wl4cda9g74hkn3zmks805vjz3h") - ,(mozilla-patch "icecat-bug-1309834.patch" "744e01001e6e" "0z2fq765kap3ll9as5rvjpnbj3pw26074alw7df0zi215qz47nxr") - ,(mozilla-patch "icecat-bug-1317936-pt1.patch" "8ae673f34a5b" "1rlbihckl9afa0y91lqs7gpnv6a7zxzrmxjv95y3yrl03kibqp76") - ,(mozilla-patch "icecat-bug-1317936-pt2.patch" "409c23c144fe" "05kgs16y8s5pxmg2dxp93247zagnj6zgj3209qpm5hz3an7gr13h") - ,(mozilla-patch "icecat-bug-1319122.patch" "994d9bd0e28d" "007wifyx3b2ln4fwv1i8n24yz5ngjf4mkzd7sqr5bpd3q88ff293") - ,(mozilla-patch "icecat-bug-1312609.patch" "0fc43af8982e" "0pc8q9knzq2knj723mwkay1lnzbzysb07ygxnc16mcb6f7vl2mw8") - ,(mozilla-patch "icecat-bug-1319524.patch" "19f9a4643d77" "0w5yxj1l0hvs66q9agjp4m5sfby7fj05lx33gaqf899bw4hn4vcf") - ,(mozilla-patch "icecat-bug-1312548.patch" "c58442c414f5" "1z1w1v8xagkhrwgp51ij1k2gx0ripslia09vm78812n7gcwddaas") - ,(mozilla-patch "icecat-bug-1314442.patch" "5054047b7328" "0xlw8irymfp3bcaa5jpf7clf7bq6qxp3i8zapp8jya8lzr1nf868"))) + (list + (search-patch "icecat-avoid-bundled-libraries.patch") + (search-patch "icecat-binutils.patch") + (mozilla-patch "icecat-bug-1301381.patch" "2e5438a92617" "0pyjbzyy04759ldpcar8q8cccv67j1jkxsg46rkq7a3rbhmwmw4p") + (mozilla-patch "icecat-bug-1317409.patch" "7391f60fb790" "1hydggpmmm2cs9lb15micnkxn4wl4cda9g74hkn3zmks805vjz3h") + (mozilla-patch "icecat-bug-1309834.patch" "744e01001e6e" "0z2fq765kap3ll9as5rvjpnbj3pw26074alw7df0zi215qz47nxr") + (mozilla-patch "icecat-bug-1317936-pt1.patch" "8ae673f34a5b" "1rlbihckl9afa0y91lqs7gpnv6a7zxzrmxjv95y3yrl03kibqp76") + (mozilla-patch "icecat-bug-1317936-pt2.patch" "409c23c144fe" "05kgs16y8s5pxmg2dxp93247zagnj6zgj3209qpm5hz3an7gr13h") + (mozilla-patch "icecat-bug-1319122.patch" "994d9bd0e28d" "007wifyx3b2ln4fwv1i8n24yz5ngjf4mkzd7sqr5bpd3q88ff293") + (mozilla-patch "icecat-bug-1312609.patch" "0fc43af8982e" "0pc8q9knzq2knj723mwkay1lnzbzysb07ygxnc16mcb6f7vl2mw8") + (mozilla-patch "icecat-bug-1319524.patch" "19f9a4643d77" "0w5yxj1l0hvs66q9agjp4m5sfby7fj05lx33gaqf899bw4hn4vcf") + (mozilla-patch "icecat-bug-1312548.patch" "c58442c414f5" "1z1w1v8xagkhrwgp51ij1k2gx0ripslia09vm78812n7gcwddaas") + (mozilla-patch "icecat-bug-1314442.patch" "5054047b7328" "0xlw8irymfp3bcaa5jpf7clf7bq6qxp3i8zapp8jya8lzr1nf868") + (mozilla-patch "icecat-bug-881832-pt1.patch" "1123263318a3" "1qkxwva3zrcs1zhga8ncmndq03988dx75i896g53gbvpskj06915") + (mozilla-patch "icecat-bug-881832-pt2.patch" "dc87c0a39adf" "01rapf14f3r2wk0cjd16dn1rll4ipgs33cnjmjck48nvk67ikz6h") + (mozilla-patch "icecat-bug-881832-pt3.patch" "f20e5f488368" "15ql9ywifb3gm2g1057k63f821dbs3wqsh3zhndprzf3dn6aha4i") + (mozilla-patch "icecat-bug-881832-pt4.patch" "7950c4d5bd7c" "0jhkg5hq5yfy7rh21k1mpbsbr81ql85aazym30zy3n2cf28xxhd7") + (mozilla-patch "icecat-bug-881832-pt5.patch" "972734ec21b6" "073i4v1f1ydy49i57pvzscz95sjr5bbk9s5sajxvmmcsmwhpjdfy") + (mozilla-patch "icecat-bug-1293985-pt1.patch" "aebd3687e05e" "1qz6hdgflcrqyg7fv66cbg23v4b7q5bc2yxzrgjxs4j1d7jy1s0s") + (mozilla-patch "icecat-bug-1293985-pt2.patch" "63d8e5cd27cb" "11fsgyngy7v59ma30xdbmycwf4izwikzvaljngm3ks4534inpl4a") + (mozilla-patch "icecat-bug-1279202.patch" "e560997291af" "1hn35slasfcj3ryka4fsarx4l9r99z0iwj67fmbv6zxz4z133kks") + (mozilla-patch "icecat-bug-1320039.patch" "21c615b65048" "0ibgsxa36x9ajn2jqbhxxvrfvj6x6iyspsmzzn4brdz11n93skhr") + (mozilla-patch "icecat-bug-1320057.patch" "c15e5afc0430" "17gj32agqs94548z8lvz0l6zz3kbwajn8as0y4iw5nb6jsll4c66") + (mozilla-patch "icecat-bug-1163212.patch" "46163fb1cb34" "1yikayczfgfla3aka0159apq3149d52sgvlca0sivx4myd0lvjm7"))) (modules '((guix build utils))) (snippet '(begin @@ -422,7 +381,7 @@ standards.") "db/sqlite3")) ;; Delete .pyc files, typically present in icecat source tarballs (for-each delete-file (find-files "." "\\.pyc$")) - ;; Delete obj-* directories, found in icecat-45.3.0-gnu1-beta + ;; Delete obj-* directories, sometimes present in icecat tarballs (for-each delete-file-recursively (scandir "." (lambda (name) (string-prefix? "obj-" name)))) @@ -502,9 +461,8 @@ standards.") "--disable-debug" "--disable-debug-symbols" - ;; Temporary hack to work around missing - ;; "unofficial" branding in - ;; icecat-45.3.0-gnu1-beta. + ;; Hack to work around missing + ;; "unofficial" branding in icecat. "--enable-official-branding" ;; Avoid bundled libraries. diff --git a/gnu/packages/patches/icecat-CVE-2016-9064.patch b/gnu/packages/patches/icecat-CVE-2016-9064.patch deleted file mode 100644 index a5393815e0..0000000000 --- a/gnu/packages/patches/icecat-CVE-2016-9064.patch +++ /dev/null @@ -1,996 +0,0 @@ -Copied from - -but with one hunk omitted: the git binary patch for -toolkit/mozapps/extensions/test/addons/test_update_multi2/addon.xpi -which is not present in the IceCat sources. - -# HG changeset patch -# User Andrew Swan -# Date 1474063218 25200 -# Node ID 00c2b7baaa0b4bfb7d5f1aac31c094ea6b255e1f -# Parent 46b07bdbf8b20cf3fdc28104add57ff58a55832b -Bug 1303418 - Don't allow upgrades that change the addon ID. r=mossop, a=lizzard - -MozReview-Commit-ID: JHINo8ShmeI - -diff --git a/toolkit/mozapps/extensions/AddonManager.jsm b/toolkit/mozapps/extensions/AddonManager.jsm ---- a/toolkit/mozapps/extensions/AddonManager.jsm -+++ b/toolkit/mozapps/extensions/AddonManager.jsm -@@ -2956,16 +2956,18 @@ this.AddonManager = { - // The downloaded file seems to be corrupted in some way. - ERROR_CORRUPT_FILE: -3, - // An error occured trying to write to the filesystem. - ERROR_FILE_ACCESS: -4, - // The add-on must be signed and isn't. - ERROR_SIGNEDSTATE_REQUIRED: -5, - // The downloaded add-on had a different type than expected. - ERROR_UNEXPECTED_ADDON_TYPE: -6, -+ // The addon did not have the expected ID -+ ERROR_INCORRECT_ID: -7, - - // These must be kept in sync with AddonUpdateChecker. - // No error was encountered. - UPDATE_STATUS_NO_ERROR: 0, - // The update check timed out - UPDATE_STATUS_TIMEOUT: -1, - // There was an error while downloading the update information. - UPDATE_STATUS_DOWNLOAD_ERROR: -2, -diff --git a/toolkit/mozapps/extensions/internal/XPIProvider.jsm b/toolkit/mozapps/extensions/internal/XPIProvider.jsm ---- a/toolkit/mozapps/extensions/internal/XPIProvider.jsm -+++ b/toolkit/mozapps/extensions/internal/XPIProvider.jsm -@@ -5473,16 +5473,37 @@ AddonInstall.prototype = { - // loadManifestFromZipReader performs the certificate verification for us - this.addon = yield loadManifestFromZipReader(zipreader, this.installLocation); - } - catch (e) { - zipreader.close(); - return Promise.reject([AddonManager.ERROR_CORRUPT_FILE, e]); - } - -+ if (this.existingAddon) { -+ // Check various conditions related to upgrades -+ if (this.addon.id != this.existingAddon.id) { -+ zipreader.close(); -+ return Promise.reject([AddonManager.ERROR_INCORRECT_ID, -+ `Refusing to upgrade addon ${this.existingAddon.id} to different ID ${this.addon.id}`]); -+ } -+ -+ if (this.addon.type == "multipackage") { -+ zipreader.close(); -+ return Promise.reject([AddonManager.ERROR_UNEXPECTED_ADDON_TYPE, -+ `Refusing to upgrade addon ${this.existingAddon.id} to a multi-package xpi`]); -+ } -+ -+ if (this.existingAddon.type == "webextension" && this.addon.type != "webextension") { -+ zipreader.close(); -+ return Promise.reject([AddonManager.ERROR_UNEXPECTED_ADDON_TYPE, -+ "Webextensions may not be updated to other extension types"]); -+ } -+ } -+ - if (mustSign(this.addon.type)) { - if (this.addon.signedState <= AddonManager.SIGNEDSTATE_MISSING) { - // This add-on isn't properly signed by a signature that chains to the - // trusted root. - let state = this.addon.signedState; - this.addon = null; - zipreader.close(); - -@@ -5510,23 +5531,16 @@ AddonInstall.prototype = { - } else { - zipreader.close(); - return Promise.reject([AddonManager.ERROR_CORRUPT_FILE, - "XPI is incorrectly signed"]); - } - } - } - -- if (this.existingAddon && this.existingAddon.type == "webextension" && -- this.addon.type != "webextension") { -- zipreader.close(); -- return Promise.reject([AddonManager.ERROR_UNEXPECTED_ADDON_TYPE, -- "WebExtensions may not be upated to other extension types"]); -- } -- - if (this.addon.type == "multipackage") - return this._loadMultipackageManifests(zipreader); - - zipreader.close(); - - this.updateAddonURIs(); - - this.addon._install = this; -@@ -5791,16 +5805,17 @@ AddonInstall.prototype = { - else { - // TODO Should we send some event here (bug 557716)? - this.state = AddonManager.STATE_CHECKING; - new UpdateChecker(this.addon, { - onUpdateFinished: aAddon => this.downloadCompleted(), - }, AddonManager.UPDATE_WHEN_ADDON_INSTALLED); - } - }, ([error, message]) => { -+ this.removeTemporaryFile(); - this.downloadFailed(error, message); - }); - } - else { - if (aRequest instanceof Ci.nsIHttpChannel) - this.downloadFailed(AddonManager.ERROR_NETWORK_FAILURE, - aRequest.responseStatus + " " + - aRequest.responseStatusText); -diff --git a/toolkit/mozapps/extensions/test/addons/test_update_multi1/bootstrap.js b/toolkit/mozapps/extensions/test/addons/test_update_multi1/bootstrap.js -new file mode 100644 ---- /dev/null -+++ b/toolkit/mozapps/extensions/test/addons/test_update_multi1/bootstrap.js -@@ -0,0 +1,5 @@ -+ -+function install(data, reason) {} -+function startup(data, reason) {} -+function shutdown(data, reason) {} -+function uninstall(data, reason) {} -diff --git a/toolkit/mozapps/extensions/test/addons/test_update_multi1/install.rdf b/toolkit/mozapps/extensions/test/addons/test_update_multi1/install.rdf -new file mode 100644 ---- /dev/null -+++ b/toolkit/mozapps/extensions/test/addons/test_update_multi1/install.rdf -@@ -0,0 +1,16 @@ -+ -+ -+ -+ updatemulti@tests.mozilla.org -+ 1.0 -+ http://localhost:4444/data/test_update_multi.rdf -+ true -+ Test Addon 1 -+ -+ xpcshell@tests.mozilla.org -+ 1 -+ 1 -+ -+ -+ -diff --git a/toolkit/mozapps/extensions/test/addons/test_update_multi2/install.rdf b/toolkit/mozapps/extensions/test/addons/test_update_multi2/install.rdf -new file mode 100644 ---- /dev/null -+++ b/toolkit/mozapps/extensions/test/addons/test_update_multi2/install.rdf -@@ -0,0 +1,9 @@ -+ -+ -+ -+ updatemulti@tests.mozilla.org -+ 32 -+ 2.0 -+ -+ -diff --git a/toolkit/mozapps/extensions/test/addons/test_updateid1/bootstrap.js b/toolkit/mozapps/extensions/test/addons/test_updateid1/bootstrap.js -new file mode 100644 ---- /dev/null -+++ b/toolkit/mozapps/extensions/test/addons/test_updateid1/bootstrap.js -@@ -0,0 +1,5 @@ -+ -+function install(data, reason) {} -+function startup(data, reason) {} -+function shutdown(data, reason) {} -+function uninstall(data, reason) {} -diff --git a/toolkit/mozapps/extensions/test/addons/test_updateid1/install.rdf b/toolkit/mozapps/extensions/test/addons/test_updateid1/install.rdf -new file mode 100644 ---- /dev/null -+++ b/toolkit/mozapps/extensions/test/addons/test_updateid1/install.rdf -@@ -0,0 +1,16 @@ -+ -+ -+ -+ addon1@tests.mozilla.org -+ 1.0 -+ http://localhost:4444/data/test_updateid.rdf -+ true -+ Test Addon 1 -+ -+ xpcshell@tests.mozilla.org -+ 1 -+ 1 -+ -+ -+ -diff --git a/toolkit/mozapps/extensions/test/addons/test_updateid2/bootstrap.js b/toolkit/mozapps/extensions/test/addons/test_updateid2/bootstrap.js -new file mode 100644 ---- /dev/null -+++ b/toolkit/mozapps/extensions/test/addons/test_updateid2/bootstrap.js -@@ -0,0 +1,5 @@ -+ -+function install(data, reason) {} -+function startup(data, reason) {} -+function shutdown(data, reason) {} -+function uninstall(data, reason) {} -diff --git a/toolkit/mozapps/extensions/test/addons/test_updateid2/install.rdf b/toolkit/mozapps/extensions/test/addons/test_updateid2/install.rdf -new file mode 100644 ---- /dev/null -+++ b/toolkit/mozapps/extensions/test/addons/test_updateid2/install.rdf -@@ -0,0 +1,16 @@ -+ -+ -+ -+ addon1.changed@tests.mozilla.org -+ 2.0 -+ http://localhost:4444/data/test_updateid.rdf -+ true -+ Test Addon 1 -+ -+ xpcshell@tests.mozilla.org -+ 1 -+ 1 -+ -+ -+ -diff --git a/toolkit/mozapps/extensions/test/addons/test_updateid2_2/install.rdf b/toolkit/mozapps/extensions/test/addons/test_updateid2_2/install.rdf -deleted file mode 100644 ---- a/toolkit/mozapps/extensions/test/addons/test_updateid2_2/install.rdf -+++ /dev/null -@@ -1,24 +0,0 @@ -- -- -- -- -- -- addon2@tests.mozilla.org -- 2.0 -- http://localhost:4444/data/test_updateid.rdf -- -- -- Test 2 -- Test Description -- -- -- -- xpcshell@tests.mozilla.org -- 1 -- 1 -- -- -- -- -- -diff --git a/toolkit/mozapps/extensions/test/addons/test_updateid2_5/install.rdf b/toolkit/mozapps/extensions/test/addons/test_updateid2_5/install.rdf -deleted file mode 100644 ---- a/toolkit/mozapps/extensions/test/addons/test_updateid2_5/install.rdf -+++ /dev/null -@@ -1,24 +0,0 @@ -- -- -- -- -- -- addon2@tests.mozilla.org -- 5.0 -- http://localhost:4444/data/test_updateid.rdf -- -- -- Test 2 -- Test Description -- -- -- -- xpcshell@tests.mozilla.org -- 1 -- 1 -- -- -- -- -- -diff --git a/toolkit/mozapps/extensions/test/addons/test_updateid3_3/bootstrap.js b/toolkit/mozapps/extensions/test/addons/test_updateid3_3/bootstrap.js -deleted file mode 100644 ---- a/toolkit/mozapps/extensions/test/addons/test_updateid3_3/bootstrap.js -+++ /dev/null -@@ -1,21 +0,0 @@ --Components.utils.import("resource://gre/modules/Services.jsm"); -- --function install(data, reason) { -- Services.prefs.setIntPref("bootstraptest.installed_version", 3); -- Services.prefs.setIntPref("bootstraptest.install_reason", reason); --} -- --function startup(data, reason) { -- Services.prefs.setIntPref("bootstraptest.active_version", 3); -- Services.prefs.setIntPref("bootstraptest.startup_reason", reason); --} -- --function shutdown(data, reason) { -- Services.prefs.setIntPref("bootstraptest.active_version", 0); -- Services.prefs.setIntPref("bootstraptest.shutdown_reason", reason); --} -- --function uninstall(data, reason) { -- Services.prefs.setIntPref("bootstraptest.installed_version", 0); -- Services.prefs.setIntPref("bootstraptest.uninstall_reason", reason); --} -diff --git a/toolkit/mozapps/extensions/test/addons/test_updateid3_3/install.rdf b/toolkit/mozapps/extensions/test/addons/test_updateid3_3/install.rdf -deleted file mode 100644 ---- a/toolkit/mozapps/extensions/test/addons/test_updateid3_3/install.rdf -+++ /dev/null -@@ -1,25 +0,0 @@ -- -- -- -- -- -- addon3@tests.mozilla.org -- 3.0 -- http://localhost:4444/data/test_updateid.rdf -- true -- -- -- Test 3 -- Test Description -- -- -- -- xpcshell@tests.mozilla.org -- 1 -- 1 -- -- -- -- -- -diff --git a/toolkit/mozapps/extensions/test/addons/test_updateid4_4/bootstrap.js b/toolkit/mozapps/extensions/test/addons/test_updateid4_4/bootstrap.js -deleted file mode 100644 ---- a/toolkit/mozapps/extensions/test/addons/test_updateid4_4/bootstrap.js -+++ /dev/null -@@ -1,21 +0,0 @@ --Components.utils.import("resource://gre/modules/Services.jsm"); -- --function install(data, reason) { -- Services.prefs.setIntPref("bootstraptest.installed_version", 4); -- Services.prefs.setIntPref("bootstraptest.install_reason", reason); --} -- --function startup(data, reason) { -- Services.prefs.setIntPref("bootstraptest.active_version", 4); -- Services.prefs.setIntPref("bootstraptest.startup_reason", reason); --} -- --function shutdown(data, reason) { -- Services.prefs.setIntPref("bootstraptest.active_version", 0); -- Services.prefs.setIntPref("bootstraptest.shutdown_reason", reason); --} -- --function uninstall(data, reason) { -- Services.prefs.setIntPref("bootstraptest.installed_version", 0); -- Services.prefs.setIntPref("bootstraptest.uninstall_reason", reason); --} -diff --git a/toolkit/mozapps/extensions/test/addons/test_updateid4_4/install.rdf b/toolkit/mozapps/extensions/test/addons/test_updateid4_4/install.rdf -deleted file mode 100644 ---- a/toolkit/mozapps/extensions/test/addons/test_updateid4_4/install.rdf -+++ /dev/null -@@ -1,25 +0,0 @@ -- -- -- -- -- -- addon4@tests.mozilla.org -- 4.0 -- http://localhost:4444/data/test_updateid.rdf -- true -- -- -- Test 4 -- Test Description -- -- -- -- xpcshell@tests.mozilla.org -- 1 -- 1 -- -- -- -- -- -diff --git a/toolkit/mozapps/extensions/test/xpcshell/data/test_update_multi.rdf b/toolkit/mozapps/extensions/test/xpcshell/data/test_update_multi.rdf -new file mode 100644 ---- /dev/null -+++ b/toolkit/mozapps/extensions/test/xpcshell/data/test_update_multi.rdf -@@ -0,0 +1,26 @@ -+ -+ -+ -+ -+ -+ -+ -+
  • -+ -+ 2.0 -+ -+ -+ xpcshell@tests.mozilla.org -+ 1 -+ 1 -+ http://localhost:4444/addons/test_update_multi2.xpi -+ -+ -+ -+
  • -+
    -+
    -+
    -+ -+
    -diff --git a/toolkit/mozapps/extensions/test/xpcshell/data/test_updateid.rdf b/toolkit/mozapps/extensions/test/xpcshell/data/test_updateid.rdf ---- a/toolkit/mozapps/extensions/test/xpcshell/data/test_updateid.rdf -+++ b/toolkit/mozapps/extensions/test/xpcshell/data/test_updateid.rdf -@@ -9,77 +9,17 @@ -
  • - - 2.0 - - - xpcshell@tests.mozilla.org - 1 - 1 -- http://localhost:4444/addons/test_updateid2_2.xpi -- -- -- --
  • -- -- -- -- -- -- -- --
  • -- -- 3.0 -- -- -- xpcshell@tests.mozilla.org -- 1 -- 1 -- http://localhost:4444/addons/test_updateid3_3.xpi -- -- -- --
  • --
    --
    --
    -- -- -- -- --
  • -- -- 4.0 -- -- -- xpcshell@tests.mozilla.org -- 1 -- 1 -- http://localhost:4444/addons/test_updateid4_4.xpi -- -- -- --
  • --
    --
    --
    -- -- -- -- --
  • -- -- 5.0 -- -- -- xpcshell@tests.mozilla.org -- 1 -- 1 -- http://localhost:4444/addons/test_updateid2_5.xpi -+ http://localhost:4444/addons/test_updateid2.xpi - - - -
  • -
    -
    -
    - -diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_updateid.js b/toolkit/mozapps/extensions/test/xpcshell/test_updateid.js ---- a/toolkit/mozapps/extensions/test/xpcshell/test_updateid.js -+++ b/toolkit/mozapps/extensions/test/xpcshell/test_updateid.js -@@ -2,421 +2,85 @@ - * http://creativecommons.org/publicdomain/zero/1.0/ - */ - - // This verifies that updating an add-on to a new ID works - - // The test extension uses an insecure update url. - Services.prefs.setBoolPref("extensions.checkUpdateSecurity", false); - --Components.utils.import("resource://testing-common/httpd.js"); --var testserver; - const profileDir = gProfD.clone(); - profileDir.append("extensions"); - --function resetPrefs() { -- Services.prefs.setIntPref("bootstraptest.active_version", -1); -- Services.prefs.setIntPref("bootstraptest.installed_version", -1); -- Services.prefs.setIntPref("bootstraptest.startup_reason", -1); -- Services.prefs.setIntPref("bootstraptest.shutdown_reason", -1); -- Services.prefs.setIntPref("bootstraptest.install_reason", -1); -- Services.prefs.setIntPref("bootstraptest.uninstall_reason", -1); --} -- --function getActiveVersion() { -- return Services.prefs.getIntPref("bootstraptest.active_version"); --} -- --function getInstalledVersion() { -- return Services.prefs.getIntPref("bootstraptest.installed_version"); --} -- --function run_test() { -- createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9.2"); -- -- // Create and configure the HTTP server. -- testserver = new HttpServer(); -- testserver.registerDirectory("/data/", do_get_file("data")); -- testserver.registerDirectory("/addons/", do_get_file("addons")); -- testserver.start(4444); -- -- do_test_pending(); -- run_test_1(); --} -- --function end_test() { -- testserver.stop(do_test_finished); --} -- --function installUpdate(aInstall, aCallback) { -- aInstall.addListener({ -- onInstallEnded: function(aInstall) { -- // give the startup time to run -- do_execute_soon(function() { -- aCallback(aInstall); -- }); -- } -- }); -- -- aInstall.install(); --} -- --// Verify that an update to an add-on with a new ID uninstalls the old add-on --function run_test_1() { -- writeInstallRDFForExtension({ -- id: "addon1@tests.mozilla.org", -- version: "1.0", -- updateURL: "http://localhost:4444/data/test_updateid.rdf", -- targetApplications: [{ -- id: "xpcshell@tests.mozilla.org", -- minVersion: "1", -- maxVersion: "1" -- }], -- name: "Test Addon 1", -- }, profileDir); -- -- startupManager(); -- -- AddonManager.getAddonByID("addon1@tests.mozilla.org", function(a1) { -- do_check_neq(a1, null); -- do_check_eq(a1.version, "1.0"); -+function promiseInstallUpdate(install) { -+ return new Promise((resolve, reject) => { -+ install.addListener({ -+ onDownloadFailed: () => { -+ let err = new Error("download error"); -+ err.code = install.error; -+ reject(err); -+ }, -+ onInstallFailed: () => { -+ let err = new Error("install error"); -+ err.code = install.error; -+ reject(err); -+ }, -+ onInstallEnded: resolve, -+ }); - -- a1.findUpdates({ -- onUpdateAvailable: function(addon, install) { -- do_check_eq(install.name, addon.name); -- do_check_eq(install.version, "2.0"); -- do_check_eq(install.state, AddonManager.STATE_AVAILABLE); -- do_check_eq(install.existingAddon, a1); -- -- installUpdate(install, check_test_1); -- } -- }, AddonManager.UPDATE_WHEN_USER_REQUESTED); -- }); --} -- --function check_test_1(install) { -- AddonManager.getAddonByID("addon1@tests.mozilla.org", callback_soon(function(a1) { -- // Existing add-on should have a pending upgrade -- do_check_neq(a1.pendingUpgrade, null); -- do_check_eq(a1.pendingUpgrade.id, "addon2@tests.mozilla.org"); -- do_check_eq(a1.pendingUpgrade.install.existingAddon, a1); -- do_check_neq(a1.syncGUID); -- -- let a1SyncGUID = a1.syncGUID; -- -- restartManager(); -- -- AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org", -- "addon2@tests.mozilla.org"], function([a1, a2]) { -- // Should have uninstalled the old and installed the new -- do_check_eq(a1, null); -- do_check_neq(a2, null); -- do_check_neq(a2.syncGUID, null); -- -- // The Sync GUID should change when the ID changes -- do_check_neq(a1SyncGUID, a2.syncGUID); -- -- a2.uninstall(); -- -- do_execute_soon(run_test_2); -- }); -- })); --} -- --// Test that when the new add-on already exists we just upgrade that --function run_test_2() { -- restartManager(); -- shutdownManager(); -- -- writeInstallRDFForExtension({ -- id: "addon1@tests.mozilla.org", -- version: "1.0", -- updateURL: "http://localhost:4444/data/test_updateid.rdf", -- targetApplications: [{ -- id: "xpcshell@tests.mozilla.org", -- minVersion: "1", -- maxVersion: "1" -- }], -- name: "Test Addon 1", -- }, profileDir); -- writeInstallRDFForExtension({ -- id: "addon2@tests.mozilla.org", -- version: "1.0", -- targetApplications: [{ -- id: "xpcshell@tests.mozilla.org", -- minVersion: "1", -- maxVersion: "1" -- }], -- name: "Test Addon 2", -- }, profileDir); -- -- startupManager(); -- -- AddonManager.getAddonByID("addon1@tests.mozilla.org", function(a1) { -- do_check_neq(a1, null); -- do_check_eq(a1.version, "1.0"); -- -- a1.findUpdates({ -- onUpdateAvailable: function(addon, install) { -- installUpdate(install, check_test_2); -- } -- }, AddonManager.UPDATE_WHEN_USER_REQUESTED); -+ install.install(); - }); - } - --function check_test_2(install) { -- AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org", -- "addon2@tests.mozilla.org"], -- callback_soon(function([a1, a2]) { -- do_check_eq(a1.pendingUpgrade, null); -- // Existing add-on should have a pending upgrade -- do_check_neq(a2.pendingUpgrade, null); -- do_check_eq(a2.pendingUpgrade.id, "addon2@tests.mozilla.org"); -- do_check_eq(a2.pendingUpgrade.install.existingAddon, a2); -- -- restartManager(); -- -- AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org", -- "addon2@tests.mozilla.org"], function([a1, a2]) { -- // Should have uninstalled the old and installed the new -- do_check_neq(a1, null); -- do_check_neq(a2, null); -- -- a1.uninstall(); -- a2.uninstall(); -- -- do_execute_soon(run_test_3); -- }); -- })); --} -- --// Test that we rollback correctly when removing the old add-on fails --function run_test_3() { -- restartManager(); -- shutdownManager(); -- -- // This test only works on Windows -- if (!("nsIWindowsRegKey" in AM_Ci)) { -- run_test_4(); -- return; -- } -- -- writeInstallRDFForExtension({ -- id: "addon1@tests.mozilla.org", -- version: "1.0", -- updateURL: "http://localhost:4444/data/test_updateid.rdf", -- targetApplications: [{ -- id: "xpcshell@tests.mozilla.org", -- minVersion: "1", -- maxVersion: "1" -- }], -- name: "Test Addon 1", -- }, profileDir); -- -- startupManager(); -+// Create and configure the HTTP server. -+let testserver = createHttpServer(4444); -+testserver.registerDirectory("/data/", do_get_file("data")); -+testserver.registerDirectory("/addons/", do_get_file("addons")); - -- AddonManager.getAddonByID("addon1@tests.mozilla.org", function(a1) { -- do_check_neq(a1, null); -- do_check_eq(a1.version, "1.0"); -- -- a1.findUpdates({ -- onUpdateAvailable: function(addon, install) { -- installUpdate(install, check_test_3); -- } -- }, AddonManager.UPDATE_WHEN_USER_REQUESTED); -- }); --} -- --function check_test_3(install) { -- AddonManager.getAddonByID("addon1@tests.mozilla.org", callback_soon(function(a1) { -- // Existing add-on should have a pending upgrade -- do_check_neq(a1.pendingUpgrade, null); -- do_check_eq(a1.pendingUpgrade.id, "addon2@tests.mozilla.org"); -- do_check_eq(a1.pendingUpgrade.install.existingAddon, a1); -- -- // Lock the old add-on open so it can't be uninstalled -- var file = profileDir.clone(); -- file.append("addon1@tests.mozilla.org"); -- if (!file.exists()) -- file.leafName += ".xpi"; -- else -- file.append("install.rdf"); -- -- var fstream = AM_Cc["@mozilla.org/network/file-output-stream;1"]. -- createInstance(AM_Ci.nsIFileOutputStream); -- fstream.init(file, FileUtils.MODE_APPEND | FileUtils.MODE_WRONLY, FileUtils.PERMS_FILE, 0); -- -- restartManager(); -- -- fstream.close(); -- -- AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org", -- "addon2@tests.mozilla.org"], -- callback_soon(function([a1, a2]) { -- // Should not have installed the new add-on but it should still be -- // pending install -- do_check_neq(a1, null); -- do_check_eq(a2, null); -- -- restartManager(); -- -- AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org", -- "addon2@tests.mozilla.org"], function([a1, a2]) { -- // Should have installed the new add-on -- do_check_eq(a1, null); -- do_check_neq(a2, null); -- -- a2.uninstall(); -- -- do_execute_soon(run_test_4); -- }); -- })); -- })); -+function run_test() { -+ createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9.2"); -+ startupManager(); -+ run_next_test(); - } - --// Tests that upgrading to a bootstrapped add-on works but requires a restart --function run_test_4() { -- restartManager(); -- shutdownManager(); -- -- writeInstallRDFForExtension({ -- id: "addon2@tests.mozilla.org", -- version: "2.0", -- updateURL: "http://localhost:4444/data/test_updateid.rdf", -- targetApplications: [{ -- id: "xpcshell@tests.mozilla.org", -- minVersion: "1", -- maxVersion: "1" -- }], -- name: "Test Addon 2", -- }, profileDir); -- -- startupManager(); -- -- resetPrefs(); -- -- AddonManager.getAddonByID("addon2@tests.mozilla.org", function(a2) { -- do_check_neq(a2, null); -- do_check_neq(a2.syncGUID, null); -- do_check_eq(a2.version, "2.0"); -- -- a2.findUpdates({ -- onUpdateAvailable: function(addon, install) { -- installUpdate(install, check_test_4); -- } -- }, AddonManager.UPDATE_WHEN_USER_REQUESTED); -- }); --} -- --function check_test_4() { -- AddonManager.getAddonsByIDs(["addon2@tests.mozilla.org", -- "addon3@tests.mozilla.org"], -- callback_soon(function([a2, a3]) { -- // Should still be pending install even though the new add-on is restartless -- do_check_neq(a2, null); -- do_check_eq(a3, null); -- -- do_check_neq(a2.pendingUpgrade, null); -- do_check_eq(a2.pendingUpgrade.id, "addon3@tests.mozilla.org"); -- -- do_check_eq(getInstalledVersion(), -1); -- do_check_eq(getActiveVersion(), -1); -- -- restartManager(); -- -- AddonManager.getAddonsByIDs(["addon2@tests.mozilla.org", -- "addon3@tests.mozilla.org"], function([a2, a3]) { -- // Should have updated -- do_check_eq(a2, null); -- do_check_neq(a3, null); -- -- do_check_eq(getInstalledVersion(), 3); -- do_check_eq(getActiveVersion(), 3); -- -- do_execute_soon(run_test_5); -- }); -- })); --} -- --// Tests that upgrading to another bootstrapped add-on works without a restart --function run_test_5() { -- AddonManager.getAddonByID("addon3@tests.mozilla.org", function(a3) { -- do_check_neq(a3, null); -- do_check_eq(a3.version, "3.0"); -+// Verify that an update to an add-on with a new ID fails -+add_task(function* test_update_new_id() { -+ yield promiseInstallAllFiles([do_get_addon("test_updateid1")]); - -- a3.findUpdates({ -- onUpdateAvailable: function(addon, install) { -- installUpdate(install, check_test_5); -- } -- }, AddonManager.UPDATE_WHEN_USER_REQUESTED); -- }); --} -- --function check_test_5() { -- AddonManager.getAddonsByIDs(["addon3@tests.mozilla.org", -- "addon4@tests.mozilla.org"], -- callback_soon(function([a3, a4]) { -- // Should have updated -- do_check_eq(a3, null); -- do_check_neq(a4, null); -- -- do_check_eq(getInstalledVersion(), 4); -- do_check_eq(getActiveVersion(), 4); -- -- restartManager(); -- -- AddonManager.getAddonsByIDs(["addon3@tests.mozilla.org", -- "addon4@tests.mozilla.org"], function([a3, a4]) { -- // Should still be gone -- do_check_eq(a3, null); -- do_check_neq(a4, null); -- -- do_check_eq(getInstalledVersion(), 4); -- do_check_eq(getActiveVersion(), 4); -- -- run_test_6(); -- }); -- })); --} -+ let addon = yield promiseAddonByID("addon1@tests.mozilla.org"); -+ do_check_neq(addon, null); -+ do_check_eq(addon.version, "1.0"); - --// Tests that upgrading to a non-bootstrapped add-on works but requires a restart --function run_test_6() { -- AddonManager.getAddonByID("addon4@tests.mozilla.org", function(a4) { -- do_check_neq(a4, null); -- do_check_eq(a4.version, "4.0"); -- -- a4.findUpdates({ -- onUpdateAvailable: function(addon, install) { -- installUpdate(install, check_test_6); -- } -- }, AddonManager.UPDATE_WHEN_USER_REQUESTED); -- }); --} -+ let update = yield promiseFindAddonUpdates(addon, AddonManager.UPDATE_WHEN_USER_REQUESTED); -+ let install = update.updateAvailable; -+ do_check_eq(install.name, addon.name); -+ do_check_eq(install.version, "2.0"); -+ do_check_eq(install.state, AddonManager.STATE_AVAILABLE); -+ do_check_eq(install.existingAddon, addon); - --function check_test_6() { -- AddonManager.getAddonsByIDs(["addon4@tests.mozilla.org", -- "addon2@tests.mozilla.org"], -- callback_soon(function([a4, a2]) { -- // Should still be pending install even though the old add-on is restartless -- do_check_neq(a4, null); -- do_check_eq(a2, null); -- -- do_check_neq(a4.pendingUpgrade, null); -- do_check_eq(a4.pendingUpgrade.id, "addon2@tests.mozilla.org"); -- -- do_check_eq(getInstalledVersion(), 4); -- do_check_eq(getActiveVersion(), 4); -+ yield Assert.rejects(promiseInstallUpdate(install), -+ function(err) { return err.code == AddonManager.ERROR_INCORRECT_ID }, -+ "Upgrade to a different ID fails"); - -- restartManager(); -+ addon.uninstall(); -+}); - -- AddonManager.getAddonsByIDs(["addon4@tests.mozilla.org", -- "addon2@tests.mozilla.org"], function([a4, a2]) { -- // Should have updated -- do_check_eq(a4, null); -- do_check_neq(a2, null); -+// Verify that an update to a multi-package xpi fails -+add_task(function* test_update_new_id() { -+ yield promiseInstallAllFiles([do_get_addon("test_update_multi1")]); - -- do_check_eq(getInstalledVersion(), 0); -- do_check_eq(getActiveVersion(), 0); -+ let addon = yield promiseAddonByID("updatemulti@tests.mozilla.org"); -+ do_check_neq(addon, null); -+ do_check_eq(addon.version, "1.0"); - -- end_test(); -- }); -- })); --} -+ let update = yield promiseFindAddonUpdates(addon, AddonManager.UPDATE_WHEN_USER_REQUESTED); -+ let install = update.updateAvailable; -+ do_check_eq(install.name, addon.name); -+ do_check_eq(install.version, "2.0"); -+ do_check_eq(install.state, AddonManager.STATE_AVAILABLE); -+ do_check_eq(install.existingAddon, addon); -+ -+ yield Assert.rejects(promiseInstallUpdate(install), -+ function(err) { return err.code == AddonManager.ERROR_UNEXPECTED_ADDON_TYPE }, -+ "Upgrade to a multipackage xpi fails"); -+ -+ addon.uninstall(); -+}); - -- cgit 1.4.1