| OLD | NEW | 
|     1 /* |     1 /* | 
|     2  * Copyright (C) 2014 Google Inc. All rights reserved. |     2  * Copyright (C) 2014 Google Inc. All rights reserved. | 
|     3  * |     3  * | 
|     4  * Redistribution and use in source and binary forms, with or without |     4  * Redistribution and use in source and binary forms, with or without | 
|     5  * modification, are permitted provided that the following conditions are |     5  * modification, are permitted provided that the following conditions are | 
|     6  * met: |     6  * met: | 
|     7  * |     7  * | 
|     8  *     * Redistributions of source code must retain the above copyright |     8  *     * Redistributions of source code must retain the above copyright | 
|     9  * notice, this list of conditions and the following disclaimer. |     9  * notice, this list of conditions and the following disclaimer. | 
|    10  *     * Redistributions in binary form must reproduce the above |    10  *     * Redistributions in binary form must reproduce the above | 
| (...skipping 969 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   980  */ |   980  */ | 
|   981 Promise.prototype.thenOrCatch = function(callback) |   981 Promise.prototype.thenOrCatch = function(callback) | 
|   982 { |   982 { | 
|   983     return this.then(callback, reject); |   983     return this.then(callback, reject); | 
|   984  |   984  | 
|   985     /** |   985     /** | 
|   986      * @param {*} e |   986      * @param {*} e | 
|   987      */ |   987      */ | 
|   988     function reject(e) |   988     function reject(e) | 
|   989     { |   989     { | 
|   990         console.error(e); |   990         if (e instanceof Error) | 
 |   991             console.error(e.stack); | 
 |   992         else | 
 |   993             console.error(e); | 
|   991         callback(); |   994         callback(); | 
|   992     } |   995     } | 
|   993 } |   996 } | 
|   994  |   997  | 
|   995 Promise.prototype.done = function() |   998 Promise.prototype.done = function() | 
|   996 { |   999 { | 
|   997     this.catch(console.error.bind(console)); |  1000     /** | 
 |  1001      * @param {*} e | 
 |  1002      */ | 
 |  1003     function reportError(e) | 
 |  1004     { | 
 |  1005         if (e instanceof Error) | 
 |  1006             console.error(e.stack); | 
 |  1007         else | 
 |  1008             console.error(e); | 
 |  1009     } | 
 |  1010     this.catch(reportError); | 
|   998 } |  1011 } | 
|   999  |  1012  | 
|  1000 /** |  1013 /** | 
|  1001  * @param {!Array.<!Promise.<T, !Error>>} promises |  1014  * @param {!Array.<!Promise.<T, !Error>>} promises | 
|  1002  * @return {!Promise.<!Array.<T>>} |  1015  * @return {!Promise.<!Array.<T>>} | 
|  1003  * @template T |  1016  * @template T | 
|  1004  */ |  1017  */ | 
|  1005 Promise.some = function(promises) |  1018 Promise.some = function(promises) | 
|  1006 { |  1019 { | 
|  1007     var all = []; |  1020     var all = []; | 
| (...skipping 30 matching lines...) Expand all  Loading... | 
|  1038         wasRejected[index] = true; |  1051         wasRejected[index] = true; | 
|  1039         console.error(e); |  1052         console.error(e); | 
|  1040     } |  1053     } | 
|  1041 } |  1054 } | 
|  1042  |  1055  | 
|  1043 // This must be constructed after the query parameters have been parsed. |  1056 // This must be constructed after the query parameters have been parsed. | 
|  1044 Runtime.experiments = new Runtime.ExperimentsSupport(); |  1057 Runtime.experiments = new Runtime.ExperimentsSupport(); | 
|  1045  |  1058  | 
|  1046 /** @type {!Runtime} */ |  1059 /** @type {!Runtime} */ | 
|  1047 var runtime; |  1060 var runtime; | 
| OLD | NEW |