Changeset 49091 in webkit


Ignore:
Timestamp:
Oct 5, 2009 7:03:07 AM (15 years ago)
Author:
pfeldman@chromium.org
Message:

2009-10-05 Pavel Feldman <pfeldman@chromium.org>

Reviewed by Timothy Hatcher.

Web Inspector: add testing harness for Web Inspector.

https://bugs.webkit.org/show_bug.cgi?id=30010

WebKit:

  • WebKit.xcodeproj/project.pbxproj:

WebKit/mac:

WebKit/win:

  • Interfaces/IWebInspectorPrivate.idl: Added.
  • Interfaces/IWebViewPrivate.idl:
  • Interfaces/WebKit.idl:
  • WebInspector.cpp: (WebInspector::evaluateInFrontend):
  • WebInspector.h:
  • WebView.cpp: (WebView::inspectorPrivate):
  • WebView.h:

WebKitTools:

  • DumpRenderTree/LayoutTestController.cpp: (showWebInspectorCallback): (closeWebInspectorCallback): (evaluateInWebInspectorCallback): (LayoutTestController::staticFunctions):
  • DumpRenderTree/LayoutTestController.h:
  • DumpRenderTree/gtk/LayoutTestControllerGtk.cpp: (LayoutTestController::showWebInspector): (LayoutTestController::closeWebInspector): (LayoutTestController::evaluateInWebInspector):
  • DumpRenderTree/mac/LayoutTestControllerMac.mm: (LayoutTestController::showWebInspector): (LayoutTestController::closeWebInspector): (LayoutTestController::evaluateInWebInspector):
  • DumpRenderTree/win/LayoutTestControllerWin.cpp: (LayoutTestController::showWebInspector): (LayoutTestController::closeWebInspector): (LayoutTestController::evaluateInWebInspector):
  • DumpRenderTree/wx/LayoutTestControllerWx.cpp: (LayoutTestController::showWebInspector): (LayoutTestController::closeWebInspector): (LayoutTestController::evaluateInWebInspector):
Location:
trunk
Files:
2 added
19 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebKit/ChangeLog

    r49080 r49091  
     12009-10-05  Pavel Feldman  <pfeldman@chromium.org>
     2
     3        Reviewed by Timothy Hatcher.
     4
     5        Web Inspector: add testing harness for Web Inspector.
     6
     7        https://bugs.webkit.org/show_bug.cgi?id=30010
     8
     9        * WebKit.xcodeproj/project.pbxproj:
     10
    1112009-10-04  Fumitoshi Ukai  <ukai@chromium.org>
    212
  • trunk/WebKit/WebKit.xcodeproj/project.pbxproj

    r48914 r49091  
    122122                65FFB7FC0AD0B7D30048CD05 /* WebDocumentLoaderMac.h in Headers */ = {isa = PBXBuildFile; fileRef = 65FFB7FA0AD0B7D30048CD05 /* WebDocumentLoaderMac.h */; };
    123123                65FFB7FD0AD0B7D30048CD05 /* WebDocumentLoaderMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 65FFB7FB0AD0B7D30048CD05 /* WebDocumentLoaderMac.mm */; };
     124                7A8FF0D11075024A00A80A08 /* WebInspectorPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 7A8FF0D01075024A00A80A08 /* WebInspectorPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
    124125                7E6FEF0808985A7200C44C3F /* WebScriptDebugDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 7E6FEF0508985A7200C44C3F /* WebScriptDebugDelegate.h */; settings = {ATTRIBUTES = (Private, ); }; };
    125126                7E6FEF0908985A7200C44C3F /* WebScriptDebugDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = 7E6FEF0608985A7200C44C3F /* WebScriptDebugDelegate.mm */; };
     
    511512                7082F56F038EADAA00A80180 /* WebKitNSStringExtras.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebKitNSStringExtras.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
    512513                7082F570038EADAA00A80180 /* WebKitNSStringExtras.mm */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 30; indentWidth = 4; path = WebKitNSStringExtras.mm; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
     514                7A8FF0D01075024A00A80A08 /* WebInspectorPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebInspectorPrivate.h; sourceTree = "<group>"; };
    513515                7E6FEF0508985A7200C44C3F /* WebScriptDebugDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebScriptDebugDelegate.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
    514516                7E6FEF0608985A7200C44C3F /* WebScriptDebugDelegate.mm */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebScriptDebugDelegate.mm; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
     
    812814                                5D7BF8120C2A1D90008CE06D /* WebInspector.h */,
    813815                                5D7BF8130C2A1D90008CE06D /* WebInspector.mm */,
     816                                7A8FF0D01075024A00A80A08 /* WebInspectorPrivate.h */,
    814817                                1C68F663095B5FC100C2984E /* WebNodeHighlight.h */,
    815818                                1C68F664095B5FC100C2984E /* WebNodeHighlight.mm */,
     
    13791382                                5D7BF8140C2A1D90008CE06D /* WebInspector.h in Headers */,
    13801383                                06693DDC0BFBA85200216072 /* WebInspectorClient.h in Headers */,
     1384                                7A8FF0D11075024A00A80A08 /* WebInspectorPrivate.h in Headers */,
    13811385                                939810A00824BF01008DF038 /* WebJavaPlugIn.h in Headers */,
    13821386                                939810420824BF01008DF038 /* WebJavaScriptTextInputPanel.h in Headers */,
  • trunk/WebKit/mac/ChangeLog

    r49079 r49091  
     12009-10-05  Pavel Feldman  <pfeldman@chromium.org>
     2
     3        Reviewed by Timothy Hatcher.
     4
     5        Web Inspector: add testing harness for Web Inspector.
     6
     7        https://bugs.webkit.org/show_bug.cgi?id=30010
     8
     9        * WebInspector/WebInspector.mm:
     10        (-[WebInspector evaluateInFrontend:callId:script:]):
     11        * WebInspector/WebInspectorPrivate.h: Added.
     12
    1132009-10-04  Kevin Decker  <kdecker@apple.com>
    214
  • trunk/WebKit/mac/WebInspector/WebInspector.mm

    r43804 r49091  
    2828
    2929#import "WebInspector.h"
     30
    3031#import "WebFrameInternal.h"
     32#import "WebInspectorPrivate.h"
    3133
    3234#include <WebCore/Document.h>
     
    164166        page->inspectorController()->detachWindow();
    165167}
     168
     169- (void)evaluateInFrontend:(id)sender callId:(long)callId script:(NSString *)script
     170{
     171    if (Page* page = core(_webView))
     172        page->inspectorController()->evaluateForTestInFrontend(callId, script);
     173}
    166174@end
    167175
  • trunk/WebKit/win/ChangeLog

    r49033 r49091  
     12009-10-05  Pavel Feldman  <pfeldman@chromium.org>
     2
     3        Reviewed by Timothy Hatcher.
     4
     5        Web Inspector: add testing harness for Web Inspector.
     6
     7        https://bugs.webkit.org/show_bug.cgi?id=30010
     8
     9        * Interfaces/IWebInspectorPrivate.idl: Added.
     10        * Interfaces/IWebViewPrivate.idl:
     11        * Interfaces/WebKit.idl:
     12        * WebInspector.cpp:
     13        (WebInspector::evaluateInFrontend):
     14        * WebInspector.h:
     15        * WebView.cpp:
     16        (WebView::inspectorPrivate):
     17        * WebView.h:
     18
    1192009-10-02  Dave Hyatt  <hyatt@apple.com>
    220
  • trunk/WebKit/win/Interfaces/IWebViewPrivate.idl

    r49033 r49091  
    3030import "IWebFrameLoadDelegatePrivate.idl";
    3131import "IWebInspector.idl";
     32import "IWebInspectorPrivate.idl";
    3233#endif
    3334
     
    3940interface IWebFrameLoadDelegatePrivate;
    4041interface IWebInspector;
     42interface IWebInspectorPrivate;
    4143interface IWebPluginHalterDelegate;
    4244interface IWebURLRequest;
     
    114116
    115117    HRESULT inspector([out, retval] IWebInspector**);
     118
     119    HRESULT inspectorPrivate([out, retval] IWebInspectorPrivate**);
    116120
    117121    HRESULT clearUndoRedoOperations();
  • trunk/WebKit/win/Interfaces/WebKit.idl

    r48748 r49091  
    9797#include "IWebIconFetcher.idl"
    9898#include "IWebInspector.idl"
     99#include "IWebInspectorPrivate.idl"
    99100#include "IWebJavaScriptCollector.idl"
    100101#include "IWebKitStatistics.idl"
  • trunk/WebKit/win/WebInspector.cpp

    r37943 r49091  
    257257    return S_OK;
    258258}
     259
     260HRESULT STDMETHODCALLTYPE  WebInspector::evaluateInFrontend(ULONG callId, BSTR bScript)
     261{
     262    if (!m_webView)
     263        return S_OK;
     264
     265    Page* page = m_webView->page();
     266    if (!page)
     267        return S_OK;
     268
     269    String script(bScript, SysStringLen(bScript));
     270    page->inspectorController()->evaluateForTestInFrontend(callId, script);
     271    return S_OK;
     272}
  • trunk/WebKit/win/WebInspector.h

    r45891 r49091  
    3535class WebView;
    3636
    37 class WebInspector : public IWebInspector, public Noncopyable {
     37class WebInspector : public IWebInspector, public IWebInspectorPrivate, public Noncopyable {
    3838public:
    3939    static WebInspector* createInstance(WebView*);
     
    6060    virtual HRESULT STDMETHODCALLTYPE isJavaScriptProfilingEnabled(BOOL* isProfilingEnabled);
    6161    virtual HRESULT STDMETHODCALLTYPE setJavaScriptProfilingEnabled(BOOL);
     62   
     63    virtual HRESULT STDMETHODCALLTYPE evaluateInFrontend(ULONG callId, BSTR script);
    6264
    6365private:
  • trunk/WebKit/win/WebKit.vcproj/Interfaces.vcproj

    r48748 r49091  
    945945                </File>
    946946                <File
     947                        RelativePath="..\Interfaces\IWebInspectorPrivate.idl"
     948                        >
     949                        <FileConfiguration
     950                                Name="Debug|Win32"
     951                                ExcludedFromBuild="true"
     952                                >
     953                                <Tool
     954                                        Name="VCMIDLTool"
     955                                />
     956                        </FileConfiguration>
     957                        <FileConfiguration
     958                                Name="Release|Win32"
     959                                ExcludedFromBuild="true"
     960                                >
     961                                <Tool
     962                                        Name="VCMIDLTool"
     963                                />
     964                        </FileConfiguration>
     965                </File>
     966                <File
    947967                        RelativePath="..\Interfaces\IWebJavaScriptCollector.idl"
    948968                        >
  • trunk/WebKit/win/WebView.cpp

    r49038 r49091  
    51785178}
    51795179
     5180HRESULT STDMETHODCALLTYPE WebView::inspectorPrivate(IWebInspectorPrivate** inspector)
     5181{
     5182    if (!m_webInspector)
     5183        m_webInspector.adoptRef(WebInspector::createInstance(this));
     5184
     5185    return m_webInspector.copyRefTo(inspector);
     5186}
     5187
    51805188HRESULT STDMETHODCALLTYPE WebView::windowAncestryDidChange()
    51815189{
  • trunk/WebKit/win/WebView.h

    r49033 r49091  
    673673    virtual HRESULT STDMETHODCALLTYPE inspector(
    674674        /* [retval][out] */ IWebInspector**);
     675
     676    virtual HRESULT STDMETHODCALLTYPE inspectorPrivate(
     677        /* [retval][out] */ IWebInspectorPrivate**);
    675678
    676679    virtual HRESULT STDMETHODCALLTYPE clearUndoRedoOperations( void);
  • trunk/WebKitTools/ChangeLog

    r49088 r49091  
     12009-10-05  Pavel Feldman  <pfeldman@chromium.org>
     2
     3        Reviewed by Timothy Hatcher.
     4
     5        Web Inspector: add testing harness for Web Inspector.
     6
     7        https://bugs.webkit.org/show_bug.cgi?id=30010
     8
     9        * DumpRenderTree/LayoutTestController.cpp:
     10        (showWebInspectorCallback):
     11        (closeWebInspectorCallback):
     12        (evaluateInWebInspectorCallback):
     13        (LayoutTestController::staticFunctions):
     14        * DumpRenderTree/LayoutTestController.h:
     15        * DumpRenderTree/gtk/LayoutTestControllerGtk.cpp:
     16        (LayoutTestController::showWebInspector):
     17        (LayoutTestController::closeWebInspector):
     18        (LayoutTestController::evaluateInWebInspector):
     19        * DumpRenderTree/mac/LayoutTestControllerMac.mm:
     20        (LayoutTestController::showWebInspector):
     21        (LayoutTestController::closeWebInspector):
     22        (LayoutTestController::evaluateInWebInspector):
     23        * DumpRenderTree/win/LayoutTestControllerWin.cpp:
     24        (LayoutTestController::showWebInspector):
     25        (LayoutTestController::closeWebInspector):
     26        (LayoutTestController::evaluateInWebInspector):
     27        * DumpRenderTree/wx/LayoutTestControllerWx.cpp:
     28        (LayoutTestController::showWebInspector):
     29        (LayoutTestController::closeWebInspector):
     30        (LayoutTestController::evaluateInWebInspector):
     31
    1322009-10-05  Tor Arne Vestbø  <tor.arne.vestbo@nokia.com>
    233
  • trunk/WebKitTools/DumpRenderTree/LayoutTestController.cpp

    r48915 r49091  
    930930}
    931931
     932static JSValueRef showWebInspectorCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
     933{
     934    LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
     935    controller->showWebInspector();
     936    return JSValueMakeUndefined(context);
     937}
     938
     939static JSValueRef closeWebInspectorCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
     940{
     941    LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
     942    controller->closeWebInspector();
     943    return JSValueMakeUndefined(context);
     944}
     945
     946static JSValueRef evaluateInWebInspectorCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
     947{
     948    LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
     949    double callId = JSValueToNumber(context, arguments[0], exception);
     950    ASSERT(!*exception);
     951    JSRetainPtr<JSStringRef> script(Adopt, JSValueToStringCopy(context, arguments[1], exception));
     952    ASSERT(!*exception);
     953
     954    controller->evaluateInWebInspector(static_cast<long>(callId), script.get());
     955    return JSValueMakeUndefined(context);
     956}
     957
    932958static JSValueRef elementDoesAutoCompleteForElementWithIdCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
    933959{
     
    11151141        { "clearBackForwardList", clearBackForwardListCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    11161142        { "clearPersistentUserStyleSheet", clearPersistentUserStyleSheetCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
     1143        { "closeWebInspector", closeWebInspectorCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    11171144        { "decodeHostName", decodeHostNameCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    11181145        { "disableImageLoading", disableImageLoadingCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
     
    11361163        { "elementDoesAutoCompleteForElementWithId", elementDoesAutoCompleteForElementWithIdCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    11371164        { "encodeHostName", encodeHostNameCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
     1165        { "evaluateInWebInspector", evaluateInWebInspectorCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    11381166        { "execCommand", execCommandCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    11391167        { "grantDesktopNotificationPermission", grantDesktopNotificationPermissionCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
     
    11861214        { "setWillSendRequestReturnsNullOnRedirect", setWillSendRequestReturnsNullOnRedirectCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    11871215        { "setWindowIsKey", setWindowIsKeyCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
     1216        { "showWebInspector", showWebInspectorCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    11881217        { "testOnscreen", testOnscreenCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    11891218        { "testRepaint", testRepaintCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
  • trunk/WebKitTools/DumpRenderTree/LayoutTestController.h

    r48915 r49091  
    204204    bool geolocationPermission() const { return m_geolocationPermission; }
    205205
     206    void showWebInspector();
     207    void closeWebInspector();
     208    void evaluateInWebInspector(long callId, JSStringRef script);
     209
    206210private:
    207211    bool m_dumpAsPDF;
  • trunk/WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp

    r48222 r49091  
    472472    printf("LayoutTestController::addUserStyleSheet not implemented.\n");
    473473}
     474
     475void LayoutTestController::showWebInspector()
     476{
     477    // FIXME: Implement this.
     478}
     479
     480void LayoutTestController::closeWebInspector()
     481{
     482    // FIXME: Implement this.
     483}
     484
     485void LayoutTestController::evaluateInWebInspector(long callId, JSStringRef script)
     486{
     487    // FIXME: Implement this.
     488}
  • trunk/WebKitTools/DumpRenderTree/mac/LayoutTestControllerMac.mm

    r49034 r49091  
    5252#import <WebKit/WebHistory.h>
    5353#import <WebKit/WebHistoryPrivate.h>
    54 #import <WebKit/WebInspector.h>
     54#import <WebKit/WebInspectorPrivate.h>
    5555#import <WebKit/WebGeolocationMockPrivate.h>
    5656#import <WebKit/WebNSURLExtras.h>
     
    493493}
    494494
     495void LayoutTestController::showWebInspector()
     496{
     497    [[[mainFrame webView] inspector] show:nil];
     498}
     499
     500void LayoutTestController::closeWebInspector()
     501{
     502    [[[mainFrame webView] inspector] close:nil];
     503}
     504
     505void LayoutTestController::evaluateInWebInspector(long callId, JSStringRef script)
     506{
     507    RetainPtr<CFStringRef> scriptCF(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, script));
     508    NSString *scriptNS = (NSString *)scriptCF.get();
     509    [[[mainFrame webView] inspector] evaluateInFrontend:nil callId:callId script:scriptNS];
     510}
  • trunk/WebKitTools/DumpRenderTree/win/LayoutTestControllerWin.cpp

    r49034 r49091  
    870870    webView->addUserStyleSheetToGroup(_bstr_t(L"org.webkit.DumpRenderTree").GetBSTR(), 1, bstrT(source).GetBSTR(), 0, 0, 0, 0, 0);
    871871}
     872
     873void LayoutTestController::showWebInspector()
     874{
     875    COMPtr<IWebViewPrivate> webView;
     876    if (FAILED(WebKitCreateInstance(__uuidof(WebView), 0, __uuidof(webView), reinterpret_cast<void**>(&webView))))
     877        return;
     878
     879    COMPtr<IWebInspector> inspector;
     880    if (SUCCEEDED(webView->inspector(&inspector)))
     881        inspector->show();
     882}
     883
     884void LayoutTestController::closeWebInspector()
     885{
     886    COMPtr<IWebViewPrivate> webView;
     887    if (FAILED(WebKitCreateInstance(__uuidof(WebView), 0, __uuidof(webView), reinterpret_cast<void**>(&webView))))
     888        return;
     889
     890    COMPtr<IWebInspector> inspector;
     891    if (SUCCEEDED(webView->inspector(&inspector)))
     892        inspector->close();
     893}
     894
     895void LayoutTestController::evaluateInWebInspector(long callId, JSStringRef script)
     896{
     897    COMPtr<IWebViewPrivate> webView;
     898    if (FAILED(WebKitCreateInstance(__uuidof(WebView), 0, __uuidof(webView), reinterpret_cast<void**>(&webView))))
     899        return;
     900
     901    COMPtr<IWebInspectorPrivate> inspector;
     902    if (SUCCEEDED(webView->inspectorPrivate(&inspector)))
     903        inspector->evaluateInFrontend(callId, bstrT(script).GetBSTR());
     904}
  • trunk/WebKitTools/DumpRenderTree/wx/LayoutTestControllerWx.cpp

    r48222 r49091  
    299299    printf("LayoutTestController::addUserStyleSheet not implemented.\n");
    300300}
     301
     302void LayoutTestController::showWebInspector()
     303{
     304    // FIXME: Implement this.
     305}
     306
     307void LayoutTestController::closeWebInspector()
     308{
     309    // FIXME: Implement this.
     310}
     311
     312void LayoutTestController::evaluateInWebInspector(long callId, JSStringRef script)
     313{
     314    // FIXME: Implement this.
     315}
Note: See TracChangeset for help on using the changeset viewer.