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

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

Issue 29329571: Issue 3208 - Separate contentPolicy module into a parent and child part (Closed)
Left Patch Set: Removed stringification Created Nov. 9, 2015, 10:57 a.m.
Right Patch Set: Fixed JSDoc comment Created Nov. 12, 2015, 3:13 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 | « no previous file | lib/child/main.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 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 /** 312 /**
313 * Processes nodes scheduled for post-processing (typically hides them). 313 * Processes nodes scheduled for post-processing (typically hides them).
314 */ 314 */
315 function postProcessNodes() 315 function postProcessNodes()
316 { 316 {
317 if (!collapsedClass) 317 if (!collapsedClass)
318 { 318 {
319 let response = sendSyncMessage("AdblockPlus:GetCollapsedClass"); 319 let response = sendSyncMessage("AdblockPlus:GetCollapsedClass");
320 if (response.length) 320 if (response.length)
321 collapsedClass = response[0]; 321 collapsedClass = response[0];
322
323 if (!collapsedClass)
324 {
325 Utils.runAsync(postProcessNodes);
Thomas Greiner 2015/11/11 16:52:33 I'd suggest either stopping this loop at some poin
Wladimir Palant 2015/11/11 17:43:25 Actually, that's a left-over from a previous versi
Thomas Greiner 2015/11/11 18:07:32 Ah, you're right.
326 return;
327 }
328 } 322 }
329 323
330 let nodes = scheduledNodes; 324 let nodes = scheduledNodes;
331 scheduledNodes = null; 325 scheduledNodes = null;
326
327 if (!collapsedClass)
328 return;
332 329
333 for (let node of nodes) 330 for (let node of nodes)
334 { 331 {
335 // adjust frameset's cols/rows for frames 332 // adjust frameset's cols/rows for frames
336 let parentNode = node.parentNode; 333 let parentNode = node.parentNode;
337 if (parentNode && parentNode instanceof Ci.nsIDOMHTMLFrameSetElement) 334 if (parentNode && parentNode instanceof Ci.nsIDOMHTMLFrameSetElement)
338 { 335 {
339 let hasCols = (parentNode.cols && parentNode.cols.indexOf(",") > 0); 336 let hasCols = (parentNode.cols && parentNode.cols.indexOf(",") > 0);
340 let hasRows = (parentNode.rows && parentNode.rows.indexOf(",") > 0); 337 let hasRows = (parentNode.rows && parentNode.rows.indexOf(",") > 0);
341 if ((hasCols || hasRows) && !(hasCols && hasRows)) 338 if ((hasCols || hasRows) && !(hasCols && hasRows))
342 { 339 {
343 let index = -1; 340 let index = -1;
344 for (let frame = node; frame; frame = frame.previousSibling) 341 for (let frame = node; frame; frame = frame.previousSibling)
345 if (frame instanceof Ci.nsIDOMHTMLFrameElement || frame instanceof Ci. nsIDOMHTMLFrameSetElement) 342 if (frame instanceof Ci.nsIDOMHTMLFrameElement || frame instanceof Ci. nsIDOMHTMLFrameSetElement)
346 index++; 343 index++;
347 344
348 let property = (hasCols ? "cols" : "rows"); 345 let property = (hasCols ? "cols" : "rows");
349 let weights = parentNode[property].split(","); 346 let weights = parentNode[property].split(",");
350 weights[index] = "0"; 347 weights[index] = "0";
351 parentNode[property] = weights.join(","); 348 parentNode[property] = weights.join(",");
352 } 349 }
353 } 350 }
354 else 351 else
355 node.classList.add(collapsedClass); 352 node.classList.add(collapsedClass);
356 } 353 }
357 } 354 }
LEFTRIGHT
« no previous file | lib/child/main.js » ('j') | Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Toggle Comments ('s')

Powered by Google App Engine
This is Rietveld