Title: [93235] trunk
Revision
93235
Author
[email protected]
Date
2011-08-17 12:59:57 -0700 (Wed, 17 Aug 2011)

Log Message

2011-08-16  Chang Shu  <[email protected]>

        Support reset in WebCore::Internals
        https://bugs.webkit.org/show_bug.cgi?id=66307

        Reviewed by Dimitri Glazkov.

        New tests will be added when function reset is implemented.

        Added framework code in WebCoreTestSupport. The real implementation of
        Internals::reset() depends on the need from the settings that require a reset.

        * testing/Internals.cpp:
        (WebCore::Internals::reset):
        * testing/Internals.h:
        * testing/js/WebCoreTestSupport.cpp:
        (WebCoreTestSupport::resetInternalsObject):
        * testing/js/WebCoreTestSupport.h:
        * testing/v8/WebCoreTestSupport.cpp:
        (WebCoreTestSupport::resetInternalsObject):
        * testing/v8/WebCoreTestSupport.h:

2011-08-16  Chang Shu  <[email protected]>

        Support reset in WebCore::Internals
        https://bugs.webkit.org/show_bug.cgi?id=66307

        Reviewed by Dimitri Glazkov.

        Added framework code in WebKit.

        * public/WebTestingSupport.h:
        * src/WebTestingSupport.cpp:
        (WebKit::WebTestingSupport::resetInternalsObject):

2011-08-16  Chang Shu  <[email protected]>

        Support reset in WebCore::Internals
        https://bugs.webkit.org/show_bug.cgi?id=66307

        Reviewed by Dimitri Glazkov.

        Added framework code in WebKit.

        * WebCoreSupport/DumpRenderTreeSupportQt.cpp:
        (DumpRenderTreeSupportQt::resetInternalsObject):
        * WebCoreSupport/DumpRenderTreeSupportQt.h:

2011-08-16  Chang Shu  <[email protected]>

        Support reset in WebCore::Internals
        https://bugs.webkit.org/show_bug.cgi?id=66307

        Reviewed by Dimitri Glazkov.

        Added call to resetInternalsObject in DRT.

        * DumpRenderTree/chromium/TestShell.cpp:
        (TestShell::resetTestController):
        * DumpRenderTree/mac/DumpRenderTree.mm:
        (resetWebViewToConsistentStateBeforeTesting):
        * DumpRenderTree/qt/DumpRenderTreeQt.cpp:
        (WebCore::WebPage::resetSettings):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (93234 => 93235)


--- trunk/Source/WebCore/ChangeLog	2011-08-17 19:44:03 UTC (rev 93234)
+++ trunk/Source/WebCore/ChangeLog	2011-08-17 19:59:57 UTC (rev 93235)
@@ -1,3 +1,25 @@
+2011-08-16  Chang Shu  <[email protected]>
+
+        Support reset in WebCore::Internals
+        https://bugs.webkit.org/show_bug.cgi?id=66307
+
+        Reviewed by Dimitri Glazkov.
+
+        New tests will be added when function reset is implemented.
+
+        Added framework code in WebCoreTestSupport. The real implementation of
+        Internals::reset() depends on the need from the settings that require a reset.
+
+        * testing/Internals.cpp:
+        (WebCore::Internals::reset):
+        * testing/Internals.h:
+        * testing/js/WebCoreTestSupport.cpp:
+        (WebCoreTestSupport::resetInternalsObject):
+        * testing/js/WebCoreTestSupport.h:
+        * testing/v8/WebCoreTestSupport.cpp:
+        (WebCoreTestSupport::resetInternalsObject):
+        * testing/v8/WebCoreTestSupport.h:
+
 2011-08-17  Tony Chang  <[email protected]>
 
         Fix chromium mac compile.  MediaPlayerPrivateAVFoundationObjC.* moved

Modified: trunk/Source/WebCore/testing/Internals.cpp (93234 => 93235)


--- trunk/Source/WebCore/testing/Internals.cpp	2011-08-17 19:44:03 UTC (rev 93234)
+++ trunk/Source/WebCore/testing/Internals.cpp	2011-08-17 19:59:57 UTC (rev 93235)
@@ -43,6 +43,8 @@
 
 namespace WebCore {
 
+const char* Internals::internalsId = "internals";
+
 PassRefPtr<Internals> Internals::create()
 {
     return adoptRef(new Internals);
@@ -189,4 +191,9 @@
     document->settings()->setForceCompositingMode(enabled);
 }
 
+void Internals::reset(Document*)
+{
+// FIXME: Implement
 }
+
+}

Modified: trunk/Source/WebCore/testing/Internals.h (93234 => 93235)


--- trunk/Source/WebCore/testing/Internals.h	2011-08-17 19:44:03 UTC (rev 93234)
+++ trunk/Source/WebCore/testing/Internals.h	2011-08-17 19:59:57 UTC (rev 93235)
@@ -43,7 +43,9 @@
 public:
     static PassRefPtr<Internals> create();
     virtual ~Internals();
-    
+
+    void reset(Document*);
+
     String elementRenderTreeAsText(Element*, ExceptionCode&);
 
     bool isPreloaded(Document*, const String& url);
@@ -67,6 +69,7 @@
 
     void setForceCompositingMode(Document*, bool enabled, ExceptionCode&);
 
+    static const char* internalsId;
 private:
     Internals();
 };

Modified: trunk/Source/WebCore/testing/js/WebCoreTestSupport.cpp (93234 => 93235)


--- trunk/Source/WebCore/testing/js/WebCoreTestSupport.cpp	2011-08-17 19:44:03 UTC (rev 93234)
+++ trunk/Source/WebCore/testing/js/WebCoreTestSupport.cpp	2011-08-17 19:59:57 UTC (rev 93235)
@@ -28,6 +28,7 @@
 
 #include "Internals.h"
 #include "JSDOMGlobalObject.h"
+#include "JSDocument.h"
 #include "JSInternals.h"
 #include <_javascript_Core/APICast.h>
 #include <interpreter/CallFrame.h>
@@ -42,7 +43,20 @@
     JSLock lock(SilenceAssertionsOnly);
     ExecState* exec = toJS(context);
     JSDOMGlobalObject* globalObject = static_cast<JSDOMGlobalObject*>(exec->lexicalGlobalObject());
-    globalObject->putDirect(exec->globalData(), Identifier(exec, "internals"), toJS(exec, globalObject, Internals::create()));
+    globalObject->putDirect(exec->globalData(), Identifier(exec, Internals::internalsId), toJS(exec, globalObject, Internals::create()));
 }
 
+void resetInternalsObject(JSContextRef context)
+{
+    JSLock lock(SilenceAssertionsOnly);
+    ExecState* exec = toJS(context);
+    JSDOMGlobalObject* globalObject = static_cast<JSDOMGlobalObject*>(exec->lexicalGlobalObject());
+    Internals * internals = toInternals(globalObject->getDirect(exec->globalData(), Identifier(exec, Internals::internalsId)));
+    if (internals) {
+        ScriptExecutionContext* scriptContext = globalObject->scriptExecutionContext();
+        if (scriptContext->isDocument())
+            internals->reset(static_cast<Document*>(scriptContext));
+    }
 }
+
+}

Modified: trunk/Source/WebCore/testing/js/WebCoreTestSupport.h (93234 => 93235)


--- trunk/Source/WebCore/testing/js/WebCoreTestSupport.h	2011-08-17 19:44:03 UTC (rev 93234)
+++ trunk/Source/WebCore/testing/js/WebCoreTestSupport.h	2011-08-17 19:59:57 UTC (rev 93235)
@@ -31,6 +31,7 @@
 namespace WebCoreTestSupport {
 
 void injectInternalsObject(JSContextRef);
+void resetInternalsObject(JSContextRef);
 
 } // namespace WebCore
 

Modified: trunk/Source/WebCore/testing/v8/WebCoreTestSupport.cpp (93234 => 93235)


--- trunk/Source/WebCore/testing/v8/WebCoreTestSupport.cpp	2011-08-17 19:44:03 UTC (rev 93234)
+++ trunk/Source/WebCore/testing/v8/WebCoreTestSupport.cpp	2011-08-17 19:59:57 UTC (rev 93235)
@@ -26,7 +26,9 @@
 #include "config.h"
 #include "WebCoreTestSupport.h"
 
+#include "Document.h"
 #include "Internals.h"
+#include "ScriptExecutionContext.h"
 #include "V8Internals.h"
 
 #include <v8.h>
@@ -40,7 +42,21 @@
     v8::Context::Scope contextScope(context);
     v8::HandleScope scope;
 
-    context->Global()->Set(v8::String::New("internals"), toV8(Internals::create()));
+    context->Global()->Set(v8::String::New(Internals::internalsId), toV8(Internals::create()));
 }
 
+void resetInternalsObject(v8::Local<v8::Context> context)
+{
+    v8::Context::Scope contextScope(context);
+    v8::HandleScope scope;
+
+    v8::Handle<v8::Object> object = v8::Handle<v8::Object>::Cast(context->Global()->Get(v8::String::New(Internals::internalsId)));
+    Internals * internals = V8Internals::toNative(object);
+    if (internals) {
+        ScriptExecutionContext* scriptContext = getScriptExecutionContext();
+        if (scriptContext->isDocument())
+            internals->reset(static_cast<Document*>(scriptContext));
+    }
 }
+
+}

Modified: trunk/Source/WebCore/testing/v8/WebCoreTestSupport.h (93234 => 93235)


--- trunk/Source/WebCore/testing/v8/WebCoreTestSupport.h	2011-08-17 19:44:03 UTC (rev 93234)
+++ trunk/Source/WebCore/testing/v8/WebCoreTestSupport.h	2011-08-17 19:59:57 UTC (rev 93235)
@@ -34,6 +34,7 @@
 namespace WebCoreTestSupport {
 
 void injectInternalsObject(v8::Local<v8::Context>);
+void resetInternalsObject(v8::Local<v8::Context>);
 
 } // namespace WebCore
 

Modified: trunk/Source/WebKit/chromium/ChangeLog (93234 => 93235)


--- trunk/Source/WebKit/chromium/ChangeLog	2011-08-17 19:44:03 UTC (rev 93234)
+++ trunk/Source/WebKit/chromium/ChangeLog	2011-08-17 19:59:57 UTC (rev 93235)
@@ -1,3 +1,16 @@
+2011-08-16  Chang Shu  <[email protected]>
+
+        Support reset in WebCore::Internals
+        https://bugs.webkit.org/show_bug.cgi?id=66307
+
+        Reviewed by Dimitri Glazkov.
+
+        Added framework code in WebKit.
+
+        * public/WebTestingSupport.h:
+        * src/WebTestingSupport.cpp:
+        (WebKit::WebTestingSupport::resetInternalsObject):
+
 2011-08-15  Aaron Boodman  <[email protected]>
 
         Remove support for old didCreateIsolatedContext() signature

Modified: trunk/Source/WebKit/chromium/public/WebTestingSupport.h (93234 => 93235)


--- trunk/Source/WebKit/chromium/public/WebTestingSupport.h	2011-08-17 19:44:03 UTC (rev 93234)
+++ trunk/Source/WebKit/chromium/public/WebTestingSupport.h	2011-08-17 19:59:57 UTC (rev 93235)
@@ -35,6 +35,7 @@
 class WebTestingSupport {
 public:
     WEBKIT_EXPORT static void injectInternalsObject(WebFrame*);
+    WEBKIT_EXPORT static void resetInternalsObject(WebFrame*);
 };
 
 }

Modified: trunk/Source/WebKit/chromium/src/WebTestingSupport.cpp (93234 => 93235)


--- trunk/Source/WebKit/chromium/src/WebTestingSupport.cpp	2011-08-17 19:44:03 UTC (rev 93234)
+++ trunk/Source/WebKit/chromium/src/WebTestingSupport.cpp	2011-08-17 19:59:57 UTC (rev 93235)
@@ -38,4 +38,10 @@
     WebCoreTestSupport::injectInternalsObject(frame->mainWorldScriptContext());
 }
 
+void WebTestingSupport::resetInternalsObject(WebFrame* frame)
+{
+    v8::HandleScope handleScope;
+    WebCoreTestSupport::resetInternalsObject(frame->mainWorldScriptContext());
 }
+
+}

Modified: trunk/Source/WebKit/qt/ChangeLog (93234 => 93235)


--- trunk/Source/WebKit/qt/ChangeLog	2011-08-17 19:44:03 UTC (rev 93234)
+++ trunk/Source/WebKit/qt/ChangeLog	2011-08-17 19:59:57 UTC (rev 93235)
@@ -1,3 +1,16 @@
+2011-08-16  Chang Shu  <[email protected]>
+
+        Support reset in WebCore::Internals
+        https://bugs.webkit.org/show_bug.cgi?id=66307
+
+        Reviewed by Dimitri Glazkov.
+
+        Added framework code in WebKit.
+
+        * WebCoreSupport/DumpRenderTreeSupportQt.cpp:
+        (DumpRenderTreeSupportQt::resetInternalsObject):
+        * WebCoreSupport/DumpRenderTreeSupportQt.h:
+
 2011-08-16  Lindsay Mathieson   <[email protected]>
 
         [Qt] Missing spell check support

Modified: trunk/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp (93234 => 93235)


--- trunk/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp	2011-08-17 19:44:03 UTC (rev 93234)
+++ trunk/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp	2011-08-17 19:59:57 UTC (rev 93235)
@@ -1165,6 +1165,25 @@
 #endif
 }
 
+void DumpRenderTreeSupportQt::resetInternalsObject(QWebFrame* frame)
+{
+    WebCore::Frame* coreFrame = QWebFramePrivate::core(frame);
+#if USE(JSC)
+    JSC::JSLock lock(JSC::SilenceAssertionsOnly);
+
+    JSDOMWindow* window = toJSDOMWindow(coreFrame, mainThreadNormalWorld());
+    Q_ASSERT(window);
+
+    JSC::ExecState* exec = window->globalExec();
+    Q_ASSERT(exec);
+
+    JSContextRef context = toRef(exec);
+    WebCoreTestSupport::resetInternalsObject(context);
+#elif USE(V8)
+    WebCoreTestSupport::resetInternalsObject(V8Proxy::mainWorldContext(coreFrame));
+#endif
+}
+
 // Provide a backward compatibility with previously exported private symbols as of QtWebKit 4.6 release
 
 void QWEBKIT_EXPORT qt_resumeActiveDOMObjects(QWebFrame* frame)

Modified: trunk/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h (93234 => 93235)


--- trunk/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h	2011-08-17 19:44:03 UTC (rev 93234)
+++ trunk/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h	2011-08-17 19:59:57 UTC (rev 93235)
@@ -213,6 +213,7 @@
     static QString layerTreeAsText(QWebFrame*);
 
     static void injectInternalsObject(QWebFrame*);
+    static void resetInternalsObject(QWebFrame*);
 
     static void setInteractiveFormValidationEnabled(QWebPage*, bool);
 

Modified: trunk/Tools/ChangeLog (93234 => 93235)


--- trunk/Tools/ChangeLog	2011-08-17 19:44:03 UTC (rev 93234)
+++ trunk/Tools/ChangeLog	2011-08-17 19:59:57 UTC (rev 93235)
@@ -1,3 +1,19 @@
+2011-08-16  Chang Shu  <[email protected]>
+
+        Support reset in WebCore::Internals
+        https://bugs.webkit.org/show_bug.cgi?id=66307
+
+        Reviewed by Dimitri Glazkov.
+
+        Added call to resetInternalsObject in DRT.
+
+        * DumpRenderTree/chromium/TestShell.cpp:
+        (TestShell::resetTestController):
+        * DumpRenderTree/mac/DumpRenderTree.mm:
+        (resetWebViewToConsistentStateBeforeTesting):
+        * DumpRenderTree/qt/DumpRenderTreeQt.cpp:
+        (WebCore::WebPage::resetSettings):
+
 2011-08-17  Alexis Menard  <[email protected]>
 
         Add a new build slave for the Qt port on Mac OS SnowLeopard.

Modified: trunk/Tools/DumpRenderTree/chromium/TestShell.cpp (93234 => 93235)


--- trunk/Tools/DumpRenderTree/chromium/TestShell.cpp	2011-08-17 19:44:03 UTC (rev 93234)
+++ trunk/Tools/DumpRenderTree/chromium/TestShell.cpp	2011-08-17 19:59:57 UTC (rev 93235)
@@ -268,6 +268,7 @@
         m_drtDevToolsClient->reset();
     webView()->scalePage(1, WebPoint(0, 0));
     webView()->mainFrame()->clearOpener();
+    WebTestingSupport::resetInternalsObject(webView()->mainFrame());
 }
 
 void TestShell::loadURL(const WebURL& url)

Modified: trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm (93234 => 93235)


--- trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm	2011-08-17 19:44:03 UTC (rev 93234)
+++ trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm	2011-08-17 19:59:57 UTC (rev 93235)
@@ -51,6 +51,7 @@
 #import "StorageTrackerDelegate.h"
 #import "UIDelegate.h"
 #import "WebArchiveDumpSupport.h"
+#import "WebCoreTestSupport.h"
 #import "WorkQueue.h"
 #import "WorkQueueItem.h"
 #import <Carbon/Carbon.h>
@@ -1056,6 +1057,9 @@
 
     resetDefaultsToConsistentValues();
 
+    if (gLayoutTestController)
+        WebCoreTestSupport::resetInternalsObject([mainFrame globalContext]);
+
     [[mainFrame webView] setSmartInsertDeleteEnabled:YES];
     [[[mainFrame webView] inspector] setJavaScriptProfilingEnabled:NO];
 

Modified: trunk/Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp (93234 => 93235)


--- trunk/Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp	2011-08-17 19:44:03 UTC (rev 93234)
+++ trunk/Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp	2011-08-17 19:59:57 UTC (rev 93235)
@@ -211,6 +211,8 @@
 
     DumpRenderTreeSupportQt::setMinimumTimerInterval(this, DumpRenderTreeSupportQt::defaultMinimumTimerInterval());
 
+    DumpRenderTreeSupportQt::resetInternalsObject(mainFrame());
+
     m_pendingGeolocationRequests.clear();
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to