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

Side by Side Diff: lib/utils.js

Issue 29340852: Issue 3993 - Implement Utils.yield() in a better way (ABP/Firefox part) (Closed)
Patch Set: Finalized revisions and added comment Created April 28, 2016, 12:16 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 | « lib/io.js ('k') | 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 <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-2016 Eyeo GmbH 3 * Copyright (C) 2006-2016 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 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 * other extension code might execute, the extension might even shut down. 350 * other extension code might execute, the extension might even shut down.
351 */ 351 */
352 yield: function() 352 yield: function()
353 { 353 {
354 let {Prefs} = require("prefs"); 354 let {Prefs} = require("prefs");
355 if (Prefs.please_kill_startup_performance) 355 if (Prefs.please_kill_startup_performance)
356 { 356 {
357 this.yield = function() {}; 357 this.yield = function() {};
358 return; 358 return;
359 } 359 }
360 let thread = Services.tm.currentThread; 360 return new Promise((resolve, reject) => Utils.runAsync(resolve));
361 while (thread.processNextEvent(false));
362 }, 361 },
363 362
364 /** 363 /**
365 * Saves sidebar state before detaching/reattaching 364 * Saves sidebar state before detaching/reattaching
366 */ 365 */
367 setParams: function(params) 366 setParams: function(params)
368 { 367 {
369 sidebarParams = params; 368 sidebarParams = params;
370 }, 369 },
371 370
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after
766 Cu.reportError(e); 765 Cu.reportError(e);
767 // Expected, ctypes isn't supported in Gecko 1.9.2 766 // Expected, ctypes isn't supported in Gecko 1.9.2
768 return null; 767 return null;
769 } 768 }
770 }); 769 });
771 770
772 if ("@mozilla.org/messenger/headerparser;1" in Cc) 771 if ("@mozilla.org/messenger/headerparser;1" in Cc)
773 XPCOMUtils.defineLazyServiceGetter(Utils, "headerParser", "@mozilla.org/messen ger/headerparser;1", "nsIMsgHeaderParser"); 772 XPCOMUtils.defineLazyServiceGetter(Utils, "headerParser", "@mozilla.org/messen ger/headerparser;1", "nsIMsgHeaderParser");
774 else 773 else
775 Utils.headerParser = null; 774 Utils.headerParser = null;
OLDNEW
« no previous file with comments | « lib/io.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld