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 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 info.GetIsolate()->GetCurrentContext(), property.As<v8::String>()) | 297 info.GetIsolate()->GetCurrentContext(), property.As<v8::String>()) |
298 .ToLocal(&value)) | 298 .ToLocal(&value)) |
299 v8SetReturnValue(info, value); | 299 v8SetReturnValue(info, value); |
300 } | 300 } |
301 | 301 |
302 void LocalWindowProxy::namedItemAdded(HTMLDocument* document, | 302 void LocalWindowProxy::namedItemAdded(HTMLDocument* document, |
303 const AtomicString& name) { | 303 const AtomicString& name) { |
304 DCHECK(m_world->isMainWorld()); | 304 DCHECK(m_world->isMainWorld()); |
305 | 305 |
306 // Context must be initialized before this point. | 306 // Context must be initialized before this point. |
307 DCHECK(m_lifecycle >= Lifecycle::ContextInitialized); | 307 DCHECK(m_lifecycle == Lifecycle::ContextInitialized); |
308 // TODO(yukishiino): Is it okay to not update named properties | |
309 // after the context gets detached? | |
310 if (m_lifecycle == Lifecycle::ContextDetached) | |
311 return; | |
312 | 308 |
313 ScriptState::Scope scope(m_scriptState.get()); | 309 ScriptState::Scope scope(m_scriptState.get()); |
314 v8::Local<v8::Object> documentWrapper = | 310 v8::Local<v8::Object> documentWrapper = |
315 m_world->domDataStore().get(document, isolate()); | 311 m_world->domDataStore().get(document, isolate()); |
316 // TODO(yukishiino,peria): We should check if the own property with the same | 312 // TODO(yukishiino,peria): We should check if the own property with the same |
317 // name already exists or not, and if it exists, we shouldn't define a new | 313 // name already exists or not, and if it exists, we shouldn't define a new |
318 // accessor property (it fails). | 314 // accessor property (it fails). |
319 documentWrapper->SetAccessor(isolate()->GetCurrentContext(), | 315 documentWrapper->SetAccessor(isolate()->GetCurrentContext(), |
320 v8String(isolate(), name), getter); | 316 v8String(isolate(), name), getter); |
321 } | 317 } |
322 | 318 |
323 void LocalWindowProxy::namedItemRemoved(HTMLDocument* document, | 319 void LocalWindowProxy::namedItemRemoved(HTMLDocument* document, |
324 const AtomicString& name) { | 320 const AtomicString& name) { |
325 DCHECK(m_world->isMainWorld()); | 321 DCHECK(m_world->isMainWorld()); |
326 | 322 |
327 // Context must be initialized before this point. | 323 DCHECK(m_lifecycle == Lifecycle::ContextInitialized); |
328 DCHECK(m_lifecycle >= Lifecycle::ContextInitialized); | |
329 // TODO(yukishiino): Is it okay to not update named properties | |
330 // after the context gets detached? | |
331 if (m_lifecycle == Lifecycle::ContextDetached) | |
332 return; | |
333 | 324 |
334 if (document->hasNamedItem(name) || document->hasExtraNamedItem(name)) | 325 if (document->hasNamedItem(name) || document->hasExtraNamedItem(name)) |
335 return; | 326 return; |
336 ScriptState::Scope scope(m_scriptState.get()); | 327 ScriptState::Scope scope(m_scriptState.get()); |
337 v8::Local<v8::Object> documentWrapper = | 328 v8::Local<v8::Object> documentWrapper = |
338 m_world->domDataStore().get(document, isolate()); | 329 m_world->domDataStore().get(document, isolate()); |
339 documentWrapper | 330 documentWrapper |
340 ->Delete(isolate()->GetCurrentContext(), v8String(isolate(), name)) | 331 ->Delete(isolate()->GetCurrentContext(), v8String(isolate(), name)) |
341 .ToChecked(); | 332 .ToChecked(); |
342 } | 333 } |
(...skipping 10 matching lines...) Expand all Loading... |
353 | 344 |
354 setSecurityToken(origin); | 345 setSecurityToken(origin); |
355 } | 346 } |
356 | 347 |
357 LocalWindowProxy::LocalWindowProxy(v8::Isolate* isolate, | 348 LocalWindowProxy::LocalWindowProxy(v8::Isolate* isolate, |
358 LocalFrame& frame, | 349 LocalFrame& frame, |
359 RefPtr<DOMWrapperWorld> world) | 350 RefPtr<DOMWrapperWorld> world) |
360 : WindowProxy(isolate, frame, std::move(world)) {} | 351 : WindowProxy(isolate, frame, std::move(world)) {} |
361 | 352 |
362 } // namespace blink | 353 } // namespace blink |
OLD | NEW |