Diff
Modified: trunk/Source/WebCore/ChangeLog (140538 => 140539)
--- trunk/Source/WebCore/ChangeLog 2013-01-23 17:45:36 UTC (rev 140538)
+++ trunk/Source/WebCore/ChangeLog 2013-01-23 17:57:26 UTC (rev 140539)
@@ -1,3 +1,40 @@
+2013-01-22 Pavel Feldman <pfeld...@chromium.org>
+
+ Web Inspector: only allow evaluateForTestInFrontend for front-ends under test.
+ https://bugs.webkit.org/show_bug.cgi?id=107523
+
+ Reviewed by Yury Semikhatsky.
+
+ * inspector/InspectorController.cpp:
+ (WebCore::InspectorController::InspectorController):
+ (WebCore::InspectorController::isUnderTest):
+ (WebCore):
+ (WebCore::InspectorController::evaluateForTestInFrontend):
+ * inspector/InspectorController.h:
+ (InspectorController):
+ * inspector/InspectorFrontendClient.h:
+ (InspectorFrontendClient):
+ * inspector/InspectorFrontendClientLocal.cpp:
+ (WebCore::InspectorFrontendClientLocal::canAttachWindow):
+ (WebCore::InspectorFrontendClientLocal::isUnderTest):
+ (WebCore):
+ * inspector/InspectorFrontendClientLocal.h:
+ (InspectorFrontendClientLocal):
+ * inspector/InspectorFrontendHost.cpp:
+ (WebCore::InspectorFrontendHost::isUnderTest):
+ (WebCore):
+ * inspector/InspectorFrontendHost.h:
+ (InspectorFrontendHost):
+ * inspector/InspectorFrontendHost.idl:
+ * inspector/front-end/DOMExtension.js:
+ * inspector/front-end/InspectorFrontendHostStub.js:
+ (.WebInspector.InspectorFrontendHostStub.prototype.canInspectWorkers):
+ (.WebInspector.InspectorFrontendHostStub.prototype.isUnderTest):
+ * inspector/front-end/TestController.js:
+ (.invokeMethod):
+ (WebInspector.evaluateForTestInFrontend):
+ * inspector/front-end/externs.js:
+
2013-01-23 Andrey Lushnikov <lushni...@chromium.org>
Web Inspector: remove invisibleLineRow code from paintLines DTE method
Modified: trunk/Source/WebCore/WebCore.exp.in (140538 => 140539)
--- trunk/Source/WebCore/WebCore.exp.in 2013-01-23 17:45:36 UTC (rev 140538)
+++ trunk/Source/WebCore/WebCore.exp.in 2013-01-23 17:57:26 UTC (rev 140539)
@@ -2388,6 +2388,7 @@
__ZN7WebCore24InspectorInstrumentation17s_frontendCounterE
__ZN7WebCore24InspectorInstrumentation18didCancelFrameImplEPNS_19InstrumentingAgentsE
__ZN7WebCore24InspectorInstrumentation26instrumentingAgentsForPageEPNS_4PageE
+__ZN7WebCore28InspectorFrontendClientLocal11isUnderTestEv
__ZN7WebCore28InspectorFrontendClientLocal11showConsoleEv
__ZN7WebCore28InspectorFrontendClientLocal12moveWindowByEff
__ZN7WebCore28InspectorFrontendClientLocal12openInNewTabERKN3WTF6StringE
Modified: trunk/Source/WebCore/inspector/InspectorController.cpp (140538 => 140539)
--- trunk/Source/WebCore/inspector/InspectorController.cpp 2013-01-23 17:45:36 UTC (rev 140538)
+++ trunk/Source/WebCore/inspector/InspectorController.cpp 2013-01-23 17:57:26 UTC (rev 140539)
@@ -86,6 +86,7 @@
, m_overlay(InspectorOverlay::create(page, inspectorClient))
, m_page(page)
, m_inspectorClient(inspectorClient)
+ , m_isUnderTest(false)
{
OwnPtr<InspectorAgent> inspectorAgentPtr(InspectorAgent::create(page, m_injectedScriptManager.get(), m_instrumentingAgents.get(), m_state.get()));
m_inspectorAgent = inspectorAgentPtr.get();
@@ -299,8 +300,14 @@
m_pageAgent->webViewResized(size);
}
+bool InspectorController::isUnderTest()
+{
+ return m_isUnderTest;
+}
+
void InspectorController::evaluateForTestInFrontend(long callId, const String& script)
{
+ m_isUnderTest = true;
m_inspectorAgent->evaluateForTestInFrontend(callId, script);
}
Modified: trunk/Source/WebCore/inspector/InspectorController.h (140538 => 140539)
--- trunk/Source/WebCore/inspector/InspectorController.h 2013-01-23 17:45:36 UTC (rev 140538)
+++ trunk/Source/WebCore/inspector/InspectorController.h 2013-01-23 17:57:26 UTC (rev 140539)
@@ -104,6 +104,7 @@
void hideHighlight();
Node* highlightedNode() const;
+ bool isUnderTest();
void evaluateForTestInFrontend(long callId, const String& script);
#if ENABLE(_javascript__DEBUGGER)
@@ -150,6 +151,7 @@
Page* m_page;
InspectorClient* m_inspectorClient;
InspectorAgentRegistry m_agents;
+ bool m_isUnderTest;
};
}
Modified: trunk/Source/WebCore/inspector/InspectorFrontendClient.h (140538 => 140539)
--- trunk/Source/WebCore/inspector/InspectorFrontendClient.h 2013-01-23 17:45:36 UTC (rev 140538)
+++ trunk/Source/WebCore/inspector/InspectorFrontendClient.h 2013-01-23 17:57:26 UTC (rev 140539)
@@ -76,6 +76,8 @@
virtual void requestFileSystems() = 0;
virtual void addFileSystem() = 0;
virtual void removeFileSystem(const String& fileSystemPath) = 0;
+
+ virtual bool isUnderTest() = 0;
};
} // namespace WebCore
Modified: trunk/Source/WebCore/inspector/InspectorFrontendClientLocal.cpp (140538 => 140539)
--- trunk/Source/WebCore/inspector/InspectorFrontendClientLocal.cpp 2013-01-23 17:45:36 UTC (rev 140538)
+++ trunk/Source/WebCore/inspector/InspectorFrontendClientLocal.cpp 2013-01-23 17:57:26 UTC (rev 140539)
@@ -166,7 +166,7 @@
{
// Don't allow the attach if the window would be too small to accommodate the minimum inspector height.
// Also don't allow attaching to another inspector -- two inspectors in one window is too much!
- bool isInspectorPage = m_inspectorController->inspectedPage()->inspectorController()->hasInspectorFrontendClient();
+ bool isInspectorPage = m_inspectorController->hasInspectorFrontendClient();
unsigned inspectedPageHeight = m_inspectorController->inspectedPage()->mainFrame()->view()->visibleHeight();
unsigned maximumAttachedHeight = inspectedPageHeight * maximumAttachedHeightRatio;
return minimumAttachedHeight <= maximumAttachedHeight && !isInspectorPage;
@@ -297,6 +297,11 @@
m_dispatchTask->dispatch(message);
}
+bool InspectorFrontendClientLocal::isUnderTest()
+{
+ return m_inspectorController->isUnderTest();
+}
+
bool InspectorFrontendClientLocal::evaluateAsBoolean(const String& _expression_)
{
if (!m_frontendPage->mainFrame())
Modified: trunk/Source/WebCore/inspector/InspectorFrontendClientLocal.h (140538 => 140539)
--- trunk/Source/WebCore/inspector/InspectorFrontendClientLocal.h 2013-01-23 17:45:36 UTC (rev 140538)
+++ trunk/Source/WebCore/inspector/InspectorFrontendClientLocal.h 2013-01-23 17:57:26 UTC (rev 140539)
@@ -80,6 +80,7 @@
virtual void requestFileSystems() { }
virtual void addFileSystem() { }
virtual void removeFileSystem(const String&) { }
+ virtual bool isUnderTest();
bool canAttachWindow();
void setDockingUnavailable(bool);
Modified: trunk/Source/WebCore/inspector/InspectorFrontendHost.cpp (140538 => 140539)
--- trunk/Source/WebCore/inspector/InspectorFrontendHost.cpp 2013-01-23 17:45:36 UTC (rev 140538)
+++ trunk/Source/WebCore/inspector/InspectorFrontendHost.cpp 2013-01-23 17:57:26 UTC (rev 140539)
@@ -328,6 +328,11 @@
}
#endif
+bool InspectorFrontendHost::isUnderTest()
+{
+ return m_client && m_client->isUnderTest();
+}
+
} // namespace WebCore
#endif // ENABLE(INSPECTOR)
Modified: trunk/Source/WebCore/inspector/InspectorFrontendHost.h (140538 => 140539)
--- trunk/Source/WebCore/inspector/InspectorFrontendHost.h 2013-01-23 17:45:36 UTC (rev 140538)
+++ trunk/Source/WebCore/inspector/InspectorFrontendHost.h 2013-01-23 17:57:26 UTC (rev 140539)
@@ -94,6 +94,8 @@
PassRefPtr<DOMFileSystem> isolatedFileSystem(const String& fileSystemName, const String& rootURL);
#endif
+ bool isUnderTest();
+
private:
#if ENABLE(CONTEXT_MENUS)
friend class FrontendMenuProvider;
Modified: trunk/Source/WebCore/inspector/InspectorFrontendHost.idl (140538 => 140539)
--- trunk/Source/WebCore/inspector/InspectorFrontendHost.idl 2013-01-23 17:45:36 UTC (rev 140538)
+++ trunk/Source/WebCore/inspector/InspectorFrontendHost.idl 2013-01-23 17:57:26 UTC (rev 140539)
@@ -72,4 +72,6 @@
void addFileSystem();
void removeFileSystem(in DOMString fileSystemPath);
[Conditional=FILE_SYSTEM] DOMFileSystem isolatedFileSystem(in DOMString fileSystemId, in DOMString registeredName);
+
+ boolean isUnderTest();
};
Modified: trunk/Source/WebCore/inspector/front-end/DOMExtension.js (140538 => 140539)
--- trunk/Source/WebCore/inspector/front-end/DOMExtension.js 2013-01-23 17:45:36 UTC (rev 140538)
+++ trunk/Source/WebCore/inspector/front-end/DOMExtension.js 2013-01-23 17:57:26 UTC (rev 140539)
@@ -573,8 +573,6 @@
e.consume();
}
-window.isUnderTest = false;
-
/**
* Mutation observers leak memory. Keep track of them and disconnect
* on unload.
Modified: trunk/Source/WebCore/inspector/front-end/InspectorFrontendHostStub.js (140538 => 140539)
--- trunk/Source/WebCore/inspector/front-end/InspectorFrontendHostStub.js 2013-01-23 17:45:36 UTC (rev 140538)
+++ trunk/Source/WebCore/inspector/front-end/InspectorFrontendHostStub.js 2013-01-23 17:57:26 UTC (rev 140539)
@@ -224,6 +224,11 @@
canInspectWorkers: function()
{
return true;
+ },
+
+ isUnderTest: function()
+ {
+ return false;
}
}
Modified: trunk/Source/WebCore/inspector/front-end/TestController.js (140538 => 140539)
--- trunk/Source/WebCore/inspector/front-end/TestController.js 2013-01-23 17:45:36 UTC (rev 140538)
+++ trunk/Source/WebCore/inspector/front-end/TestController.js 2013-01-23 17:57:26 UTC (rev 140539)
@@ -28,33 +28,22 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-/**
- * @constructor
- */
-WebInspector.TestController = function()
-{
-}
-
-WebInspector.TestController.prototype = {
- notifyDone: function(callId, result)
- {
- var message = typeof result === "undefined" ? "\"<undefined>\"" : JSON.stringify(result);
- RuntimeAgent.evaluate("didEvaluateForTestInFrontend(" + callId + ", " + message + ")", "test");
- }
-}
-
WebInspector.evaluateForTestInFrontend = function(callId, script)
{
- window.isUnderTest = true;
+ if (!InspectorFrontendHost.isUnderTest())
+ return;
+
function invokeMethod()
{
+ var message;
try {
script = script + "//@ sourceURL=evaluateInWebInspector" + callId + ".js";
var result = window.eval(script);
- WebInspector.TestController.prototype.notifyDone(callId, result);
+ message = typeof result === "undefined" ? "\"<undefined>\"" : JSON.stringify(result);
} catch (e) {
- WebInspector.TestController.prototype.notifyDone(callId, e.toString());
+ message = e.toString();
}
+ RuntimeAgent.evaluate("didEvaluateForTestInFrontend(" + callId + ", " + message + ")", "test");
}
InspectorBackend.runAfterPendingDispatches(invokeMethod);
}
Modified: trunk/Source/WebCore/inspector/front-end/externs.js (140538 => 140539)
--- trunk/Source/WebCore/inspector/front-end/externs.js 2013-01-23 17:45:36 UTC (rev 140538)
+++ trunk/Source/WebCore/inspector/front-end/externs.js 2013-01-23 17:57:26 UTC (rev 140539)
@@ -65,8 +65,6 @@
/** @type {*} */
window.testRunner = null;
-window.isUnderTest = false;
-
/**
* @constructor
*/
Modified: trunk/Source/WebKit/chromium/ChangeLog (140538 => 140539)
--- trunk/Source/WebKit/chromium/ChangeLog 2013-01-23 17:45:36 UTC (rev 140538)
+++ trunk/Source/WebKit/chromium/ChangeLog 2013-01-23 17:57:26 UTC (rev 140539)
@@ -1,3 +1,18 @@
+2013-01-22 Pavel Feldman <pfeld...@chromium.org>
+
+ Web Inspector: only allow evaluateForTestInFrontend for front-ends under test.
+ https://bugs.webkit.org/show_bug.cgi?id=107523
+
+ Reviewed by Yury Semikhatsky.
+
+ * public/WebDevToolsFrontendClient.h:
+ (WebKit::WebDevToolsFrontendClient::isUnderTest):
+ (WebDevToolsFrontendClient):
+ * src/InspectorFrontendClientImpl.cpp:
+ (WebKit::InspectorFrontendClientImpl::isUnderTest):
+ * src/InspectorFrontendClientImpl.h:
+ (InspectorFrontendClientImpl):
+
2013-01-22 Mark Lam <mark....@apple.com>
Change the Supplementable class to not use AtomicString.
Modified: trunk/Source/WebKit/chromium/public/WebDevToolsFrontendClient.h (140538 => 140539)
--- trunk/Source/WebKit/chromium/public/WebDevToolsFrontendClient.h 2013-01-23 17:45:36 UTC (rev 140538)
+++ trunk/Source/WebKit/chromium/public/WebDevToolsFrontendClient.h 2013-01-23 17:57:26 UTC (rev 140539)
@@ -57,6 +57,8 @@
virtual void addFileSystem() { }
virtual void removeFileSystem(const WebString& fileSystemPath) { }
+ virtual bool isUnderTest() { return false; }
+
protected:
virtual ~WebDevToolsFrontendClient() {}
};
Modified: trunk/Source/WebKit/chromium/src/InspectorFrontendClientImpl.cpp (140538 => 140539)
--- trunk/Source/WebKit/chromium/src/InspectorFrontendClientImpl.cpp 2013-01-23 17:45:36 UTC (rev 140538)
+++ trunk/Source/WebKit/chromium/src/InspectorFrontendClientImpl.cpp 2013-01-23 17:57:26 UTC (rev 140539)
@@ -174,5 +174,9 @@
m_client->removeFileSystem(fileSystemPath);
}
+bool InspectorFrontendClientImpl::isUnderTest()
+{
+ return m_client->isUnderTest();
+}
} // namespace WebKit
Modified: trunk/Source/WebKit/chromium/src/InspectorFrontendClientImpl.h (140538 => 140539)
--- trunk/Source/WebKit/chromium/src/InspectorFrontendClientImpl.h 2013-01-23 17:45:36 UTC (rev 140538)
+++ trunk/Source/WebKit/chromium/src/InspectorFrontendClientImpl.h 2013-01-23 17:57:26 UTC (rev 140539)
@@ -80,6 +80,9 @@
virtual void requestFileSystems();
virtual void addFileSystem();
virtual void removeFileSystem(const String& fileSystemPath);
+
+ virtual bool isUnderTest();
+
private:
WebCore::Page* m_frontendPage;
WebDevToolsFrontendClient* m_client;
Modified: trunk/Tools/ChangeLog (140538 => 140539)
--- trunk/Tools/ChangeLog 2013-01-23 17:45:36 UTC (rev 140538)
+++ trunk/Tools/ChangeLog 2013-01-23 17:57:26 UTC (rev 140539)
@@ -1,3 +1,16 @@
+2013-01-22 Pavel Feldman <pfeld...@chromium.org>
+
+ Web Inspector: only allow evaluateForTestInFrontend for front-ends under test.
+ https://bugs.webkit.org/show_bug.cgi?id=107523
+
+ Reviewed by Yury Semikhatsky.
+
+ * DumpRenderTree/chromium/DRTDevToolsClient.cpp:
+ (DRTDevToolsClient::isUnderTest):
+ (DRTDevToolsClient::call):
+ * DumpRenderTree/chromium/DRTDevToolsClient.h:
+ (DRTDevToolsClient):
+
2013-01-23 Tim 'mithro' Ansell <mit...@mithis.com>
Removing command line shortening as it makes it difficult to see the command during errors.
Modified: trunk/Tools/DumpRenderTree/chromium/DRTDevToolsClient.cpp (140538 => 140539)
--- trunk/Tools/DumpRenderTree/chromium/DRTDevToolsClient.cpp 2013-01-23 17:45:36 UTC (rev 140538)
+++ trunk/Tools/DumpRenderTree/chromium/DRTDevToolsClient.cpp 2013-01-23 17:57:26 UTC (rev 140539)
@@ -92,6 +92,11 @@
// Not implemented.
}
+bool DRTDevToolsClient::isUnderTest()
+{
+ return true;
+}
+
void DRTDevToolsClient::asyncCall(const WebString& args)
{
postTask(new AsyncCallTask(this, args));
@@ -101,4 +106,3 @@
{
m_webDevToolsFrontend->dispatchOnInspectorFrontend(args);
}
-
Modified: trunk/Tools/DumpRenderTree/chromium/DRTDevToolsClient.h (140538 => 140539)
--- trunk/Tools/DumpRenderTree/chromium/DRTDevToolsClient.h 2013-01-23 17:45:36 UTC (rev 140538)
+++ trunk/Tools/DumpRenderTree/chromium/DRTDevToolsClient.h 2013-01-23 17:57:26 UTC (rev 140539)
@@ -60,6 +60,7 @@
virtual void closeWindow();
virtual void dockWindow();
virtual void undockWindow();
+ virtual bool isUnderTest();
void asyncCall(const WebKit::WebString& args);