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

Side by Side Diff: chrome/ext/background.js

Issue 5673543668858880: Issue 451 - Fall back to the first known frame instead of hard-coding the top level frame (Closed)
Patch Set: Created May 9, 2014, 5:49 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
« no previous file with comments | « no previous file | 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 <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 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 { 306 {
307 // we are looking for the frame that contains the element that 307 // we are looking for the frame that contains the element that
308 // is about to load, however if a frame is loading the surrounding 308 // is about to load, however if a frame is loading the surrounding
309 // frame is indicated by parentFrameId instead of frameId 309 // frame is indicated by parentFrameId instead of frameId
310 var frameId; 310 var frameId;
311 if (details.type == "sub_frame") 311 if (details.type == "sub_frame")
312 frameId = details.parentFrameId; 312 frameId = details.parentFrameId;
313 else 313 else
314 frameId = details.frameId; 314 frameId = details.frameId;
315 315
316 frame = frames[frameId] || frames[0]; 316 frame = frames[frameId] || frames[Object.keys(frames)[0]];
Wladimir Palant 2014/05/13 14:29:49 Object.keys() doesn't guarantee a particular order
317 317
318 if (frame && !ext.webRequest.onBeforeRequest._dispatch(details.url, deta ils.type, new Page({id: details.tabId}), frame)) 318 if (frame && !ext.webRequest.onBeforeRequest._dispatch(details.url, deta ils.type, new Page({id: details.tabId}), frame))
319 return {cancel: true}; 319 return {cancel: true};
320 } 320 }
321 321
322 if (isMainFrame || details.type == "sub_frame") 322 if (isMainFrame || details.type == "sub_frame")
323 frames[details.frameId] = {url: details.url, parent: frame}; 323 frames[details.frameId] = {url: details.url, parent: frame};
324 } 324 }
325 catch (e) 325 catch (e)
326 { 326 {
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 }; 359 };
360 360
361 return ext.onMessage._dispatch(message, sender, sendResponse); 361 return ext.onMessage._dispatch(message, sender, sendResponse);
362 }); 362 });
363 363
364 364
365 /* Storage */ 365 /* Storage */
366 366
367 ext.storage = localStorage; 367 ext.storage = localStorage;
368 })(); 368 })();
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld