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: Adjusted a caller that was forgotten Created Nov. 9, 2015, 1:36 p.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 {
320 collapsedClass = sendSyncMessage("AdblockPlus:GetCollapsedClass"); 319 collapsedClass = sendSyncMessage("AdblockPlus:GetCollapsedClass");
321 if (!collapsedClass)
322 {
323 Utils.runAsync(postProcessNodes);
324 return;
325 }
326 }
327 320
328 let nodes = scheduledNodes; 321 let nodes = scheduledNodes;
329 scheduledNodes = null; 322 scheduledNodes = null;
323
324 if (!collapsedClass)
325 return;
330 326
331 for (let node of nodes) 327 for (let node of nodes)
332 { 328 {
333 // adjust frameset's cols/rows for frames 329 // adjust frameset's cols/rows for frames
334 let parentNode = node.parentNode; 330 let parentNode = node.parentNode;
335 if (parentNode && parentNode instanceof Ci.nsIDOMHTMLFrameSetElement) 331 if (parentNode && parentNode instanceof Ci.nsIDOMHTMLFrameSetElement)
336 { 332 {
337 let hasCols = (parentNode.cols && parentNode.cols.indexOf(",") > 0); 333 let hasCols = (parentNode.cols && parentNode.cols.indexOf(",") > 0);
338 let hasRows = (parentNode.rows && parentNode.rows.indexOf(",") > 0); 334 let hasRows = (parentNode.rows && parentNode.rows.indexOf(",") > 0);
339 if ((hasCols || hasRows) && !(hasCols && hasRows)) 335 if ((hasCols || hasRows) && !(hasCols && hasRows))
340 { 336 {
341 let index = -1; 337 let index = -1;
342 for (let frame = node; frame; frame = frame.previousSibling) 338 for (let frame = node; frame; frame = frame.previousSibling)
343 if (frame instanceof Ci.nsIDOMHTMLFrameElement || frame instanceof Ci. nsIDOMHTMLFrameSetElement) 339 if (frame instanceof Ci.nsIDOMHTMLFrameElement || frame instanceof Ci. nsIDOMHTMLFrameSetElement)
344 index++; 340 index++;
345 341
346 let property = (hasCols ? "cols" : "rows"); 342 let property = (hasCols ? "cols" : "rows");
347 let weights = parentNode[property].split(","); 343 let weights = parentNode[property].split(",");
348 weights[index] = "0"; 344 weights[index] = "0";
349 parentNode[property] = weights.join(","); 345 parentNode[property] = weights.join(",");
350 } 346 }
351 } 347 }
352 else 348 else
353 node.classList.add(collapsedClass); 349 node.classList.add(collapsedClass);
354 } 350 }
355 } 351 }
LEFTRIGHT

Powered by Google App Engine
This is Rietveld