Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: mobile-options.js

Issue 29715759: Issue 6440 - Use long-lived connections to listen to extension events (Closed)
Patch Set: Created March 6, 2018, 6:35 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« messageResponder.js ('K') | « messageResponder.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-present eyeo GmbH 3 * Copyright (C) 2006-present eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 case "title": 404 case "title":
405 // We're also receiving these messages for subscriptions that are 405 // We're also receiving these messages for subscriptions that are
406 // not installed so we shouldn't add those by accident 406 // not installed so we shouldn't add those by accident
407 setSubscription(subscription, "update"); 407 setSubscription(subscription, "update");
408 break; 408 break;
409 } 409 }
410 break; 410 break;
411 } 411 }
412 } 412 }
413 } 413 }
414 ext.onMessage.addListener(onMessage);
415 414
416 browser.runtime.sendMessage({ 415 let port = browser.runtime.connect({name: "ui"});
416 port.onMessage.addListener(onMessage);
417
418 port.postMessage({
417 type: "app.listen", 419 type: "app.listen",
418 filter: ["addSubscription", "showPageOptions"] 420 filter: ["addSubscription", "showPageOptions"]
419 }); 421 });
420 422
421 browser.runtime.sendMessage({ 423 port.postMessage({
422 type: "filters.listen", 424 type: "filters.listen",
423 filter: ["added", "removed"] 425 filter: ["added", "removed"]
424 }); 426 });
425 427
426 browser.runtime.sendMessage({ 428 port.postMessage({
427 type: "subscriptions.listen", 429 type: "subscriptions.listen",
428 filter: ["added", "disabled", "removed", "title"] 430 filter: ["added", "disabled", "removed", "title"]
429 }); 431 });
430 432
431 /* Initialization */ 433 /* Initialization */
432 434
433 populateLists(); 435 populateLists();
434 436
435 getDocLink("acceptable_ads", (link) => 437 getDocLink("acceptable_ads", (link) =>
436 { 438 {
437 get("#acceptableAds-more").href = link; 439 get("#acceptableAds-more").href = link;
438 }); 440 });
439 441
440 get("#dialog-subscribe [name='title']").setAttribute( 442 get("#dialog-subscribe [name='title']").setAttribute(
441 "placeholder", 443 "placeholder",
442 getMessage("mops_subscribe_title") 444 getMessage("mops_subscribe_title")
443 ); 445 );
444 446
445 get("#dialog-subscribe [name='url']").setAttribute( 447 get("#dialog-subscribe [name='url']").setAttribute(
446 "placeholder", 448 "placeholder",
447 getMessage("mops_subscribe_url") 449 getMessage("mops_subscribe_url")
448 ); 450 );
449 } 451 }
OLDNEW
« messageResponder.js ('K') | « messageResponder.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld