这是indexloc提供的服务,不要输入任何密码
WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Fixed Based on Pavel's Comments
cleaner2.patch (text/plain), 25.42 KB, created by
Joseph Pecoraro
on 2009-08-19 13:44:45 PDT
(
hide
)
Description:
Fixed Based on Pavel's Comments
Filename:
MIME Type:
Creator:
Joseph Pecoraro
Created:
2009-08-19 13:44:45 PDT
Size:
25.42 KB
patch
obsolete
>diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog >index 798eaff..cc8c421 100644 >--- a/WebCore/ChangeLog >+++ b/WebCore/ChangeLog >@@ -1,3 +1,64 @@ >+2009-08-19 Joseph Pecoraro <joepeck02@gmail.com> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Inspector: Improve Cookie DataGrid to Show Hidden Data >+ https://bugs.webkit.org/show_bug.cgi?id=28269 >+ >+ Removed Custom Bindings >+ >+ * bindings/js/JSInspectorBackendCustom.cpp: >+ * bindings/v8/custom/V8CustomBinding.h: >+ * bindings/v8/custom/V8InspectorBackendCustom.cpp: >+ * inspector/InspectorBackend.cpp: >+ >+ Made Non-Custom Bindings in the Backend >+ >+ (WebCore::InspectorBackend::getCookies): >+ (WebCore::InspectorBackend::deleteCookie): >+ * inspector/InspectorBackend.h: >+ * inspector/InspectorBackend.idl: >+ * inspector/InspectorController.cpp: >+ (WebCore::InspectorController::deleteCookie): >+ * inspector/InspectorController.h: >+ >+ Build the Cookie ScriptObjects, handles using document.cookie in >+ case the platform hasn't implemented raw cookie access. >+ >+ * inspector/InspectorDOMAgent.cpp: >+ (WebCore::InspectorDOMAgent::getCookies): >+ (WebCore::InspectorDOMAgent::buildObjectForCookie): >+ (WebCore::InspectorDOMAgent::buildArrayForCookies): >+ * inspector/InspectorDOMAgent.h: >+ >+ Complete the Asynchronous Calls >+ >+ * inspector/InspectorFrontend.cpp: >+ (WebCore::InspectorFrontend::didGetCookies): >+ * inspector/InspectorFrontend.h: >+ >+ Asynchronous Functions to get Cookie Data >+ >+ * inspector/front-end/DOMAgent.js: >+ (WebInspector.Cookies.getCookiesAsync): >+ (WebInspector.Cookies.buildCookiesFromString): fallback behavior >+ >+ Refactor to use the Asynchronous Functions >+ >+ * inspector/front-end/CookieItemsView.js: >+ (WebInspector.CookieItemsView): >+ (WebInspector.CookieItemsView.prototype.get statusBarItems): >+ (WebInspector.CookieItemsView.prototype.update.callback): >+ (WebInspector.CookieItemsView.prototype.update): >+ (WebInspector.CookieItemsView.prototype.simpleDataGridForCookies): >+ (WebInspector.CookieItemsView.prototype._deleteButtonClicked): >+ >+ Cleaned/Commented Related Code >+ >+ (InspectorController.searchCanceled): >+ * inspector/front-end/InjectedScript.js: >+ * platform/Cookie.h: >+ > 2009-08-19 Michelangelo De Simone <micdesim@gmail.com> > > Reviewed by Darin Adler. >diff --git a/WebCore/bindings/js/JSInspectorBackendCustom.cpp b/WebCore/bindings/js/JSInspectorBackendCustom.cpp >index 9aa68da..782ffab 100644 >--- a/WebCore/bindings/js/JSInspectorBackendCustom.cpp >+++ b/WebCore/bindings/js/JSInspectorBackendCustom.cpp >@@ -2,7 +2,6 @@ > * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. > * Copyright (C) 2008 Matt Lilek <webkit@mattlilek.com> > * Copyright (C) 2009 Google Inc. All rights reserved. >- * Copyright (C) 2009 Joseph Pecoraro > * > * Redistribution and use in source and binary forms, with or without > * modification, are permitted provided that the following conditions are >@@ -35,8 +34,6 @@ > #include "JSInspectorBackend.h" > > #include "Console.h" >-#include "Cookie.h" >-#include "CookieJar.h" > #if ENABLE(DATABASE) > #include "Database.h" > #include "JSDatabase.h" >@@ -156,68 +153,6 @@ JSValue JSInspectorBackend::inspectedWindow(ExecState*, const ArgList&) > return JSInspectedObjectWrapper::wrap(inspectedWindow->globalExec(), inspectedWindow); > } > >-JSValue JSInspectorBackend::cookies(ExecState* exec, const ArgList&) >-{ >- InspectorController* ic = impl()->inspectorController(); >- if (!ic) >- return jsUndefined(); >- >- Document* document = ic->inspectedPage()->mainFrame()->document(); >- Vector<Cookie> cookies; >- bool isImplemented = getRawCookies(document, document->cookieURL(), cookies); >- >- if (!isImplemented) >- return jsUndefined(); >- >- MarkedArgumentBuffer result; >- Identifier nameIdentifier(exec, "name"); >- Identifier valueIdentifier(exec, "value"); >- Identifier domainIdentifier(exec, "domain"); >- Identifier pathIdentifier(exec, "path"); >- Identifier expiresIdentifier(exec, "expires"); >- Identifier sizeIdentifier(exec, "size"); >- Identifier httpOnlyIdentifier(exec, "httpOnly"); >- Identifier secureIdentifier(exec, "secure"); >- Identifier sessionIdentifier(exec, "session"); >- >- unsigned length = cookies.size(); >- for (unsigned i = 0; i < length; ++i) { >- const Cookie& cookie = cookies[i]; >- JSObject* cookieObject = constructEmptyObject(exec); >- cookieObject->putDirect(nameIdentifier, jsString(exec, cookie.name)); >- cookieObject->putDirect(valueIdentifier, jsString(exec, cookie.value)); >- cookieObject->putDirect(domainIdentifier, jsString(exec, cookie.domain)); >- cookieObject->putDirect(pathIdentifier, jsString(exec, cookie.path)); >- cookieObject->putDirect(expiresIdentifier, jsNumber(exec, cookie.expires)); >- cookieObject->putDirect(sizeIdentifier, jsNumber(exec, cookie.name.length() + cookie.value.length())); >- cookieObject->putDirect(httpOnlyIdentifier, jsBoolean(cookie.httpOnly)); >- cookieObject->putDirect(secureIdentifier, jsBoolean(cookie.secure)); >- cookieObject->putDirect(sessionIdentifier, jsBoolean(cookie.session)); >- result.append(cookieObject); >- } >- >- return constructArray(exec, result); >-} >- >-JSValue JSInspectorBackend::deleteCookie(ExecState* exec, const ArgList& args) >-{ >- if (args.size() < 1) >- return jsUndefined(); >- >- InspectorController* ic = impl()->inspectorController(); >- if (!ic) >- return jsUndefined(); >- >- String cookieName = args.at(0).toString(exec); >- if (exec->hadException()) >- return jsUndefined(); >- >- Document* document = ic->inspectedPage()->mainFrame()->document(); >- WebCore::deleteCookie(document, document->cookieURL(), cookieName); >- >- return jsUndefined(); >-} >- > JSValue JSInspectorBackend::setting(ExecState* exec, const ArgList& args) > { > if (args.size() < 1) >diff --git a/WebCore/bindings/v8/custom/V8CustomBinding.h b/WebCore/bindings/v8/custom/V8CustomBinding.h >index 241d59c..cefe96e 100644 >--- a/WebCore/bindings/v8/custom/V8CustomBinding.h >+++ b/WebCore/bindings/v8/custom/V8CustomBinding.h >@@ -407,8 +407,6 @@ namespace WebCore { > DECLARE_CALLBACK(InspectorBackendSetting); > DECLARE_CALLBACK(InspectorBackendInspectedWindow); > DECLARE_CALLBACK(InspectorBackendSetSetting); >- DECLARE_CALLBACK(InspectorBackendCookies); >- DECLARE_CALLBACK(InspectorBackendDeleteCookie); > DECLARE_CALLBACK(InspectorBackendCurrentCallFrame); > DECLARE_CALLBACK(InspectorBackendDebuggerEnabled); > DECLARE_CALLBACK(InspectorBackendPauseOnExceptions); >diff --git a/WebCore/bindings/v8/custom/V8InspectorBackendCustom.cpp b/WebCore/bindings/v8/custom/V8InspectorBackendCustom.cpp >index c125f3a..c8d6bf2 100644 >--- a/WebCore/bindings/v8/custom/V8InspectorBackendCustom.cpp >+++ b/WebCore/bindings/v8/custom/V8InspectorBackendCustom.cpp >@@ -204,20 +204,6 @@ CALLBACK_FUNC_DECL(InspectorBackendSetSetting) > return v8::Undefined(); > } > >-CALLBACK_FUNC_DECL(InspectorBackendCookies) >-{ >- INC_STATS("InspectorBackend.cookies()"); >- // FIXME: Not yet implemented. >- return v8::Undefined(); >-} >- >-CALLBACK_FUNC_DECL(InspectorBackendDeleteCookie) >-{ >- INC_STATS("InspectorBackend.deleteCookie()"); >- // FIXME: Not yet implemented. (see WebCore/bindings/js/JSInspectorBackendCustom.cpp#deleteCookie) >- return v8::Undefined(); >-} >- > CALLBACK_FUNC_DECL(InspectorBackendWrapCallback) > { > INC_STATS("InspectorBackend.wrapCallback()"); >diff --git a/WebCore/inspector/InspectorBackend.cpp b/WebCore/inspector/InspectorBackend.cpp >index db6bc2f..0db5ac3 100644 >--- a/WebCore/inspector/InspectorBackend.cpp >+++ b/WebCore/inspector/InspectorBackend.cpp >@@ -251,6 +251,22 @@ const String& InspectorBackend::platform() const > return platform; > } > >+void InspectorBackend::getCookies(long callId) >+{ >+ if (!m_inspectorController) >+ return; >+ if (!m_inspectorController->m_domAgent || !m_inspectorController->m_frontend) >+ return; >+ m_inspectorController->domAgent()->getCookies(callId); >+} >+ >+void InspectorBackend::deleteCookie(const String& cookieName) >+{ >+ if (!m_inspectorController) >+ return; >+ m_inspectorController->deleteCookie(cookieName); >+} >+ > #if ENABLE(JAVASCRIPT_DEBUGGER) > const ProfilesArray& InspectorBackend::profiles() const > { >diff --git a/WebCore/inspector/InspectorBackend.h b/WebCore/inspector/InspectorBackend.h >index dac171a..55f7820 100644 >--- a/WebCore/inspector/InspectorBackend.h >+++ b/WebCore/inspector/InspectorBackend.h >@@ -95,6 +95,9 @@ public: > > const String& platform() const; > >+ void getCookies(long callId); >+ void deleteCookie(const String& cookieName); >+ > #if ENABLE(JAVASCRIPT_DEBUGGER) > const ProfilesArray& profiles() const; > >diff --git a/WebCore/inspector/InspectorBackend.idl b/WebCore/inspector/InspectorBackend.idl >index c937475..87e79ff 100644 >--- a/WebCore/inspector/InspectorBackend.idl >+++ b/WebCore/inspector/InspectorBackend.idl >@@ -68,8 +68,8 @@ module core { > void disableResourceTracking(in boolean always); > void storeLastActivePanel(in DOMString panelName); > >- [Custom] Array cookies(); >- [Custom] void deleteCookie(in DOMString cookieName); >+ void getCookies(in long callId); >+ void deleteCookie(in DOMString cookieName); > > #if defined(ENABLE_JAVASCRIPT_DEBUGGER) && ENABLE_JAVASCRIPT_DEBUGGER > boolean debuggerEnabled(); >diff --git a/WebCore/inspector/InspectorController.cpp b/WebCore/inspector/InspectorController.cpp >index 166258c..425b150 100644 >--- a/WebCore/inspector/InspectorController.cpp >+++ b/WebCore/inspector/InspectorController.cpp >@@ -34,6 +34,7 @@ > #include "CachedResource.h" > #include "Console.h" > #include "ConsoleMessage.h" >+#include "CookieJar.h" > #include "Document.h" > #include "DocumentLoader.h" > #include "Element.h" >@@ -1511,4 +1512,10 @@ void InspectorController::resetInjectedScript() > function.call(); > } > >+void InspectorController::deleteCookie(const String& cookieName) >+{ >+ Document* document = m_inspectedPage->mainFrame()->document(); >+ WebCore::deleteCookie(document, document->cookieURL(), cookieName); >+} >+ > } // namespace WebCore >diff --git a/WebCore/inspector/InspectorController.h b/WebCore/inspector/InspectorController.h >index ec8f687..14b0066 100644 >--- a/WebCore/inspector/InspectorController.h >+++ b/WebCore/inspector/InspectorController.h >@@ -288,6 +288,8 @@ private: > > void resetInjectedScript(); > >+ void deleteCookie(const String& cookieName); >+ > #if ENABLE(JAVASCRIPT_DEBUGGER) > void startUserInitiatedProfilingSoon(); > void toggleRecordButton(bool); >diff --git a/WebCore/inspector/InspectorDOMAgent.cpp b/WebCore/inspector/InspectorDOMAgent.cpp >index bf66adf..e035cfb 100644 >--- a/WebCore/inspector/InspectorDOMAgent.cpp >+++ b/WebCore/inspector/InspectorDOMAgent.cpp >@@ -1,6 +1,7 @@ > /* > * Copyright (C) 2009 Apple Inc. All rights reserved. > * Copyright (C) 2009 Google Inc. All rights reserved. >+ * Copyright (C) 2009 Joseph Pecoraro > * > * Redistribution and use in source and binary forms, with or without > * modification, are permitted provided that the following conditions >@@ -32,6 +33,8 @@ > > #include "AtomicString.h" > #include "ContainerNode.h" >+#include "Cookie.h" >+#include "CookieJar.h" > #include "DOMWindow.h" > #include "Document.h" > #include "Event.h" >@@ -91,6 +94,18 @@ void InspectorDOMAgent::releaseDanglingNodes() > m_danglingNodeToIdMaps.clear(); > } > >+void InspectorDOMAgent::getCookies(long callId) >+{ >+ Document* doc = mainFrameDocument(); >+ Vector<Cookie> cookiesList; >+ bool isImplemented = getRawCookies(doc, doc->cookieURL(), cookiesList); >+ >+ if (!isImplemented) >+ m_frontend->didGetCookies(callId, m_frontend->newScriptArray(), doc->cookie()); >+ else >+ m_frontend->didGetCookies(callId, buildArrayForCookies(cookiesList), String()); >+} >+ > void InspectorDOMAgent::startListening(Document* doc) > { > if (m_documents.contains(doc)) >@@ -440,6 +455,32 @@ ScriptArray InspectorDOMAgent::buildArrayForContainerChildren(Node* container, i > return children; > } > >+ScriptObject InspectorDOMAgent::buildObjectForCookie(const Cookie& cookie) >+{ >+ ScriptObject value = m_frontend->newScriptObject(); >+ value.set("name", cookie.name); >+ value.set("value", cookie.value); >+ value.set("domain", cookie.domain); >+ value.set("path", cookie.path); >+ value.set("expires", cookie.expires); >+ value.set("size", (int)(cookie.name.length() + cookie.value.length())); >+ value.set("httpOnly", cookie.httpOnly); >+ value.set("secure", cookie.secure); >+ value.set("session", cookie.session); >+ return value; >+} >+ >+ScriptArray InspectorDOMAgent::buildArrayForCookies(const Vector<Cookie>& cookiesList) >+{ >+ ScriptArray cookies = m_frontend->newScriptArray(); >+ unsigned length = cookiesList.size(); >+ for (unsigned i = 0; i < length; ++i) { >+ const Cookie& cookie = cookiesList[i]; >+ cookies.set(i, buildObjectForCookie(cookie)); >+ } >+ return cookies; >+} >+ > Node* InspectorDOMAgent::innerFirstChild(Node* node) > { > if (node->isFrameOwnerElement()) { >diff --git a/WebCore/inspector/InspectorDOMAgent.h b/WebCore/inspector/InspectorDOMAgent.h >index de08145..64666bf 100644 >--- a/WebCore/inspector/InspectorDOMAgent.h >+++ b/WebCore/inspector/InspectorDOMAgent.h >@@ -51,6 +51,8 @@ namespace WebCore { > class Node; > class Page; > >+ struct Cookie; >+ > class InspectorDOMAgent : public EventListener { > public: > InspectorDOMAgent(InspectorFrontend* frontend); >@@ -66,6 +68,9 @@ namespace WebCore { > bool setDocument(Document* document); > void releaseDanglingNodes(); > >+ // Methods called from the backend >+ void getCookies(long callId); >+ > Node* nodeForId(long nodeId); > long pushNodePathToFrontend(Node* node); > >@@ -86,6 +91,9 @@ namespace WebCore { > ScriptArray buildArrayForElementAttributes(Element* element); > ScriptArray buildArrayForContainerChildren(Node* container, int depth, NodeToIdMap* nodesMap); > >+ ScriptObject buildObjectForCookie(const Cookie& cookie); >+ ScriptArray buildArrayForCookies(const Vector<Cookie>& cookiesList); >+ > // We represent embedded doms as a part of the same hierarchy. Hence we treat children of frame owners differently. > // We also skip whitespace text nodes conditionally. Following methods encapsulate these specifics. > Node* innerFirstChild(Node* node); >diff --git a/WebCore/inspector/InspectorFrontend.cpp b/WebCore/inspector/InspectorFrontend.cpp >index 52a6899..4b88353 100644 >--- a/WebCore/inspector/InspectorFrontend.cpp >+++ b/WebCore/inspector/InspectorFrontend.cpp >@@ -347,6 +347,15 @@ void InspectorFrontend::didApplyDomChange(int callId, bool success) > function->call(); > } > >+void InspectorFrontend::didGetCookies(int callId, const ScriptArray& cookies, const String& cookiesString) >+{ >+ OwnPtr<ScriptFunctionCall> function(newFunctionCall("didGetCookies")); >+ function->appendArgument(callId); >+ function->appendArgument(cookies); >+ function->appendArgument(cookiesString); >+ function->call(); >+} >+ > #if ENABLE(DATABASE) > void InspectorFrontend::selectDatabase(Database* database) > { >diff --git a/WebCore/inspector/InspectorFrontend.h b/WebCore/inspector/InspectorFrontend.h >index 5972571..3ada587 100644 >--- a/WebCore/inspector/InspectorFrontend.h >+++ b/WebCore/inspector/InspectorFrontend.h >@@ -112,6 +112,8 @@ namespace WebCore { > void didGetChildNodes(int callId); > void didApplyDomChange(int callId, bool success); > >+ void didGetCookies(int callId, const ScriptArray& cookies, const String& cookiesString); >+ > void addNodesToSearchResult(const String& nodeIds); > > private: >diff --git a/WebCore/inspector/front-end/CookieItemsView.js b/WebCore/inspector/front-end/CookieItemsView.js >index 2d69e7d..d4fae42 100644 >--- a/WebCore/inspector/front-end/CookieItemsView.js >+++ b/WebCore/inspector/front-end/CookieItemsView.js >@@ -31,13 +31,6 @@ WebInspector.CookieItemsView = function() > { > WebInspector.View.call(this); > >- // Some Platforms have not yet implemented access to raw cookies >- // Those platforms will return undefined instead of an Array >- // For these platforms we: >- // - resort to document.cookie >- // - do not show the delete cookie status bar button >- this._useFallback = typeof InspectorController.cookies() === "undefined"; >- > this.element.addStyleClass("storage-view"); > this.element.addStyleClass("table"); > >@@ -52,10 +45,7 @@ WebInspector.CookieItemsView = function() > WebInspector.CookieItemsView.prototype = { > get statusBarItems() > { >- if (this._useFallback) >- return [this.refreshButton.element]; >- else >- return [this.refreshButton.element, this.deleteButton.element]; >+ return [this.refreshButton.element, this.deleteButton.element]; > }, > > show: function(parentElement) >@@ -72,46 +62,37 @@ WebInspector.CookieItemsView.prototype = { > > update: function() > { >- if (this._useFallback) { >- this.fallbackUpdate(); >- return; >- } >- > this.element.removeChildren(); >- var dataGrid = this.dataGridForCookies(); >- if (dataGrid) { >- this._dataGrid = dataGrid; >- this.element.appendChild(dataGrid.element); >- this.deleteButton.visible = true; >- } else { >- var emptyMsgElement = document.createElement("div"); >- emptyMsgElement.className = "storage-table-empty"; >- emptyMsgElement.textContent = WebInspector.UIString("This site has no cookies."); >- this.element.appendChild(emptyMsgElement); >- this._dataGrid = null; >- this.deleteButton.visible = false; >- } >- }, > >- buildCookies: function() >- { >- var rawCookies = InspectorController.cookies(); >- var cookies = []; >- for (var i = 0; i < rawCookies.length; ++i) { >- var cookie = rawCookies[i]; >- cookie.expires = new Date(cookie.expires); >- cookies.push(cookie); >+ var self = this; >+ function callback(cookies, isAdvanced) { >+ var dataGrid = (isAdvanced ? self.dataGridForCookies(cookies) : self.simpleDataGridForCookies(cookies)); >+ if (dataGrid) { >+ self._dataGrid = dataGrid; >+ self.element.appendChild(dataGrid.element); >+ if (isAdvanced) >+ self.deleteButton.visible = true; >+ } else { >+ var emptyMsgElement = document.createElement("div"); >+ emptyMsgElement.className = "storage-table-empty"; >+ emptyMsgElement.textContent = WebInspector.UIString("This site has no cookies."); >+ self.element.appendChild(emptyMsgElement); >+ self._dataGrid = null; >+ self.deleteButton.visible = false; >+ } > } > >- return cookies; >+ WebInspector.Cookies.getCookiesAsync(callback); > }, > >- dataGridForCookies: function() >+ dataGridForCookies: function(cookies) > { >- var cookies = this.buildCookies(); > if (!cookies.length) > return null; > >+ for (var i = 0; i < cookies.length; ++i) >+ cookies[i].expires = new Date(cookies[i].expires); >+ > var columns = { 0: {}, 1: {}, 2: {}, 3: {}, 4: {}, 5: {}, 6: {}, 7: {} }; > columns[0].title = WebInspector.UIString("Name"); > columns[0].width = columns[0].title.length; >@@ -211,51 +192,7 @@ WebInspector.CookieItemsView.prototype = { > return dataGrid; > }, > >- fallbackUpdate: function() >- { >- this.element.removeChildren(); >- >- var self = this; >- function callback(rawCookieString) { >- var cookies = self.fallbackBuildCookiesFromString(rawCookieString); >- var dataGrid = self.fallbackDataGridForCookies(cookies); >- if (dataGrid) { >- self._dataGrid = dataGrid; >- self.element.appendChild(dataGrid.element); >- self.deleteButton.visible = true; >- } else { >- var emptyMsgElement = document.createElement("div"); >- emptyMsgElement.className = "storage-table-empty"; >- emptyMsgElement.textContent = WebInspector.UIString("This site has no cookies."); >- self.element.appendChild(emptyMsgElement); >- self._dataGrid = null; >- self.deleteButton.visible = false; >- } >- } >- >- InspectorController.getCookies(callback); >- }, >- >- fallbackBuildCookiesFromString: function(rawCookieString) >- { >- var rawCookies = rawCookieString.split(/;\s*/); >- var cookies = []; >- >- if (!(/^\s*$/.test(rawCookieString))) { >- for (var i = 0; i < rawCookies.length; ++i) { >- var cookie = rawCookies[i]; >- var delimIndex = cookie.indexOf("="); >- var name = cookie.substring(0, delimIndex); >- var value = cookie.substring(delimIndex + 1); >- var size = name.length + value.length; >- cookies.push({ name: name, value: value, size: size }); >- } >- } >- >- return cookies; >- }, >- >- fallbackDataGridForCookies: function(cookies) >+ simpleDataGridForCookies: function(cookies) > { > if (!cookies.length) > return null; >@@ -312,7 +249,7 @@ WebInspector.CookieItemsView.prototype = { > > _deleteButtonClicked: function(event) > { >- if (!this._dataGrid || this._useFallback) >+ if (!this._dataGrid) > return; > > var cookie = this._dataGrid.selectedNode.cookie; >diff --git a/WebCore/inspector/front-end/DOMAgent.js b/WebCore/inspector/front-end/DOMAgent.js >index a32009b..7b004c1 100644 >--- a/WebCore/inspector/front-end/DOMAgent.js >+++ b/WebCore/inspector/front-end/DOMAgent.js >@@ -1,5 +1,6 @@ > /* > * Copyright (C) 2009 Google Inc. All rights reserved. >+ * Copyright (C) 2009 Joseph Pecoraro > * > * Redistribution and use in source and binary forms, with or without > * modification, are permitted provided that the following conditions are >@@ -439,7 +440,41 @@ WebInspector.DOMAgent.prototype = { > } > } > >-WebInspector.CSSStyleDeclaration = function(payload) { >+WebInspector.Cookies = {} >+ >+WebInspector.Cookies.getCookiesAsync = function(callback) >+{ >+ function mycallback(cookies, cookiesString) { >+ if (cookiesString) >+ callback(WebInspector.Cookies.buildCookiesFromString(cookiesString), false); >+ else >+ callback(cookies, true); >+ } >+ var callId = WebInspector.Callback.wrap(mycallback); >+ InspectorController.getCookies(callId); >+} >+ >+WebInspector.Cookies.buildCookiesFromString = function(rawCookieString) >+{ >+ var rawCookies = rawCookieString.split(/;\s*/); >+ var cookies = []; >+ >+ if (!(/^\s*$/.test(rawCookieString))) { >+ for (var i = 0; i < rawCookies.length; ++i) { >+ var cookie = rawCookies[i]; >+ var delimIndex = cookie.indexOf("="); >+ var name = cookie.substring(0, delimIndex); >+ var value = cookie.substring(delimIndex + 1); >+ var size = name.length + value.length; >+ cookies.push({ name: name, value: value, size: size }); >+ } >+ } >+ >+ return cookies; >+} >+ >+WebInspector.CSSStyleDeclaration = function(payload) >+{ > this.id = payload.id; > this.width = payload.width; > this.height = payload.height; >@@ -607,6 +642,7 @@ WebInspector.childNodeRemoved = function() > this.domAgent._childNodeRemoved.apply(this.domAgent, arguments); > } > >+WebInspector.didGetCookies = WebInspector.Callback.processCallback; > WebInspector.didGetChildNodes = WebInspector.Callback.processCallback; > WebInspector.didPerformSearch = WebInspector.Callback.processCallback; > WebInspector.didApplyDomChange = WebInspector.Callback.processCallback; >@@ -732,10 +768,3 @@ InspectorController.searchCanceled = function(callback) > callback(InjectedScript.searchCanceled()); > }, 0); > } >- >-InspectorController.getCookies = function(callback) >-{ >- setTimeout(function() { >- callback(InjectedScript.getCookies()); >- }, 0); >-} >diff --git a/WebCore/inspector/front-end/InjectedScript.js b/WebCore/inspector/front-end/InjectedScript.js >index 9c74cb6..dffed65 100644 >--- a/WebCore/inspector/front-end/InjectedScript.js >+++ b/WebCore/inspector/front-end/InjectedScript.js >@@ -1,6 +1,5 @@ > /* > * Copyright (C) 2007 Apple Inc. All rights reserved. >- * Copyright (C) 2009 Joseph Pecoraro > * > * Redistribution and use in source and binary forms, with or without > * modification, are permitted provided that the following conditions >@@ -759,11 +758,6 @@ InjectedScript.searchCanceled = function() > return true; > } > >-InjectedScript.getCookies = function() >-{ >- return InjectedScript._window().document.cookie; >-} >- > InjectedScript._ensureCommandLineAPIInstalled = function(inspectedWindow) > { > var inspectedWindow = InjectedScript._window(); >diff --git a/WebCore/platform/Cookie.h b/WebCore/platform/Cookie.h >index f646d3a..3e74ddc 100644 >--- a/WebCore/platform/Cookie.h >+++ b/WebCore/platform/Cookie.h >@@ -30,6 +30,9 @@ > > namespace WebCore { > >+ // This struct is currently only used to provide more cookies information >+ // to the Web Inspector. >+ > struct Cookie { > Cookie(const String& name, const String& value, const String& domain, > const String& path, double expires, bool httpOnly, bool secure,
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 28269
:
34759
|
34760
|
34805
|
34807
|
35133
|
35140
|
35146