| 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 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 338 } else if (context->isWorkerContext()) { | 338 } else if (context->isWorkerContext()) { |
| 339 if (WorkerScriptController* script = static_cast<WorkerContext*>(context
)->script()) | 339 if (WorkerScriptController* script = static_cast<WorkerContext*>(context
)->script()) |
| 340 return script->context(); | 340 return script->context(); |
| 341 } | 341 } |
| 342 return v8::Local<v8::Context>(); | 342 return v8::Local<v8::Context>(); |
| 343 } | 343 } |
| 344 | 344 |
| 345 v8::Local<v8::Context> toV8Context(ScriptExecutionContext* context, DOMWrapperWo
rld* world) | 345 v8::Local<v8::Context> toV8Context(ScriptExecutionContext* context, DOMWrapperWo
rld* world) |
| 346 { | 346 { |
| 347 if (context->isDocument()) { | 347 if (context->isDocument()) { |
| 348 if (Frame* frame = toDocument(context)->frame()) { | 348 ASSERT(world); |
| 349 // FIXME: Store the DOMWrapperWorld for the main world in the v8::Co
ntext so callers | 349 if (Frame* frame = toDocument(context)->frame()) |
| 350 // that are looking up their world with DOMWrapperWorld::isolatedWor
ld(v8::Context::GetCurrent()) | |
| 351 // won't end up passing null here when later trying to get their v8:
:Context back. | |
| 352 if (!world) | |
| 353 return frame->script()->mainWorldContext(); | |
| 354 return v8::Local<v8::Context>::New(frame->script()->windowShell(worl
d)->context()); | 350 return v8::Local<v8::Context>::New(frame->script()->windowShell(worl
d)->context()); |
| 355 } | |
| 356 } else if (context->isWorkerContext()) { | 351 } else if (context->isWorkerContext()) { |
| 352 ASSERT(!world); |
| 357 if (WorkerScriptController* script = static_cast<WorkerContext*>(context
)->script()) | 353 if (WorkerScriptController* script = static_cast<WorkerContext*>(context
)->script()) |
| 358 return script->context(); | 354 return script->context(); |
| 359 } | 355 } |
| 360 return v8::Local<v8::Context>(); | 356 return v8::Local<v8::Context>(); |
| 361 } | 357 } |
| 362 | 358 |
| 363 bool handleOutOfMemory() | 359 bool handleOutOfMemory() |
| 364 { | 360 { |
| 365 v8::Local<v8::Context> context = v8::Context::GetCurrent(); | 361 v8::Local<v8::Context> context = v8::Context::GetCurrent(); |
| 366 | 362 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 409 if (!DOMWrapperWorld::isolatedWorldsExist()) | 405 if (!DOMWrapperWorld::isolatedWorldsExist()) |
| 410 return MainWorld; | 406 return MainWorld; |
| 411 ASSERT(!v8::Context::GetEntered().IsEmpty()); | 407 ASSERT(!v8::Context::GetEntered().IsEmpty()); |
| 412 DOMWrapperWorld* isolatedWorld = DOMWrapperWorld::isolatedWorld(v8::Context:
:GetEntered()); | 408 DOMWrapperWorld* isolatedWorld = DOMWrapperWorld::isolatedWorld(v8::Context:
:GetEntered()); |
| 413 if (isolatedWorld) | 409 if (isolatedWorld) |
| 414 return IsolatedWorld; | 410 return IsolatedWorld; |
| 415 return MainWorld; | 411 return MainWorld; |
| 416 } | 412 } |
| 417 | 413 |
| 418 } // namespace WebCore | 414 } // namespace WebCore |
| OLD | NEW |