~ubuntu-branches/ubuntu/maverick/adblock-plus/maverick-updates

« back to all changes in this revision

Viewing changes to chrome/content/ui/subscriptionSelection.js

  • Committer: Bazaar Package Importer
  • Author(s): Benjamin Drung
  • Date: 2010-05-04 14:45:07 UTC
  • mfrom: (1.1.9 upstream)
  • Revision ID: james.westby@ubuntu.com-20100504144507-h47ieg2r2w46nn32
Tags: 1.2-1
* New upstream release.
* Bump Standards-Version to 3.8.4 (no changes required).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* ***** BEGIN LICENSE BLOCK *****
 
2
 * Version: MPL 1.1
 
3
 *
 
4
 * The contents of this file are subject to the Mozilla Public License Version
 
5
 * 1.1 (the "License"); you may not use this file except in compliance with
 
6
 * the License. You may obtain a copy of the License at
 
7
 * http://www.mozilla.org/MPL/
 
8
 *
 
9
 * Software distributed under the License is distributed on an "AS IS" basis,
 
10
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
 
11
 * for the specific language governing rights and limitations under the
 
12
 * License.
 
13
 *
 
14
 * The Original Code is Adblock Plus.
 
15
 *
 
16
 * The Initial Developer of the Original Code is
 
17
 * Wladimir Palant.
 
18
 * Portions created by the Initial Developer are Copyright (C) 2006-2010
 
19
 * the Initial Developer. All Rights Reserved.
 
20
 *
 
21
 * Contributor(s):
 
22
 *
 
23
 * ***** END LICENSE BLOCK ***** */
 
24
 
 
25
let newInstall = true;
 
26
let editMode = true;
 
27
let autoAdd = false;
 
28
let source = null;
 
29
let result = null;
 
30
let initialized = false;
 
31
 
 
32
/**
 
33
 * Suppresses window resizing while the window is loading or if the window is loaded in a browser tab.
 
34
 * @type Boolean
 
35
 */
 
36
let suppressResize = true;
 
37
 
 
38
let closing = false;
 
39
let subscriptionListLoading = false;
 
40
let appLocale = "en-US";
 
41
 
 
42
let adblockID = "{34274bf4-1d97-a289-e984-17e546307e4f}";
 
43
let filtersetG = "filtersetg@updater";
 
44
 
 
45
function init()
 
46
{
 
47
  if (window.arguments  && window.arguments.length)
 
48
  {
 
49
    // In K-Meleon we might get the arguments wrapped
 
50
    for (var i = 0; i < window.arguments.length; i++)
 
51
      if (window.arguments[i] && "wrappedJSObject" in window.arguments[i])
 
52
        window.arguments[i] = window.arguments[i].wrappedJSObject;
 
53
 
 
54
    newInstall = false;
 
55
    [source, result] = window.arguments;
 
56
    if (window.arguments.length > 2 && window.arguments[2])
 
57
      window.hasSubscription = window.arguments[2];
 
58
  }
 
59
 
 
60
  if (!result)
 
61
  {
 
62
    result = {};
 
63
    autoAdd = true;
 
64
  }
 
65
  if (!source)
 
66
  {
 
67
    editMode = false;
 
68
    source = {title: "", url: "", disabled: false, external: false, autoDownload: true, mainSubscriptionTitle: null, mainSubscriptionURL: null};
 
69
  }
 
70
  else
 
71
  {
 
72
    if (typeof source.mainSubscriptionURL == "undefined")
 
73
      source.mainSubscriptionURL = source.mainSubscriptionTitle = null;
 
74
  }
 
75
 
 
76
  E("description-newInstall").hidden = !newInstall;
 
77
  if (newInstall)
 
78
    document.documentElement.setAttribute("newInstall", "true");
 
79
 
 
80
  E("subscriptionsBox").hidden = E("all-subscriptions-container").hidden
 
81
    = E("subscriptionInfo").hidden = editMode;
 
82
 
 
83
  E("fromWebText").hidden = !editMode || source instanceof abp.Subscription;
 
84
  E("editText").hidden = !(source instanceof abp.Subscription) || source instanceof abp.ExternalSubscription;
 
85
  E("externalText").hidden = !(source instanceof abp.ExternalSubscription);
 
86
  E("differentSubscription").hidden = !editMode;
 
87
  document.documentElement.getButton("extra2").hidden = editMode;
 
88
 
 
89
  setCustomSubscription(source.title, source.url,
 
90
                        source.mainSubscriptionTitle, source.mainSubscriptionURL);
 
91
 
 
92
  if (source instanceof abp.Subscription)
 
93
  {
 
94
    document.title = document.documentElement.getAttribute("edittitle");
 
95
    document.documentElement.getButton("accept").setAttribute("label", document.documentElement.getAttribute("buttonlabelacceptedit"))
 
96
  }
 
97
 
 
98
  if (source instanceof abp.ExternalSubscription)
 
99
  {
 
100
    E("location").setAttribute("disabled", "true");
 
101
    E("autoDownload").setAttribute("disabled", "true");
 
102
    E("autoDownload").checked = true;
 
103
  }
 
104
  else
 
105
    E("autoDownload").checked = source.autoDownload;
 
106
 
 
107
  // Find filter subscription suggestion based on user's browser locale
 
108
  try
 
109
  {
 
110
    appLocale = Cc["@mozilla.org/chrome/chrome-registry;1"].getService(Ci.nsIXULChromeRegistry).getSelectedLocale("adblockplus");
 
111
  }
 
112
  catch (e)
 
113
  {
 
114
    Cu.reportError(e);
 
115
  }
 
116
 
 
117
  initialized = true;
 
118
 
 
119
  if (!editMode)
 
120
  {
 
121
    let list = E("subscriptions");
 
122
    let items = list.menupopup.childNodes;
 
123
    let selectedItem = null;
 
124
    let selectedPrefix = null;
 
125
    let matchCount = 0;
 
126
    for (let i = 0; i < items.length; i++)
 
127
    {
 
128
      let item = items[i];
 
129
      let prefixes = item.getAttribute("_prefixes");
 
130
      if (!prefixes)
 
131
        continue;
 
132
  
 
133
      if (!selectedItem)
 
134
        selectedItem = item;
 
135
  
 
136
      let prefix = checkPrefixMatch(prefixes, appLocale);
 
137
      if (prefix)
 
138
      {
 
139
        item.setAttribute("class", "localeMatch");
 
140
        if (!selectedPrefix || selectedPrefix.length < prefix.length)
 
141
        {
 
142
          selectedItem = item;
 
143
          selectedPrefix = prefix;
 
144
          matchCount = 1;
 
145
        }
 
146
        else if (selectedPrefix && selectedPrefix.length == prefix.length)
 
147
        {
 
148
          matchCount++;
 
149
 
 
150
          // If multiple items have a matching prefix of the same length:
 
151
          // Select one of the items randomly, probability should be the same
 
152
          // for all items. So we replace the previous match here with
 
153
          // probability 1/N (N being the number of matches).
 
154
          if (Math.random() * matchCount < 1)
 
155
          {
 
156
            selectedItem = item;
 
157
            selectedPrefix = prefix;
 
158
          }
 
159
        }
 
160
      }
 
161
    }
 
162
    list.selectedItem = selectedItem;
 
163
 
 
164
    // Warn if Adblock or Filterset.G Updater are installed
 
165
    if (isExtensionActive(adblockID))
 
166
      E("adblock-warning").hidden = false;
 
167
  
 
168
    if (isExtensionActive(filtersetG))
 
169
      E("filtersetg-warning").hidden = false;
 
170
  
 
171
    if ("Filterset.G" in filterStorage.knownSubscriptions &&
 
172
        !filterStorage.knownSubscriptions["Filterset.G"].disabled)
 
173
    {
 
174
      E("filtersetg-warning").hidden = false;
 
175
    }
 
176
  }
 
177
 
 
178
  // Only resize if we are a chrome window (not loaded into a browser tab)
 
179
  if (window.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIWebNavigation).QueryInterface(Ci.nsIDocShellTreeItem).itemType == Ci.nsIDocShellTreeItem.typeChrome)
 
180
    suppressResize = false;
 
181
}
 
182
 
 
183
function checkPrefixMatch(prefixes, appLocale)
 
184
{
 
185
  if (!prefixes)
 
186
    return null;
 
187
 
 
188
  for each (let prefix in prefixes.split(/,/))
 
189
    if (new RegExp("^" + prefix + "\\b").test(appLocale))
 
190
      return prefix;
 
191
 
 
192
  return null;
 
193
}
 
194
 
 
195
function collapseElements()
 
196
{
 
197
  if (!suppressResize && window.windowState == Ci.nsIDOMChromeWindow.STATE_NORMAL)
 
198
  {
 
199
    let diff = 0;
 
200
    for (let i = 0; i < arguments.length; i++)
 
201
      diff -= arguments[i].boxObject.height;
 
202
    window.resizeBy(0, diff);
 
203
    window.moveBy(0, -diff/2);
 
204
  }
 
205
  for (let i = 0; i < arguments.length; i++)
 
206
    arguments[i].hidden = true;
 
207
}
 
208
 
 
209
function showElements()
 
210
{
 
211
  for (let i = 0; i < arguments.length; i++)
 
212
    arguments[i].hidden = false;
 
213
 
 
214
  let scrollBox = E("content-scroll").boxObject;
 
215
  if (!suppressResize && window.windowState == Ci.nsIDOMChromeWindow.STATE_NORMAL && scrollBox instanceof Ci.nsIScrollBoxObject)
 
216
  {
 
217
    // Force reflow
 
218
    for (let i = 0; i < arguments.length; i++)
 
219
      arguments[i].boxObject.height;
 
220
 
 
221
    let scrollHeight = {};
 
222
    scrollBox.getScrolledSize({}, scrollHeight);
 
223
    if (scrollHeight.value > scrollBox.height)
 
224
    {
 
225
      let diff = scrollHeight.value - scrollBox.height;
 
226
      window.resizeBy(0, diff);
 
227
      window.moveBy(0, -diff/2);
 
228
    }
 
229
  }
 
230
}
 
231
 
 
232
function onSelectionChange()
 
233
{
 
234
  if (!initialized)
 
235
    return;
 
236
 
 
237
  let selectedSubscription = E("subscriptions").value;
 
238
 
 
239
  // Show/hide extra UI widgets for custom subscriptions, resize window appropriately
 
240
  let container = E("all-subscriptions-container");
 
241
  let inputFields = E("differentSubscription");
 
242
  if (container.hidden && !selectedSubscription)
 
243
    showElements(container, inputFields);
 
244
  else if (!container.hidden && selectedSubscription)
 
245
    collapseElements(container, inputFields);
 
246
 
 
247
  // Make sure to hide "Add different subscription button" if we are already in that mode
 
248
  document.documentElement.getButton("extra2").hidden = !selectedSubscription;
 
249
 
 
250
  if (!selectedSubscription)
 
251
  {
 
252
    loadSubscriptionList();
 
253
    E("title").focus();
 
254
  }
 
255
 
 
256
  updateSubscriptionInfo();
 
257
}
 
258
 
 
259
function updateSubscriptionInfo()
 
260
{
 
261
  let selectedSubscription = E("subscriptions").selectedItem;
 
262
  if (!selectedSubscription.value)
 
263
    selectedSubscription = E("all-subscriptions").selectedItem;
 
264
 
 
265
  E("subscriptionInfo").setAttribute("invisible", !selectedSubscription);
 
266
  if (selectedSubscription)
 
267
  {
 
268
    let url = selectedSubscription.getAttribute("_url");
 
269
    let homePage = selectedSubscription.getAttribute("_homepage")
 
270
 
 
271
    let viewLink = E("view-list");
 
272
    viewLink.setAttribute("_url", url);
 
273
    viewLink.setAttribute("tooltiptext", url);
 
274
 
 
275
    let homePageLink = E("visit-homepage");
 
276
    homePageLink.hidden = !homePage;
 
277
    if (homePage)
 
278
    {
 
279
      homePageLink.setAttribute("_url", homePage);
 
280
      homePageLink.setAttribute("tooltiptext", homePage);
 
281
    }
 
282
  }
 
283
}
 
284
 
 
285
function reloadSubscriptionList()
 
286
{
 
287
  subscriptionListLoading = false;
 
288
  loadSubscriptionList();
 
289
}
 
290
 
 
291
function loadSubscriptionList()
 
292
{
 
293
  if (subscriptionListLoading)
 
294
    return;
 
295
 
 
296
  E("all-subscriptions-container").selectedIndex = 0;
 
297
 
 
298
  let request = new XMLHttpRequest();
 
299
  let errorHandler = function()
 
300
  {
 
301
    E("all-subscriptions-container").selectedIndex = 2;
 
302
  };
 
303
  let successHandler = function()
 
304
  {
 
305
    if (!request.responseXML || request.responseXML.documentElement.localName != "subscriptions")
 
306
    {
 
307
      errorHandler();
 
308
      return;
 
309
    }
 
310
 
 
311
    try
 
312
    {
 
313
      processSubscriptionList(request.responseXML);
 
314
    }
 
315
    catch (e)
 
316
    {
 
317
      Cu.reportError(e);
 
318
      errorHandler();
 
319
    }
 
320
  };
 
321
 
 
322
  request.open("GET", abp.prefs.subscriptions_listurl);
 
323
  request.onerror = errorHandler;
 
324
  request.onload = successHandler;
 
325
  request.send(null);
 
326
 
 
327
  subscriptionListLoading = true;
 
328
}
 
329
 
 
330
function processSubscriptionList(doc)
 
331
{
 
332
  let list = E("all-subscriptions");
 
333
  while (list.firstChild)
 
334
    list.removeChild(list.firstChild);
 
335
 
 
336
  addSubscriptions(list, doc.documentElement, 0, null, null);
 
337
  E("all-subscriptions-container").selectedIndex = 1;
 
338
}
 
339
 
 
340
function addSubscriptions(list, parent, level, parentTitle, parentURL)
 
341
{
 
342
  for (let i = 0; i < parent.childNodes.length; i++)
 
343
  {
 
344
    let node = parent.childNodes[i];
 
345
    if (node.nodeType != Node.ELEMENT_NODE || node.localName != "subscription")
 
346
      continue;
 
347
 
 
348
    if (node.getAttribute("type") != "ads" || node.getAttribute("deprecated") == "true")
 
349
      continue;
 
350
 
 
351
    let variants = node.getElementsByTagName("variants");
 
352
    if (!variants.length || !variants[0].childNodes.length)
 
353
      continue;
 
354
    variants = variants[0].childNodes;
 
355
 
 
356
    let isFirst = true;
 
357
    let mainTitle = null;
 
358
    let mainURL = null;
 
359
    for (let j = 0; j < variants.length; j++)
 
360
    {
 
361
      let variant = variants[j];
 
362
      if (variant.nodeType != Node.ELEMENT_NODE || variant.localName != "variant")
 
363
        continue;
 
364
 
 
365
      let item = document.createElement("richlistitem");
 
366
      item.setAttribute("_title", variant.getAttribute("title"));
 
367
      item.setAttribute("_url", variant.getAttribute("url"));
 
368
      if (parentTitle && parentURL && variant.getAttribute("complete") != "true")
 
369
      {
 
370
        item.setAttribute("_supplementForTitle", parentTitle);
 
371
        item.setAttribute("_supplementForURL", parentURL);
 
372
      }
 
373
      item.setAttribute("tooltiptext", variant.getAttribute("url"));
 
374
      item.setAttribute("_homepage", node.getAttribute("homepage"));
 
375
 
 
376
      let title = document.createElement("description");
 
377
      if (isFirst)
 
378
      {
 
379
        if (checkPrefixMatch(node.getAttribute("prefixes"), appLocale))
 
380
          title.setAttribute("class", "title localeMatch");
 
381
        else
 
382
          title.setAttribute("class", "title");
 
383
        title.textContent = node.getAttribute("title");
 
384
        mainTitle = variant.getAttribute("title");
 
385
        mainURL = variant.getAttribute("url");
 
386
        isFirst = false;
 
387
      }
 
388
      title.setAttribute("flex", "1");
 
389
      title.style.marginLeft = (20 * level) + "px";
 
390
      item.appendChild(title);
 
391
  
 
392
      let variantTitle = document.createElement("description");
 
393
      variantTitle.setAttribute("class", "variant");
 
394
      variantTitle.textContent = variant.getAttribute("title");
 
395
      variantTitle.setAttribute("crop", "end");
 
396
      item.appendChild(variantTitle);
 
397
 
 
398
      list.appendChild(item);
 
399
    }
 
400
 
 
401
    let supplements = node.getElementsByTagName("supplements");
 
402
    if (supplements.length)
 
403
      addSubscriptions(list, supplements[0], level + 1, mainTitle, mainURL);
 
404
  }
 
405
}
 
406
 
 
407
function onAllSelectionChange()
 
408
{
 
409
  let selectedItem = E("all-subscriptions").selectedItem;
 
410
  if (!selectedItem)
 
411
    return;
 
412
 
 
413
  setCustomSubscription(selectedItem.getAttribute("_title"), selectedItem.getAttribute("_url"),
 
414
                        selectedItem.getAttribute("_supplementForTitle"), selectedItem.getAttribute("_supplementForURL"));
 
415
 
 
416
  updateSubscriptionInfo();
 
417
}
 
418
 
 
419
function setCustomSubscription(title, url, mainSubscriptionTitle, mainSubscriptionURL)
 
420
{
 
421
  E("title").value = title;
 
422
  E("location").value = url;
 
423
 
 
424
  let messageElement = E("supplementMessage");
 
425
  let addMainCheckbox = E("addMainSubscription");
 
426
  if (mainSubscriptionURL && !hasSubscription(mainSubscriptionURL))
 
427
  {
 
428
    if (messageElement.hidden)
 
429
      showElements(messageElement, addMainCheckbox);
 
430
 
 
431
    let beforeLink, afterLink;
 
432
    if (/(.*)\?1\?(.*)/.test(messageElement.getAttribute("_textTemplate")))
 
433
      [beforeLink, afterLink] = [RegExp.$1, RegExp.$2, RegExp.$3];
 
434
    else
 
435
      [beforeLink, afterLink] = [messageElement.getAttribute("_textTemplate"), ""];
 
436
 
 
437
    while (messageElement.firstChild)
 
438
      messageElement.removeChild(messageElement.firstChild);
 
439
    messageElement.appendChild(document.createTextNode(beforeLink));
 
440
    let link = document.createElement("label");
 
441
    link.className = "text-link";
 
442
    link.setAttribute("tooltiptext", mainSubscriptionURL);
 
443
    link.addEventListener("click", function() abp.loadInBrowser(mainSubscriptionURL), false);
 
444
    link.textContent = mainSubscriptionTitle;
 
445
    messageElement.appendChild(link);
 
446
    messageElement.appendChild(document.createTextNode(afterLink));
 
447
    
 
448
    addMainCheckbox.value = mainSubscriptionURL;
 
449
    addMainCheckbox.setAttribute("_mainSubscriptionTitle", mainSubscriptionTitle)
 
450
    addMainCheckbox.label = addMainCheckbox.getAttribute("_labelTemplate").replace(/\?1\?/g, mainSubscriptionTitle);
 
451
    addMainCheckbox.accessKey = addMainCheckbox.accessKey;
 
452
  }
 
453
  else if (!messageElement.hidden)
 
454
    collapseElements(messageElement, addMainCheckbox);
 
455
}
 
456
 
 
457
function selectCustomSubscription()
 
458
{
 
459
  let list = E("subscriptions")
 
460
  list.selectedItem = list.menupopup.lastChild;
 
461
}
 
462
 
 
463
function validateURL(url)
 
464
{
 
465
  url = url.replace(/^\s+/, "").replace(/\s+$/, "");
 
466
 
 
467
  // Is this a file path?
 
468
  try {
 
469
    let file = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsILocalFile);
 
470
    file.initWithPath(url);
 
471
    return Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService).newFileURI(file).spec;
 
472
  } catch (e) {}
 
473
 
 
474
  // Is this a valid URL?
 
475
  let uri = abp.makeURL(url);
 
476
  if (uri)
 
477
    return uri.spec;
 
478
 
 
479
  return null;
 
480
}
 
481
 
 
482
function addSubscription()
 
483
{
 
484
  let list = E("subscriptions");
 
485
  let url;
 
486
  let title;
 
487
  let autoDownload;
 
488
  if (list.value)
 
489
  {
 
490
    url = list.value;
 
491
    title = list.label;
 
492
    autoDownload = true;
 
493
  }
 
494
  else
 
495
  {
 
496
    url = E("location").value;
 
497
    if (!(source instanceof abp.ExternalSubscription))
 
498
      url = validateURL(url);
 
499
    if (!url)
 
500
    {
 
501
      abp.alert(window, abp.getString("subscription_invalid_location"));
 
502
      E("location").focus();
 
503
      return false;
 
504
    }
 
505
 
 
506
    title = E("title").value.replace(/^\s+/, "").replace(/\s+$/, "");
 
507
    if (!title)
 
508
      title = url;
 
509
 
 
510
    autoDownload = E("autoDownload").checked;
 
511
  }
 
512
 
 
513
  result.url = url;
 
514
  result.title = title;
 
515
  result.autoDownload = autoDownload;
 
516
  result.disabled = source.disabled;
 
517
 
 
518
  let addMainCheckbox = E("addMainSubscription")
 
519
  if (!addMainCheckbox.hidden && addMainCheckbox.checked)
 
520
  {
 
521
    result.mainSubscriptionTitle = addMainCheckbox.getAttribute("_mainSubscriptionTitle");
 
522
    result.mainSubscriptionURL = addMainCheckbox.value;
 
523
  }
 
524
 
 
525
  if (autoAdd)
 
526
  {
 
527
    abp.addSubscription(result.url, result.title, result.autoDownload, result.disabled);
 
528
    if ("mainSubscriptionURL" in result)
 
529
      abp.addSubscription(result.mainSubscriptionURL, result.mainSubscriptionTitle, result.autoDownload, result.disabled);
 
530
  }
 
531
 
 
532
  closing = true;
 
533
  return true;
 
534
}
 
535
 
 
536
function hasSubscription(url)
 
537
{
 
538
  return abp.filterStorage.subscriptions.some(function(subscription) subscription instanceof abp.DownloadableSubscription && subscription.url == url);
 
539
}
 
540
 
 
541
function checkUnload()
 
542
{
 
543
  if (newInstall && !closing)
 
544
    return abp.getString("subscription_notAdded_warning");
 
545
 
 
546
  return undefined;
 
547
}
 
548
 
 
549
function onDialogCancel()
 
550
{
 
551
  let message = checkUnload();
 
552
  if (!message)
 
553
    return true;
 
554
 
 
555
  message += " " + abp.getString("subscription_notAdded_warning_addendum");
 
556
  closing = abp.confirm(window, message);
 
557
  return closing;
 
558
}
 
559
 
 
560
function uninstallExtension(id)
 
561
{
 
562
  let extensionManager = Cc["@mozilla.org/extensions/manager;1"].getService(Ci.nsIExtensionManager);
 
563
  if (extensionManager.getItemForID(id))
 
564
  {
 
565
    let location = extensionManager.getInstallLocation(id);
 
566
    if (location && !location.canAccess)
 
567
    {
 
568
      // Cannot uninstall, need to disable
 
569
      extensionManager.disableItem(id);
 
570
    }
 
571
    else
 
572
    {
 
573
      extensionManager.uninstallItem(id);
 
574
    }
 
575
  }
 
576
}
 
577
 
 
578
function isExtensionActive(id)
 
579
{
 
580
  if (!("@mozilla.org/extensions/manager;1" in Cc))
 
581
    return false;
 
582
 
 
583
  let extensionManager = Cc["@mozilla.org/extensions/manager;1"].getService(Ci.nsIExtensionManager);
 
584
 
 
585
  // First check whether the extension is installed
 
586
  if (!extensionManager.getItemForID(id))
 
587
    return false;
 
588
 
 
589
  let ds = extensionManager.datasource;
 
590
  let rdfService = Cc["@mozilla.org/rdf/rdf-service;1"].getService(Ci.nsIRDFService);
 
591
  let source = rdfService.GetResource("urn:mozilla:item:" + id);
 
592
 
 
593
  // Check whether extension is disabled
 
594
  let link = rdfService.GetResource("http://www.mozilla.org/2004/em-rdf#isDisabled");
 
595
  let target = ds.GetTarget(source, link, true);
 
596
  if (target instanceof Ci.nsIRDFLiteral && target.Value == "true")
 
597
    return false;
 
598
 
 
599
  // Check whether an operation is pending for the extension
 
600
  link = rdfService.GetResource("http://www.mozilla.org/2004/em-rdf#opType");
 
601
  if (ds.GetTarget(source, link, false))
 
602
    return false;
 
603
 
 
604
  return true;
 
605
}
 
606
 
 
607
function uninstallAdblock()
 
608
{
 
609
  uninstallExtension(adblockID);
 
610
  E("adblock-warning").hidden = true;
 
611
}
 
612
 
 
613
function uninstallFiltersetG()
 
614
{
 
615
  // Disable further updates
 
616
  abp.denyFiltersetG = true;
 
617
 
 
618
  // Uninstall extension
 
619
  uninstallExtension(filtersetG);
 
620
 
 
621
  // Remove filter subscription
 
622
  if ("Filterset.G" in filterStorage.knownSubscriptions)
 
623
    filterStorage.removeSubscription(filterStorage.knownSubscriptions["Filterset.G"]);
 
624
 
 
625
  E("filtersetg-warning").hidden = true;
 
626
}