Diff
Modified: trunk/LayoutTests/ChangeLog (93912 => 93913)
--- trunk/LayoutTests/ChangeLog 2011-08-26 21:36:42 UTC (rev 93912)
+++ trunk/LayoutTests/ChangeLog 2011-08-26 21:40:45 UTC (rev 93913)
@@ -1,3 +1,24 @@
+2011-08-26 Alexey Proskuryakov <[email protected]>
+
+ Get rid of frame life support timer
+ https://bugs.webkit.org/show_bug.cgi?id=66874
+
+ Reviewed by Geoff Garen.
+
+ * fast/dom/resources/xmlhttprequest-constructor-in-detached-document-frame.html:
+ * fast/dom/xmlhttprequest-constructor-in-detached-document-expected.txt:
+ The test used to access XMLHttpRequest constructor from a detached frame. Modified the test
+ to also try a stored constructor, and added an error that's clogged when trying that in a
+ detached frame to test output.
+
+ * fast/frames/detached-frame-property-expected.txt: Added.
+ * fast/frames/detached-frame-property.html: Added.
+ Added a test to check for the new, more compatible behavior.
+
+ * fast/storage/storage-detached-iframe.html:
+ Store a reference to localStorage before detaching a frame, as it won't be available
+ afterwards any more.
+
2011-08-26 Martin Robinson <[email protected]>
fast/js/const.html is opening a modal print dialog, leading to a timeout on the GTK+ bots
Modified: trunk/LayoutTests/fast/dom/resources/xmlhttprequest-constructor-in-detached-document-frame.html (93912 => 93913)
--- trunk/LayoutTests/fast/dom/resources/xmlhttprequest-constructor-in-detached-document-frame.html 2011-08-26 21:36:42 UTC (rev 93912)
+++ trunk/LayoutTests/fast/dom/resources/xmlhttprequest-constructor-in-detached-document-frame.html 2011-08-26 21:40:45 UTC (rev 93913)
@@ -4,8 +4,13 @@
xhr._onreadystatechange_ = function(evt) {
if (evt.target.readyState == 4) {
parent.setTimeout("pass()", 0);
+ var xhrConstructor = XMLHttpRequest; // The constructor may not be reachable as window object property after detaching the frame.
parent.document.body.removeChild(parent.document.getElementsByTagName("iframe")[0]);
- var req = new XMLHttpRequest;
+ try {
+ var req = new XMLHttpRequest;
+ } catch (ex) {
+ var req = new xhrConstructor;
+ }
req.open("GET", "xmlhttprequest-constructor-in-detached-document-frame.html", false);
req.send(null);
}
Modified: trunk/LayoutTests/fast/dom/xmlhttprequest-constructor-in-detached-document-expected.txt (93912 => 93913)
--- trunk/LayoutTests/fast/dom/xmlhttprequest-constructor-in-detached-document-expected.txt 2011-08-26 21:36:42 UTC (rev 93912)
+++ trunk/LayoutTests/fast/dom/xmlhttprequest-constructor-in-detached-document-expected.txt 2011-08-26 21:40:45 UTC (rev 93913)
@@ -1,3 +1,4 @@
+CONSOLE MESSAGE: line 12: ReferenceError: XMLHttpRequest constructor associated document is unavailable
Text for bug 25290: Crash when constructing XMLHttpRequest in a detached document.
PASS
Added: trunk/LayoutTests/fast/frames/detached-frame-property-expected.txt (0 => 93913)
--- trunk/LayoutTests/fast/frames/detached-frame-property-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/frames/detached-frame-property-expected.txt 2011-08-26 21:40:45 UTC (rev 93913)
@@ -0,0 +1,4 @@
+Test that properties in a detached subframe become unavailable immediately.
+
+PASS
+
Property changes on: trunk/LayoutTests/fast/frames/detached-frame-property-expected.txt
___________________________________________________________________
Added: svn:mime-type
Added: svn:eol-style
Added: trunk/LayoutTests/fast/frames/detached-frame-property.html (0 => 93913)
--- trunk/LayoutTests/fast/frames/detached-frame-property.html (rev 0)
+++ trunk/LayoutTests/fast/frames/detached-frame-property.html 2011-08-26 21:40:45 UTC (rev 93913)
@@ -0,0 +1,14 @@
+<p>Test that properties in a detached subframe become unavailable immediately.</p>
+<script>
+if (window.layoutTestController)
+ layoutTestController.dumpAsText();
+
+_onload_ = function()
+{
+ var childWindow = frames[0];
+ document.body.removeChild(document.getElementsByTagName("iframe")[0]);
+ document.getElementById("result").innerHTML = childWindow.XMLHttpRequest ? "FAIL" : "PASS";
+}
+</script>
+<div id="result">FAIL: Script did not run</div>
+<iframe src=""
Property changes on: trunk/LayoutTests/fast/frames/detached-frame-property.html
___________________________________________________________________
Added: svn:mime-type
Modified: trunk/LayoutTests/fast/storage/storage-detached-iframe.html (93912 => 93913)
--- trunk/LayoutTests/fast/storage/storage-detached-iframe.html 2011-08-26 21:36:42 UTC (rev 93912)
+++ trunk/LayoutTests/fast/storage/storage-detached-iframe.html 2011-08-26 21:40:45 UTC (rev 93913)
@@ -26,9 +26,10 @@
t1 = openIframe();
var a = t1.contentWindow.frames;
var b = t1.contentDocument.defaultView.localStorage;
+ var a_localStorage = a.localStorage; // The constructor won't be reachable as window object property after detaching the frame.
t1.outerText = "";
- a.localStorage.fuzz3_visited="test";
+ a_localStorage.fuzz3_visited="test";
}
function runTests() {
Modified: trunk/Source/_javascript_Core/ChangeLog (93912 => 93913)
--- trunk/Source/_javascript_Core/ChangeLog 2011-08-26 21:36:42 UTC (rev 93912)
+++ trunk/Source/_javascript_Core/ChangeLog 2011-08-26 21:40:45 UTC (rev 93913)
@@ -1,3 +1,14 @@
+2011-08-26 Alexey Proskuryakov <[email protected]>
+
+ Get rid of frame life support timer
+ https://bugs.webkit.org/show_bug.cgi?id=66874
+
+ Reviewed by Geoff Garen.
+
+ * runtime/JSGlobalObject.h:
+ * _javascript_Core.vcproj/_javascript_Core/_javascript_Core.def:
+ globalExec() no longer needs to be virtual, its only override was in JSDOMWindowBase.
+
2011-08-26 Chao-ying Fu <[email protected]>
Fix MIPS patchOffsetGetByIdSlowCaseCall
Modified: trunk/Source/_javascript_Core/_javascript_Core.vcproj/_javascript_Core/_javascript_Core.def (93912 => 93913)
--- trunk/Source/_javascript_Core/_javascript_Core.vcproj/_javascript_Core/_javascript_Core.def 2011-08-26 21:36:42 UTC (rev 93912)
+++ trunk/Source/_javascript_Core/_javascript_Core.vcproj/_javascript_Core/_javascript_Core.def 2011-08-26 21:40:45 UTC (rev 93913)
@@ -204,7 +204,7 @@
?getString@JSCell@JSC@@QBE_NPAVExecState@2@AAVUString@2@@Z
?getUInt32@JSCell@JSC@@UBE_NAAI@Z
?getter@PropertyDescriptor@JSC@@QBE?AVJSValue@2@XZ
- ?globalExec@JSGlobalObject@JSC@@UAEPAVExecState@2@XZ
+ ?globalExec@JSGlobalObject@JSC@@QAEPAVExecState@2@XZ
?globalObject@JSObjectWithGlobalObject@JSC@@QBEPAVJSGlobalObject@2@XZ
?globalObjectCount@Heap@JSC@@QAEIXZ
?grow@HandleHeap@JSC@@AAEXXZ
Modified: trunk/Source/_javascript_Core/runtime/JSGlobalObject.h (93912 => 93913)
--- trunk/Source/_javascript_Core/runtime/JSGlobalObject.h 2011-08-26 21:36:42 UTC (rev 93912)
+++ trunk/Source/_javascript_Core/runtime/JSGlobalObject.h 2011-08-26 21:40:45 UTC (rev 93913)
@@ -262,7 +262,7 @@
virtual bool isGlobalObject() const { return true; }
- virtual ExecState* globalExec();
+ ExecState* globalExec();
virtual bool shouldInterruptScript() const { return true; }
Modified: trunk/Source/WebCore/ChangeLog (93912 => 93913)
--- trunk/Source/WebCore/ChangeLog 2011-08-26 21:36:42 UTC (rev 93912)
+++ trunk/Source/WebCore/ChangeLog 2011-08-26 21:40:45 UTC (rev 93913)
@@ -1,3 +1,32 @@
+2011-08-26 Alexey Proskuryakov <[email protected]>
+
+ Get rid of frame life support timer
+ https://bugs.webkit.org/show_bug.cgi?id=66874
+
+ Reviewed by Geoff Garen. V8 fixes courtesy of Dmitry Titov.
+
+ Test: fast/frames/detached-frame-property.html
+
+ * bindings/js/JSDOMWindowBase.cpp:
+ * bindings/js/JSDOMWindowBase.h:
+ * bindings/js/ScriptController.cpp: (WebCore::ScriptController::evaluateInWorld):
+ * bindings/v8/ScriptController.cpp: (WebCore::ScriptController::evaluate):
+ * bindings/v8/V8Proxy.cpp:
+ (WebCore::V8Proxy::runScript):
+ (WebCore::V8Proxy::callFunction):
+ (WebCore::V8Proxy::newInstance):
+ * page/Frame.cpp:
+ (WebCore::Frame::Frame):
+ (WebCore::Frame::~Frame):
+ (WebCore::Frame::pageDestroyed):
+ * page/Frame.h:
+ * page/Page.cpp: (WebCore::Page::~Page):
+ Removed all code that dealt with the life support timer. Protect Frame inside runScript()
+ and callFunction() for v8 bindings.
+
+ * bindings/js/JSEventListener.cpp: (WebCore::JSEventListener::handleEvent):
+ Replaced ref/deref calls on self with a RefPtr.
+
2011-08-26 Ned Holbrook <[email protected]>
RenderText::computePreferredLogicalWidths() should measure words with trailing spaces
Modified: trunk/Source/WebCore/bindings/js/JSDOMWindowBase.cpp (93912 => 93913)
--- trunk/Source/WebCore/bindings/js/JSDOMWindowBase.cpp 2011-08-26 21:36:42 UTC (rev 93912)
+++ trunk/Source/WebCore/bindings/js/JSDOMWindowBase.cpp 2011-08-26 21:40:45 UTC (rev 93913)
@@ -80,15 +80,6 @@
printErrorMessageForFrame(impl()->frame(), message);
}
-ExecState* JSDOMWindowBase::globalExec()
-{
- // We need to make sure that any script execution happening in this
- // frame does not destroy it
- if (Frame *frame = impl()->frame())
- frame->keepAlive();
- return Base::globalExec();
-}
-
bool JSDOMWindowBase::supportsProfiling() const
{
#if !ENABLE(_javascript__DEBUGGER) || !ENABLE(INSPECTOR)
Modified: trunk/Source/WebCore/bindings/js/JSDOMWindowBase.h (93912 => 93913)
--- trunk/Source/WebCore/bindings/js/JSDOMWindowBase.h 2011-08-26 21:36:42 UTC (rev 93912)
+++ trunk/Source/WebCore/bindings/js/JSDOMWindowBase.h 2011-08-26 21:40:45 UTC (rev 93913)
@@ -55,7 +55,6 @@
return JSC::Structure::create(globalData, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount, &s_info);
}
- virtual JSC::ExecState* globalExec();
virtual bool supportsProfiling() const;
virtual bool supportsRichSourceInfo() const;
virtual bool shouldInterruptScript() const;
Modified: trunk/Source/WebCore/bindings/js/JSEventListener.cpp (93912 => 93913)
--- trunk/Source/WebCore/bindings/js/JSEventListener.cpp 2011-08-26 21:36:42 UTC (rev 93912)
+++ trunk/Source/WebCore/bindings/js/JSEventListener.cpp 2011-08-26 21:40:45 UTC (rev 93913)
@@ -104,7 +104,7 @@
}
if (callType != CallTypeNone) {
- ref();
+ RefPtr<JSEventListener> protect(this);
MarkedArgumentBuffer args;
args.append(toJS(exec, globalObject, event));
@@ -151,8 +151,6 @@
event->preventDefault();
}
}
-
- deref();
}
}
Modified: trunk/Source/WebCore/bindings/js/ScriptController.cpp (93912 => 93913)
--- trunk/Source/WebCore/bindings/js/ScriptController.cpp 2011-08-26 21:36:42 UTC (rev 93912)
+++ trunk/Source/WebCore/bindings/js/ScriptController.cpp 2011-08-26 21:40:45 UTC (rev 93913)
@@ -144,10 +144,6 @@
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());
Modified: trunk/Source/WebCore/bindings/v8/ScriptController.cpp (93912 => 93913)
--- trunk/Source/WebCore/bindings/v8/ScriptController.cpp 2011-08-26 21:36:42 UTC (rev 93912)
+++ trunk/Source/WebCore/bindings/v8/ScriptController.cpp 2011-08-26 21:40:45 UTC (rev 93913)
@@ -190,10 +190,6 @@
v8::Local<v8::Value> object = m_proxy->evaluate(sourceCode, 0);
- // Evaluating the _javascript_ could cause the frame to be deallocated
- // so we start the keep alive timer here.
- m_frame->keepAlive();
-
m_sourceURL = savedSourceURL;
if (object.IsEmpty())
Modified: trunk/Source/WebCore/bindings/v8/V8Proxy.cpp (93912 => 93913)
--- trunk/Source/WebCore/bindings/v8/V8Proxy.cpp 2011-08-26 21:36:42 UTC (rev 93912)
+++ trunk/Source/WebCore/bindings/v8/V8Proxy.cpp 2011-08-26 21:40:45 UTC (rev 93913)
@@ -421,14 +421,14 @@
bool previousInlineCode = inlineCode();
setInlineCode(isInlineCode);
+ // Keep Frame (and therefore ScriptController and V8Proxy) alive.
+ RefPtr<Frame> protect(frame());
+
// Run the script and keep track of the current recursion depth.
v8::Local<v8::Value> result;
v8::TryCatch tryCatch;
tryCatch.SetVerbose(true);
{
- // See comment in V8Proxy::callFunction.
- m_frame->keepAlive();
-
m_recursion++;
result = script->Run();
m_recursion--;
@@ -461,6 +461,10 @@
v8::Local<v8::Value> V8Proxy::callFunction(v8::Handle<v8::Function> function, v8::Handle<v8::Object> receiver, int argc, v8::Handle<v8::Value> args[])
{
V8GCController::checkMemoryUsage();
+
+ // Keep Frame (and therefore ScriptController and V8Proxy) alive.
+ RefPtr<Frame> protect(frame());
+
v8::Local<v8::Value> result;
{
if (m_recursion >= kMaxRecursionDepth) {
@@ -474,13 +478,6 @@
return result;
}
- // Evaluating the _javascript_ could cause the frame to be deallocated,
- // so we start the keep alive timer here.
- // Frame::keepAlive method adds the ref count of the frame and sets a
- // timer to decrease the ref count. It assumes that the current _javascript_
- // execution finishs before firing the timer.
- m_frame->keepAlive();
-
InspectorInstrumentationCookie cookie;
if (InspectorInstrumentation::hasFrontends()) {
v8::ScriptOrigin origin = function->GetScriptOrigin();
@@ -526,9 +523,6 @@
// V8Proxy::callFunction.
v8::Local<v8::Value> result;
{
- // See comment in V8Proxy::callFunction.
- m_frame->keepAlive();
-
result = constructor->NewInstance(argc, args);
}
Modified: trunk/Source/WebCore/page/Frame.cpp (93912 => 93913)
--- trunk/Source/WebCore/page/Frame.cpp 2011-08-26 21:36:42 UTC (rev 93912)
+++ trunk/Source/WebCore/page/Frame.cpp 2011-08-26 21:40:45 UTC (rev 93913)
@@ -158,7 +158,6 @@
, m_selection(this)
, m_eventHandler(this)
, m_animationController(this)
- , m_lifeSupportTimer(this, &Frame::lifeSupportTimerFired)
, m_pageZoomFactor(parentPageZoomFactor(this))
, m_textZoomFactor(parentTextZoomFactor(this))
, m_pageScaleFactor(1)
@@ -218,8 +217,6 @@
// FIXME: We should not be doing all this work inside the destructor
- ASSERT(!m_lifeSupportTimer.isActive());
-
#ifndef NDEBUG
frameCounter.decrement();
#endif
@@ -248,8 +245,6 @@
m_view->hide();
m_view->clearFrame();
}
-
- ASSERT(!m_lifeSupportTimer.isActive());
}
void Frame::addDestructionObserver(FrameDestructionObserver* observer)
@@ -590,46 +585,6 @@
}
}
-#ifndef NDEBUG
-static HashSet<Frame*>& keepAliveSet()
-{
- DEFINE_STATIC_LOCAL(HashSet<Frame*>, staticKeepAliveSet, ());
- return staticKeepAliveSet;
-}
-#endif
-
-void Frame::keepAlive()
-{
- if (m_lifeSupportTimer.isActive())
- return;
-#ifndef NDEBUG
- keepAliveSet().add(this);
-#endif
- ref();
- m_lifeSupportTimer.startOneShot(0);
-}
-
-#ifndef NDEBUG
-void Frame::cancelAllKeepAlive()
-{
- HashSet<Frame*>::iterator end = keepAliveSet().end();
- for (HashSet<Frame*>::iterator it = keepAliveSet().begin(); it != end; ++it) {
- Frame* frame = *it;
- frame->m_lifeSupportTimer.stop();
- frame->deref();
- }
- keepAliveSet().clear();
-}
-#endif
-
-void Frame::lifeSupportTimerFired(Timer<Frame>*)
-{
-#ifndef NDEBUG
- keepAliveSet().remove(this);
-#endif
- deref();
-}
-
void Frame::clearDOMWindow()
{
if (m_domWindow) {
@@ -753,10 +708,6 @@
if (page() && page()->focusController()->focusedFrame() == this)
page()->focusController()->setFocusedFrame(0);
- // FIXME: Removing keepalive will make behavior better match Firefox.
- // Some code that used to be here indirectly triggered keepalive, and we don't want to change behavior at the moment.
- keepAlive();
-
script()->clearScriptObjects();
script()->updatePlatformScriptObjects();
Modified: trunk/Source/WebCore/page/Frame.h (93912 => 93913)
--- trunk/Source/WebCore/page/Frame.h 2011-08-26 21:36:42 UTC (rev 93912)
+++ trunk/Source/WebCore/page/Frame.h 2011-08-26 21:40:45 UTC (rev 93913)
@@ -153,9 +153,6 @@
bool inViewSourceMode() const;
void setInViewSourceMode(bool = true);
- void keepAlive(); // Used to keep the frame alive when running a script that might destroy it.
- static void cancelAllKeepAlive();
-
void setDocument(PassRefPtr<Document>);
void setPageZoomFactor(float factor);
@@ -219,7 +216,6 @@
Frame(Page*, HTMLFrameOwnerElement*, FrameLoaderClient*);
void injectUserScriptsForWorld(DOMWrapperWorld*, const UserScriptVector&, UserScriptInjectionTime);
- void lifeSupportTimerFired(Timer<Frame>*);
HashSet<FrameDestructionObserver*> m_destructionObservers;
@@ -242,8 +238,6 @@
mutable EventHandler m_eventHandler;
mutable AnimationController m_animationController;
- Timer<Frame> m_lifeSupportTimer;
-
float m_pageZoomFactor;
float m_textZoomFactor;
Modified: trunk/Source/WebCore/page/Page.cpp (93912 => 93913)
--- trunk/Source/WebCore/page/Page.cpp 2011-08-26 21:36:42 UTC (rev 93912)
+++ trunk/Source/WebCore/page/Page.cpp 2011-08-26 21:40:45 UTC (rev 93913)
@@ -203,11 +203,6 @@
#ifndef NDEBUG
pageCounter.decrement();
-
- // Cancel keepAlive timers, to ensure we release all Frames before exiting.
- // It's safe to do this because we prohibit closing a Page while _javascript_
- // is executing.
- Frame::cancelAllKeepAlive();
#endif
}