| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008, 2009, 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2008, 2009, 2011 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 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 // If conditional features for window have been queued before the V8 context | 284 // If conditional features for window have been queued before the V8 context |
| 285 // was ready, then inject them into the context now | 285 // was ready, then inject them into the context now |
| 286 if (m_world->isMainWorld()) { | 286 if (m_world->isMainWorld()) { |
| 287 installPendingConditionalFeaturesOnWindow(m_scriptState.get()); | 287 installPendingConditionalFeaturesOnWindow(m_scriptState.get()); |
| 288 } | 288 } |
| 289 | 289 |
| 290 return true; | 290 return true; |
| 291 } | 291 } |
| 292 | 292 |
| 293 void WindowProxy::createContext() { | 293 void WindowProxy::createContext() { |
| 294 // FIXME: This should be a null check of m_frame->client(), but there are | |
| 295 // still some edge cases | |
| 296 // that this fails to catch during frame detach. | |
| 297 if (m_frame->isLocalFrame() && | |
| 298 !toLocalFrame(m_frame)->loader().documentLoader()) { | |
| 299 // TODO(yukishiino): Remove this if-clause entirely once we are sure that | |
| 300 // it's safe. There seems no case that we hit this if-clause. Plus, | |
| 301 // createContext() is responsible just to create a new v8::Context, and it's | |
| 302 // technically possible to create it without a document loader. | |
| 303 // If we really want to limit the context creation under some condition, | |
| 304 // it must come with the right reason described in a comment. | |
| 305 NOTREACHED(); | |
| 306 return; | |
| 307 } | |
| 308 | |
| 309 // Create a new v8::Context with the window object as the global object | 294 // Create a new v8::Context with the window object as the global object |
| 310 // (aka the inner global). Reuse the global proxy object (aka the outer | 295 // (aka the inner global). Reuse the global proxy object (aka the outer |
| 311 // global) if it already exists. See the comments in | 296 // global) if it already exists. See the comments in |
| 312 // setupWindowPrototypeChain for the structure of the prototype chain of | 297 // setupWindowPrototypeChain for the structure of the prototype chain of |
| 313 // the global object. | 298 // the global object. |
| 314 v8::Local<v8::ObjectTemplate> globalTemplate = | 299 v8::Local<v8::ObjectTemplate> globalTemplate = |
| 315 V8Window::domTemplate(m_isolate, *m_world)->InstanceTemplate(); | 300 V8Window::domTemplate(m_isolate, *m_world)->InstanceTemplate(); |
| 316 CHECK(!globalTemplate.IsEmpty()); | 301 CHECK(!globalTemplate.IsEmpty()); |
| 317 | 302 |
| 318 // FIXME: It's not clear what the right thing to do for remote frames is. | 303 // FIXME: It's not clear what the right thing to do for remote frames is. |
| (...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 586 .ToChecked(); | 571 .ToChecked(); |
| 587 } | 572 } |
| 588 | 573 |
| 589 void WindowProxy::updateSecurityOrigin(SecurityOrigin* origin) { | 574 void WindowProxy::updateSecurityOrigin(SecurityOrigin* origin) { |
| 590 if (!isContextInitialized()) | 575 if (!isContextInitialized()) |
| 591 return; | 576 return; |
| 592 setSecurityToken(origin); | 577 setSecurityToken(origin); |
| 593 } | 578 } |
| 594 | 579 |
| 595 } // namespace blink | 580 } // namespace blink |
| OLD | NEW |