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

Delta Between Two Patch Sets: lib/child/contentPolicy.js

Issue 29329742: Issue 3251 - Simplify messaging from child scripts to parent (Closed)
Left Patch Set: Rebased, no return value stringification Created Nov. 9, 2015, 11:01 a.m.
Right Patch Set: Rebased Created Nov. 12, 2015, 12:29 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 | « lib/child/bootstrap.js ('k') | lib/child/elemHide.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-2015 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 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 Utils.runAsync(postProcessNodes); 309 Utils.runAsync(postProcessNodes);
310 } 310 }
311 } 311 }
312 312
313 /** 313 /**
314 * Processes nodes scheduled for post-processing (typically hides them). 314 * Processes nodes scheduled for post-processing (typically hides them).
315 */ 315 */
316 function postProcessNodes() 316 function postProcessNodes()
317 { 317 {
318 if (!collapsedClass) 318 if (!collapsedClass)
319 { 319 collapsedClass = sendSyncMessage("AdblockPlus:GetCollapsedClass");
320 let response = sendSyncMessage("AdblockPlus:GetCollapsedClass");
321 if (response.length)
322 collapsedClass = response[0];
323
324 if (!collapsedClass)
325 {
326 Utils.runAsync(postProcessNodes);
327 return;
328 }
329 }
330 320
331 let nodes = scheduledNodes; 321 let nodes = scheduledNodes;
332 scheduledNodes = null; 322 scheduledNodes = null;
323
324 if (!collapsedClass)
325 return;
333 326
334 for (let node of nodes) 327 for (let node of nodes)
335 { 328 {
336 // adjust frameset's cols/rows for frames 329 // adjust frameset's cols/rows for frames
337 let parentNode = node.parentNode; 330 let parentNode = node.parentNode;
338 if (parentNode && parentNode instanceof Ci.nsIDOMHTMLFrameSetElement) 331 if (parentNode && parentNode instanceof Ci.nsIDOMHTMLFrameSetElement)
339 { 332 {
340 let hasCols = (parentNode.cols && parentNode.cols.indexOf(",") > 0); 333 let hasCols = (parentNode.cols && parentNode.cols.indexOf(",") > 0);
341 let hasRows = (parentNode.rows && parentNode.rows.indexOf(",") > 0); 334 let hasRows = (parentNode.rows && parentNode.rows.indexOf(",") > 0);
342 if ((hasCols || hasRows) && !(hasCols && hasRows)) 335 if ((hasCols || hasRows) && !(hasCols && hasRows))
343 { 336 {
344 let index = -1; 337 let index = -1;
345 for (let frame = node; frame; frame = frame.previousSibling) 338 for (let frame = node; frame; frame = frame.previousSibling)
346 if (frame instanceof Ci.nsIDOMHTMLFrameElement || frame instanceof Ci. nsIDOMHTMLFrameSetElement) 339 if (frame instanceof Ci.nsIDOMHTMLFrameElement || frame instanceof Ci. nsIDOMHTMLFrameSetElement)
347 index++; 340 index++;
348 341
349 let property = (hasCols ? "cols" : "rows"); 342 let property = (hasCols ? "cols" : "rows");
350 let weights = parentNode[property].split(","); 343 let weights = parentNode[property].split(",");
351 weights[index] = "0"; 344 weights[index] = "0";
352 parentNode[property] = weights.join(","); 345 parentNode[property] = weights.join(",");
353 } 346 }
354 } 347 }
355 else 348 else
356 node.classList.add(collapsedClass); 349 node.classList.add(collapsedClass);
357 } 350 }
358 } 351 }
LEFTRIGHT

Powered by Google App Engine
This is Rietveld