void ScriptController::clearWindowShell(bool goingIntoPageCache) { if (m_windowShells.isEmpty()) return; JSLock lock(SilenceAssertionsOnly); for (ShellMap::iterator iter = m_windowShells.begin(); iter != m_windowShells.end(); ++iter) { JSDOMWindowShell* windowShell = iter->second.get(); // Clear the debugger from the current window before setting the new window. attachDebugger(windowShell, 0); windowShell->window()->willRemoveFromWindowShell(); windowShell->setWindow(m_frame->domWindow()); // An m_cacheableBindingRootObject persists between page navigations // so needs to know about the new JSDOMWindow. if (m_cacheableBindingRootObject) m_cacheableBindingRootObject->updateGlobalObject(windowShell->window()); if (Page* page = m_frame->page()) { attachDebugger(windowShell, page->debugger()); windowShell->window()->setProfileGroup(page->group().identifier()); } } // It's likely that resetting our windows created a lot of garbage, unless // it went in a back/forward cache. if (!goingIntoPageCache) gcController().garbageCollectSoon(); }
JSValue JSHTMLDocument::open(ExecState* exec) { // For compatibility with other browsers, pass open calls with more than 2 parameters to the window. if (exec->argumentCount() > 2) { Frame* frame = static_cast<HTMLDocument*>(impl())->frame(); if (frame) { JSDOMWindowShell* wrapper = toJSDOMWindowShell(frame, currentWorld(exec)); if (wrapper) { JSValue function = wrapper->get(exec, Identifier(exec, "open")); CallData callData; CallType callType = ::getCallData(function, callData); if (callType == CallTypeNone) return throwTypeError(exec); return JSC::call(exec, function, callType, callData, wrapper, ArgList(exec)); } } return jsUndefined(); } // document.open clobbers the security context of the document and // aliases it with the active security context. Document* activeDocument = asJSDOMWindow(exec->lexicalGlobalObject())->impl()->document(); // In the case of two parameters or fewer, do a normal document open. static_cast<HTMLDocument*>(impl())->open(activeDocument); return this; }
JSValue JSHTMLDocument::open(ExecState& state) { // For compatibility with other browsers, pass open calls with more than 2 parameters to the window. if (state.argumentCount() > 2) { if (Frame* frame = wrapped().frame()) { JSDOMWindowShell* wrapper = toJSDOMWindowShell(frame, currentWorld(&state)); if (wrapper) { JSValue function = wrapper->get(&state, Identifier::fromString(&state, "open")); CallData callData; CallType callType = ::getCallData(function, callData); if (callType == CallTypeNone) return throwTypeError(&state); return JSC::call(&state, function, callType, callData, wrapper, ArgList(&state)); } } return jsUndefined(); } // document.open clobbers the security context of the document and // aliases it with the active security context. Document* activeDocument = asJSDOMWindow(state.lexicalGlobalObject())->wrapped().document(); // In the case of two parameters or fewer, do a normal document open. wrapped().open(activeDocument); return this; }
void ScriptCachedFrameData::restore(Frame* frame) { JSLockHolder lock(JSDOMWindowBase::commonJSGlobalData()); ScriptController* scriptController = frame->script(); ScriptController::ShellMap& windowShells = scriptController->m_windowShells; ScriptController::ShellMap::iterator windowShellsEnd = windowShells.end(); for (ScriptController::ShellMap::iterator iter = windowShells.begin(); iter != windowShellsEnd; ++iter) { DOMWrapperWorld* world = iter->first.get(); JSDOMWindowShell* windowShell = iter->second.get(); if (JSDOMWindow* window = m_windows.get(world).get()) windowShell->setWindow(window->globalData(), window); else { DOMWindow* domWindow = frame->document()->domWindow(); if (windowShell->window()->impl() == domWindow) continue; windowShell->setWindow(domWindow); if (Page* page = frame->page()) { scriptController->attachDebugger(windowShell, page->debugger()); windowShell->window()->setProfileGroup(page->group().identifier()); } } } }
void ScriptController::disableEval() { JSDOMWindowShell* windowShell = existingWindowShell(mainThreadNormalWorld()); if (!windowShell) return; windowShell->window()->setEvalEnabled(false); }
bool ScriptController::anyPageIsProcessingUserGesture() const { Page* page = m_frame->page(); if (!page) return false; const HashSet<Page*>& pages = page->group().pages(); HashSet<Page*>::const_iterator end = pages.end(); for (HashSet<Page*>::const_iterator it = pages.begin(); it != end; ++it) { for (Frame* frame = page->mainFrame(); frame; frame = frame->tree()->traverseNext()) { ScriptController* script = frame->script(); if (script->m_allowPopupsFromPlugin) return true; const ShellMap::const_iterator iterEnd = m_windowShells.end(); for (ShellMap::const_iterator iter = m_windowShells.begin(); iter != iterEnd; ++iter) { JSDOMWindowShell* shell = iter->second.get(); Event* event = shell->window()->currentEvent(); if (event && event->fromUserGesture()) return true; } if (isJavaScriptAnchorNavigation()) return true; } } return false; }
void ScriptController::enableEval() { JSDOMWindowShell* windowShell = existingWindowShell(mainThreadNormalWorld()); if (!windowShell) return; // Eval is enabled by default. windowShell->window()->setEvalEnabled(true); }
void ScriptController::updateDocument() { Vector<JSC::Strong<JSDOMWindowShell>> windowShells = this->windowShells(); for (size_t i = 0; i < windowShells.size(); ++i) { JSDOMWindowShell* windowShell = windowShells[i].get(); JSLockHolder lock(windowShell->world().vm()); windowShell->window()->updateDocument(); } }
void JSDOMWindowShell::visitChildren(JSCell* cell, SlotVisitor& visitor) { JSDOMWindowShell* thisObject = static_cast<JSDOMWindowShell*>(cell); ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info); COMPILE_ASSERT(StructureFlags & OverridesVisitChildren, OverridesVisitChildrenWithoutSettingFlag); ASSERT(thisObject->structure()->typeInfo().overridesVisitChildren()); Base::visitChildren(thisObject, visitor); if (thisObject->m_window) visitor.append(&thisObject->m_window); }
ScriptValue ScriptController::evaluateInWorld(const ScriptSourceCode& sourceCode, DOMWrapperWorld* world, ShouldAllowXSS shouldAllowXSS) { const SourceCode& jsSourceCode = sourceCode.jsSourceCode(); String sourceURL = ustringToString(jsSourceCode.provider()->url()); if (shouldAllowXSS == DoNotAllowXSS && !m_XSSAuditor->canEvaluate(sourceCode.source())) { // This script is not safe to be evaluated. return JSValue(); } // evaluate code. Returns the JS return value or 0 // if there was none, an error occurred or the type couldn't be converted. // inlineCode is true for <a href="javascript:doSomething()"> // and false for <script>doSomething()</script>. Check if it has the // expected value in all cases. // See smart window.open policy for where this is used. JSDOMWindowShell* shell = windowShell(world); ExecState* exec = shell->window()->globalExec(); const String* savedSourceURL = m_sourceURL; m_sourceURL = &sourceURL; JSLock lock(SilenceAssertionsOnly); RefPtr<Frame> protect = m_frame; #if ENABLE(INSPECTOR) if (InspectorTimelineAgent* timelineAgent = m_frame->page() ? m_frame->page()->inspectorTimelineAgent() : 0) timelineAgent->willEvaluateScript(sourceURL, sourceCode.startLine()); #endif exec->globalData().timeoutChecker.start(); Completion comp = JSMainThreadExecState::evaluate(exec, exec->dynamicGlobalObject()->globalScopeChain(), jsSourceCode, shell); exec->globalData().timeoutChecker.stop(); #if ENABLE(INSPECTOR) if (InspectorTimelineAgent* timelineAgent = m_frame->page() ? m_frame->page()->inspectorTimelineAgent() : 0) timelineAgent->didEvaluateScript(); #endif // Evaluating the JavaScript could cause the frame to be deallocated // so we start the keep alive timer here. m_frame->keepAlive(); if (comp.complType() == Normal || comp.complType() == ReturnValue) { m_sourceURL = savedSourceURL; return comp.value(); } if (comp.complType() == Throw || comp.complType() == Interrupted) reportException(exec, comp.value()); m_sourceURL = savedSourceURL; return JSValue(); }
bool ScriptController::executeIfJavaScriptURL(const KURL& url, ShouldReplaceDocumentIfJavaScriptURL shouldReplaceDocumentIfJavaScriptURL) { if (!protocolIsJavaScript(url)) return false; if (!m_frame->page() || !m_frame->page()->javaScriptURLsAreAllowed() || !m_frame->document()->contentSecurityPolicy()->allowJavaScriptURLs() || m_frame->inViewSourceMode()) return true; // We need to hold onto the Frame here because executing script can // destroy the frame. RefPtr<Frame> protector(m_frame); RefPtr<Document> ownerDocument(m_frame->document()); const int javascriptSchemeLength = sizeof("javascript:") - 1; String decodedURL = decodeURLEscapeSequences(url.string()); ScriptValue result = executeScript(decodedURL.substring(javascriptSchemeLength)); // If executing script caused this frame to be removed from the page, we // don't want to try to replace its document! if (!m_frame->page()) return true; String scriptResult; #if USE(JSC) JSDOMWindowShell* shell = windowShell(mainThreadNormalWorld()); JSC::ExecState* exec = shell->window()->globalExec(); if (!result.getString(exec, scriptResult)) return true; #else if (!result.getString(scriptResult)) return true; #endif // FIXME: We should always replace the document, but doing so // synchronously can cause crashes: // http://bugs.webkit.org/show_bug.cgi?id=16782 if (shouldReplaceDocumentIfJavaScriptURL == ReplaceDocumentIfJavaScriptURL) { // We're still in a frame, so there should be a DocumentLoader. ASSERT(m_frame->document()->loader()); // DocumentWriter::replaceDocument can cause the DocumentLoader to get deref'ed and possible destroyed, // so protect it with a RefPtr. if (RefPtr<DocumentLoader> loader = m_frame->document()->loader()) loader->writer()->replaceDocument(scriptResult, ownerDocument.get()); } return true; }
ScriptCachedFrameData::ScriptCachedFrameData(Frame& frame) { JSLockHolder lock(JSDOMWindowBase::commonVM()); ScriptController& scriptController = frame.script(); Vector<JSC::Strong<JSDOMWindowShell>> windowShells = scriptController.windowShells(); for (size_t i = 0; i < windowShells.size(); ++i) { JSDOMWindowShell* windowShell = windowShells[i].get(); JSDOMWindow* window = windowShell->window(); m_windows.add(&windowShell->world(), Strong<JSDOMWindow>(window->vm(), window)); window->setConsoleClient(nullptr); } scriptController.attachDebugger(nullptr); }
bool ScriptController::executeIfJavaScriptURL(const KURL& url, bool userGesture, bool replaceDocument) { if (!protocolIsJavaScript(url)) return false; if (m_frame->page() && !m_frame->page()->javaScriptURLsAreAllowed()) return true; if (m_frame->inViewSourceMode()) return true; #if PLATFORM(APOLLO) // We should return true even though the script is not going to be executed. // Otherwise the frame will actually try to navigate to "javascript:" // which will eventually fail, but will also stop any other in progress requests in this page // like CSS files, images or JS files if (!m_frame->loader()->client()->canExecuteScriptURL()) return true; #endif const int javascriptSchemeLength = sizeof("javascript:") - 1; String decodedURL = decodeURLEscapeSequences(url.string()); ScriptValue result; if (xssAuditor()->canEvaluateJavaScriptURL(decodedURL)) result = executeScript(decodedURL.substring(javascriptSchemeLength), userGesture, AllowXSS); String scriptResult; #if USE(JSC) JSDOMWindowShell* shell = windowShell(mainThreadNormalWorld()); JSC::ExecState* exec = shell->window()->globalExec(); if (!result.getString(exec, scriptResult)) return true; #else if (!result.getString(scriptResult)) return true; #endif // FIXME: We should always replace the document, but doing so // synchronously can cause crashes: // http://bugs.webkit.org/show_bug.cgi?id=16782 if (replaceDocument) m_frame->loader()->writer()->replaceDocument(scriptResult); return true; }
void ScriptCachedFrameData::restore(Frame& frame) { JSLockHolder lock(JSDOMWindowBase::commonVM()); Page* page = frame.page(); ScriptController& scriptController = frame.script(); Vector<JSC::Strong<JSDOMWindowShell>> windowShells = scriptController.windowShells(); for (size_t i = 0; i < windowShells.size(); ++i) { JSDOMWindowShell* windowShell = windowShells[i].get(); DOMWrapperWorld* world = &windowShell->world(); if (JSDOMWindow* window = m_windows.get(world).get()) windowShell->setWindow(window->vm(), window); else { DOMWindow* domWindow = frame.document()->domWindow(); if (&windowShell->window()->impl() == domWindow) continue; windowShell->setWindow(domWindow); if (page) { scriptController.attachDebugger(windowShell, page->debugger()); windowShell->window()->setProfileGroup(page->group().identifier()); } } if (page) windowShell->window()->setConsoleClient(&page->console()); } }
void ScriptCachedPageData::restore(Page* page) { Frame* mainFrame = page->mainFrame(); JSLock lock(false); ScriptController* scriptController = mainFrame->script(); if (scriptController->haveWindowShell()) { JSDOMWindowShell* windowShell = scriptController->windowShell(); if (m_window) { windowShell->setWindow(m_window.get()); } else { windowShell->setWindow(mainFrame->domWindow()); scriptController->attachDebugger(page->debugger()); windowShell->window()->setProfileGroup(page->group().identifier()); } } }
void ScriptCachedFrameData::restore(Frame* frame) { Page* page = frame->page(); JSLock lock(SilenceAssertionsOnly); ScriptController* scriptController = frame->script(); if (scriptController->haveWindowShell()) { JSDOMWindowShell* windowShell = scriptController->windowShell(); if (m_window) { windowShell->setWindow(m_window.get()); } else { windowShell->setWindow(frame->domWindow()); scriptController->attachDebugger(page->debugger()); windowShell->window()->setProfileGroup(page->group().identifier()); } } }
ScriptValue ScriptController::evaluateInWorld(const ScriptSourceCode& sourceCode, DOMWrapperWorld* world) { const SourceCode& jsSourceCode = sourceCode.jsSourceCode(); String sourceURL = ustringToString(jsSourceCode.provider()->url()); // evaluate code. Returns the JS return value or 0 // if there was none, an error occurred or the type couldn't be converted. // inlineCode is true for <a href="javascript:doSomething()"> // and false for <script>doSomething()</script>. Check if it has the // expected value in all cases. // See smart window.open policy for where this is used. JSDOMWindowShell* shell = windowShell(world); ExecState* exec = shell->window()->globalExec(); const String* savedSourceURL = m_sourceURL; m_sourceURL = &sourceURL; JSLock lock(SilenceAssertionsOnly); RefPtr<Frame> protect = m_frame; InspectorInstrumentationCookie cookie = InspectorInstrumentation::willEvaluateScript(m_frame, sourceURL, sourceCode.startLine()); exec->globalData().timeoutChecker.start(); Completion comp = JSMainThreadExecState::evaluate(exec, exec->dynamicGlobalObject()->globalScopeChain(), jsSourceCode, shell); exec->globalData().timeoutChecker.stop(); InspectorInstrumentation::didEvaluateScript(cookie); // Evaluating the JavaScript could cause the frame to be deallocated // so we start the keep alive timer here. m_frame->keepAlive(); if (comp.complType() == Normal || comp.complType() == ReturnValue) { m_sourceURL = savedSourceURL; return ScriptValue(exec->globalData(), comp.value()); } if (comp.complType() == Throw || comp.complType() == Interrupted) reportException(exec, comp.value()); m_sourceURL = savedSourceURL; return ScriptValue(); }
JSDOMWindowShell* ScriptController::initScript(DOMWrapperWorld* world) { ASSERT(!m_windowShells.contains(world)); JSLock lock(SilenceAssertionsOnly); JSDOMWindowShell* windowShell = createWindowShell(world); windowShell->window()->updateDocument(); if (Page* page = m_frame->page()) { attachDebugger(windowShell, page->debugger()); windowShell->window()->setProfileGroup(page->group().identifier()); } m_frame->loader()->dispatchDidClearWindowObjectInWorld(world); return windowShell; }
ScriptValue ScriptController::evaluateInWorld(const ScriptSourceCode& sourceCode, DOMWrapperWorld* world) { const SourceCode& jsSourceCode = sourceCode.jsSourceCode(); String sourceURL = ustringToString(jsSourceCode.provider()->url()); // evaluate code. Returns the JS return value or 0 // if there was none, an error occurred or the type couldn't be converted. // inlineCode is true for <a href="javascript:doSomething()"> // and false for <script>doSomething()</script>. Check if it has the // expected value in all cases. // See smart window.open policy for where this is used. JSDOMWindowShell* shell = windowShell(world); ExecState* exec = shell->window()->globalExec(); const String* savedSourceURL = m_sourceURL; m_sourceURL = &sourceURL; JSLockHolder lock(exec); RefPtr<Frame> protect = m_frame; InspectorInstrumentationCookie cookie = InspectorInstrumentation::willEvaluateScript(m_frame, sourceURL, sourceCode.startLine()); JSValue evaluationException; exec->globalData().timeoutChecker.start(); JSValue returnValue = JSMainThreadExecState::evaluate(exec, exec->dynamicGlobalObject()->globalScopeChain(), jsSourceCode, shell, &evaluationException); exec->globalData().timeoutChecker.stop(); InspectorInstrumentation::didEvaluateScript(cookie); if (evaluationException) { reportException(exec, evaluationException); m_sourceURL = savedSourceURL; return ScriptValue(); } m_sourceURL = savedSourceURL; return ScriptValue(exec->globalData(), returnValue); }
JSDOMWindowShell* ScriptController::initScript(DOMWrapperWorld& world) { ASSERT(!m_windowShells.contains(&world)); JSLockHolder lock(world.vm()); JSDOMWindowShell* windowShell = createWindowShell(world); windowShell->window()->updateDocument(); if (m_frame.document()) { bool shouldBypassMainWorldContentSecurityPolicy = !world.isNormal(); if (shouldBypassMainWorldContentSecurityPolicy) windowShell->window()->setEvalEnabled(true); else windowShell->window()->setEvalEnabled(m_frame.document()->contentSecurityPolicy()->allowEval(0, shouldBypassMainWorldContentSecurityPolicy, ContentSecurityPolicy::ReportingStatus::SuppressReport), m_frame.document()->contentSecurityPolicy()->evalDisabledErrorMessage()); } if (Page* page = m_frame.page()) { attachDebugger(windowShell, page->debugger()); windowShell->window()->setProfileGroup(page->group().identifier()); windowShell->window()->setConsoleClient(&page->console()); } m_frame.loader().dispatchDidClearWindowObjectInWorld(world); return windowShell; }
JSDOMWindowShell* ScriptController::initScript(DOMWrapperWorld* world) { ASSERT(!m_windowShells.contains(world)); JSLockHolder lock(world->globalData()); JSDOMWindowShell* windowShell = createWindowShell(world); windowShell->window()->updateDocument(); if (m_frame->document()) windowShell->window()->setEvalEnabled(m_frame->document()->contentSecurityPolicy()->allowEval(0, ContentSecurityPolicy::SuppressReport)); if (Page* page = m_frame->page()) { attachDebugger(windowShell, page->debugger()); windowShell->window()->setProfileGroup(page->group().identifier()); } m_frame->loader()->dispatchDidClearWindowObjectInWorld(world); return windowShell; }
void CachedPage::restore(Page* page) { ASSERT(m_document->view() == m_view); Frame* mainFrame = page->mainFrame(); JSLock lock(false); ScriptController* proxy = mainFrame->script(); if (proxy->haveWindowShell()) { JSDOMWindowShell* windowShell = proxy->windowShell(); if (m_window) { windowShell->setWindow(m_window.get()); windowShell->window()->resumeTimeouts(m_pausedTimeouts); } else { windowShell->setWindow(mainFrame->domWindow()); proxy->attachDebugger(page->debugger()); windowShell->window()->setProfileGroup(page->group().identifier()); } } #if ENABLE(SVG) if (m_document && m_document->svgExtensions()) m_document->accessSVGExtensions()->unpauseAnimations(); #endif mainFrame->animation()->resumeAnimations(m_document.get()); mainFrame->eventHandler()->setMousePressNode(mousePressNode()); // Restore the focus appearance for the focused element. // FIXME: Right now we don't support pages w/ frames in the b/f cache. This may need to be tweaked when we add support for that. Document* focusedDocument = page->focusController()->focusedOrMainFrame()->document(); if (Node* node = focusedDocument->focusedNode()) { if (node->isElementNode()) static_cast<Element*>(node)->updateFocusAppearance(true); } }
bool ScriptController::executeIfJavaScriptURL(const KURL& url, bool userGesture, bool replaceDocument) { if (!protocolIsJavaScript(url)) return false; if (m_frame->page() && !m_frame->page()->javaScriptURLsAreAllowed()) return true; if (m_frame->inViewSourceMode()) return true; const int javascriptSchemeLength = sizeof("javascript:") - 1; String script = decodeURLEscapeSequences(url.string().substring(javascriptSchemeLength)); ScriptValue result; if (xssAuditor()->canEvaluateJavaScriptURL(script)) result = executeScript(script, userGesture); String scriptResult; #if USE(JSC) JSDOMWindowShell* shell = windowShell(mainThreadNormalWorld()); JSC::ExecState* exec = shell->window()->globalExec(); if (!result.getString(exec, scriptResult)) return true; #else if (!result.getString(scriptResult)) return true; #endif // FIXME: We should always replace the document, but doing so // synchronously can cause crashes: // http://bugs.webkit.org/show_bug.cgi?id=16782 if (replaceDocument) m_frame->loader()->replaceDocument(scriptResult); return true; }
JSValue ScriptController::evaluateInWorld(const ScriptSourceCode& sourceCode, DOMWrapperWorld& world, ExceptionDetails* exceptionDetails) { JSLockHolder lock(world.vm()); const SourceCode& jsSourceCode = sourceCode.jsSourceCode(); String sourceURL = jsSourceCode.provider()->url(); // evaluate code. Returns the JS return value or 0 // if there was none, an error occurred or the type couldn't be converted. // inlineCode is true for <a href="javascript:doSomething()"> // and false for <script>doSomething()</script>. Check if it has the // expected value in all cases. // See smart window.open policy for where this is used. JSDOMWindowShell* shell = windowShell(world); ExecState* exec = shell->window()->globalExec(); const String* savedSourceURL = m_sourceURL; m_sourceURL = &sourceURL; Ref<Frame> protect(m_frame); InspectorInstrumentationCookie cookie = InspectorInstrumentation::willEvaluateScript(m_frame, sourceURL, sourceCode.startLine()); NakedPtr<Exception> evaluationException; JSValue returnValue = JSMainThreadExecState::profiledEvaluate(exec, JSC::ProfilingReason::Other, jsSourceCode, shell, evaluationException); InspectorInstrumentation::didEvaluateScript(cookie, m_frame); if (evaluationException) { reportException(exec, evaluationException, sourceCode.cachedScript(), exceptionDetails); m_sourceURL = savedSourceURL; return { }; } m_sourceURL = savedSourceURL; return returnValue; }
void ScriptCachedFrameData::restore(Frame* frame) { JSLock lock(SilenceAssertionsOnly); ScriptController* scriptController = frame->script(); ScriptController::ShellMap& windowShells = scriptController->m_windowShells; ScriptController::ShellMap::iterator windowShellsEnd = windowShells.end(); for (ScriptController::ShellMap::iterator iter = windowShells.begin(); iter != windowShellsEnd; ++iter) { DOMWrapperWorld* world = iter->first.get(); JSDOMWindowShell* windowShell = iter->second.get(); if (JSDOMWindow* window = m_windows.get(world)) windowShell->setWindow(window->globalData(), window); else { windowShell->setWindow(frame->domWindow()); if (Page* page = frame->page()) { scriptController->attachDebugger(windowShell, page->debugger()); windowShell->window()->setProfileGroup(page->group().identifier()); } } } }
void ScriptController::clearWindowShell(DOMWindow* newDOMWindow, bool goingIntoPageCache) { if (m_windowShells.isEmpty()) return; JSLockHolder lock(JSDOMWindowBase::commonVM()); Vector<JSC::Strong<JSDOMWindowShell>> windowShells = this->windowShells(); for (size_t i = 0; i < windowShells.size(); ++i) { JSDOMWindowShell* windowShell = windowShells[i].get(); if (&windowShell->window()->wrapped() == newDOMWindow) continue; // Clear the debugger and console from the current window before setting the new window. attachDebugger(windowShell, nullptr); windowShell->window()->setConsoleClient(nullptr); // FIXME: We should clear console profiles for each frame as soon as the frame is destroyed. // Instead of clearing all of them when the main frame is destroyed. if (m_frame.isMainFrame()) { if (Page* page = m_frame.page()) page->console().clearProfiles(); } windowShell->window()->willRemoveFromWindowShell(); windowShell->setWindow(newDOMWindow); // An m_cacheableBindingRootObject persists between page navigations // so needs to know about the new JSDOMWindow. if (m_cacheableBindingRootObject) m_cacheableBindingRootObject->updateGlobalObject(windowShell->window()); if (Page* page = m_frame.page()) { attachDebugger(windowShell, page->debugger()); windowShell->window()->setProfileGroup(page->group().identifier()); windowShell->window()->setConsoleClient(&page->console()); } } // It's likely that resetting our windows created a lot of garbage, unless // it went in a back/forward cache. if (!goingIntoPageCache) collectGarbageAfterWindowShellDestruction(); }
bool JSDOMWindowShell::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor) { JSDOMWindowShell* thisObject = jsCast<JSDOMWindowShell*>(object); return thisObject->window()->methodTable()->getOwnPropertyDescriptor(thisObject->window(), exec, propertyName, descriptor); }
void JSDOMWindowShell::getOwnPropertyNames(JSObject* object, ExecState* exec, PropertyNameArray& propertyNames, EnumerationMode mode) { JSDOMWindowShell* thisObject = jsCast<JSDOMWindowShell*>(object); thisObject->window()->methodTable()->getOwnPropertyNames(thisObject->window(), exec, propertyNames, mode); }
bool JSDOMWindowShell::deleteProperty(JSCell* cell, ExecState* exec, PropertyName propertyName) { JSDOMWindowShell* thisObject = jsCast<JSDOMWindowShell*>(cell); return thisObject->window()->methodTable()->deleteProperty(thisObject->window(), exec, propertyName); }
bool JSDOMWindowShell::getOwnPropertySlot(JSCell* cell, ExecState* exec, PropertyName propertyName, PropertySlot& slot) { JSDOMWindowShell* thisObject = jsCast<JSDOMWindowShell*>(cell); return thisObject->window()->methodTable()->getOwnPropertySlot(thisObject->window(), exec, propertyName, slot); }