Left: | ||
Right: |
OLD | NEW |
---|---|
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-2014 Eyeo GmbH | 3 * Copyright (C) 2006-2014 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 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
351 page: new Page(rawSender.tab), | 351 page: new Page(rawSender.tab), |
352 frame: { | 352 frame: { |
353 url: rawSender.url, | 353 url: rawSender.url, |
354 get parent() | 354 get parent() |
355 { | 355 { |
356 var frames = framesOfTabs[rawSender.tab.id]; | 356 var frames = framesOfTabs[rawSender.tab.id]; |
357 | 357 |
358 if (!frames) | 358 if (!frames) |
359 return null; | 359 return null; |
360 | 360 |
361 for (var frameId in frames) | 361 if ("frameId" in rawSender) |
362 { | 362 { |
363 if (frames[frameId].url == rawSender.url) | 363 // Chrome 41+ |
364 return frames[frameId].parent; | 364 var frame = frames[rawSender.frameId]; |
365 if (frame) | |
366 return frame.parent; | |
367 } | |
368 else | |
kzar
2015/01/05 15:30:15
Maybe remove the else here? That way if rawSender.
Sebastian Noack
2015/01/05 15:33:36
I think falling back to the top-level frame in thi
| |
369 { | |
370 // Chrome 28-40 | |
371 for (var frameId in frames) | |
372 { | |
373 if (frames[frameId].url == rawSender.url) | |
374 return frames[frameId].parent; | |
375 } | |
365 } | 376 } |
366 | 377 |
367 return frames[0]; | 378 return frames[0]; |
368 } | 379 } |
369 } | 380 } |
370 }; | 381 }; |
371 | 382 |
372 return ext.onMessage._dispatch(message, sender, sendResponse); | 383 return ext.onMessage._dispatch(message, sender, sendResponse); |
373 }); | 384 }); |
374 | 385 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
406 callback(new Page(tab)); | 417 callback(new Page(tab)); |
407 } | 418 } |
408 else | 419 else |
409 { | 420 { |
410 ext.pages.open(optionsUrl, callback); | 421 ext.pages.open(optionsUrl, callback); |
411 } | 422 } |
412 }); | 423 }); |
413 }); | 424 }); |
414 }; | 425 }; |
415 })(); | 426 })(); |
OLD | NEW |