Changeset 47205 in webkit
- Timestamp:
- Aug 13, 2009 9:51:22 AM (15 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 13 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r47203 r47205 1 2009-08-13 Joseph Pecoraro <joepeck02@gmail.com> 2 3 Reviewed by Darin Adler. 4 5 Inspector: Show Hidden Cookie Data 6 https://bugs.webkit.org/show_bug.cgi?id=28185 7 8 Added new file Cookie.h to the WebCore XCode 9 10 * WebCore.xcodeproj/project.pbxproj: 11 12 InspectorController.cookies() binding 13 14 * bindings/js/JSInspectorBackendCustom.cpp: 15 (WebCore::JSInspectorBackend::cookies): 16 * inspector/InspectorBackend.idl: 17 18 Struct for static Cookie information 19 (name, value, path, domain, expires, httpOnly, secure, session) 20 21 * platform/Cookie.h: Added. 22 (WebCore::Cookie::Cookie): 23 24 Getter for the a list of raw Cookies 25 getRawCookies(., ., out Vector<Cookie>) 26 27 * platform/CookieJar.h: 28 29 Implementation of getRawCookies for the mac platform. 30 31 * platform/mac/CookieJar.mm: 32 (WebCore::getRawCookies): 33 34 Stub other CookieJar implementations to satisfy the interface. 35 36 * platform/haiku/CookieJarHaiku.cpp: 37 (WebCore::getRawCookies): 38 * platform/network/chromium/CookieJarChromium.cpp: 39 (WebCore::getRawCookies): 40 * platform/network/curl/CookieJarCurl.cpp: 41 (WebCore::getRawCookies): 42 * platform/network/soup/CookieJarSoup.cpp: 43 (WebCore::getRawCookies): 44 * platform/network/win/CookieJarCFNetWin.cpp: 45 (WebCore::getRawCookies): 46 * platform/network/win/CookieJarWin.cpp: 47 (WebCore::getRawCookies): 48 * platform/qt/CookieJarQt.cpp: 49 (WebCore::getRawCookies): 50 1 51 2009-08-13 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk> 2 52 -
trunk/WebCore/WebCore.xcodeproj/project.pbxproj
r47195 r47205 4400 4400 D23CA55F0AB0EAB6005108A5 /* JSRangeException.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D23CA55E0AB0EAB6005108A5 /* JSRangeException.cpp */; }; 4401 4401 D23CA56C0AB0EB8D005108A5 /* RangeException.h in Headers */ = {isa = PBXBuildFile; fileRef = D23CA56B0AB0EB8D005108A5 /* RangeException.h */; }; 4402 D8B6152F1032495100C8554A /* Cookie.h in Headers */ = {isa = PBXBuildFile; fileRef = D8B6152E1032495100C8554A /* Cookie.h */; }; 4402 4403 DB23C2CB0A508D29002489EB /* IndentOutdentCommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DB23C2C90A508D29002489EB /* IndentOutdentCommand.cpp */; }; 4403 4404 DB23C2CC0A508D29002489EB /* IndentOutdentCommand.h in Headers */ = {isa = PBXBuildFile; fileRef = DB23C2CA0A508D29002489EB /* IndentOutdentCommand.h */; }; … … 9331 9332 D23CA55E0AB0EAB6005108A5 /* JSRangeException.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSRangeException.cpp; sourceTree = "<group>"; }; 9332 9333 D23CA56B0AB0EB8D005108A5 /* RangeException.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = RangeException.h; sourceTree = "<group>"; }; 9334 D8B6152E1032495100C8554A /* Cookie.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Cookie.h; sourceTree = "<group>"; }; 9333 9335 DB23C2C90A508D29002489EB /* IndentOutdentCommand.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = IndentOutdentCommand.cpp; sourceTree = "<group>"; }; 9334 9336 DB23C2CA0A508D29002489EB /* IndentOutdentCommand.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = IndentOutdentCommand.h; sourceTree = "<group>"; }; … … 14133 14135 93B6A0E50B0BCA5C00F5027A /* ContextMenu.h */, 14134 14136 06027CAC0B1CBFC000884B2D /* ContextMenuItem.h */, 14137 D8B6152E1032495100C8554A /* Cookie.h */, 14135 14138 9352088109BD45E900F2038D /* CookieJar.h */, 14136 14139 2E4346560F546A9900B0F1BA /* CrossThreadCopier.cpp */, … … 17260 17263 416E29A6102FA962007FC14E /* WorkerReportingProxy.h in Headers */, 17261 17264 B5C1123C102B6C4600096578 /* SQLTransactionCoordinator.h in Headers */, 17265 D8B6152F1032495100C8554A /* Cookie.h in Headers */, 17262 17266 ); 17263 17267 runOnlyForDeploymentPostprocessing = 0; -
trunk/WebCore/bindings/js/JSInspectorBackendCustom.cpp
r47195 r47205 35 35 36 36 #include "Console.h" 37 #include "Cookie.h" 38 #include "CookieJar.h" 37 39 #if ENABLE(DATABASE) 38 40 #include "Database.h" … … 157 159 JSDOMWindow* inspectedWindow = toJSDOMWindow(ic->inspectedPage()->mainFrame()); 158 160 return JSInspectedObjectWrapper::wrap(inspectedWindow->globalExec(), inspectedWindow); 161 } 162 163 JSValue JSInspectorBackend::cookies(ExecState* exec, const ArgList&) 164 { 165 InspectorController* ic = impl()->inspectorController(); 166 if (!ic) 167 return jsUndefined(); 168 169 Document* document = ic->inspectedPage()->mainFrame()->document(); 170 Vector<Cookie> cookies; 171 getRawCookies(document, document->cookieURL(), cookies); 172 173 MarkedArgumentBuffer result; 174 Identifier nameIdentifier(exec, "name"); 175 Identifier valueIdentifier(exec, "value"); 176 Identifier domainIdentifier(exec, "domain"); 177 Identifier pathIdentifier(exec, "path"); 178 Identifier expiresIdentifier(exec, "expires"); 179 Identifier sizeIdentifier(exec, "size"); 180 Identifier httpOnlyIdentifier(exec, "httpOnly"); 181 Identifier secureIdentifier(exec, "secure"); 182 Identifier sessionIdentifier(exec, "session"); 183 184 unsigned length = cookies.size(); 185 for (unsigned i = 0; i < length; ++i) { 186 const Cookie& cookie = cookies[i]; 187 JSObject* cookieObject = constructEmptyObject(exec); 188 cookieObject->putDirect(nameIdentifier, jsString(exec, cookie.name)); 189 cookieObject->putDirect(valueIdentifier, jsString(exec, cookie.value)); 190 cookieObject->putDirect(domainIdentifier, jsString(exec, cookie.domain)); 191 cookieObject->putDirect(pathIdentifier, jsString(exec, cookie.path)); 192 cookieObject->putDirect(expiresIdentifier, jsNumber(exec, cookie.expires)); 193 cookieObject->putDirect(sizeIdentifier, jsNumber(exec, cookie.name.length() + cookie.value.length())); 194 cookieObject->putDirect(httpOnlyIdentifier, jsBoolean(cookie.httpOnly)); 195 cookieObject->putDirect(secureIdentifier, jsBoolean(cookie.secure)); 196 cookieObject->putDirect(sessionIdentifier, jsBoolean(cookie.session)); 197 result.append(cookieObject); 198 } 199 200 return constructArray(exec, result); 159 201 } 160 202 -
trunk/WebCore/inspector/InspectorBackend.idl
r47195 r47205 69 69 void storeLastActivePanel(in DOMString panelName); 70 70 71 [Custom] Array cookies(); 72 71 73 #if defined(ENABLE_JAVASCRIPT_DEBUGGER) && ENABLE_JAVASCRIPT_DEBUGGER 72 74 boolean debuggerEnabled(); -
trunk/WebCore/platform/Cookie.h
r47204 r47205 1 1 /* 2 * Copyright (C) 2006 George Staikos <staikos@kde.org> 3 * Copyright (C) 2007 Ryan Leavengood <leavengood@gmail.com> 4 * 5 * All rights reserved. 2 * Copyright (C) 2009 Joseph Pecoraro. All rights reserved. 6 3 * 7 4 * Redistribution and use in source and binary forms, with or without … … 27 24 */ 28 25 29 #i nclude "config.h"30 # include "CookieJar.h"26 #ifndef Cookie_h 27 #define Cookie_h 31 28 32 #include "KURL.h"33 29 #include "PlatformString.h" 34 #include "StringHash.h"35 36 #include <wtf/HashMap.h>37 38 30 39 31 namespace WebCore { 40 32 41 // FIXME: Shouldn't this be saved to and restored from disk too? 42 static HashMap<String, String> cookieJar; 33 struct Cookie { 34 Cookie(const String& name, const String& value, const String& domain, 35 const String& path, double expires, bool httpOnly, bool secure, 36 bool session) 37 : name(name) 38 , value(value) 39 , domain(domain) 40 , path(path) 41 , expires(expires) 42 , httpOnly(httpOnly) 43 , secure(secure) 44 , session(session) 45 { 46 } 43 47 44 void setCookies(const KURL& url, const KURL& /*policyURL*/, const String& value) 45 { 46 cookieJar.set(url.string(), value); 48 String name; 49 String value; 50 String domain; 51 String path; 52 double expires; 53 bool httpOnly; 54 bool secure; 55 bool session; 56 }; 57 47 58 } 48 59 49 String cookies(const KURL& url) 50 { 51 return cookieJar.get(url.string()); 52 } 53 54 bool cookiesEnabled() 55 { 56 // FIXME: This should probably be a setting 57 return true; 58 } 59 60 } // namespace WebCore 61 60 #endif -
trunk/WebCore/platform/CookieJar.h
r47195 r47205 27 27 #define CookieJar_h 28 28 29 #include <wtf/Vector.h> 30 29 31 namespace WebCore { 30 32 33 class Document; 31 34 class KURL; 32 35 class String; 33 class Document; 36 37 struct Cookie; 34 38 35 39 String cookies(const Document*, const KURL&); 36 40 void setCookies(Document*, const KURL&, const String&); 37 41 bool cookiesEnabled(const Document*); 42 void getRawCookies(const Document*, const KURL&, Vector<Cookie>&); 38 43 39 44 } -
trunk/WebCore/platform/haiku/CookieJarHaiku.cpp
r47195 r47205 30 30 #include "CookieJar.h" 31 31 32 #include "Cookie.h" 32 33 #include "KURL.h" 33 34 #include "PlatformString.h" … … 42 43 static HashMap<String, String> cookieJar; 43 44 44 void setCookies( const KURL& url, const KURL& /*policyURL*/, const String& value)45 void setCookies(Document*, const KURL& url, const String& value) 45 46 { 46 47 cookieJar.set(url.string(), value); 47 48 } 48 49 49 String cookies(const KURL& url)50 String cookies(const Document*, const KURL& url) 50 51 { 51 52 return cookieJar.get(url.string()); 52 53 } 53 54 54 bool cookiesEnabled( )55 bool cookiesEnabled(const Document*) 55 56 { 56 57 // FIXME: This should probably be a setting … … 58 59 } 59 60 61 void getRawCookies(const Document*, const KURL&, Vector<Cookie>& rawCookies) 62 { 63 // FIXME: Not yet implemented 64 rawCookies.clear(); 65 } 66 60 67 } // namespace WebCore 61 68 -
trunk/WebCore/platform/mac/CookieJar.mm
r47195 r47205 28 28 29 29 #import "BlockExceptions.h" 30 #import "Cookie.h" 30 31 #import "Document.h" 31 32 #import "KURL.h" … … 117 118 } 118 119 120 void getRawCookies(const Document*, const KURL& url, Vector<Cookie>& rawCookies) 121 { 122 rawCookies.clear(); 123 BEGIN_BLOCK_OBJC_EXCEPTIONS; 124 125 NSURL *cookieURL = url; 126 NSArray *cookies = [[NSHTTPCookieStorage sharedHTTPCookieStorage] cookiesForURL:cookieURL]; 127 128 NSUInteger count = [cookies count]; 129 rawCookies.reserveCapacity(count); 130 for (NSUInteger i = 0; i < count; ++i) { 131 NSHTTPCookie *cookie = (NSHTTPCookie *)[cookies objectAtIndex:i]; 132 NSString *name = [cookie name]; 133 NSString *value = [cookie value]; 134 NSString *domain = [cookie domain]; 135 NSString *path = [cookie path]; 136 NSTimeInterval expires = [[cookie expiresDate] timeIntervalSince1970] * 1000; 137 bool httpOnly = [cookie isHTTPOnly]; 138 bool secure = [cookie isSecure]; 139 bool session = [cookie isSessionOnly]; 140 rawCookies.uncheckedAppend(Cookie(name, value, domain, path, expires, httpOnly, secure, session)); 141 } 142 143 END_BLOCK_OBJC_EXCEPTIONS; 119 144 } 145 146 } -
trunk/WebCore/platform/network/chromium/CookieJarChromium.cpp
r47195 r47205 32 32 #include "CookieJar.h" 33 33 34 #include "Cookie.h" 34 35 #include "ChromiumBridge.h" 35 36 #include "Document.h" … … 53 54 } 54 55 56 void getRawCookies(const Document*, const KURL&, Vector<Cookie>& rawCookies) 57 { 58 // FIXME: Not yet implemented 59 rawCookies.clear(); 60 } 61 55 62 } // namespace WebCore -
trunk/WebCore/platform/network/curl/CookieJarCurl.cpp
r47195 r47205 18 18 #include "CookieJar.h" 19 19 20 #include "Cookie.h" 20 21 #include "Document.h" 21 22 #include "KURL.h" … … 44 45 } 45 46 47 void getRawCookies(const Document*, const KURL&, Vector<Cookie>& rawCookies) 48 { 49 // FIXME: Not yet implemented 50 rawCookies.clear(); 46 51 } 52 53 } -
trunk/WebCore/platform/network/soup/CookieJarSoup.cpp
r47195 r47205 22 22 #include "CookieJarSoup.h" 23 23 24 #include "Cookie.h" 24 25 #include "CString.h" 25 26 #include "Document.h" … … 87 88 } 88 89 90 void getRawCookies(const Document*, const KURL&, Vector<Cookie>& rawCookies) 91 { 92 // FIXME: Not yet implemented 93 rawCookies.clear(); 89 94 } 95 96 } -
trunk/WebCore/platform/network/win/CookieJarCFNetWin.cpp
r47195 r47205 27 27 #include "CookieJar.h" 28 28 29 #include "Cookie.h" 29 30 #include "CookieStorageWin.h" 30 31 #include "Document.h" … … 114 115 } 115 116 117 void getRawCookies(const Document*, const KURL&, Vector<Cookie>& rawCookies) 118 { 119 // FIXME: Not yet implemented 120 rawCookies.clear(); 116 121 } 122 123 } -
trunk/WebCore/platform/network/win/CookieJarWin.cpp
r47195 r47205 27 27 #include "CookieJar.h" 28 28 29 #include "Cookie.h" 29 30 #include "KURL.h" 30 31 #include "PlatformString.h" … … 35 36 36 37 namespace WebCore { 37 38 38 39 39 void setCookies(Document* /*document*/, const KURL& url, const String& value) … … 65 65 } 66 66 67 void getRawCookies(const Document*, const KURL&, Vector<Cookie>& rawCookies) 68 { 69 // FIXME: Not yet implemented 70 rawCookies.clear(); 67 71 } 72 73 } -
trunk/WebCore/platform/qt/CookieJarQt.cpp
r47195 r47205 29 29 #include "CookieJar.h" 30 30 31 #include "Cookie.h" 31 32 #include "Document.h" 32 33 #include "KURL.h" … … 129 130 } 130 131 132 void getRawCookies(const Document*, const KURL&, Vector<Cookie>& rawCookies) 133 { 134 // FIXME: Not yet implemented 135 rawCookies.clear(); 136 } 137 131 138 } 132 139
Note: See TracChangeset
for help on using the changeset viewer.