Diff
Modified: trunk/LayoutTests/ChangeLog (120474 => 120475)
--- trunk/LayoutTests/ChangeLog 2012-06-15 17:13:52 UTC (rev 120474)
+++ trunk/LayoutTests/ChangeLog 2012-06-15 17:16:30 UTC (rev 120475)
@@ -1,3 +1,12 @@
+2012-06-15 Taiju Tsuiki <[email protected]>
+
+ Web Inspector: Move FileSystem frame management from frontend to backend
+ https://bugs.webkit.org/show_bug.cgi?id=89190
+
+ Reviewed by Vsevolod Vlasov.
+
+ * http/tests/inspector/filesystem/read-directory.html:
+
2012-06-15 Pavel Feldman <[email protected]>
Web Inspector: extension's Resource.getContent always returns original revision.
Modified: trunk/LayoutTests/http/tests/inspector/filesystem/read-directory.html (120474 => 120475)
--- trunk/LayoutTests/http/tests/inspector/filesystem/read-directory.html 2012-06-15 17:13:52 UTC (rev 120474)
+++ trunk/LayoutTests/http/tests/inspector/filesystem/read-directory.html 2012-06-15 17:16:30 UTC (rev 120475)
@@ -37,7 +37,7 @@
{
InspectorTest.addSniffer(FileSystemDispatcher.prototype, "didReadDirectory", step5, false);
// FIXME: Call FileSystemDispatcher through FileSystemDispatcher implementation after it landed.
- FileSystemAgent.readDirectory(1, WebInspector.resourceTreeModel.mainFrame.id, "filesystem:http://127.0.0.1/temporary/hoge");
+ FileSystemAgent.readDirectory(1, "filesystem:http://127.0.0.1:8000/temporary/hoge");
}
function step5(requestId, errorCode, entries)
@@ -46,7 +46,7 @@
InspectorTest.addSniffer(FileSystemDispatcher.prototype, "didReadDirectory", step6, false);
// FIXME: Call FileSystemDispatcher through FileSystemDispatcher implementation after it landed.
- FileSystemAgent.readDirectory(1, WebInspector.resourceTreeModel.mainFrame.id, "filesystem:http://127.0.0.1/temporary/foo");
+ FileSystemAgent.readDirectory(1, "filesystem:http://127.0.0.1:8000/temporary/foo");
}
function step6(requestId, errorCode, entries) {
Modified: trunk/Source/WebCore/ChangeLog (120474 => 120475)
--- trunk/Source/WebCore/ChangeLog 2012-06-15 17:13:52 UTC (rev 120474)
+++ trunk/Source/WebCore/ChangeLog 2012-06-15 17:16:30 UTC (rev 120475)
@@ -1,3 +1,22 @@
+2012-06-15 Taiju Tsuiki <[email protected]>
+
+ Web Inspector: Move FileSystem frame management from frontend to backend
+ https://bugs.webkit.org/show_bug.cgi?id=89190
+
+ Reviewed by Vsevolod Vlasov.
+
+ Test: http/tests/inspector/filesystem/read-directory.html
+
+ * inspector/Inspector.json:
+ * inspector/InspectorFileSystemAgent.cpp:
+ (WebCore::InspectorFileSystemAgent::readDirectory):
+ (WebCore::InspectorFileSystemAgent::InspectorFileSystemAgent):
+ (WebCore::InspectorFileSystemAgent::scriptExecutionContextForOrigin):
+ (WebCore):
+ * inspector/InspectorFileSystemAgent.h:
+ (WebCore):
+ (InspectorFileSystemAgent):
+
2012-06-15 Alexander Pavlov <[email protected]>
Unreviewed, build fix after r120469.
Modified: trunk/Source/WebCore/inspector/Inspector.json (120474 => 120475)
--- trunk/Source/WebCore/inspector/Inspector.json 2012-06-15 17:13:52 UTC (rev 120474)
+++ trunk/Source/WebCore/inspector/Inspector.json 2012-06-15 17:16:30 UTC (rev 120475)
@@ -1430,7 +1430,6 @@
"description": "Requests to read the directory content. Result should return on didReadDirectory event with request id.",
"parameters": [
{ "name": "requestId", "type": "integer" },
- { "name": "frameId", "type": "string" },
{ "name": "url", "type": "string" }
]
}
Modified: trunk/Source/WebCore/inspector/InspectorFileSystemAgent.cpp (120474 => 120475)
--- trunk/Source/WebCore/inspector/InspectorFileSystemAgent.cpp 2012-06-15 17:13:52 UTC (rev 120474)
+++ trunk/Source/WebCore/inspector/InspectorFileSystemAgent.cpp 2012-06-15 17:16:30 UTC (rev 120475)
@@ -52,6 +52,7 @@
#include "KURL.h"
#include "LocalFileSystem.h"
#include "MIMETypeRegistry.h"
+#include "SecurityOrigin.h"
using WebCore::TypeBuilder::Array;
@@ -308,19 +309,16 @@
m_state->setBoolean(FileSystemAgentState::fileSystemAgentEnabled, m_enabled);
}
-void InspectorFileSystemAgent::readDirectory(ErrorString*, int requestId, const String& frameId, const String& url)
+void InspectorFileSystemAgent::readDirectory(ErrorString*, int requestId, const String& url)
{
if (!m_enabled || !m_frontendProvider)
return;
ASSERT(m_frontendProvider->frontend());
- Frame* frame = m_pageAgent->frameForId(frameId);
- if (!frame) {
+ if (ScriptExecutionContext* scriptExecutionContext = scriptExecutionContextForOrigin(SecurityOrigin::createFromString(url).get()))
+ ReadDirectoryTask::create(m_frontendProvider, requestId, url)->start(scriptExecutionContext);
+ else
m_frontendProvider->frontend()->didReadDirectory(requestId, static_cast<int>(FileError::ABORT_ERR), 0);
- return;
- }
-
- ReadDirectoryTask::create(m_frontendProvider, requestId, url)->start(frame->document());
}
void InspectorFileSystemAgent::setFrontend(InspectorFrontend* frontend)
@@ -351,9 +349,19 @@
{
ASSERT(instrumentingAgents);
ASSERT(state);
+ ASSERT(m_pageAgent);
m_instrumentingAgents->setInspectorFileSystemAgent(this);
}
+ScriptExecutionContext* InspectorFileSystemAgent::scriptExecutionContextForOrigin(SecurityOrigin* origin)
+{
+ for (Frame* frame = m_pageAgent->mainFrame(); frame; frame = frame->tree()->traverseNext()) {
+ if (frame->document() && frame->document()->securityOrigin()->isSameSchemeHostPort(origin))
+ return frame->document();
+ }
+ return 0;
+}
+
} // namespace WebCore
#endif // ENABLE(INSPECTOR) && ENABLE(FILE_SYSTEM)
Modified: trunk/Source/WebCore/inspector/InspectorFileSystemAgent.h (120474 => 120475)
--- trunk/Source/WebCore/inspector/InspectorFileSystemAgent.h 2012-06-15 17:13:52 UTC (rev 120474)
+++ trunk/Source/WebCore/inspector/InspectorFileSystemAgent.h 2012-06-15 17:16:30 UTC (rev 120475)
@@ -46,6 +46,8 @@
class InspectorPageAgent;
class InspectorState;
class InstrumentingAgents;
+class ScriptExecutionContext;
+class SecurityOrigin;
class InspectorFileSystemAgent : public InspectorBaseAgent<InspectorFileSystemAgent>, public InspectorBackendDispatcher::FileSystemCommandHandler {
public:
@@ -57,13 +59,15 @@
virtual void enable(ErrorString*) OVERRIDE;
virtual void disable(ErrorString*) OVERRIDE;
- virtual void readDirectory(ErrorString*, int requestId, const String& frameId, const String& url) OVERRIDE;
+ virtual void readDirectory(ErrorString*, int requestId, const String& url) OVERRIDE;
virtual void setFrontend(InspectorFrontend*) OVERRIDE;
virtual void clearFrontend() OVERRIDE;
virtual void restore() OVERRIDE;
+
private:
InspectorFileSystemAgent(InstrumentingAgents*, InspectorPageAgent*, InspectorState*);
+ ScriptExecutionContext* scriptExecutionContextForOrigin(SecurityOrigin*);
InspectorPageAgent* m_pageAgent;
RefPtr<FrontendProvider> m_frontendProvider;