|
1 const Cc = Components.classes; |
|
2 const Ci = Components.interfaces; |
|
3 |
|
4 const MANDATORY = ["id", "name", "headerURL"]; |
|
5 const OPTIONAL = ["footerURL", "textcolor", "accentcolor", "iconURL", |
|
6 "previewURL", "author", "description", "homepageURL", |
|
7 "updateURL", "version"]; |
|
8 |
|
9 Components.utils.import("resource://gre/modules/Services.jsm"); |
|
10 |
|
11 function dummy(id) { |
|
12 return { |
|
13 id: id || Math.random().toString(), |
|
14 name: Math.random().toString(), |
|
15 headerURL: "http://lwttest.invalid/a.png", |
|
16 footerURL: "http://lwttest.invalid/b.png", |
|
17 textcolor: Math.random().toString(), |
|
18 accentcolor: Math.random().toString() |
|
19 }; |
|
20 } |
|
21 |
|
22 function run_test() { |
|
23 createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9"); |
|
24 startupManager(); |
|
25 |
|
26 Services.prefs.setIntPref("lightweightThemes.maxUsedThemes", 8); |
|
27 |
|
28 var temp = {}; |
|
29 Components.utils.import("resource://gre/modules/LightweightThemeManager.jsm", temp); |
|
30 do_check_eq(typeof temp.LightweightThemeManager, "object"); |
|
31 |
|
32 var ltm = temp.LightweightThemeManager; |
|
33 |
|
34 do_check_eq(typeof ltm.usedThemes, "object"); |
|
35 do_check_eq(ltm.usedThemes.length, 0); |
|
36 do_check_eq(ltm.currentTheme, null); |
|
37 |
|
38 ltm.previewTheme(dummy("preview0")); |
|
39 do_check_eq(ltm.usedThemes.length, 0); |
|
40 do_check_eq(ltm.currentTheme, null); |
|
41 |
|
42 ltm.previewTheme(dummy("preview1")); |
|
43 do_check_eq(ltm.usedThemes.length, 0); |
|
44 do_check_eq(ltm.currentTheme, null); |
|
45 ltm.resetPreview(); |
|
46 |
|
47 ltm.currentTheme = dummy("x0"); |
|
48 do_check_eq(ltm.usedThemes.length, 1); |
|
49 do_check_eq(ltm.currentTheme.id, "x0"); |
|
50 do_check_eq(ltm.usedThemes[0].id, "x0"); |
|
51 do_check_eq(ltm.getUsedTheme("x0").id, "x0"); |
|
52 |
|
53 ltm.previewTheme(dummy("preview0")); |
|
54 do_check_eq(ltm.usedThemes.length, 1); |
|
55 do_check_eq(ltm.currentTheme.id, "x0"); |
|
56 |
|
57 ltm.resetPreview(); |
|
58 do_check_eq(ltm.usedThemes.length, 1); |
|
59 do_check_eq(ltm.currentTheme.id, "x0"); |
|
60 |
|
61 ltm.currentTheme = dummy("x1"); |
|
62 do_check_eq(ltm.usedThemes.length, 2); |
|
63 do_check_eq(ltm.currentTheme.id, "x1"); |
|
64 do_check_eq(ltm.usedThemes[1].id, "x0"); |
|
65 |
|
66 ltm.currentTheme = dummy("x2"); |
|
67 do_check_eq(ltm.usedThemes.length, 3); |
|
68 do_check_eq(ltm.currentTheme.id, "x2"); |
|
69 do_check_eq(ltm.usedThemes[1].id, "x1"); |
|
70 do_check_eq(ltm.usedThemes[2].id, "x0"); |
|
71 |
|
72 ltm.currentTheme = dummy("x3"); |
|
73 ltm.currentTheme = dummy("x4"); |
|
74 ltm.currentTheme = dummy("x5"); |
|
75 ltm.currentTheme = dummy("x6"); |
|
76 ltm.currentTheme = dummy("x7"); |
|
77 do_check_eq(ltm.usedThemes.length, 8); |
|
78 do_check_eq(ltm.currentTheme.id, "x7"); |
|
79 do_check_eq(ltm.usedThemes[1].id, "x6"); |
|
80 do_check_eq(ltm.usedThemes[7].id, "x0"); |
|
81 |
|
82 ltm.currentTheme = dummy("x8"); |
|
83 do_check_eq(ltm.usedThemes.length, 8); |
|
84 do_check_eq(ltm.currentTheme.id, "x8"); |
|
85 do_check_eq(ltm.usedThemes[1].id, "x7"); |
|
86 do_check_eq(ltm.usedThemes[7].id, "x1"); |
|
87 do_check_eq(ltm.getUsedTheme("x0"), null); |
|
88 |
|
89 ltm.forgetUsedTheme("nonexistent"); |
|
90 do_check_eq(ltm.usedThemes.length, 8); |
|
91 do_check_neq(ltm.currentTheme, null); |
|
92 |
|
93 ltm.forgetUsedTheme("x8"); |
|
94 do_check_eq(ltm.usedThemes.length, 7); |
|
95 do_check_eq(ltm.currentTheme, null); |
|
96 do_check_eq(ltm.usedThemes[0].id, "x7"); |
|
97 do_check_eq(ltm.usedThemes[6].id, "x1"); |
|
98 |
|
99 ltm.forgetUsedTheme("x7"); |
|
100 ltm.forgetUsedTheme("x6"); |
|
101 ltm.forgetUsedTheme("x5"); |
|
102 ltm.forgetUsedTheme("x4"); |
|
103 ltm.forgetUsedTheme("x3"); |
|
104 do_check_eq(ltm.usedThemes.length, 2); |
|
105 do_check_eq(ltm.currentTheme, null); |
|
106 do_check_eq(ltm.usedThemes[0].id, "x2"); |
|
107 do_check_eq(ltm.usedThemes[1].id, "x1"); |
|
108 |
|
109 ltm.currentTheme = dummy("x1"); |
|
110 do_check_eq(ltm.usedThemes.length, 2); |
|
111 do_check_eq(ltm.currentTheme.id, "x1"); |
|
112 do_check_eq(ltm.usedThemes[0].id, "x1"); |
|
113 do_check_eq(ltm.usedThemes[1].id, "x2"); |
|
114 |
|
115 ltm.currentTheme = dummy("x2"); |
|
116 do_check_eq(ltm.usedThemes.length, 2); |
|
117 do_check_eq(ltm.currentTheme.id, "x2"); |
|
118 do_check_eq(ltm.usedThemes[0].id, "x2"); |
|
119 do_check_eq(ltm.usedThemes[1].id, "x1"); |
|
120 |
|
121 ltm.currentTheme = ltm.getUsedTheme("x1"); |
|
122 do_check_eq(ltm.usedThemes.length, 2); |
|
123 do_check_eq(ltm.currentTheme.id, "x1"); |
|
124 do_check_eq(ltm.usedThemes[0].id, "x1"); |
|
125 do_check_eq(ltm.usedThemes[1].id, "x2"); |
|
126 |
|
127 ltm.forgetUsedTheme("x1"); |
|
128 ltm.forgetUsedTheme("x2"); |
|
129 do_check_eq(ltm.usedThemes.length, 0); |
|
130 do_check_eq(ltm.currentTheme, null); |
|
131 |
|
132 // Use chinese name to test utf-8, for bug #541943 |
|
133 var chineseTheme = dummy("chinese0"); |
|
134 chineseTheme.name = "笢恅0"; |
|
135 chineseTheme.description = "笢恅1"; |
|
136 ltm.currentTheme = chineseTheme; |
|
137 do_check_eq(ltm.usedThemes.length, 1); |
|
138 do_check_eq(ltm.currentTheme.name, "笢恅0"); |
|
139 do_check_eq(ltm.currentTheme.description, "笢恅1"); |
|
140 do_check_eq(ltm.usedThemes[0].name, "笢恅0"); |
|
141 do_check_eq(ltm.usedThemes[0].description, "笢恅1"); |
|
142 do_check_eq(ltm.getUsedTheme("chinese0").name, "笢恅0"); |
|
143 do_check_eq(ltm.getUsedTheme("chinese0").description, "笢恅1"); |
|
144 |
|
145 // This name used to break the usedTheme JSON causing all LWTs to be lost |
|
146 var chineseTheme1 = dummy("chinese1"); |
|
147 chineseTheme1.name = "眵昜湮桵蔗坌~郔乾"; |
|
148 chineseTheme1.description = "眵昜湮桵蔗坌~郔乾"; |
|
149 ltm.currentTheme = chineseTheme1; |
|
150 do_check_neq(ltm.currentTheme, null); |
|
151 do_check_eq(ltm.usedThemes.length, 2); |
|
152 do_check_eq(ltm.currentTheme.name, "眵昜湮桵蔗坌~郔乾"); |
|
153 do_check_eq(ltm.currentTheme.description, "眵昜湮桵蔗坌~郔乾"); |
|
154 do_check_eq(ltm.usedThemes[1].name, "笢恅0"); |
|
155 do_check_eq(ltm.usedThemes[1].description, "笢恅1"); |
|
156 do_check_eq(ltm.usedThemes[0].name, "眵昜湮桵蔗坌~郔乾"); |
|
157 do_check_eq(ltm.usedThemes[0].description, "眵昜湮桵蔗坌~郔乾"); |
|
158 |
|
159 ltm.forgetUsedTheme("chinese0"); |
|
160 do_check_eq(ltm.usedThemes.length, 1); |
|
161 do_check_neq(ltm.currentTheme, null); |
|
162 |
|
163 ltm.forgetUsedTheme("chinese1"); |
|
164 do_check_eq(ltm.usedThemes.length, 0); |
|
165 do_check_eq(ltm.currentTheme, null); |
|
166 |
|
167 do_check_eq(ltm.parseTheme("invalid json"), null); |
|
168 do_check_eq(ltm.parseTheme('"json string"'), null); |
|
169 |
|
170 function roundtrip(data, secure) { |
|
171 return ltm.parseTheme(JSON.stringify(data), |
|
172 "http" + (secure ? "s" : "") + "://lwttest.invalid/"); |
|
173 } |
|
174 |
|
175 var data = dummy(); |
|
176 do_check_neq(roundtrip(data), null); |
|
177 data.id = null; |
|
178 do_check_eq(roundtrip(data), null); |
|
179 data.id = 1; |
|
180 do_check_eq(roundtrip(data), null); |
|
181 data.id = 1.5; |
|
182 do_check_eq(roundtrip(data), null); |
|
183 data.id = true; |
|
184 do_check_eq(roundtrip(data), null); |
|
185 data.id = {}; |
|
186 do_check_eq(roundtrip(data), null); |
|
187 data.id = []; |
|
188 do_check_eq(roundtrip(data), null); |
|
189 |
|
190 // Check whether parseTheme handles international characters right |
|
191 var chineseTheme2 = dummy(); |
|
192 chineseTheme2.name = "眵昜湮桵蔗坌~郔乾"; |
|
193 chineseTheme2.description = "眵昜湮桵蔗坌~郔乾"; |
|
194 do_check_neq(roundtrip(chineseTheme2), null); |
|
195 do_check_eq(roundtrip(chineseTheme2).name, "眵昜湮桵蔗坌~郔乾"); |
|
196 do_check_eq(roundtrip(chineseTheme2).description, "眵昜湮桵蔗坌~郔乾"); |
|
197 |
|
198 data = dummy(); |
|
199 data.unknownProperty = "Foo"; |
|
200 do_check_eq(typeof roundtrip(data).unknownProperty, "undefined"); |
|
201 |
|
202 data = dummy(); |
|
203 data.unknownURL = "http://lwttest.invalid/"; |
|
204 do_check_eq(typeof roundtrip(data).unknownURL, "undefined"); |
|
205 |
|
206 function roundtripSet(props, modify, test, secure) { |
|
207 props.forEach(function (prop) { |
|
208 var data = dummy(); |
|
209 modify(data, prop); |
|
210 test(roundtrip(data, secure), prop, data); |
|
211 }); |
|
212 } |
|
213 |
|
214 roundtripSet(MANDATORY, function (data, prop) { |
|
215 delete data[prop]; |
|
216 }, function (after) { |
|
217 do_check_eq(after, null); |
|
218 }); |
|
219 |
|
220 roundtripSet(OPTIONAL, function (data, prop) { |
|
221 delete data[prop]; |
|
222 }, function (after) { |
|
223 do_check_neq(after, null); |
|
224 }); |
|
225 |
|
226 roundtripSet(MANDATORY, function (data, prop) { |
|
227 data[prop] = ""; |
|
228 }, function (after) { |
|
229 do_check_eq(after, null); |
|
230 }); |
|
231 |
|
232 roundtripSet(OPTIONAL, function (data, prop) { |
|
233 data[prop] = ""; |
|
234 }, function (after, prop) { |
|
235 do_check_eq(typeof after[prop], "undefined"); |
|
236 }); |
|
237 |
|
238 roundtripSet(MANDATORY, function (data, prop) { |
|
239 data[prop] = " "; |
|
240 }, function (after) { |
|
241 do_check_eq(after, null); |
|
242 }); |
|
243 |
|
244 roundtripSet(OPTIONAL, function (data, prop) { |
|
245 data[prop] = " "; |
|
246 }, function (after, prop) { |
|
247 do_check_neq(after, null); |
|
248 do_check_eq(typeof after[prop], "undefined"); |
|
249 }); |
|
250 |
|
251 function non_urls(props) { |
|
252 return props.filter(function (prop) !/URL$/.test(prop)); |
|
253 } |
|
254 |
|
255 function urls(props) { |
|
256 return props.filter(function (prop) /URL$/.test(prop)); |
|
257 } |
|
258 |
|
259 roundtripSet(non_urls(MANDATORY.concat(OPTIONAL)), function (data, prop) { |
|
260 data[prop] = prop; |
|
261 }, function (after, prop, before) { |
|
262 do_check_eq(after[prop], before[prop]); |
|
263 }); |
|
264 |
|
265 roundtripSet(non_urls(MANDATORY.concat(OPTIONAL)), function (data, prop) { |
|
266 data[prop] = " " + prop + " "; |
|
267 }, function (after, prop, before) { |
|
268 do_check_eq(after[prop], before[prop].trim()); |
|
269 }); |
|
270 |
|
271 roundtripSet(urls(MANDATORY.concat(OPTIONAL)), function (data, prop) { |
|
272 data[prop] = Math.random().toString(); |
|
273 }, function (after, prop, before) { |
|
274 if (prop == "updateURL") |
|
275 do_check_eq(typeof after[prop], "undefined"); |
|
276 else |
|
277 do_check_eq(after[prop], "http://lwttest.invalid/" + before[prop]); |
|
278 }); |
|
279 |
|
280 roundtripSet(urls(MANDATORY.concat(OPTIONAL)), function (data, prop) { |
|
281 data[prop] = Math.random().toString(); |
|
282 }, function (after, prop, before) { |
|
283 do_check_eq(after[prop], "https://lwttest.invalid/" + before[prop]); |
|
284 }, true); |
|
285 |
|
286 roundtripSet(urls(MANDATORY.concat(OPTIONAL)), function (data, prop) { |
|
287 data[prop] = "https://sub.lwttest.invalid/" + Math.random().toString(); |
|
288 }, function (after, prop, before) { |
|
289 do_check_eq(after[prop], before[prop]); |
|
290 }); |
|
291 |
|
292 roundtripSet(urls(MANDATORY), function (data, prop) { |
|
293 data[prop] = "ftp://lwttest.invalid/" + Math.random().toString(); |
|
294 }, function (after) { |
|
295 do_check_eq(after, null); |
|
296 }); |
|
297 |
|
298 roundtripSet(urls(OPTIONAL), function (data, prop) { |
|
299 data[prop] = "ftp://lwttest.invalid/" + Math.random().toString(); |
|
300 }, function (after, prop) { |
|
301 do_check_eq(typeof after[prop], "undefined"); |
|
302 }); |
|
303 |
|
304 do_check_eq(ltm.usedThemes.length, 0); |
|
305 do_check_eq(ltm.currentTheme, null); |
|
306 |
|
307 data = dummy(); |
|
308 delete data.name; |
|
309 try { |
|
310 ltm.currentTheme = data; |
|
311 do_throw("Should have rejected a theme with no name"); |
|
312 } |
|
313 catch (e) { |
|
314 // Expected exception |
|
315 } |
|
316 |
|
317 data = dummy(); |
|
318 data.headerURL = "foo"; |
|
319 try { |
|
320 ltm.currentTheme = data; |
|
321 do_throw("Should have rejected a theme with a bad headerURL"); |
|
322 } |
|
323 catch (e) { |
|
324 // Expected exception |
|
325 } |
|
326 |
|
327 data = dummy(); |
|
328 data.headerURL = "ftp://lwtest.invalid/test.png"; |
|
329 try { |
|
330 ltm.currentTheme = data; |
|
331 do_throw("Should have rejected a theme with a non-http(s) headerURL"); |
|
332 } |
|
333 catch (e) { |
|
334 // Expected exception |
|
335 } |
|
336 |
|
337 data = dummy(); |
|
338 data.headerURL = "file:///test.png"; |
|
339 try { |
|
340 ltm.currentTheme = data; |
|
341 do_throw("Should have rejected a theme with a non-http(s) headerURL"); |
|
342 } |
|
343 catch (e) { |
|
344 // Expected exception |
|
345 } |
|
346 |
|
347 data = dummy(); |
|
348 data.updateURL = "file:///test.json"; |
|
349 ltm.setLocalTheme(data); |
|
350 do_check_eq(ltm.usedThemes.length, 1); |
|
351 do_check_eq(ltm.currentTheme.updateURL, undefined); |
|
352 ltm.forgetUsedTheme(ltm.currentTheme.id); |
|
353 do_check_eq(ltm.usedThemes.length, 0); |
|
354 |
|
355 data = dummy(); |
|
356 data.headerURL = "file:///test.png"; |
|
357 ltm.setLocalTheme(data); |
|
358 do_check_eq(ltm.usedThemes.length, 1); |
|
359 do_check_eq(ltm.currentTheme.headerURL, "file:///test.png"); |
|
360 ltm.forgetUsedTheme(ltm.currentTheme.id); |
|
361 do_check_eq(ltm.usedThemes.length, 0); |
|
362 |
|
363 data = dummy(); |
|
364 data.headerURL = "ftp://lwtest.invalid/test.png"; |
|
365 try { |
|
366 ltm.setLocalTheme(data); |
|
367 do_throw("Should have rejected a theme with a non-http(s), non-file headerURL"); |
|
368 } |
|
369 catch (e) { |
|
370 // Expected exception |
|
371 } |
|
372 |
|
373 data = dummy(); |
|
374 delete data.id; |
|
375 try { |
|
376 ltm.currentTheme = data; |
|
377 do_throw("Should have rejected a theme with no ID"); |
|
378 } |
|
379 catch (e) { |
|
380 // Expected exception |
|
381 } |
|
382 |
|
383 do_check_eq(ltm.usedThemes.length, 0); |
|
384 do_check_eq(ltm.currentTheme, null); |
|
385 |
|
386 // Force the theme into the prefs anyway |
|
387 let prefs = Cc["@mozilla.org/preferences-service;1"]. |
|
388 getService(Ci.nsIPrefBranch); |
|
389 let themes = [data]; |
|
390 prefs.setCharPref("lightweightThemes.usedThemes", JSON.stringify(themes)); |
|
391 do_check_eq(ltm.usedThemes.length, 1); |
|
392 |
|
393 // This should silently drop the bad theme. |
|
394 ltm.currentTheme = dummy(); |
|
395 do_check_eq(ltm.usedThemes.length, 1); |
|
396 ltm.forgetUsedTheme(ltm.currentTheme.id); |
|
397 do_check_eq(ltm.usedThemes.length, 0); |
|
398 do_check_eq(ltm.currentTheme, null); |
|
399 |
|
400 // Add one broken and some working. |
|
401 themes = [data, dummy("x1"), dummy("x2")]; |
|
402 prefs.setCharPref("lightweightThemes.usedThemes", JSON.stringify(themes)); |
|
403 do_check_eq(ltm.usedThemes.length, 3); |
|
404 |
|
405 // Switching to an existing theme should drop the bad theme. |
|
406 ltm.currentTheme = ltm.getUsedTheme("x1"); |
|
407 do_check_eq(ltm.usedThemes.length, 2); |
|
408 ltm.forgetUsedTheme("x1"); |
|
409 ltm.forgetUsedTheme("x2"); |
|
410 do_check_eq(ltm.usedThemes.length, 0); |
|
411 do_check_eq(ltm.currentTheme, null); |
|
412 |
|
413 prefs.setCharPref("lightweightThemes.usedThemes", JSON.stringify(themes)); |
|
414 do_check_eq(ltm.usedThemes.length, 3); |
|
415 |
|
416 // Forgetting an existing theme should drop the bad theme. |
|
417 ltm.forgetUsedTheme("x1"); |
|
418 do_check_eq(ltm.usedThemes.length, 1); |
|
419 ltm.forgetUsedTheme("x2"); |
|
420 do_check_eq(ltm.usedThemes.length, 0); |
|
421 do_check_eq(ltm.currentTheme, null); |
|
422 |
|
423 // Test whether a JSON set with setCharPref can be retrieved with usedThemes |
|
424 ltm.currentTheme = dummy("x0"); |
|
425 ltm.currentTheme = dummy("x1"); |
|
426 prefs.setCharPref("lightweightThemes.usedThemes", JSON.stringify(ltm.usedThemes)); |
|
427 do_check_eq(ltm.usedThemes.length, 2); |
|
428 do_check_eq(ltm.currentTheme.id, "x1"); |
|
429 do_check_eq(ltm.usedThemes[1].id, "x0"); |
|
430 do_check_eq(ltm.usedThemes[0].id, "x1"); |
|
431 |
|
432 ltm.forgetUsedTheme("x0"); |
|
433 do_check_eq(ltm.usedThemes.length, 1); |
|
434 do_check_neq(ltm.currentTheme, null); |
|
435 |
|
436 ltm.forgetUsedTheme("x1"); |
|
437 do_check_eq(ltm.usedThemes.length, 0); |
|
438 do_check_eq(ltm.currentTheme, null); |
|
439 |
|
440 Services.prefs.clearUserPref("lightweightThemes.maxUsedThemes"); |
|
441 |
|
442 ltm.currentTheme = dummy("x1"); |
|
443 ltm.currentTheme = dummy("x2"); |
|
444 ltm.currentTheme = dummy("x3"); |
|
445 ltm.currentTheme = dummy("x4"); |
|
446 ltm.currentTheme = dummy("x5"); |
|
447 ltm.currentTheme = dummy("x6"); |
|
448 ltm.currentTheme = dummy("x7"); |
|
449 ltm.currentTheme = dummy("x8"); |
|
450 ltm.currentTheme = dummy("x9"); |
|
451 ltm.currentTheme = dummy("x10"); |
|
452 ltm.currentTheme = dummy("x11"); |
|
453 ltm.currentTheme = dummy("x12"); |
|
454 ltm.currentTheme = dummy("x13"); |
|
455 ltm.currentTheme = dummy("x14"); |
|
456 ltm.currentTheme = dummy("x15"); |
|
457 ltm.currentTheme = dummy("x16"); |
|
458 ltm.currentTheme = dummy("x17"); |
|
459 ltm.currentTheme = dummy("x18"); |
|
460 ltm.currentTheme = dummy("x19"); |
|
461 ltm.currentTheme = dummy("x20"); |
|
462 ltm.currentTheme = dummy("x21"); |
|
463 ltm.currentTheme = dummy("x22"); |
|
464 ltm.currentTheme = dummy("x23"); |
|
465 ltm.currentTheme = dummy("x24"); |
|
466 ltm.currentTheme = dummy("x25"); |
|
467 ltm.currentTheme = dummy("x26"); |
|
468 ltm.currentTheme = dummy("x27"); |
|
469 ltm.currentTheme = dummy("x28"); |
|
470 ltm.currentTheme = dummy("x29"); |
|
471 ltm.currentTheme = dummy("x30"); |
|
472 |
|
473 do_check_eq(ltm.usedThemes.length, 30); |
|
474 |
|
475 ltm.currentTheme = dummy("x31"); |
|
476 |
|
477 do_check_eq(ltm.usedThemes.length, 30); |
|
478 do_check_eq(ltm.getUsedTheme("x1"), null); |
|
479 |
|
480 Services.prefs.setIntPref("lightweightThemes.maxUsedThemes", 15); |
|
481 |
|
482 do_check_eq(ltm.usedThemes.length, 15); |
|
483 |
|
484 Services.prefs.setIntPref("lightweightThemes.maxUsedThemes", 32); |
|
485 |
|
486 ltm.currentTheme = dummy("x1"); |
|
487 ltm.currentTheme = dummy("x2"); |
|
488 ltm.currentTheme = dummy("x3"); |
|
489 ltm.currentTheme = dummy("x4"); |
|
490 ltm.currentTheme = dummy("x5"); |
|
491 ltm.currentTheme = dummy("x6"); |
|
492 ltm.currentTheme = dummy("x7"); |
|
493 ltm.currentTheme = dummy("x8"); |
|
494 ltm.currentTheme = dummy("x9"); |
|
495 ltm.currentTheme = dummy("x10"); |
|
496 ltm.currentTheme = dummy("x11"); |
|
497 ltm.currentTheme = dummy("x12"); |
|
498 ltm.currentTheme = dummy("x13"); |
|
499 ltm.currentTheme = dummy("x14"); |
|
500 ltm.currentTheme = dummy("x15"); |
|
501 ltm.currentTheme = dummy("x16"); |
|
502 |
|
503 ltm.currentTheme = dummy("x32"); |
|
504 |
|
505 do_check_eq(ltm.usedThemes.length, 32); |
|
506 |
|
507 ltm.currentTheme = dummy("x33"); |
|
508 |
|
509 do_check_eq(ltm.usedThemes.length, 32); |
|
510 |
|
511 Services.prefs.clearUserPref("lightweightThemes.maxUsedThemes"); |
|
512 |
|
513 do_check_eq(ltm.usedThemes.length, 30); |
|
514 } |