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

Delta Between Two Patch Sets: safari/content.js

Issue 16067002: Added Safari Support (Closed)
Left Patch Set: Converted new calls to chrome.* to ext.* and fixed issue with background page proxy about added/rem… Created Nov. 9, 2013, 6:38 p.m.
Right Patch Set: Bugfixes Created Nov. 15, 2013, 8:58 a.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 | « safari/common.js ('k') | stats.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 <http://adblockplus.org/>, 2 * This file is part of Adblock Plus <http://adblockplus.org/>,
3 * Copyright (C) 2006-2013 Eyeo GmbH 3 * Copyright (C) 2006-2013 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 obj.apply( 59 obj.apply(
60 this.getObject(event.message.contextId), 60 this.getObject(event.message.contextId),
61 this.deserializeSequence(event.message.args) 61 this.deserializeSequence(event.message.args)
62 ); 62 );
63 }.bind(this)); 63 }.bind(this));
64 } 64 }
65 65
66 return {type: "callback", callbackId: callbackId}; 66 return {type: "callback", callbackId: callbackId};
67 } 67 }
68 68
69 if (typeof obj == "object") 69 if (typeof obj == "object" &&
70 if (obj != null) 70 obj != null &&
71 if (obj.constructor != Date) 71 obj.constructor != Date &&
72 if (obj.constructor != RegExp) 72 obj.constructor != RegExp)
73 { 73 {
74 if (!memo) 74 if (!memo)
75 memo = {specs: [], objects: []}; 75 memo = {specs: [], objects: []};
76 76
77 var idx = memo.objects.indexOf(obj); 77 var idx = memo.objects.indexOf(obj);
78 if (idx != -1) 78 if (idx != -1)
79 return memo.specs[idx]; 79 return memo.specs[idx];
80 80
81 var spec = {}; 81 var spec = {};
82 memo.specs.push(spec); 82 memo.specs.push(spec);
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 var array = []; 136 var array = [];
137 memo.specs.push(spec); 137 memo.specs.push(spec);
138 memo.arrays.push(array); 138 memo.arrays.push(array);
139 139
140 return this.deserializeSequence(spec.items, array, memo); 140 return this.deserializeSequence(spec.items, array, memo);
141 } 141 }
142 }, 142 },
143 getProperty: function(objectId, property) 143 getProperty: function(objectId, property)
144 { 144 {
145 return this.deserializeResult( 145 return this.deserializeResult(
146 this.send({ 146 this.send(
147 {
147 type: "getProperty", 148 type: "getProperty",
148 objectId: objectId, 149 objectId: objectId,
149 property: property 150 property: property
150 }) 151 })
151 ); 152 );
152 }, 153 },
153 createProperty: function(objectId, property, enumerable) 154 createProperty: function(objectId, property, enumerable)
154 { 155 {
155 return { 156 return {
156 get: function() 157 get: function()
157 { 158 {
158 return this.getProperty(objectId, property); 159 return this.getProperty(objectId, property);
159 }.bind(this), 160 }.bind(this),
160 set: function(value) 161 set: function(value)
161 { 162 {
162 this.checkResult( 163 this.checkResult(
163 this.send({ 164 this.send(
165 {
164 type: "setProperty", 166 type: "setProperty",
165 objectId: objectId, 167 objectId: objectId,
166 property: property, 168 property: property,
167 value: this.serialize(value) 169 value: this.serialize(value)
168 }) 170 })
169 ) 171 );
170 }.bind(this), 172 }.bind(this),
171 enumerable: enumerable, 173 enumerable: enumerable,
172 configurable: true 174 configurable: true
173 }; 175 };
174 }, 176 },
175 createFunction: function(objectId) 177 createFunction: function(objectId)
176 { 178 {
177 var proxy = this; 179 var proxy = this;
178 return function() 180 return function()
179 { 181 {
180 return proxy.deserializeResult( 182 return proxy.deserializeResult(
181 proxy.send({ 183 proxy.send(
184 {
182 type: "callFunction", 185 type: "callFunction",
183 functionId: objectId, 186 functionId: objectId,
184 contextId: proxy.objects.indexOf(this), 187 contextId: proxy.objects.indexOf(this),
185 args: Array.prototype.map.call( 188 args: Array.prototype.map.call(
186 arguments, 189 arguments,
187 proxy.serialize.bind(proxy) 190 proxy.serialize.bind(proxy)
188 ) 191 )
189 }) 192 })
190 ); 193 );
191 }; 194 };
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 ext.backgroundPage = { 292 ext.backgroundPage = {
290 _eventTarget: safari.self, 293 _eventTarget: safari.self,
291 _messageDispatcher: safari.self.tab, 294 _messageDispatcher: safari.self.tab,
292 295
293 sendMessage: sendMessage, 296 sendMessage: sendMessage,
294 getWindow: function() { return proxy.getObject(0); } 297 getWindow: function() { return proxy.getObject(0); }
295 }; 298 };
296 299
297 ext.onMessage = new MessageEventTarget(safari.self); 300 ext.onMessage = new MessageEventTarget(safari.self);
298 })(); 301 })();
LEFTRIGHT

Powered by Google App Engine
This is Rietveld