Commit 55a4224d authored by seokju@webkit.org's avatar seokju@webkit.org

Web Inspector: Get rid of DOM.setFileInputFiles from Protocol

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

Reviewed by Joseph Pecoraro.

Source/WebCore:

No new tests, No changes in behavior.

It is a dead code as all ports in WebKit don't support it.
And this patch removes all things related to DOM.setFileInputFiles in Frontend.

* inspector/InspectorClient.h:
* inspector/InspectorController.cpp:
(WebCore::InspectorController::InspectorController):
* inspector/InspectorDOMAgent.cpp:
(WebCore::InspectorDOMAgent::InspectorDOMAgent):
* inspector/InspectorDOMAgent.h:
(WebCore::InspectorDOMAgent::create):
* inspector/protocol/DOM.json:

Source/WebInspectorUI:

Update InspectorWebBackendCommands.js after removing DOM.setFileInputFiles.

* UserInterface/InspectorWebBackendCommands.js:

LayoutTests:

* inspector-protocol/dom/setFileInputFiles-expected.txt: Removed.
* inspector-protocol/dom/setFileInputFiles.html: Removed.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@161380 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 8f5a0257
2014-01-06 Seokju Kwon <seokju@webkit.org>
Web Inspector: Get rid of DOM.setFileInputFiles from Protocol
https://bugs.webkit.org/show_bug.cgi?id=126312
Reviewed by Joseph Pecoraro.
* inspector-protocol/dom/setFileInputFiles-expected.txt: Removed.
* inspector-protocol/dom/setFileInputFiles.html: Removed.
2014-01-06 Brent Fulgham <bfulgham@apple.com>
Unreviewed test update after r161375.
Received error: Cannot set file input files
Received error: Cannot set file input files
<html>
<head>
<script type="text/javascript" src="../../http/tests/inspector-protocol/resources/protocol-test.js"></script>
<script>
function onLoad()
{
document.querySelector("input").addEventListener("change", onChange);
function onChange(event)
{
var files = event.target.files;
log("File count: " + files.length);
for (var i = 0; i < files.length; i++) {
log("Name: " + files[i].name);
}
}
runTest();
}
function test()
{
function abortOnError(message)
{
if (message.error) {
InspectorTest.log(message.error.message);
InspectorTest.completeTest();
}
}
InspectorTest.sendCommand("DOM.getDocument", {}, onGotDocument);
function onGotDocument(message)
{
abortOnError(message);
var node = message.result.root;
InspectorTest.sendCommand("DOM.querySelectorAll", { "nodeId": node.nodeId, "selector": "input" }, onQuerySelectorAll);
}
function onQuerySelectorAll(message)
{
abortOnError(message);
var ids = message.result.nodeIds;
InspectorTest.sendCommand("DOM.setFileInputFiles", { "nodeId": ids[0], "files": ["file1", "file2"] }, onSetFiles);
InspectorTest.sendCommand("DOM.setFileInputFiles", { "nodeId": ids[1], "files": ["file1", "file2"] }, onBadSetFiles);
}
function onSetFiles(message)
{
if (message.error) {
InspectorTest.log("Received error: " + message.error.message);
}
}
function onBadSetFiles(message)
{
InspectorTest.log("Received error: " + message.error.message);
InspectorTest.completeTest();
}
}
</script>
</head>
<body onload="onLoad()">
<input type="file"></input>
<input type="text"></input>
</body>
</html>
2014-01-06 Seokju Kwon <seokju@webkit.org>
Web Inspector: Get rid of DOM.setFileInputFiles from Protocol
https://bugs.webkit.org/show_bug.cgi?id=126312
Reviewed by Joseph Pecoraro.
No new tests, No changes in behavior.
It is a dead code as all ports in WebKit don't support it.
And this patch removes all things related to DOM.setFileInputFiles in Frontend.
* inspector/InspectorClient.h:
* inspector/InspectorController.cpp:
(WebCore::InspectorController::InspectorController):
* inspector/InspectorDOMAgent.cpp:
(WebCore::InspectorDOMAgent::InspectorDOMAgent):
* inspector/InspectorDOMAgent.h:
(WebCore::InspectorDOMAgent::create):
* inspector/protocol/DOM.json:
2014-01-06 Brent Fulgham <bfulgham@apple.com>
[WebGL] Revise String Concatenation (Follow-up to r161247)
......@@ -95,8 +95,6 @@ public:
virtual bool handleJavaScriptDialog(bool, const String*) { return false; }
virtual bool canSetFileInputFiles() { return false; }
static bool doDispatchMessageOnFrontendPage(Page* frontendPage, const String& message);
};
......
......@@ -101,7 +101,7 @@ InspectorController::InspectorController(Page* page, InspectorClient* inspectorC
m_pageAgent = pageAgentPtr.get();
m_agents.append(pageAgentPtr.release());
OwnPtr<InspectorDOMAgent> domAgentPtr(InspectorDOMAgent::create(m_instrumentingAgents.get(), pageAgent, m_injectedScriptManager.get(), m_overlay.get(), inspectorClient));
OwnPtr<InspectorDOMAgent> domAgentPtr(InspectorDOMAgent::create(m_instrumentingAgents.get(), pageAgent, m_injectedScriptManager.get(), m_overlay.get()));
m_domAgent = domAgentPtr.get();
m_agents.append(domAgentPtr.release());
......
......@@ -57,18 +57,14 @@
#include "EventListener.h"
#include "EventNames.h"
#include "EventTarget.h"
#include "File.h"
#include "FileList.h"
#include "FrameTree.h"
#include "HTMLElement.h"
#include "HTMLFrameOwnerElement.h"
#include "HTMLInputElement.h"
#include "HTMLNames.h"
#include "HTMLTemplateElement.h"
#include "HitTestResult.h"
#include "IdentifiersFactory.h"
#include "InjectedScriptManager.h"
#include "InspectorClient.h"
#include "InspectorHistory.h"
#include "InspectorNodeFinder.h"
#include "InspectorOverlay.h"
......@@ -213,12 +209,11 @@ String InspectorDOMAgent::toErrorString(const ExceptionCode& ec)
return "";
}
InspectorDOMAgent::InspectorDOMAgent(InstrumentingAgents* instrumentingAgents, InspectorPageAgent* pageAgent, InjectedScriptManager* injectedScriptManager, InspectorOverlay* overlay, InspectorClient* client)
InspectorDOMAgent::InspectorDOMAgent(InstrumentingAgents* instrumentingAgents, InspectorPageAgent* pageAgent, InjectedScriptManager* injectedScriptManager, InspectorOverlay* overlay)
: InspectorAgentBase(ASCIILiteral("DOM"), instrumentingAgents)
, m_pageAgent(pageAgent)
, m_injectedScriptManager(injectedScriptManager)
, m_overlay(overlay)
, m_client(client)
, m_domListener(0)
, m_lastNodeId(1)
, m_lastBackendNodeId(-1)
......@@ -1188,34 +1183,6 @@ void InspectorDOMAgent::focus(ErrorString* errorString, int nodeId)
element->focus();
}
void InspectorDOMAgent::setFileInputFiles(ErrorString* errorString, int nodeId, const RefPtr<InspectorArray>& files)
{
if (!m_client->canSetFileInputFiles()) {
*errorString = "Cannot set file input files";
return;
}
Node* node = assertNode(errorString, nodeId);
if (!node)
return;
HTMLInputElement* element = node->toInputElement();
if (!element || !element->isFileUpload()) {
*errorString = "Node is not a file input element";
return;
}
RefPtr<FileList> fileList = FileList::create();
for (InspectorArray::const_iterator iter = files->begin(); iter != files->end(); ++iter) {
String path;
if (!(*iter)->asString(&path)) {
*errorString = "Files must be strings";
return;
}
fileList->append(File::create(path));
}
element->setFiles(fileList);
}
void InspectorDOMAgent::resolveNode(ErrorString* errorString, int nodeId, const String* const objectGroup, RefPtr<Inspector::TypeBuilder::Runtime::RemoteObject>& result)
{
String objectGroupName = objectGroup ? *objectGroup : "";
......
......@@ -61,7 +61,6 @@ class DOMEditor;
class Document;
class Element;
class Event;
class InspectorClient;
class InspectorHistory;
class InspectorOverlay;
class InspectorPageAgent;
......@@ -105,9 +104,9 @@ public:
virtual void didModifyDOMAttr(Element*) = 0;
};
static PassOwnPtr<InspectorDOMAgent> create(InstrumentingAgents* instrumentingAgents, InspectorPageAgent* pageAgent, InjectedScriptManager* injectedScriptManager, InspectorOverlay* overlay, InspectorClient* client)
static PassOwnPtr<InspectorDOMAgent> create(InstrumentingAgents* instrumentingAgents, InspectorPageAgent* pageAgent, InjectedScriptManager* injectedScriptManager, InspectorOverlay* overlay)
{
return adoptPtr(new InspectorDOMAgent(instrumentingAgents, pageAgent, injectedScriptManager, overlay, client));
return adoptPtr(new InspectorDOMAgent(instrumentingAgents, pageAgent, injectedScriptManager, overlay));
}
static String toErrorString(const ExceptionCode&);
......@@ -155,7 +154,6 @@ public:
virtual void redo(ErrorString*);
virtual void markUndoableState(ErrorString*);
virtual void focus(ErrorString*, int nodeId);
virtual void setFileInputFiles(ErrorString*, int nodeId, const RefPtr<Inspector::InspectorArray>& files);
void getEventListeners(Node*, Vector<EventListenerInfo>& listenersArray, bool includeAncestors);
......@@ -215,7 +213,7 @@ public:
InspectorPageAgent* pageAgent() { return m_pageAgent; }
private:
InspectorDOMAgent(InstrumentingAgents*, InspectorPageAgent*, InjectedScriptManager*, InspectorOverlay*, InspectorClient*);
InspectorDOMAgent(InstrumentingAgents*, InspectorPageAgent*, InjectedScriptManager*, InspectorOverlay*);
void setSearchingForNode(ErrorString*, bool enabled, Inspector::InspectorObject* highlightConfig);
PassOwnPtr<HighlightConfig> highlightConfigFromInspectorObject(ErrorString*, Inspector::InspectorObject* highlightInspectorObject);
......@@ -250,7 +248,6 @@ private:
InspectorPageAgent* m_pageAgent;
InjectedScriptManager* m_injectedScriptManager;
InspectorOverlay* m_overlay;
InspectorClient* m_client;
std::unique_ptr<Inspector::InspectorDOMFrontendDispatcher> m_frontendDispatcher;
RefPtr<Inspector::InspectorDOMBackendDispatcher> m_backendDispatcher;
DOMListener* m_domListener;
......
......@@ -377,14 +377,6 @@
{ "name": "nodeId", "$ref": "NodeId", "description": "Id of the node to focus." }
],
"description": "Focuses the given element."
},
{
"name": "setFileInputFiles",
"parameters": [
{ "name": "nodeId", "$ref": "NodeId", "description": "Id of the file input node to set files for." },
{ "name": "files", "type": "array", "items": { "type": "string" }, "description": "Array of file paths to set." }
],
"description": "Sets files for the given file input element."
}
],
"events": [
......
2014-01-06 Seokju Kwon <seokju@webkit.org>
Web Inspector: Get rid of DOM.setFileInputFiles from Protocol
https://bugs.webkit.org/show_bug.cgi?id=126312
Reviewed by Joseph Pecoraro.
Update InspectorWebBackendCommands.js after removing DOM.setFileInputFiles.
* UserInterface/InspectorWebBackendCommands.js:
2013-12-22 Martin Robinson <mrobinson@igalia.com>
[GTK][CMake] Integrate GResource for inspector files (and others?)
......
......@@ -126,7 +126,6 @@ InspectorBackend.registerCommand("DOM.undo", [], []);
InspectorBackend.registerCommand("DOM.redo", [], []);
InspectorBackend.registerCommand("DOM.markUndoableState", [], []);
InspectorBackend.registerCommand("DOM.focus", [{"name": "nodeId", "type": "number", "optional": false}], []);
InspectorBackend.registerCommand("DOM.setFileInputFiles", [{"name": "nodeId", "type": "number", "optional": false}, {"name": "files", "type": "object", "optional": false}], []);
// DOMDebugger.
InspectorBackend.registerEnum("DOMDebugger.DOMBreakpointType", {SubtreeModified: "subtree-modified", AttributeModified: "attribute-modified", NodeRemoved: "node-removed"});
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment