Chromium Code Reviews| 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 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 var global_receiver = %GlobalReceiver(global); |
| 311 global_receiver.Promise = $Promise; | 311 $Object.defineProperty(global_receiver, 'Promise', { |
|
rossberg
2014/03/26 09:59:37
You can use %SetProperty directly, like I did in t
yhirano
2014/03/26 10:09:12
Thanks, done.
| |
| 312 value: $Promise, | |
| 313 writable: true, | |
| 314 configurable: true | |
| 315 }); | |
| 312 InstallFunctions($Promise, DONT_ENUM, [ | 316 InstallFunctions($Promise, DONT_ENUM, [ |
| 313 "defer", PromiseDeferred, | 317 "defer", PromiseDeferred, |
| 314 "accept", PromiseResolved, | 318 "accept", PromiseResolved, |
| 315 "reject", PromiseRejected, | 319 "reject", PromiseRejected, |
| 316 "all", PromiseAll, | 320 "all", PromiseAll, |
| 317 "race", PromiseOne, | 321 "race", PromiseOne, |
| 318 "resolve", PromiseCast | 322 "resolve", PromiseCast |
| 319 ]); | 323 ]); |
| 320 InstallFunctions($Promise.prototype, DONT_ENUM, [ | 324 InstallFunctions($Promise.prototype, DONT_ENUM, [ |
| 321 "chain", PromiseChain, | 325 "chain", PromiseChain, |
| 322 "then", PromiseThen, | 326 "then", PromiseThen, |
| 323 "catch", PromiseCatch | 327 "catch", PromiseCatch |
| 324 ]); | 328 ]); |
| 325 } | 329 } |
| 326 | 330 |
| 327 SetUpPromise(); | 331 SetUpPromise(); |
| OLD | NEW |