Left: | ||
Right: |
LEFT | RIGHT |
---|---|
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-present eyeo GmbH | 3 * Copyright (C) 2006-present 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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
73 if (typeof args[args.length - 1] == "undefined") | 73 if (typeof args[args.length - 1] == "undefined") |
74 args.pop(); | 74 args.pop(); |
75 | 75 |
76 return new Promise((resolve, reject) => | 76 return new Promise((resolve, reject) => |
77 { | 77 { |
78 func.call(object, ...args, result => | 78 func.call(object, ...args, result => |
79 { | 79 { |
80 let error = browser.runtime.lastError; | 80 let error = browser.runtime.lastError; |
81 if (error) | 81 if (error) |
82 { | 82 { |
83 // runtime.lastError on Chrome is a plain object with only a | 83 // runtime.lastError is already an Error instance on Edge, while on |
84 // message property. | 84 // Chrome it is a plain object with only a message property. |
Sebastian Noack
2017/10/19 18:09:56
Perhaps, this comment could be a little bit more e
Manish Jethani
2017/10/20 00:04:23
Done.
| |
85 if (!(error instanceof Error)) | 85 if (!(error instanceof Error)) |
86 { | |
86 error = new Error(error.message); | 87 error = new Error(error.message); |
87 | 88 |
88 // Add a more helpful stack trace. | 89 // Add a more helpful stack trace. |
89 error.stack = callStack; | 90 error.stack = callStack; |
Sebastian Noack
2017/10/19 18:09:56
How does the stack on Microsoft Edge (where browse
Manish Jethani
2017/10/20 00:04:23
I'm not sure, but I think we should just move it i
| |
91 } | |
90 | 92 |
91 reject(error); | 93 reject(error); |
92 } | 94 } |
93 else | 95 else |
94 { | 96 { |
95 resolve(result); | 97 resolve(result); |
96 } | 98 } |
97 }); | 99 }); |
98 }); | 100 }); |
99 }; | 101 }; |
(...skipping 26 matching lines...) Expand all Loading... | |
126 | 128 |
127 // Workaround since HTMLCollection, NodeList, StyleSheetList, and CSSRuleList | 129 // Workaround since HTMLCollection, NodeList, StyleSheetList, and CSSRuleList |
128 // didn't have iterator support before Chrome 51. | 130 // didn't have iterator support before Chrome 51. |
129 // https://bugs.chromium.org/p/chromium/issues/detail?id=401699 | 131 // https://bugs.chromium.org/p/chromium/issues/detail?id=401699 |
130 for (let object of [HTMLCollection, NodeList, StyleSheetList, CSSRuleList]) | 132 for (let object of [HTMLCollection, NodeList, StyleSheetList, CSSRuleList]) |
131 { | 133 { |
132 if (!(Symbol.iterator in object.prototype)) | 134 if (!(Symbol.iterator in object.prototype)) |
133 object.prototype[Symbol.iterator] = Array.prototype[Symbol.iterator]; | 135 object.prototype[Symbol.iterator] = Array.prototype[Symbol.iterator]; |
134 } | 136 } |
135 } | 137 } |
LEFT | RIGHT |