Changeset 135325 in webkit
- Timestamp:
- Nov 20, 2012, 3:50:59 PM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r135324 r135325 1 2012-11-20 Michael Pruett <michael@68k.org> 2 3 [V8] Pass ScriptState::current() to functions marked with CallWith=ScriptState 4 https://bugs.webkit.org/show_bug.cgi?id=102739 5 6 Reviewed by Kentaro Hara. 7 8 Previously EmptyScriptState rather than ScriptState::current() 9 was passed to functions marked with [CallWith=ScriptState]. 10 Since the EmptyScriptState has a null v8::Context, any functions 11 which depended upon a valid v8::Context would fail. 12 13 No new tests. Covered by existing tests. 14 15 * bindings/scripts/CodeGeneratorV8.pm: 16 (GenerateNormalAttrGetter): 17 (GenerateNormalAttrSetter): 18 (GenerateCallWith): 19 (GenerateFunctionCallString): 20 * bindings/v8/ScriptState.h: 21 (WebCore::ScriptState::clearException): Added. 22 1 23 2012-11-20 Brent Fulgham <bfulgham@webkit.org> 2 24 -
trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm
r135322 r135325 983 983 $functionName = "imp->${functionName}"; 984 984 } 985 unshift(@arguments, GenerateCallWith($attribute->signature->extendedAttributes->{"CallWith"}, \@implContentDecls, " ", 0 , 0));985 unshift(@arguments, GenerateCallWith($attribute->signature->extendedAttributes->{"CallWith"}, \@implContentDecls, " ", 0)); 986 986 $getterString = "${functionName}(" . join(", ", @arguments) . ")"; 987 987 } else { … … 1300 1300 $functionName = "imp->${functionName}"; 1301 1301 } 1302 unshift(@arguments, GenerateCallWith($attribute->signature->extendedAttributes->{"CallWith"}, \@implContentDecls, " ", 1 , 0));1302 unshift(@arguments, GenerateCallWith($attribute->signature->extendedAttributes->{"CallWith"}, \@implContentDecls, " ", 1)); 1303 1303 push(@implContentDecls, " ${functionName}(" . join(", ", @arguments) . ");\n"); 1304 1304 } … … 1622 1622 my $indent = shift; 1623 1623 my $returnVoid = shift; 1624 my $emptyContext = shift;1625 1624 my $function = shift; 1626 1625 1627 1626 my @callWithArgs; 1628 1627 if ($codeGenerator->ExtendedAttributeContains($callWith, "ScriptState")) { 1629 if ($emptyContext) { 1630 push(@$outputArray, $indent . "EmptyScriptState state;\n"); 1631 push(@callWithArgs, "&state"); 1632 } else { 1633 push(@$outputArray, $indent . "ScriptState* state = ScriptState::current();\n"); 1634 push(@$outputArray, $indent . "if (!state)\n"); 1635 push(@$outputArray, $indent . " return" . ($returnVoid ? "" : " v8Undefined()") . ";\n"); 1636 push(@callWithArgs, "state"); 1637 } 1628 push(@$outputArray, $indent . "ScriptState* currentState = ScriptState::current();\n"); 1629 push(@$outputArray, $indent . "if (!currentState)\n"); 1630 push(@$outputArray, $indent . " return" . ($returnVoid ? "" : " v8Undefined()") . ";\n"); 1631 push(@$outputArray, $indent . "ScriptState& state = *currentState;\n"); 1632 push(@callWithArgs, "&state"); 1638 1633 } 1639 1634 if ($codeGenerator->ExtendedAttributeContains($callWith, "ScriptExecutionContext")) { … … 3533 3528 my $callWith = $function->signature->extendedAttributes->{"CallWith"}; 3534 3529 my @callWithOutput = (); 3535 my @callWithArgs = GenerateCallWith($callWith, \@callWithOutput, $indent, 0, 1,$function);3530 my @callWithArgs = GenerateCallWith($callWith, \@callWithOutput, $indent, 0, $function); 3536 3531 $result .= join("", @callWithOutput); 3537 3532 unshift(@arguments, @callWithArgs); … … 3591 3586 3592 3587 if ($codeGenerator->ExtendedAttributeContains($callWith, "ScriptState")) { 3593 $result .= $indent . "if (state.hadException())\n"; 3594 $result .= $indent . " return throwError(state.exception(), args.GetIsolate());\n" 3588 $result .= $indent . "if (state.hadException()) {\n"; 3589 $result .= $indent . " v8::Local<v8::Value> exception = state.exception();\n"; 3590 $result .= $indent . " state.clearException();\n"; 3591 $result .= $indent . " return throwError(exception, args.GetIsolate());\n"; 3592 $result .= $indent . "}\n"; 3595 3593 } 3596 3594 -
trunk/Source/WebCore/bindings/v8/ScriptState.h
r126502 r135325 57 57 } 58 58 v8::Local<v8::Value> exception() { return m_exception; } 59 void clearException() { m_exception.Clear(); } 59 60 60 61 v8::Local<v8::Context> context() const
Note:
See TracChangeset
for help on using the changeset viewer.