Diff
Modified: trunk/Source/WebCore/ChangeLog (90016 => 90017)
--- trunk/Source/WebCore/ChangeLog 2011-06-29 14:18:40 UTC (rev 90016)
+++ trunk/Source/WebCore/ChangeLog 2011-06-29 14:38:06 UTC (rev 90017)
@@ -1,3 +1,21 @@
+2011-06-29 Andrey Kosyakov <[email protected]>
+
+ Reviewed by Pavel Feldman.
+
+ Web Inspector: backend needs to provide system-unique object ids, so these remain unique across navigation
+ https://bugs.webkit.org/show_bug.cgi?id=62894
+
+ * inspector/InspectorController.cpp:
+ (WebCore::InspectorController::setAgentProcessIdentifier):
+ * inspector/InspectorController.h:
+ * inspector/InspectorPageAgent.cpp:
+ (WebCore::InspectorPageAgent::setAgentIdentifier):
+ (WebCore::InspectorPageAgent::createIdentifier):
+ (WebCore::InspectorPageAgent::frameForId):
+ (WebCore::InspectorPageAgent::frameId):
+ (WebCore::InspectorPageAgent::frameDestroyed):
+ * inspector/InspectorPageAgent.h:
+
2011-06-29 Pavel Feldman <[email protected]>
Reviewed by Yury Semikhatsky.
Modified: trunk/Source/WebCore/inspector/InspectorController.cpp (90016 => 90017)
--- trunk/Source/WebCore/inspector/InspectorController.cpp 2011-06-29 14:18:40 UTC (rev 90016)
+++ trunk/Source/WebCore/inspector/InspectorController.cpp 2011-06-29 14:38:06 UTC (rev 90017)
@@ -349,6 +349,11 @@
m_inspectorAgent->restore();
}
+void InspectorController::setAgentIdentifierPrefix(const String& prefix)
+{
+ m_pageAgent->setAgentIdentifierPrefix(prefix);
+}
+
void InspectorController::evaluateForTestInFrontend(long callId, const String& script)
{
m_inspectorAgent->evaluateForTestInFrontend(callId, script);
Modified: trunk/Source/WebCore/inspector/InspectorController.h (90016 => 90017)
--- trunk/Source/WebCore/inspector/InspectorController.h 2011-06-29 14:18:40 UTC (rev 90016)
+++ trunk/Source/WebCore/inspector/InspectorController.h 2011-06-29 14:38:06 UTC (rev 90017)
@@ -93,6 +93,7 @@
void connectFrontend();
void disconnectFrontend();
void restoreInspectorStateFromCookie(const String& inspectorCookie);
+ void setAgentIdentifierPrefix(const String&);
void showConsole();
void inspect(Node*);
Modified: trunk/Source/WebCore/inspector/InspectorPageAgent.cpp (90016 => 90017)
--- trunk/Source/WebCore/inspector/InspectorPageAgent.cpp 2011-06-29 14:18:40 UTC (rev 90016)
+++ trunk/Source/WebCore/inspector/InspectorPageAgent.cpp 2011-06-29 14:38:06 UTC (rev 90017)
@@ -69,7 +69,7 @@
namespace {
// This should be kept the same as the one in front-end/utilities.js
static const char regexSpecialCharacters[] = "[](){}+-*.,?\\^$|";
-static unsigned int s_lastFrameIdentifier = 0;
+static unsigned int s_lastUsedIdentifier = 0;
}
static bool decodeSharedBuffer(PassRefPtr<SharedBuffer> buffer, const String& textEncodingName, String* result)
@@ -282,6 +282,11 @@
m_frontend = 0;
}
+void InspectorPageAgent::setAgentIdentifierPrefix(const String& prefix)
+{
+ m_agentIdentifierPrefix = prefix.isEmpty() ? String("") : prefix + ".";
+}
+
void InspectorPageAgent::addScriptToEvaluateOnLoad(ErrorString*, const String& source)
{
m_scriptsToEvaluateOnLoad.append(source);
@@ -560,26 +565,27 @@
return String::format("%.0llX", address);
}
+String InspectorPageAgent::createIdentifier()
+{
+ return m_agentIdentifierPrefix + String::number(++s_lastUsedIdentifier);
+}
+
Frame* InspectorPageAgent::frameForId(const String& frameId)
{
- bool ok = false;
- unsigned int identifier = frameId.toUIntStrict(&ok);
- if (!ok || !identifier)
- return 0;
- return m_identifierToFrame.get(identifier);
+ return frameId.isEmpty() ? 0 : m_identifierToFrame.get(frameId);
}
String InspectorPageAgent::frameId(Frame* frame)
{
if (!frame)
return "";
- unsigned int identifier = m_frameToIdentifier.get(frame);
- if (!identifier) {
- identifier = ++s_lastFrameIdentifier;
+ String identifier = m_frameToIdentifier.get(frame);
+ if (identifier.isNull()) {
+ identifier = createIdentifier();
m_frameToIdentifier.set(frame, identifier);
m_identifierToFrame.set(identifier, frame);
}
- return String::number(identifier);
+ return identifier;
}
String InspectorPageAgent::loaderId(DocumentLoader* loader)
@@ -589,7 +595,7 @@
void InspectorPageAgent::frameDestroyed(Frame* frame)
{
- HashMap<Frame*, unsigned int>::iterator iterator = m_frameToIdentifier.find(frame);
+ HashMap<Frame*, String>::iterator iterator = m_frameToIdentifier.find(frame);
if (iterator != m_frameToIdentifier.end()) {
m_identifierToFrame.remove(iterator->second);
m_frameToIdentifier.remove(iterator);
Modified: trunk/Source/WebCore/inspector/InspectorPageAgent.h (90016 => 90017)
--- trunk/Source/WebCore/inspector/InspectorPageAgent.h 2011-06-29 14:18:40 UTC (rev 90016)
+++ trunk/Source/WebCore/inspector/InspectorPageAgent.h 2011-06-29 14:38:06 UTC (rev 90017)
@@ -107,6 +107,7 @@
// Inspector Controller API
void setFrontend(InspectorFrontend*);
void clearFrontend();
+ void setAgentIdentifierPrefix(const String&);
// Cross-agents API
Frame* mainFrame();
@@ -117,6 +118,8 @@
private:
InspectorPageAgent(InstrumentingAgents*, Page*, InjectedScriptManager*);
+ String createIdentifier();
+
PassRefPtr<InspectorObject> buildObjectForFrame(Frame*);
PassRefPtr<InspectorObject> buildObjectForFrameTree(Frame*);
@@ -124,9 +127,10 @@
Page* m_page;
InjectedScriptManager* m_injectedScriptManager;
InspectorFrontend::Page* m_frontend;
+ String m_agentIdentifierPrefix;
Vector<String> m_scriptsToEvaluateOnLoad;
- HashMap<Frame*, unsigned int> m_frameToIdentifier;
- HashMap<unsigned int, Frame*> m_identifierToFrame;
+ HashMap<Frame*, String> m_frameToIdentifier;
+ HashMap<String, Frame*> m_identifierToFrame;
};
Modified: trunk/Source/WebKit/chromium/ChangeLog (90016 => 90017)
--- trunk/Source/WebKit/chromium/ChangeLog 2011-06-29 14:18:40 UTC (rev 90016)
+++ trunk/Source/WebKit/chromium/ChangeLog 2011-06-29 14:38:06 UTC (rev 90017)
@@ -1,3 +1,15 @@
+2011-06-29 Andrey Kosyakov <[email protected]>
+
+ Reviewed by Pavel Feldman.
+
+ Web Inspector: backend needs to provide system-unique object ids, so these remain unique across navigation
+ https://bugs.webkit.org/show_bug.cgi?id=62894
+
+ * public/WebDevToolsAgent.h:
+ * src/WebDevToolsAgentImpl.cpp:
+ (WebKit::WebDevToolsAgentImpl::setAgentProcessIdentifier):
+ * src/WebDevToolsAgentImpl.h:
+
2011-06-28 Ilya Sherman <[email protected]>
Reviewed by Adam Barth.
Modified: trunk/Source/WebKit/chromium/public/WebDevToolsAgent.h (90016 => 90017)
--- trunk/Source/WebKit/chromium/public/WebDevToolsAgent.h 2011-06-29 14:18:40 UTC (rev 90016)
+++ trunk/Source/WebKit/chromium/public/WebDevToolsAgent.h 2011-06-29 14:38:06 UTC (rev 90017)
@@ -59,6 +59,7 @@
virtual void inspectElementAt(const WebPoint&) = 0;
virtual void setRuntimeProperty(const WebString& name, const WebString& value) = 0;
+ virtual void setAgentIdentifierPrefix(const WebString&) = 0;
// Exposed for LayoutTestController.
virtual void evaluateInWebInspector(long callId, const WebString& script) = 0;
Modified: trunk/Source/WebKit/chromium/src/WebDevToolsAgentImpl.cpp (90016 => 90017)
--- trunk/Source/WebKit/chromium/src/WebDevToolsAgentImpl.cpp 2011-06-29 14:18:40 UTC (rev 90016)
+++ trunk/Source/WebKit/chromium/src/WebDevToolsAgentImpl.cpp 2011-06-29 14:38:06 UTC (rev 90017)
@@ -306,6 +306,11 @@
m_client->runtimePropertyChanged(kInspectorStateFeatureName, state);
}
+void WebDevToolsAgentImpl::setAgentIdentifierPrefix(const WebString& prefix)
+{
+ inspectorController()->setAgentIdentifierPrefix(prefix);
+}
+
void WebDevToolsAgentImpl::evaluateInWebInspector(long callId, const WebString& script)
{
InspectorController* ic = inspectorController();
Modified: trunk/Source/WebKit/chromium/src/WebDevToolsAgentImpl.h (90016 => 90017)
--- trunk/Source/WebKit/chromium/src/WebDevToolsAgentImpl.h 2011-06-29 14:18:40 UTC (rev 90016)
+++ trunk/Source/WebKit/chromium/src/WebDevToolsAgentImpl.h 2011-06-29 14:38:06 UTC (rev 90017)
@@ -81,6 +81,7 @@
virtual void evaluateInWebInspector(long callId, const WebString& script);
virtual void setJavaScriptProfilingEnabled(bool);
virtual void setRuntimeProperty(const WebString& name, const WebString& value);
+ virtual void setAgentIdentifierPrefix(const WebString&);
// InspectorClient implementation.
virtual void inspectorDestroyed();