v8::Handle<v8::Object> V8TestInterfaceDocument::createWrapper(PassRefPtr<TestInterfaceDocument> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) { ASSERT(impl); ASSERT(!DOMDataStore::containsWrapper<V8TestInterfaceDocument>(impl.get(), isolate)); if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) { const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObject(impl.get()); // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapperTypeInfo. These will both have // the same object de-ref functions, though, so use that as the basis of the check. RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction == wrapperTypeInfo.derefObjectFunction); } if (Frame* frame = impl->frame()) { if (frame->script().initializeMainWorld()) { // initializeMainWorld may have created a wrapper for the object, retry from the start. v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapper<V8TestInterfaceDocument>(impl.get(), isolate); if (!wrapper.IsEmpty()) return wrapper; } } v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext, &wrapperTypeInfo, toInternalPointer(impl.get()), isolate); if (UNLIKELY(wrapper.IsEmpty())) return wrapper; installPerContextEnabledProperties(wrapper, impl.get(), isolate); V8DOMWrapper::associateObjectWithWrapper<V8TestInterfaceDocument>(impl, &wrapperTypeInfo, wrapper, isolate, WrapperConfiguration::Dependent); return wrapper; }
void Frame::setDocument(PassRefPtr<Document> newDoc) { ASSERT(!newDoc || newDoc->frame()); if (m_doc && m_doc->attached() && !m_doc->inPageCache()) { // FIXME: We don't call willRemove here. Why is that OK? m_doc->detach(); } m_doc = newDoc; selection()->updateSecureKeyboardEntryIfActive(); if (m_doc && !m_doc->attached()) m_doc->attach(); // Update the cached 'document' property, which is now stale. m_script.updateDocument(); if (m_doc) m_doc->updateViewportArguments(); if (m_page && m_page->mainFrame() == this) { notifyChromeClientWheelEventHandlerCountChanged(); notifyChromeClientTouchEventHandlerCountChanged(); } }
JSDOMWindowBase::JSDOMWindowBase(VM& vm, Structure* structure, PassRefPtr<DOMWindow> window, JSDOMWindowShell* shell) : JSDOMGlobalObject(vm, structure, &shell->world(), &s_globalObjectMethodTable) , m_windowCloseWatchpoints((window && window->frame()) ? IsWatched : IsInvalidated) , m_impl(window) , m_shell(shell) { }
void Frame::setDocument(PassRefPtr<Document> newDoc) { ASSERT(!newDoc || newDoc->frame()); if (m_doc && m_doc->attached() && !m_doc->inPageCache()) { // FIXME: We don't call willRemove here. Why is that OK? m_doc->detach(); } m_doc = newDoc; selection()->updateSecureKeyboardEntryIfActive(); if (m_doc && !m_doc->attached()) m_doc->attach(); // Update the cached 'document' property, which is now stale. m_script.updateDocument(); if (m_doc) m_doc->updateViewportArguments(); if (m_page && m_page->mainFrame() == this) { notifyChromeClientWheelEventHandlerCountChanged(); notifyChromeClientTouchEventHandlerCountChanged(); } // Suspend document if this frame was created in suspended state. if (m_doc && activeDOMObjectsAndAnimationsSuspended()) { m_doc->suspendScriptedAnimationControllerCallbacks(); m_animationController.suspendAnimationsForDocument(m_doc.get()); m_doc->suspendActiveDOMObjects(ActiveDOMObject::PageWillBeSuspended); } }
JSDOMWindowBase::JSDOMWindowBase(VM& vm, Structure* structure, PassRefPtr<DOMWindow> window, JSDOMWindowShell* shell) : JSDOMGlobalObject(vm, structure, &shell->world(), &s_globalObjectMethodTable) , m_windowCloseWatchpoints((window && window->frame()) ? IsWatched : IsInvalidated) , m_impl(window) , m_shell(shell) #if ENABLE(STREAMS_API) , m_readableStreamFunctions(vm) #endif { }
void Frame::setDocument(PassRefPtr<Document> newDocument) { ASSERT(!newDocument || newDocument->frame() == this); if (m_doc && m_doc->attached() && !m_doc->inPageCache()) { // FIXME: We don't call willRemove here. Why is that OK? m_doc->detach(); } m_doc = newDocument.get(); ASSERT(!m_doc || m_doc->domWindow()); ASSERT(!m_doc || m_doc->domWindow()->frame() == this); // Don't use m_doc because it can be overwritten and we want to guarantee // that the document is not destroyed during this function call. if (newDocument) newDocument->didBecomeCurrentDocumentInFrame(); }
void Frame::setDocument(PassRefPtr<Document> newDoc) { ASSERT(!newDoc || newDoc->frame()); if (m_doc && m_doc->attached() && !m_doc->inPageCache()) { // FIXME: We don't call willRemove here. Why is that OK? m_doc->detach(); } m_doc = newDoc; selection()->updateSecureKeyboardEntryIfActive(); if (m_doc && !m_doc->attached()) m_doc->attach(); // Update the cached 'document' property, which is now stale. m_script.updateDocument(); if (m_page) m_page->updateViewportArguments(); }
void Frame::setDocument(PassRefPtr<Document> newDoc) { ASSERT(!newDoc || newDoc->frame() == this); if (m_doc && m_doc->attached() && !m_doc->inPageCache()) { // FIXME: We don't call willRemove here. Why is that OK? m_doc->detach(); } m_doc = newDoc; ASSERT(!m_doc || m_doc->domWindow()); ASSERT(!m_doc || m_doc->domWindow()->frame() == this); selection()->updateSecureKeyboardEntryIfActive(); if (m_doc && !m_doc->attached()) m_doc->attach(); if (m_doc) { m_script.updateDocument(); m_doc->updateViewportArguments(); } if (m_page && m_page->mainFrame() == this) { notifyChromeClientWheelEventHandlerCountChanged(); #if ENABLE(TOUCH_EVENTS) if (m_doc && m_doc->touchEventHandlerCount()) m_page->chrome()->client()->needTouchEvents(true); #endif } // Suspend document if this frame was created in suspended state. if (m_doc && activeDOMObjectsAndAnimationsSuspended()) { m_doc->suspendScriptedAnimationControllerCallbacks(); m_animationController.suspendAnimationsForDocument(m_doc.get()); m_doc->suspendActiveDOMObjects(ActiveDOMObject::PageWillBeSuspended); } }
void Frame::setDocument(PassRefPtr<Document> newDoc) { ASSERT(!newDoc || newDoc->frame()); if (m_doc && m_doc->attached() && !m_doc->inPageCache()) { // FIXME: We don't call willRemove here. Why is that OK? m_doc->detach(); } m_doc = newDoc; #if PLATFORM(ANDROID) // Temporary hack for http://b/5188895 m_isDocumentUpToDate = true; #endif selection()->updateSecureKeyboardEntryIfActive(); if (m_doc && !m_doc->attached()) m_doc->attach(); // Update the cached 'document' property, which is now stale. m_script.updateDocument(); if (m_page) m_page->updateViewportArguments(); }