Changeset 65314 in webkit


Ignore:
Timestamp:
Aug 13, 2010 5:08:21 AM (14 years ago)
Author:
pfeldman@chromium.org
Message:

2010-08-13 Pavel Feldman <pfeldman@chromium.org>

Reviewed by Yury Semikhatsky.

Web Inspector: remove openInInspectorWindow and evaluateAndStringify from InjectedScript.
https://bugs.webkit.org/show_bug.cgi?id=43854

  • inspector/Inspector.idl:
  • inspector/InspectorController.cpp: (WebCore::InspectorController::openInInspectedWindow):
  • inspector/InspectorController.h:
  • inspector/front-end/ExtensionServer.js: (WebInspector.ExtensionServer.prototype._onEvaluateOnInspectedPage.callback): (WebInspector.ExtensionServer.prototype._onEvaluateOnInspectedPage):
  • inspector/front-end/InjectedScript.js: (injectedScriptConstructor):
  • inspector/front-end/InjectedScriptAccess.js:
  • inspector/front-end/InspectorBackendStub.js: (WebInspector.InspectorBackendStub):
  • inspector/front-end/ResourcesPanel.js: (WebInspector.ResourceSidebarTreeElement.prototype.ondblclick):
Location:
trunk/WebCore
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r65313 r65314  
     12010-08-13  Pavel Feldman  <pfeldman@chromium.org>
     2
     3        Reviewed by Yury Semikhatsky.
     4
     5        Web Inspector: remove openInInspectorWindow and evaluateAndStringify from InjectedScript.
     6        https://bugs.webkit.org/show_bug.cgi?id=43854
     7
     8        * inspector/Inspector.idl:
     9        * inspector/InspectorController.cpp:
     10        (WebCore::InspectorController::openInInspectedWindow):
     11        * inspector/InspectorController.h:
     12        * inspector/front-end/ExtensionServer.js:
     13        (WebInspector.ExtensionServer.prototype._onEvaluateOnInspectedPage.callback):
     14        (WebInspector.ExtensionServer.prototype._onEvaluateOnInspectedPage):
     15        * inspector/front-end/InjectedScript.js:
     16        (injectedScriptConstructor):
     17        * inspector/front-end/InjectedScriptAccess.js:
     18        * inspector/front-end/InspectorBackendStub.js:
     19        (WebInspector.InspectorBackendStub):
     20        * inspector/front-end/ResourcesPanel.js:
     21        (WebInspector.ResourceSidebarTreeElement.prototype.ondblclick):
     22
    1232010-08-13  Fumitoshi Ukai  <ukai@chromium.org>
    224
  • trunk/WebCore/inspector/Inspector.idl

    r65072 r65314  
    181181        [handler=Controller] void highlightDOMNode(in long nodeId);
    182182        [handler=Controller] void hideDOMNodeHighlight();
     183        [handler=Controller] void openInInspectedWindow(in String url);
    183184
    184185        [handler=DOM] void getStyles(in long callId, in long nodeId, in boolean authOnly, out Value styles);
  • trunk/WebCore/inspector/InspectorController.cpp

    r65073 r65314  
    4747#include "FloatRect.h"
    4848#include "Frame.h"
     49#include "FrameLoadRequest.h"
    4950#include "FrameLoader.h"
    5051#include "FrameTree.h"
     
    8788#include "TextEncoding.h"
    8889#include "TextIterator.h"
     90#include "WindowFeatures.h"
    8991#include <wtf/text/CString.h>
    9092#include <wtf/CurrentTime.h>
     
    18691871}
    18701872
     1873void InspectorController::openInInspectedWindow(const String& url)
     1874{
     1875    ResourceRequest request;
     1876    FrameLoadRequest frameRequest(request, "_blank");
     1877    bool created;
     1878    Frame* mainFrame = m_inspectedPage->mainFrame();
     1879    WindowFeatures windowFeatures;
     1880    Frame* newFrame = WebCore::createWindow(mainFrame, mainFrame, frameRequest, windowFeatures, created);
     1881    if (!newFrame)
     1882        return;
     1883
     1884    newFrame->loader()->setOpener(mainFrame);
     1885    newFrame->page()->setOpenedByDOM();
     1886    newFrame->loader()->changeLocation(newFrame->loader()->completeURL(url), "", false, false, true);
     1887}
     1888
    18711889void InspectorController::count(const String& title, unsigned lineNumber, const String& sourceID)
    18721890{
  • trunk/WebCore/inspector/InspectorController.h

    r65258 r65314  
    213213
    214214    void drawNodeHighlight(GraphicsContext&) const;
     215    void openInInspectedWindow(const String& url);
    215216
    216217    void count(const String& title, unsigned lineNumber, const String& sourceID);
     
    253254
    254255    InjectedScript injectedScriptForNodeId(long id);
     256
    255257    void addScriptToEvaluateOnLoad(const String& source);
    256258    void removeAllScriptsToEvaluateOnLoad();
  • trunk/WebCore/inspector/front-end/ExtensionServer.js

    r64973 r65314  
    194194    _onEvaluateOnInspectedPage: function(message, port)
    195195    {
    196         InjectedScriptAccess.getDefault().evaluateAndStringify(message.expression, this._dispatchCallback.bind(this, message.requestId, port));
     196        var escapedMessage = escape(message.expression);
     197        function callback(resultPayload)
     198        {
     199            var resultObject = WebInspector.RemoteObject.fromPayload(resultPayload);
     200            var result = {};
     201            if (resultObject.isError())
     202                result.isException = true;
     203            result.value = resultObject.description;
     204            this._dispatchCallback(message.requestId, port, result);
     205        }
     206        InjectedScriptAccess.getDefault().evaluate("(function() { var a = window.eval(unescape(\"" + escapedMessage + "\")); return JSON.stringify(a); })();", "", callback.bind(this));
    197207    },
    198208
  • trunk/WebCore/inspector/front-end/InjectedScript.js

    r65300 r65314  
    8181};
    8282
    83 InjectedScript.dispatch = function(methodName, args, callId)
     83InjectedScript.dispatch = function(methodName, args)
    8484{
    8585    var argsArray = eval("(" + args + ")");
    86     if (callId)
    87         argsArray.splice(0, 0, callId);  // Methods that run asynchronously have a call back id parameter.
    8886    var result = InjectedScript[methodName].apply(InjectedScript, argsArray);
    8987    if (typeof result === "undefined") {
     
    237235}
    238236
    239 InjectedScript.evaluateAndStringify = function(expression)
    240 {
    241     var result = {};
    242     try {
    243         var value = InjectedScript._evaluateOn(inspectedWindow.eval, inspectedWindow, expression, false);
    244         result.value = JSON.stringify(value);
    245     } catch (e) {
    246         result.value = e.toString();
    247         result.isException = true;
    248     }
    249     return result;
    250 }
    251 
    252237InjectedScript.evaluate = function(expression, objectGroup)
    253238{
     
    291276{
    292277    return InjectedScriptHost.pushNodePathToFrontend(node, false, false);
    293 }
    294 
    295 InjectedScript.openInInspectedWindow = function(url)
    296 {
    297     // Don't call window.open on wrapper - popup blocker mutes it.
    298     // URIs should have no double quotes.
    299     inspectedWindow.eval("window.open(\"" + url + "\")");
    300     return true;
    301278}
    302279
  • trunk/WebCore/inspector/front-end/InjectedScriptAccess.js

    r65072 r65314  
    7676// We keep these sorted.
    7777InjectedScriptAccess._installHandler("evaluate");
    78 InjectedScriptAccess._installHandler("evaluateAndStringify");
    7978InjectedScriptAccess._installHandler("evaluateInCallFrame");
    8079InjectedScriptAccess._installHandler("evaluateOnSelf");
     
    8281InjectedScriptAccess._installHandler("getProperties");
    8382InjectedScriptAccess._installHandler("getPrototypes");
    84 InjectedScriptAccess._installHandler("openInInspectedWindow");
    8583InjectedScriptAccess._installHandler("pushNodeToFrontend");
    8684InjectedScriptAccess._installHandler("setPropertyValue");
  • trunk/WebCore/inspector/front-end/InspectorBackendStub.js

    r65075 r65314  
    8585    this._registerDelegate("takeHeapSnapshot");
    8686    this._registerDelegate("getProfilerLogLines");
     87    this._registerDelegate("openInInspectedWindow");
    8788
    8889    this._registerDelegate("getAllStyles");
  • trunk/WebCore/inspector/front-end/ResourcesPanel.js

    r65052 r65314  
    11871187    ondblclick: function(event)
    11881188    {
    1189         InjectedScriptAccess.getDefault().openInInspectedWindow(this.resource.url, function() {});
     1189        InspectorBackend.openInInspectedWindow(this.resource.url);
    11901190    },
    11911191
Note: See TracChangeset for help on using the changeset viewer.