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

Delta Between Two Patch Sets: chrome/ext/background.js

Issue 29342909: Issue 4020 - In Edge, rawSender.url is not always defined (Closed)
Left Patch Set: Created May 23, 2016, 5:45 a.m.
Right Patch Set: Add space before the column Created May 30, 2016, 12:35 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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-2016 Eyeo GmbH 3 * Copyright (C) 2006-2016 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 483 matching lines...) Expand 10 before | Expand all | Expand 10 after
494 chrome.runtime.onMessage.addListener(function(message, rawSender, sendResponse ) 494 chrome.runtime.onMessage.addListener(function(message, rawSender, sendResponse )
495 { 495 {
496 var sender = {}; 496 var sender = {};
497 497
498 // Add "page" and "frame" if the message was sent by a content script. 498 // Add "page" and "frame" if the message was sent by a content script.
499 // If sent by popup or the background page itself, there is no "tab". 499 // If sent by popup or the background page itself, there is no "tab".
500 if ("tab" in rawSender) 500 if ("tab" in rawSender)
501 { 501 {
502 sender.page = new Page(rawSender.tab); 502 sender.page = new Page(rawSender.tab);
503 sender.frame = { 503 sender.frame = {
504 url: rawSender.url ? new URL(rawSender.url): '', 504 // In Edge requests from internal extension pages
Sebastian Noack 2016/05/27 11:58:47 I think it would be more appropriate to set URL to
505 // (protocol ms-browser-extension://) do no have a sender URL.
506 url: rawSender.url ? new URL(rawSender.url) : null,
505 get parent() 507 get parent()
506 { 508 {
507 var frames = framesOfTabs[rawSender.tab.id]; 509 var frames = framesOfTabs[rawSender.tab.id];
508 510
509 if (!frames) 511 if (!frames)
510 return null; 512 return null;
511 513
512 if ("frameId" in rawSender) 514 if ("frameId" in rawSender)
513 { 515 {
514 // Chrome 41+ 516 // Chrome 41+
(...skipping 20 matching lines...) Expand all
535 }); 537 });
536 538
537 539
538 /* Storage */ 540 /* Storage */
539 541
540 ext.storage = { 542 ext.storage = {
541 get: function(keys, callback) 543 get: function(keys, callback)
542 { 544 {
543 chrome.storage.local.get(keys, callback); 545 chrome.storage.local.get(keys, callback);
544 }, 546 },
545 set: function(key, value, callback) 547 set: function(items, callback)
546 { 548 {
547 let items = {};
548 items[key] = value;
549 chrome.storage.local.set(items, callback); 549 chrome.storage.local.set(items, callback);
550 }, 550 },
551 remove: function(key, callback) 551 remove: function(key, callback)
552 { 552 {
553 chrome.storage.local.remove(key, callback); 553 chrome.storage.local.remove(key, callback);
554 }, 554 },
555 onChanged: chrome.storage.onChanged 555 onChanged: chrome.storage.onChanged
556 }; 556 };
557 557
558 /* Options */ 558 /* Options */
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
595 create: function(createData, callback) 595 create: function(createData, callback)
596 { 596 {
597 if ("create" in chrome.windows){ 597 if ("create" in chrome.windows){
598 chrome.windows.create(createData, function(createdWindow) 598 chrome.windows.create(createData, function(createdWindow)
599 { 599 {
600 afterTabLoaded(callback)(createdWindow.tabs[0]); 600 afterTabLoaded(callback)(createdWindow.tabs[0]);
601 }); 601 });
602 } 602 }
603 else 603 else
604 { 604 {
605 ext.pages.open(createData.url, callback); 605 ext.pages.open(createData.url, callback);
606 } 606 }
607 } 607 }
608 }; 608 };
609 })(); 609 })();
LEFTRIGHT
« no previous file | no next file » | Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Toggle Comments ('s')

Powered by Google App Engine
This is Rietveld