Skip to content
Permalink
Browse files
2009-11-19 Alexander Pavlov <apavlov@chromium.org>
        Reviewed by Pavel Feldman.

        Store cookie domains in the WebInspector object

        The cookie domains have been moved from StoragePanel into WebInspector.
        Also, the document URLs are now passed inside the WebInspector.addResource()
        payload rather than pushed directly from InspectorController.
        https://bugs.webkit.org/show_bug.cgi?id=31627

        * inspector/InspectorController.cpp:
        (WebCore::InspectorController::populateScriptObjects):
        (WebCore::InspectorController::didFinishLoading):
        * inspector/InspectorFrontend.cpp:
        * inspector/InspectorFrontend.h:
        * inspector/InspectorResource.cpp:
        (WebCore::InspectorResource::createScriptObject):
        (WebCore::InspectorResource::updateScriptObject):
        * inspector/front-end/StoragePanel.js:
        (WebInspector.StoragePanel.prototype.reset):
        (WebInspector.StoragePanel.prototype.addCookieDomain):
        * inspector/front-end/inspector.js:
        (WebInspector.addResource):
        (WebInspector.addCookieDomain):
        (WebInspector.reset):

Canonical link: https://commits.webkit.org/42611@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@51182 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
eseidel committed Nov 19, 2009
1 parent 912b598 commit f833eade76b0f3950b928d54ec5409da6bfb5bf7
@@ -1,3 +1,30 @@
2009-11-19 Alexander Pavlov <apavlov@chromium.org>

Reviewed by Pavel Feldman.

Store cookie domains in the WebInspector object

The cookie domains have been moved from StoragePanel into WebInspector.
Also, the document URLs are now passed inside the WebInspector.addResource()
payload rather than pushed directly from InspectorController.
https://bugs.webkit.org/show_bug.cgi?id=31627

* inspector/InspectorController.cpp:
(WebCore::InspectorController::populateScriptObjects):
(WebCore::InspectorController::didFinishLoading):
* inspector/InspectorFrontend.cpp:
* inspector/InspectorFrontend.h:
* inspector/InspectorResource.cpp:
(WebCore::InspectorResource::createScriptObject):
(WebCore::InspectorResource::updateScriptObject):
* inspector/front-end/StoragePanel.js:
(WebInspector.StoragePanel.prototype.reset):
(WebInspector.StoragePanel.prototype.addCookieDomain):
* inspector/front-end/inspector.js:
(WebInspector.addResource):
(WebInspector.addCookieDomain):
(WebInspector.reset):

2009-11-19 Zoltan Horvath <zoltan@webkit.org>

Reviewed by Darin Adler.
@@ -670,12 +670,8 @@ void InspectorController::populateScriptObjects()
m_domAgent->setDocument(m_inspectedPage->mainFrame()->document());

ResourcesMap::iterator resourcesEnd = m_resources.end();
for (ResourcesMap::iterator it = m_resources.begin(); it != resourcesEnd; ++it) {
for (ResourcesMap::iterator it = m_resources.begin(); it != resourcesEnd; ++it)
it->second->createScriptObject(m_frontend.get());
KURL resourceURL = it->second->frame()->document()->url();
if (resourceURL.protocolInHTTPFamily() || resourceURL.protocolIs("file"))
m_frontend->addCookieDomain(resourceURL.host());
}

unsigned messageCount = m_consoleMessages.size();
for (unsigned i = 0; i < messageCount; ++i)
@@ -1011,12 +1007,8 @@ void InspectorController::didFinishLoading(DocumentLoader*, unsigned long identi

addResource(resource.get());

if (windowVisible()) {
if (windowVisible())
resource->updateScriptObject(m_frontend.get());
KURL resourceURL = resource->frame()->document()->url();
if (resourceURL.protocolInHTTPFamily() || resourceURL.protocolIs("file"))
m_frontend->addCookieDomain(resourceURL.host());
}
}

void InspectorController::didFailLoading(DocumentLoader*, unsigned long identifier, const ResourceError& /*error*/)
@@ -132,13 +132,6 @@ void InspectorFrontend::removeResource(long long identifier)
function->call();
}

void InspectorFrontend::addCookieDomain(String domain)
{
OwnPtr<ScriptFunctionCall> function(newFunctionCall("addCookieDomain"));
function->appendArgument(domain);
function->call();
}

void InspectorFrontend::updateFocusedNode(long long nodeId)
{
OwnPtr<ScriptFunctionCall> function(newFunctionCall("updateFocusedNode"));
@@ -71,8 +71,6 @@ namespace WebCore {
bool updateResource(long long identifier, const ScriptObject& resourceObj);
void removeResource(long long identifier);

void addCookieDomain(String);

void updateFocusedNode(long long nodeId);
void setAttachedWindow(bool attached);
void showPanel(int panel);
@@ -128,6 +128,7 @@ void InspectorResource::createScriptObject(InspectorFrontend* frontend)
ScriptObject requestHeaders = frontend->newScriptObject();
populateHeadersObject(&requestHeaders, m_requestHeaderFields);
jsonObject.set("requestHeaders", requestHeaders);
jsonObject.set("documentURL", m_frame->document()->url().string());
jsonObject.set("requestURL", requestURL());
jsonObject.set("host", m_requestURL.host());
jsonObject.set("path", m_requestURL.path());
@@ -156,6 +157,7 @@ void InspectorResource::updateScriptObject(InspectorFrontend* frontend)
ScriptObject jsonObject = frontend->newScriptObject();
if (m_changes.hasChange(RequestChange)) {
jsonObject.set("url", requestURL());
jsonObject.set("documentURL", m_frame->document()->url().string());
jsonObject.set("domain", m_requestURL.host());
jsonObject.set("path", m_requestURL.path());
jsonObject.set("lastPathComponent", m_requestURL.lastPathComponent());
@@ -97,7 +97,6 @@ WebInspector.StoragePanel.prototype = {

this._domStorage = [];

this._cookieDomains = {};
this._cookieViews = {};

this.databasesListTreeElement.removeChildren();
@@ -124,13 +123,8 @@ WebInspector.StoragePanel.prototype = {

addCookieDomain: function(domain)
{
// Eliminate duplicate domains from the list.
if (typeof this._cookieDomains[domain] !== "undefined")
return;

var cookieDomainTreeElement = new WebInspector.CookieSidebarTreeElement(domain);
this.cookieListTreeElement.appendChild(cookieDomainTreeElement);
this._cookieDomains[domain] = true;
},

addDOMStorage: function(domStorage)
@@ -70,6 +70,7 @@ preloadImages();
var WebInspector = {
resources: {},
resourceURLMap: {},
cookieDomains: {},
missingLocalizedStrings: {},

get previousFocusElement()
@@ -984,6 +985,10 @@ WebInspector.addResource = function(identifier, payload)

if (this.panels.resources)
this.panels.resources.addResource(resource);

var match = payload.documentURL.match(/^(http[s]?|file):\/\/([\/]*[^\/]+)/i);
if (match)
this.addCookieDomain(match[1].toLowerCase() === "file" ? "" : match[2]);
}

WebInspector.clearConsoleMessages = function()
@@ -1095,6 +1100,11 @@ WebInspector.addDatabase = function(payload)

WebInspector.addCookieDomain = function(domain)
{
// Eliminate duplicate domains from the list.
if (domain in this.cookieDomains)
return;
this.cookieDomains[domain] = true;

if (!this.panels.storage)
return;
this.panels.storage.addCookieDomain(domain);
@@ -1195,6 +1205,7 @@ WebInspector.reset = function()

this.resources = {};
this.resourceURLMap = {};
this.cookieDomains = {};
this.hoveredDOMNode = null;

delete this.mainResource;

0 comments on commit f833ead

Please sign in to comment.