| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 #include "core/frame/UseCounter.h" | 46 #include "core/frame/UseCounter.h" |
| 47 #include "core/inspector/InspectorInstrumentation.h" | 47 #include "core/inspector/InspectorInstrumentation.h" |
| 48 #include "core/workers/WorkerGlobalScope.h" | 48 #include "core/workers/WorkerGlobalScope.h" |
| 49 #include "platform/Task.h" | 49 #include "platform/Task.h" |
| 50 #include "wtf/Deque.h" | 50 #include "wtf/Deque.h" |
| 51 #include "wtf/Functional.h" | 51 #include "wtf/Functional.h" |
| 52 #include "wtf/Noncopyable.h" | 52 #include "wtf/Noncopyable.h" |
| 53 #include "wtf/PassOwnPtr.h" | 53 #include "wtf/PassOwnPtr.h" |
| 54 #include <v8.h> | 54 #include <v8.h> |
| 55 | 55 |
| 56 #define V8TRYCATCH_VOID_EMPTY(type, var, value) \ |
| 57 type var; \ |
| 58 { \ |
| 59 v8::TryCatch block; \ |
| 60 var = (value); \ |
| 61 if (UNLIKELY(block.HasCaught())) { \ |
| 62 return; \ |
| 63 } \ |
| 64 } |
| 65 |
| 56 namespace WebCore { | 66 namespace WebCore { |
| 57 | 67 |
| 58 namespace { | 68 namespace { |
| 59 | 69 |
| 60 v8::Local<v8::ObjectTemplate> cachedObjectTemplate(void* domTemplateKey, int int
ernalFieldCount, v8::Isolate* isolate) | 70 v8::Local<v8::ObjectTemplate> cachedObjectTemplate(void* domTemplateKey, int int
ernalFieldCount, v8::Isolate* isolate) |
| 61 { | 71 { |
| 62 V8PerIsolateData* data = V8PerIsolateData::from(isolate); | 72 V8PerIsolateData* data = V8PerIsolateData::from(isolate); |
| 63 WrapperWorldType currentWorldType = worldType(isolate); | 73 WrapperWorldType currentWorldType = worldType(isolate); |
| 64 v8::Handle<v8::FunctionTemplate> functionDescriptor = data->existingDOMTempl
ate(currentWorldType, domTemplateKey); | 74 v8::Handle<v8::FunctionTemplate> functionDescriptor = data->existingDOMTempl
ate(currentWorldType, domTemplateKey); |
| 65 if (!functionDescriptor.IsEmpty()) | 75 if (!functionDescriptor.IsEmpty()) |
| (...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 489 { | 499 { |
| 490 v8SetReturnValue(info, v8::Local<v8::Value>()); | 500 v8SetReturnValue(info, v8::Local<v8::Value>()); |
| 491 v8::Isolate* isolate = info.GetIsolate(); | 501 v8::Isolate* isolate = info.GetIsolate(); |
| 492 ExecutionContext* executionContext = callingExecutionContext(isolate); | 502 ExecutionContext* executionContext = callingExecutionContext(isolate); |
| 493 UseCounter::count(executionContext, UseCounter::PromiseConstructor); | 503 UseCounter::count(executionContext, UseCounter::PromiseConstructor); |
| 494 if (!info.Length() || !info[0]->IsFunction()) { | 504 if (!info.Length() || !info[0]->IsFunction()) { |
| 495 throwTypeError("Promise constructor takes a function argument", isolate)
; | 505 throwTypeError("Promise constructor takes a function argument", isolate)
; |
| 496 return; | 506 return; |
| 497 } | 507 } |
| 498 v8::Local<v8::Function> init = info[0].As<v8::Function>(); | 508 v8::Local<v8::Function> init = info[0].As<v8::Function>(); |
| 499 V8TRYCATCH_VOID(v8::Local<v8::Object>, promise, V8PromiseCustom::createPromi
se(info.Holder(), isolate)); | 509 V8TRYCATCH_VOID_EMPTY(v8::Local<v8::Object>, promise, V8PromiseCustom::creat
ePromise(info.Holder(), isolate)); |
| 500 V8TRYCATCH_VOID(v8::Handle<v8::Value>, resolve, createClosure(promiseResolve
Callback, promise, isolate)); | 510 V8TRYCATCH_VOID_EMPTY(v8::Handle<v8::Value>, resolve, createClosure(promiseR
esolveCallback, promise, isolate)); |
| 501 V8TRYCATCH_VOID(v8::Handle<v8::Value>, reject, createClosure(promiseRejectCa
llback, promise, isolate)); | 511 V8TRYCATCH_VOID_EMPTY(v8::Handle<v8::Value>, reject, createClosure(promiseRe
jectCallback, promise, isolate)); |
| 502 v8::Handle<v8::Value> argv[] = { resolve, reject }; | 512 v8::Handle<v8::Value> argv[] = { resolve, reject }; |
| 503 v8::TryCatch trycatch; | 513 v8::TryCatch trycatch; |
| 504 if (V8ScriptRunner::callFunction(init, currentExecutionContext(isolate), v8:
:Undefined(isolate), WTF_ARRAY_LENGTH(argv), argv, isolate).IsEmpty()) { | 514 if (V8ScriptRunner::callFunction(init, currentExecutionContext(isolate), v8:
:Undefined(isolate), WTF_ARRAY_LENGTH(argv), argv, isolate).IsEmpty()) { |
| 505 // An exception is thrown. Reject the promise if its resolved flag is un
set. | 515 // An exception is thrown. Reject the promise if its resolved flag is un
set. |
| 506 V8PromiseCustom::reject(promise, trycatch.Exception(), isolate); | 516 V8PromiseCustom::reject(promise, trycatch.Exception(), isolate); |
| 507 } | 517 } |
| 508 v8SetReturnValue(info, promise); | 518 v8SetReturnValue(info, promise); |
| 509 return; | 519 return; |
| 510 } | 520 } |
| 511 | 521 |
| 512 void V8Promise::thenMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& info
) | 522 void V8Promise::thenMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& info
) |
| 513 { | 523 { |
| 514 v8::Isolate* isolate = info.GetIsolate(); | 524 v8::Isolate* isolate = info.GetIsolate(); |
| 515 v8::Local<v8::Function> onFulfilled, onRejected; | 525 v8::Local<v8::Function> onFulfilled, onRejected; |
| 516 if (info.Length() > 0 && info[0]->IsFunction()) | 526 if (info.Length() > 0 && info[0]->IsFunction()) |
| 517 onFulfilled = info[0].As<v8::Function>(); | 527 onFulfilled = info[0].As<v8::Function>(); |
| 518 if (info.Length() > 1 && info[1]->IsFunction()) | 528 if (info.Length() > 1 && info[1]->IsFunction()) |
| 519 onRejected = info[1].As<v8::Function>(); | 529 onRejected = info[1].As<v8::Function>(); |
| 520 V8TRYCATCH_VOID(v8::Local<v8::Value>, newPromise, V8PromiseCustom::then(info
.Holder(), onFulfilled, onRejected, isolate)); | 530 V8TRYCATCH_VOID_EMPTY(v8::Local<v8::Value>, newPromise, V8PromiseCustom::the
n(info.Holder(), onFulfilled, onRejected, isolate)); |
| 521 v8SetReturnValue(info, newPromise); | 531 v8SetReturnValue(info, newPromise); |
| 522 } | 532 } |
| 523 | 533 |
| 524 void V8Promise::castMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& info
) | 534 void V8Promise::castMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& info
) |
| 525 { | 535 { |
| 526 v8::Isolate* isolate = info.GetIsolate(); | 536 v8::Isolate* isolate = info.GetIsolate(); |
| 527 ExecutionContext* executionContext = callingExecutionContext(isolate); | 537 ExecutionContext* executionContext = callingExecutionContext(isolate); |
| 528 UseCounter::count(executionContext, UseCounter::PromiseCast); | 538 UseCounter::count(executionContext, UseCounter::PromiseCast); |
| 529 v8::Local<v8::Value> result = v8::Undefined(isolate); | 539 v8::Local<v8::Value> result = v8::Undefined(isolate); |
| 530 if (info.Length() > 0) | 540 if (info.Length() > 0) |
| 531 result = info[0]; | 541 result = info[0]; |
| 532 | 542 |
| 533 V8TRYCATCH_VOID(v8::Local<v8::Value>, cast, V8PromiseCustom::toPromise(resul
t, isolate)); | 543 V8TRYCATCH_VOID_EMPTY(v8::Local<v8::Value>, cast, V8PromiseCustom::toPromise
(result, isolate)); |
| 534 v8SetReturnValue(info, cast); | 544 v8SetReturnValue(info, cast); |
| 535 } | 545 } |
| 536 | 546 |
| 537 void V8Promise::catchMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& inf
o) | 547 void V8Promise::catchMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& inf
o) |
| 538 { | 548 { |
| 539 v8::Isolate* isolate = info.GetIsolate(); | 549 v8::Isolate* isolate = info.GetIsolate(); |
| 540 v8::Local<v8::Function> onFulfilled, onRejected; | 550 v8::Local<v8::Function> onFulfilled, onRejected; |
| 541 | 551 |
| 542 if (info.Length() > 0 && !info[0]->IsUndefined()) { | 552 if (info.Length() > 0 && !info[0]->IsUndefined()) { |
| 543 if (!info[0]->IsFunction()) { | 553 if (!info[0]->IsFunction()) { |
| 544 v8SetReturnValue(info, throwTypeError("onRejected must be a function
or undefined", isolate)); | 554 v8SetReturnValue(info, throwTypeError("onRejected must be a function
or undefined", isolate)); |
| 545 return; | 555 return; |
| 546 } | 556 } |
| 547 onRejected = info[0].As<v8::Function>(); | 557 onRejected = info[0].As<v8::Function>(); |
| 548 } | 558 } |
| 549 V8TRYCATCH_VOID(v8::Local<v8::Value>, newPromise, V8PromiseCustom::then(info
.Holder(), onFulfilled, onRejected, isolate)); | 559 V8TRYCATCH_VOID_EMPTY(v8::Local<v8::Value>, newPromise, V8PromiseCustom::the
n(info.Holder(), onFulfilled, onRejected, isolate)); |
| 550 v8SetReturnValue(info, newPromise); | 560 v8SetReturnValue(info, newPromise); |
| 551 } | 561 } |
| 552 | 562 |
| 553 void V8Promise::resolveMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& i
nfo) | 563 void V8Promise::resolveMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& i
nfo) |
| 554 { | 564 { |
| 555 v8::Isolate* isolate = info.GetIsolate(); | 565 v8::Isolate* isolate = info.GetIsolate(); |
| 556 ExecutionContext* executionContext = callingExecutionContext(isolate); | 566 ExecutionContext* executionContext = callingExecutionContext(isolate); |
| 557 UseCounter::count(executionContext, UseCounter::PromiseResolve); | 567 UseCounter::count(executionContext, UseCounter::PromiseResolve); |
| 558 v8::Local<v8::Value> result = v8::Undefined(isolate); | 568 v8::Local<v8::Value> result = v8::Undefined(isolate); |
| 559 if (info.Length() > 0) | 569 if (info.Length() > 0) |
| 560 result = info[0]; | 570 result = info[0]; |
| 561 | 571 |
| 562 V8TRYCATCH_VOID(v8::Local<v8::Object>, promise, V8PromiseCustom::createPromi
se(info.Holder(), isolate)); | 572 V8TRYCATCH_VOID_EMPTY(v8::Local<v8::Object>, promise, V8PromiseCustom::creat
ePromise(info.Holder(), isolate)); |
| 563 V8PromiseCustom::resolve(promise, result, isolate); | 573 V8PromiseCustom::resolve(promise, result, isolate); |
| 564 v8SetReturnValue(info, promise); | 574 v8SetReturnValue(info, promise); |
| 565 } | 575 } |
| 566 | 576 |
| 567 void V8Promise::rejectMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& in
fo) | 577 void V8Promise::rejectMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& in
fo) |
| 568 { | 578 { |
| 569 v8::Isolate* isolate = info.GetIsolate(); | 579 v8::Isolate* isolate = info.GetIsolate(); |
| 570 ExecutionContext* executionContext = callingExecutionContext(isolate); | 580 ExecutionContext* executionContext = callingExecutionContext(isolate); |
| 571 UseCounter::count(executionContext, UseCounter::PromiseReject); | 581 UseCounter::count(executionContext, UseCounter::PromiseReject); |
| 572 v8::Local<v8::Value> result = v8::Undefined(isolate); | 582 v8::Local<v8::Value> result = v8::Undefined(isolate); |
| 573 if (info.Length() > 0) | 583 if (info.Length() > 0) |
| 574 result = info[0]; | 584 result = info[0]; |
| 575 | 585 |
| 576 V8TRYCATCH_VOID(v8::Local<v8::Object>, promise, V8PromiseCustom::createPromi
se(info.Holder(), isolate)); | 586 V8TRYCATCH_VOID_EMPTY(v8::Local<v8::Object>, promise, V8PromiseCustom::creat
ePromise(info.Holder(), isolate)); |
| 577 V8PromiseCustom::reject(promise, result, isolate); | 587 V8PromiseCustom::reject(promise, result, isolate); |
| 578 v8SetReturnValue(info, promise); | 588 v8SetReturnValue(info, promise); |
| 579 } | 589 } |
| 580 | 590 |
| 581 void V8Promise::raceMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& info
) | 591 void V8Promise::raceMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& info
) |
| 582 { | 592 { |
| 583 v8::Isolate* isolate = info.GetIsolate(); | 593 v8::Isolate* isolate = info.GetIsolate(); |
| 584 V8TRYCATCH_VOID(v8::Local<v8::Object>, promise, V8PromiseCustom::createPromi
se(info.Holder(), isolate)); | 594 V8TRYCATCH_VOID_EMPTY(v8::Local<v8::Object>, promise, V8PromiseCustom::creat
ePromise(info.Holder(), isolate)); |
| 585 | 595 |
| 586 if (!info.Length() || !info[0]->IsArray()) { | 596 if (!info.Length() || !info[0]->IsArray()) { |
| 587 v8SetReturnValue(info, promise); | 597 v8SetReturnValue(info, promise); |
| 588 return; | 598 return; |
| 589 } | 599 } |
| 590 | 600 |
| 591 // FIXME: Now we limit the iterable type to the Array type. | 601 // FIXME: Now we limit the iterable type to the Array type. |
| 592 v8::Local<v8::Array> iterable = info[0].As<v8::Array>(); | 602 v8::Local<v8::Array> iterable = info[0].As<v8::Array>(); |
| 593 V8TRYCATCH_VOID(v8::Local<v8::Function>, onFulfilled, createClosure(promiseR
esolveCallback, promise, isolate)); | 603 V8TRYCATCH_VOID_EMPTY(v8::Local<v8::Function>, onFulfilled, createClosure(pr
omiseResolveCallback, promise, isolate)); |
| 594 V8TRYCATCH_VOID(v8::Local<v8::Function>, onRejected, createClosure(promiseRe
jectCallback, promise, isolate)); | 604 V8TRYCATCH_VOID_EMPTY(v8::Local<v8::Function>, onRejected, createClosure(pro
miseRejectCallback, promise, isolate)); |
| 595 | 605 |
| 596 for (unsigned i = 0, length = iterable->Length(); i < length; ++i) { | 606 for (unsigned i = 0, length = iterable->Length(); i < length; ++i) { |
| 597 // Array-holes should not be skipped by for-of iteration semantics. | 607 // Array-holes should not be skipped by for-of iteration semantics. |
| 598 V8TRYCATCH_VOID(v8::Local<v8::Value>, nextValue, iterable->Get(i)); | 608 V8TRYCATCH_VOID_EMPTY(v8::Local<v8::Value>, nextValue, iterable->Get(i))
; |
| 599 V8TRYCATCH_VOID(v8::Local<v8::Object>, nextPromise, V8PromiseCustom::toP
romise(nextValue, isolate)); | 609 V8TRYCATCH_VOID_EMPTY(v8::Local<v8::Object>, nextPromise, V8PromiseCusto
m::toPromise(nextValue, isolate)); |
| 600 V8TRYCATCH_VOID(v8::Local<v8::Value>, unused, V8PromiseCustom::then(next
Promise, onFulfilled, onRejected, isolate)); | 610 V8TRYCATCH_VOID_EMPTY(v8::Local<v8::Value>, unused, V8PromiseCustom::the
n(nextPromise, onFulfilled, onRejected, isolate)); |
| 601 } | 611 } |
| 602 v8SetReturnValue(info, promise); | 612 v8SetReturnValue(info, promise); |
| 603 } | 613 } |
| 604 | 614 |
| 605 void V8Promise::allMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& info) | 615 void V8Promise::allMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& info) |
| 606 { | 616 { |
| 607 v8::Isolate* isolate = info.GetIsolate(); | 617 v8::Isolate* isolate = info.GetIsolate(); |
| 608 V8TRYCATCH_VOID(v8::Local<v8::Object>, promise, V8PromiseCustom::createPromi
se(info.Holder(), isolate)); | 618 V8TRYCATCH_VOID_EMPTY(v8::Local<v8::Object>, promise, V8PromiseCustom::creat
ePromise(info.Holder(), isolate)); |
| 609 v8::Local<v8::Array> results = v8::Array::New(info.GetIsolate()); | 619 v8::Local<v8::Array> results = v8::Array::New(info.GetIsolate()); |
| 610 | 620 |
| 611 if (!info.Length() || !info[0]->IsArray()) { | 621 if (!info.Length() || !info[0]->IsArray()) { |
| 612 V8PromiseCustom::resolve(promise, results, isolate); | 622 V8PromiseCustom::resolve(promise, results, isolate); |
| 613 v8SetReturnValue(info, promise); | 623 v8SetReturnValue(info, promise); |
| 614 return; | 624 return; |
| 615 } | 625 } |
| 616 | 626 |
| 617 // FIXME: Now we limit the iterable type to the Array type. | 627 // FIXME: Now we limit the iterable type to the Array type. |
| 618 v8::Local<v8::Array> iterable = info[0].As<v8::Array>(); | 628 v8::Local<v8::Array> iterable = info[0].As<v8::Array>(); |
| 619 | 629 |
| 620 if (!iterable->Length()) { | 630 if (!iterable->Length()) { |
| 621 V8PromiseCustom::resolve(promise, results, isolate); | 631 V8PromiseCustom::resolve(promise, results, isolate); |
| 622 v8SetReturnValue(info, promise); | 632 v8SetReturnValue(info, promise); |
| 623 return; | 633 return; |
| 624 } | 634 } |
| 625 | 635 |
| 626 v8::Local<v8::ObjectTemplate> objectTemplate = primitiveWrapperObjectTemplat
e(isolate); | 636 v8::Local<v8::ObjectTemplate> objectTemplate = primitiveWrapperObjectTemplat
e(isolate); |
| 627 V8TRYCATCH_VOID(v8::Local<v8::Object>, countdownWrapper, objectTemplate->New
Instance()); | 637 V8TRYCATCH_VOID_EMPTY(v8::Local<v8::Object>, countdownWrapper, objectTemplat
e->NewInstance()); |
| 628 countdownWrapper->SetInternalField(V8PromiseCustom::PrimitiveWrapperPrimitiv
eIndex, v8::Integer::New(isolate, iterable->Length())); | 638 countdownWrapper->SetInternalField(V8PromiseCustom::PrimitiveWrapperPrimitiv
eIndex, v8::Integer::New(isolate, iterable->Length())); |
| 629 | 639 |
| 630 V8TRYCATCH_VOID(v8::Local<v8::Function>, onRejected, createClosure(promiseRe
jectCallback, promise, isolate)); | 640 V8TRYCATCH_VOID_EMPTY(v8::Local<v8::Function>, onRejected, createClosure(pro
miseRejectCallback, promise, isolate)); |
| 631 for (unsigned i = 0, length = iterable->Length(); i < length; ++i) { | 641 for (unsigned i = 0, length = iterable->Length(); i < length; ++i) { |
| 632 // Array-holes should not be skipped by for-of iteration semantics. | 642 // Array-holes should not be skipped by for-of iteration semantics. |
| 633 V8TRYCATCH_VOID(v8::Local<v8::Object>, environment, promiseAllEnvironmen
t(promise, countdownWrapper, i, results, isolate)); | 643 V8TRYCATCH_VOID_EMPTY(v8::Local<v8::Object>, environment, promiseAllEnvi
ronment(promise, countdownWrapper, i, results, isolate)); |
| 634 V8TRYCATCH_VOID(v8::Local<v8::Function>, onFulfilled, createClosure(prom
iseAllFulfillCallback, environment, isolate)); | 644 V8TRYCATCH_VOID_EMPTY(v8::Local<v8::Function>, onFulfilled, createClosur
e(promiseAllFulfillCallback, environment, isolate)); |
| 635 V8TRYCATCH_VOID(v8::Local<v8::Value>, nextValue, iterable->Get(i)); | 645 V8TRYCATCH_VOID_EMPTY(v8::Local<v8::Value>, nextValue, iterable->Get(i))
; |
| 636 V8TRYCATCH_VOID(v8::Local<v8::Object>, nextPromise, V8PromiseCustom::toP
romise(nextValue, isolate)); | 646 V8TRYCATCH_VOID_EMPTY(v8::Local<v8::Object>, nextPromise, V8PromiseCusto
m::toPromise(nextValue, isolate)); |
| 637 V8TRYCATCH_VOID(v8::Local<v8::Value>, unused, V8PromiseCustom::then(next
Promise, onFulfilled, onRejected, isolate)); | 647 V8TRYCATCH_VOID_EMPTY(v8::Local<v8::Value>, unused, V8PromiseCustom::the
n(nextPromise, onFulfilled, onRejected, isolate)); |
| 638 } | 648 } |
| 639 v8SetReturnValue(info, promise); | 649 v8SetReturnValue(info, promise); |
| 640 } | 650 } |
| 641 | 651 |
| 642 // | 652 // |
| 643 // -- V8PromiseCustom -- | 653 // -- V8PromiseCustom -- |
| 644 v8::Local<v8::Object> V8PromiseCustom::createPromise(v8::Handle<v8::Object> crea
tionContext, v8::Isolate* isolate) | 654 v8::Local<v8::Object> V8PromiseCustom::createPromise(v8::Handle<v8::Object> crea
tionContext, v8::Isolate* isolate) |
| 645 { | 655 { |
| 646 v8::Local<v8::ObjectTemplate> internalTemplate = internalObjectTemplate(isol
ate); | 656 v8::Local<v8::ObjectTemplate> internalTemplate = internalObjectTemplate(isol
ate); |
| 647 v8::Local<v8::Object> internal = internalTemplate->NewInstance(); | 657 v8::Local<v8::Object> internal = internalTemplate->NewInstance(); |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 832 | 842 |
| 833 void V8PromiseCustom::callHandler(v8::Handle<v8::Object> promise, v8::Handle<v8:
:Function> handler, v8::Handle<v8::Value> argument, PromiseState originatorState
, v8::Isolate* isolate) | 843 void V8PromiseCustom::callHandler(v8::Handle<v8::Object> promise, v8::Handle<v8:
:Function> handler, v8::Handle<v8::Value> argument, PromiseState originatorState
, v8::Isolate* isolate) |
| 834 { | 844 { |
| 835 ASSERT(originatorState == Fulfilled || originatorState == Rejected); | 845 ASSERT(originatorState == Fulfilled || originatorState == Rejected); |
| 836 ExecutionContext* executionContext = currentExecutionContext(isolate); | 846 ExecutionContext* executionContext = currentExecutionContext(isolate); |
| 837 ASSERT(executionContext && executionContext->isContextThread()); | 847 ASSERT(executionContext && executionContext->isContextThread()); |
| 838 executionContext->postTask(adoptPtr(new CallHandlerTask(promise, handler, ar
gument, originatorState, isolate, executionContext))); | 848 executionContext->postTask(adoptPtr(new CallHandlerTask(promise, handler, ar
gument, originatorState, isolate, executionContext))); |
| 839 } | 849 } |
| 840 | 850 |
| 841 } // namespace WebCore | 851 } // namespace WebCore |
| OLD | NEW |