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

Delta Between Two Patch Sets: ext/content.js

Issue 5646124035604480: Issue 154 - Added UI for devtools panel on Chrome (Closed)
Left Patch Set: Rebased and adapted for API changes Created March 12, 2015, 4:08 p.m.
Right Patch Set: Added new request types Created Jan. 28, 2016, 7:37 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 | « ext/background.js ('k') | ext/devtools.js » ('j') | 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-2015 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
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details. 12 * GNU General Public License for more details.
13 * 13 *
(...skipping 23 matching lines...) Expand all
37 var queue = messageQueue; 37 var queue = messageQueue;
38 messageQueue = null; 38 messageQueue = null;
39 if (queue) 39 if (queue)
40 for (var i = 0; i < queue.length; i++) 40 for (var i = 0; i < queue.length; i++)
41 backgroundFrame.contentWindow.postMessage(queue[i], "*"); 41 backgroundFrame.contentWindow.postMessage(queue[i], "*");
42 window.removeEventListener("message", loadHandler, false); 42 window.removeEventListener("message", loadHandler, false);
43 } 43 }
44 } 44 }
45 window.addEventListener("message", loadHandler, false); 45 window.addEventListener("message", loadHandler, false);
46 46
47
Thomas Greiner 2015/03/13 11:11:05 That extra line is not really adding any value.
Sebastian Noack 2015/03/13 13:07:38 Done.
48 global.ext.backgroundPage = { 47 global.ext.backgroundPage = {
49 _sendRawMessage: function(message) 48 _sendRawMessage: function(message)
50 { 49 {
51 if (messageQueue) 50 if (messageQueue)
52 messageQueue.push(message); 51 messageQueue.push(message);
53 else 52 else
54 backgroundFrame.contentWindow.postMessage(message, "*"); 53 backgroundFrame.contentWindow.postMessage(message, "*");
55 }, 54 },
56 sendMessage: function(message, responseCallback) 55 sendMessage: function(message, responseCallback)
57 { 56 {
57 var messageId = ++maxMessageId;
58
58 this._sendRawMessage({ 59 this._sendRawMessage({
59 type: "message", 60 type: "message",
60 messageId: ++maxMessageId, 61 messageId: messageId,
61 payload: message 62 payload: message
62 }); 63 });
63 64
64 if (responseCallback) 65 if (responseCallback)
65 { 66 {
66 var callbackWrapper = function(event) 67 var callbackWrapper = function(event)
67 { 68 {
68 if (event.data.type == "response" && event.data.messageId == rawMessag e.messageId) 69 if (event.data.type == "response" && event.data.messageId == messageId )
69 { 70 {
70 window.removeEventListener("message", callbackWrapper, false); 71 window.removeEventListener("message", callbackWrapper, false);
71 responseCallback(event.data.payload); 72 responseCallback(event.data.payload);
72 } 73 }
73 }; 74 };
74 window.addEventListener("message", callbackWrapper, false); 75 window.addEventListener("message", callbackWrapper, false);
75 } 76 }
76 } 77 }
77 }; 78 };
78 })(this); 79 })(this);
LEFTRIGHT

Powered by Google App Engine
This is Rietveld