OLD | NEW |
1 # Copyright (C) 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org> | 1 # Copyright (C) 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org> |
2 # Copyright (C) 2006 Anders Carlsson <andersca@mac.com> | 2 # Copyright (C) 2006 Anders Carlsson <andersca@mac.com> |
3 # Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> | 3 # Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> |
4 # Copyright (C) 2006 Alexey Proskuryakov <ap@webkit.org> | 4 # Copyright (C) 2006 Alexey Proskuryakov <ap@webkit.org> |
5 # Copyright (C) 2006 Apple Computer, Inc. | 5 # Copyright (C) 2006 Apple Computer, Inc. |
6 # Copyright (C) 2007, 2008, 2009 Google Inc. | 6 # Copyright (C) 2007, 2008, 2009 Google Inc. |
7 # Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au> | 7 # Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au> |
8 # Copyright (C) Research In Motion Limited 2010. All rights reserved. | 8 # Copyright (C) Research In Motion Limited 2010. All rights reserved. |
9 # Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) | 9 # Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) |
10 # | 10 # |
(...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
627 } | 627 } |
628 return 0; | 628 return 0; |
629 } | 629 } |
630 | 630 |
631 sub IsNodeSubType | 631 sub IsNodeSubType |
632 { | 632 { |
633 my $dataNode = shift; | 633 my $dataNode = shift; |
634 return IsSubType($dataNode, "Node"); | 634 return IsSubType($dataNode, "Node"); |
635 } | 635 } |
636 | 636 |
| 637 sub IsVisibleAcrossOrigins |
| 638 { |
| 639 my $dataNode = shift; |
| 640 return $dataNode->extendedAttributes->{"CheckDomainSecurity"} && !($dataNode
->name eq "DOMWindow"); |
| 641 } |
| 642 |
637 sub GenerateDomainSafeFunctionGetter | 643 sub GenerateDomainSafeFunctionGetter |
638 { | 644 { |
639 my $function = shift; | 645 my $function = shift; |
640 my $implClassName = shift; | 646 my $implClassName = shift; |
641 | 647 |
642 my $className = "V8" . $implClassName; | 648 my $className = "V8" . $implClassName; |
643 my $funcName = $function->signature->name; | 649 my $funcName = $function->signature->name; |
644 | 650 |
645 my $signature = "v8::Signature::New(" . $className . "::GetRawTemplate())"; | 651 my $signature = "v8::Signature::New(" . $className . "::GetRawTemplate())"; |
646 if ($function->signature->extendedAttributes->{"V8DoNotCheckSignature"}) { | 652 if ($function->signature->extendedAttributes->{"V8DoNotCheckSignature"}) { |
(...skipping 1851 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2498 if (proxy->windowShell()->initContextIfNeeded()) { | 2504 if (proxy->windowShell()->initContextIfNeeded()) { |
2499 // initContextIfNeeded may have created a wrapper for the object
, retry from the start. | 2505 // initContextIfNeeded may have created a wrapper for the object
, retry from the start. |
2500 return ${className}::wrap(impl); | 2506 return ${className}::wrap(impl); |
2501 } | 2507 } |
2502 } | 2508 } |
2503 } | 2509 } |
2504 | 2510 |
2505 END | 2511 END |
2506 } | 2512 } |
2507 | 2513 |
2508 if (IsNodeSubType($dataNode)) { | 2514 # FIXME: We need a better way of recovering the correct prototype chain |
| 2515 # for every sort of object. For now, we special-case cross-origin visible |
| 2516 # objects (i.e., those with CheckDomainSecurity). |
| 2517 if (IsVisibleAcrossOrigins($dataNode)) { |
| 2518 push(@implContent, <<END); |
| 2519 if (impl->frame()) { |
| 2520 proxy = V8Proxy::retrieve(impl->frame()); |
| 2521 if (proxy) |
| 2522 proxy->windowShell()->initContextIfNeeded(); |
| 2523 } |
| 2524 END |
| 2525 } |
| 2526 |
| 2527 if (IsNodeSubType($dataNode) || IsVisibleAcrossOrigins($dataNode)) { |
2509 push(@implContent, <<END); | 2528 push(@implContent, <<END); |
2510 | 2529 |
2511 v8::Handle<v8::Context> context; | 2530 v8::Handle<v8::Context> context; |
2512 if (proxy) | 2531 if (proxy) |
2513 context = proxy->context(); | 2532 context = proxy->context(); |
2514 | 2533 |
2515 // Enter the node's context and create the wrapper in that context. | 2534 // Enter the node's context and create the wrapper in that context. |
2516 if (!context.IsEmpty()) | 2535 if (!context.IsEmpty()) |
2517 context->Enter(); | 2536 context->Enter(); |
2518 END | 2537 END |
2519 } | 2538 } |
2520 | 2539 |
2521 push(@implContent, <<END); | 2540 push(@implContent, <<END); |
2522 wrapper = V8DOMWrapper::instantiateV8Object(proxy, &info, impl); | 2541 wrapper = V8DOMWrapper::instantiateV8Object(proxy, &info, impl); |
2523 END | 2542 END |
2524 if (IsNodeSubType($dataNode)) { | 2543 if (IsNodeSubType($dataNode) || IsVisibleAcrossOrigins($dataNode)) { |
2525 push(@implContent, <<END); | 2544 push(@implContent, <<END); |
2526 // Exit the node's context if it was entered. | 2545 // Exit the node's context if it was entered. |
2527 if (!context.IsEmpty()) | 2546 if (!context.IsEmpty()) |
2528 context->Exit(); | 2547 context->Exit(); |
2529 END | 2548 END |
2530 } | 2549 } |
2531 | 2550 |
2532 push(@implContent, <<END); | 2551 push(@implContent, <<END); |
2533 if (wrapper.IsEmpty()) | 2552 if (wrapper.IsEmpty()) |
2534 return wrapper; | 2553 return wrapper; |
(...skipping 792 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3327 return "RuntimeEnabledFeatures::" . $codeGenerator->WK_lcfirst($signature->n
ame) . "Enabled"; | 3346 return "RuntimeEnabledFeatures::" . $codeGenerator->WK_lcfirst($signature->n
ame) . "Enabled"; |
3328 } | 3347 } |
3329 | 3348 |
3330 sub DebugPrint | 3349 sub DebugPrint |
3331 { | 3350 { |
3332 my $output = shift; | 3351 my $output = shift; |
3333 | 3352 |
3334 print $output; | 3353 print $output; |
3335 print "\n"; | 3354 print "\n"; |
3336 } | 3355 } |
OLD | NEW |