| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 } | 299 } |
| 300 } catch (e) { | 300 } catch (e) { |
| 301 deferred.reject(e) | 301 deferred.reject(e) |
| 302 } | 302 } |
| 303 return deferred.promise; | 303 return deferred.promise; |
| 304 } | 304 } |
| 305 | 305 |
| 306 //------------------------------------------------------------------- | 306 //------------------------------------------------------------------- |
| 307 | 307 |
| 308 function SetUpPromise() { | 308 function SetUpPromise() { |
| 309 %CheckIsBootstrapping() | 309 %CheckIsBootstrapping(); |
| 310 var global_receiver = %GlobalReceiver(global); | 310 %SetProperty(global, 'Promise', $Promise, DONT_ENUM); |
| 311 global_receiver.Promise = $Promise; | |
| 312 InstallFunctions($Promise, DONT_ENUM, [ | 311 InstallFunctions($Promise, DONT_ENUM, [ |
| 313 "defer", PromiseDeferred, | 312 "defer", PromiseDeferred, |
| 314 "accept", PromiseResolved, | 313 "accept", PromiseResolved, |
| 315 "reject", PromiseRejected, | 314 "reject", PromiseRejected, |
| 316 "all", PromiseAll, | 315 "all", PromiseAll, |
| 317 "race", PromiseOne, | 316 "race", PromiseOne, |
| 318 "resolve", PromiseCast | 317 "resolve", PromiseCast |
| 319 ]); | 318 ]); |
| 320 InstallFunctions($Promise.prototype, DONT_ENUM, [ | 319 InstallFunctions($Promise.prototype, DONT_ENUM, [ |
| 321 "chain", PromiseChain, | 320 "chain", PromiseChain, |
| 322 "then", PromiseThen, | 321 "then", PromiseThen, |
| 323 "catch", PromiseCatch | 322 "catch", PromiseCatch |
| 324 ]); | 323 ]); |
| 325 } | 324 } |
| 326 | 325 |
| 327 SetUpPromise(); | 326 SetUpPromise(); |
| OLD | NEW |