OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008, 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008, 2009 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 536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
547 // We return 0 here because |context| is detached from the LocalFrame. If we | 547 // We return 0 here because |context| is detached from the LocalFrame. If we |
548 // did return |frame| we could get in trouble because the frame could be | 548 // did return |frame| we could get in trouble because the frame could be |
549 // navigated to another security origin. | 549 // navigated to another security origin. |
550 return 0; | 550 return 0; |
551 } | 551 } |
552 | 552 |
553 v8::Local<v8::Context> toV8Context(ExecutionContext* context, DOMWrapperWorld* w
orld) | 553 v8::Local<v8::Context> toV8Context(ExecutionContext* context, DOMWrapperWorld* w
orld) |
554 { | 554 { |
555 ASSERT(context); | 555 ASSERT(context); |
556 if (context->isDocument()) { | 556 if (context->isDocument()) { |
557 ASSERT(world); | |
558 if (LocalFrame* frame = toDocument(context)->frame()) | 557 if (LocalFrame* frame = toDocument(context)->frame()) |
559 return frame->script().windowShell(world)->context(); | 558 return frame->script().windowShell(world)->context(); |
560 } else if (context->isWorkerGlobalScope()) { | 559 } else if (context->isWorkerGlobalScope()) { |
561 ASSERT(!world); | |
562 if (WorkerScriptController* script = toWorkerGlobalScope(context)->scrip
t()) | 560 if (WorkerScriptController* script = toWorkerGlobalScope(context)->scrip
t()) |
563 return script->context(); | 561 return script->context(); |
564 } | 562 } |
565 return v8::Local<v8::Context>(); | 563 return v8::Local<v8::Context>(); |
566 } | 564 } |
567 | 565 |
568 v8::Local<v8::Context> toV8Context(v8::Isolate* isolate, LocalFrame* frame, DOMW
rapperWorld* world) | 566 v8::Local<v8::Context> toV8Context(v8::Isolate* isolate, LocalFrame* frame, DOMW
rapperWorld* world) |
569 { | 567 { |
570 if (!frame) | 568 if (!frame) |
571 return v8::Local<v8::Context>(); | 569 return v8::Local<v8::Context>(); |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
701 V8BindingTestScope::V8BindingTestScope(v8::Isolate* isolate) | 699 V8BindingTestScope::V8BindingTestScope(v8::Isolate* isolate) |
702 : m_handleScope(isolate) | 700 : m_handleScope(isolate) |
703 , m_context(v8::Context::New(isolate)) | 701 , m_context(v8::Context::New(isolate)) |
704 , m_contextScope(m_context) | 702 , m_contextScope(m_context) |
705 , m_world(DOMWrapperWorld::create()) | 703 , m_world(DOMWrapperWorld::create()) |
706 , m_perContextData(V8PerContextData::create(m_context, m_world)) | 704 , m_perContextData(V8PerContextData::create(m_context, m_world)) |
707 { | 705 { |
708 } | 706 } |
709 | 707 |
710 } // namespace WebCore | 708 } // namespace WebCore |
OLD | NEW |