Chromium Code Reviews| 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 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 511 if (info.Holder() | 511 if (info.Holder() |
| 512 ->GetRealNamedPropertyInPrototypeChain( | 512 ->GetRealNamedPropertyInPrototypeChain( |
| 513 info.GetIsolate()->GetCurrentContext(), property.As<v8::String>()) | 513 info.GetIsolate()->GetCurrentContext(), property.As<v8::String>()) |
| 514 .ToLocal(&value)) | 514 .ToLocal(&value)) |
| 515 v8SetReturnValue(info, value); | 515 v8SetReturnValue(info, value); |
| 516 } | 516 } |
| 517 | 517 |
| 518 void WindowProxy::namedItemAdded(HTMLDocument* document, | 518 void WindowProxy::namedItemAdded(HTMLDocument* document, |
| 519 const AtomicString& name) { | 519 const AtomicString& name) { |
| 520 DCHECK(m_world->isMainWorld()); | 520 DCHECK(m_world->isMainWorld()); |
| 521 | 521 DCHECK(m_scriptState); |
| 522 if (!isContextInitialized()) | 522 if (!m_scriptState->contextIsValid()) |
|
Yuki
2017/01/05 13:31:27
Why do you want to replace !isContextInitialized()
haraken
2017/01/05 23:50:26
Reverted it back to !isContextInitialized().
I ju
| |
| 523 return; | 523 return; |
| 524 | 524 |
| 525 ScriptState::Scope scope(m_scriptState.get()); | 525 ScriptState::Scope scope(m_scriptState.get()); |
| 526 v8::Local<v8::Object> documentWrapper = | 526 v8::Local<v8::Object> documentWrapper = |
| 527 m_world->domDataStore().get(document, m_isolate); | 527 m_world->domDataStore().get(document, m_isolate); |
| 528 // TODO(yukishiino,peria): We should check if the own property with the same | 528 // TODO(yukishiino,peria): We should check if the own property with the same |
| 529 // name already exists or not, and if it exists, we shouldn't define a new | 529 // name already exists or not, and if it exists, we shouldn't define a new |
| 530 // accessor property (it fails). | 530 // accessor property (it fails). |
| 531 documentWrapper->SetAccessor(m_isolate->GetCurrentContext(), | 531 documentWrapper->SetAccessor(m_isolate->GetCurrentContext(), |
| 532 v8String(m_isolate, name), getter); | 532 v8String(m_isolate, name), getter); |
| 533 } | 533 } |
| 534 | 534 |
| 535 void WindowProxy::namedItemRemoved(HTMLDocument* document, | 535 void WindowProxy::namedItemRemoved(HTMLDocument* document, |
| 536 const AtomicString& name) { | 536 const AtomicString& name) { |
| 537 DCHECK(m_world->isMainWorld()); | 537 DCHECK(m_world->isMainWorld()); |
| 538 | 538 DCHECK(m_scriptState); |
| 539 if (!isContextInitialized()) | 539 if (!m_scriptState->contextIsValid()) |
| 540 return; | 540 return; |
| 541 | |
| 542 if (document->hasNamedItem(name) || document->hasExtraNamedItem(name)) | 541 if (document->hasNamedItem(name) || document->hasExtraNamedItem(name)) |
| 543 return; | 542 return; |
| 544 | 543 |
| 545 ScriptState::Scope scope(m_scriptState.get()); | 544 ScriptState::Scope scope(m_scriptState.get()); |
| 546 v8::Local<v8::Object> documentWrapper = | 545 v8::Local<v8::Object> documentWrapper = |
| 547 m_world->domDataStore().get(document, m_isolate); | 546 m_world->domDataStore().get(document, m_isolate); |
| 548 documentWrapper | 547 documentWrapper |
| 549 ->Delete(m_isolate->GetCurrentContext(), v8String(m_isolate, name)) | 548 ->Delete(m_isolate->GetCurrentContext(), v8String(m_isolate, name)) |
| 550 .ToChecked(); | 549 .ToChecked(); |
| 551 } | 550 } |
| 552 | 551 |
| 553 void WindowProxy::updateSecurityOrigin(SecurityOrigin* origin) { | 552 void WindowProxy::updateSecurityOrigin(SecurityOrigin* origin) { |
| 554 if (!isContextInitialized()) | 553 if (!isContextInitialized()) |
| 555 return; | 554 return; |
| 556 setSecurityToken(origin); | 555 setSecurityToken(origin); |
| 557 } | 556 } |
| 558 | 557 |
| 559 } // namespace blink | 558 } // namespace blink |
| OLD | NEW |