Changeset 98759 in webkit
- Timestamp:
- Oct 28, 2011, 1:51:52 PM (14 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r98756 r98759 1 2011-10-28 Timothy Hatcher <timothy@apple.com> 2 3 Support using a different front-end for the Web Inspector in WebKit2. 4 5 rdar://problem/10318665 6 https://webkit.org/b/71089 7 8 Reviewed by Sam Weinig. 9 10 * Shared/WebProcessCreationParameters.cpp: 11 (WebKit::WebProcessCreationParameters::encode): Added webInspectorBasePath and webInspectorLocalizedStringsPath. 12 (WebKit::WebProcessCreationParameters::decode): Ditto. 13 * Shared/WebProcessCreationParameters.h: 14 * UIProcess/API/C/WKContext.cpp: 15 (WKContextSetOverrideWebInspectorBaseDirectory): Added. Calls through to WebContext. 16 (WKContextSetOverrideWebInspectorPagePath): Ditto. 17 (WKContextSetOverrideWebInspectorLocalizedStringsPath): Ditto. 18 * UIProcess/API/C/WKContextPrivate.h: 19 * UIProcess/WebContext.cpp: 20 (WebKit::WebContext::ensureWebProcess): Set webInspectorBasePath and webInspectorLocalizedStringsPath. 21 * UIProcess/WebContext.h: 22 (WebKit::WebContext::overrideWebInspectorBaseDirectory): Added. 23 (WebKit::WebContext::setOverrideWebInspectorBaseDirectory): Added. 24 (WebKit::WebContext::overrideWebInspectorPagePath): Added. 25 (WebKit::WebContext::setOverrideWebInspectorPagePath): Added. 26 (WebKit::WebContext::setOverrideWebInspectorLocalizedStringsPath): Added. 27 * UIProcess/mac/WebInspectorProxyMac.mm: 28 (WebKit::WebInspectorProxy::inspectorPageURL): Use WebContext::overrideWebInspectorPagePath if set. 29 (WebKit::WebInspectorProxy::inspectorBaseURL): Use WebContext::overrideWebInspectorBaseDirectory if set. 30 * WebProcess/WebPage/WebInspector.h: 31 * WebProcess/WebPage/mac/WebInspectorMac.mm: 32 (WebKit::globalInspectorLocalizedStringsURL): Added. Static storage for the setting. 33 (WebKit::WebInspector::setLocalizedStringsPath): Added. Set globalInspectorLocalizedStringsURL. 34 (WebKit::WebInspector::localizedStringsURL): Return globalInspectorLocalizedStringsURL. 35 * WebProcess/com.apple.WebProcess.sb: Added read-only subpath for WEBKIT_WEB_INSPECTOR_DIR. 36 * WebProcess/mac/WebProcessMac.mm: 37 (WebKit::appendReadonlySandboxDirectory): Check path for empty to prevent an exception when 38 calling through to fileSystemRepresentation. 39 (WebKit::initializeSandbox): Added WEBKIT_WEB_INSPECTOR_DIR parameter. 40 (WebKit::WebProcess::platformInitializeWebProcess): Call WebInspector::setLocalizedStringsPath. 41 1 42 2011-10-28 Alexey Proskuryakov <ap@apple.com> 2 43 -
trunk/Source/WebKit2/Shared/WebProcessCreationParameters.cpp
r96770 r98759 55 55 encoder->encode(databaseDirectory); 56 56 encoder->encode(localStorageDirectory); 57 encoder->encode(webInspectorLocalizedStringsPath); 57 58 encoder->encode(urlSchemesRegistererdAsEmptyDocument); 58 59 encoder->encode(urlSchemesRegisteredAsSecure); … … 81 82 encoder->encode(acceleratedCompositingPort); 82 83 encoder->encode(uiProcessBundleResourcePath); 84 encoder->encode(webInspectorBaseDirectory); 83 85 #elif PLATFORM(WIN) 84 86 encoder->encode(shouldPaintNativeControls); … … 110 112 return false; 111 113 if (!decoder->decode(parameters.localStorageDirectory)) 114 return false; 115 if (!decoder->decode(parameters.webInspectorLocalizedStringsPath)) 112 116 return false; 113 117 if (!decoder->decode(parameters.urlSchemesRegistererdAsEmptyDocument)) … … 160 164 if (!decoder->decode(parameters.uiProcessBundleResourcePath)) 161 165 return false; 166 if (!decoder->decode(parameters.webInspectorBaseDirectory)) 167 return false; 162 168 #elif PLATFORM(WIN) 163 169 if (!decoder->decode(parameters.shouldPaintNativeControls)) -
trunk/Source/WebKit2/Shared/WebProcessCreationParameters.h
r96770 r98759 57 57 String databaseDirectory; 58 58 String localStorageDirectory; 59 String webInspectorLocalizedStringsPath; 60 59 61 Vector<String> urlSchemesRegistererdAsEmptyDocument; 60 62 Vector<String> urlSchemesRegisteredAsSecure; … … 100 102 String uiProcessBundleResourcePath; 101 103 104 String webInspectorBaseDirectory; 105 102 106 #elif PLATFORM(WIN) 103 107 String cfURLCachePath; -
trunk/Source/WebKit2/UIProcess/API/C/WKContext.cpp
r96784 r98759 226 226 } 227 227 228 void WKContextSetOverrideWebInspectorBaseDirectory(WKContextRef contextRef, WKStringRef webInspectorBaseDirectory) 229 { 230 toImpl(contextRef)->setOverrideWebInspectorBaseDirectory(toImpl(webInspectorBaseDirectory)->string()); 231 } 232 233 void WKContextSetOverrideWebInspectorPagePath(WKContextRef contextRef, WKStringRef webInspectorPagePath) 234 { 235 toImpl(contextRef)->setOverrideWebInspectorPagePath(toImpl(webInspectorPagePath)->string()); 236 } 237 238 void WKContextSetOverrideWebInspectorLocalizedStringsPath(WKContextRef contextRef, WKStringRef webInspectorLocalizedStringsPath) 239 { 240 toImpl(contextRef)->setOverrideWebInspectorLocalizedStringsPath(toImpl(webInspectorLocalizedStringsPath)->string()); 241 } 242 228 243 void WKContextDisableProcessTermination(WKContextRef contextRef) 229 244 { -
trunk/Source/WebKit2/UIProcess/API/C/WKContextPrivate.h
r96770 r98759 63 63 WK_EXPORT void WKContextSetDatabaseDirectory(WKContextRef context, WKStringRef databaseDirectory); 64 64 WK_EXPORT void WKContextSetLocalStorageDirectory(WKContextRef context, WKStringRef localStorageDirectory); 65 WK_EXPORT void WKContextSetOverrideWebInspectorBaseDirectory(WKContextRef context, WKStringRef webInspectorBaseDirectory); 66 WK_EXPORT void WKContextSetOverrideWebInspectorPagePath(WKContextRef context, WKStringRef webInspectorPagePath); 67 WK_EXPORT void WKContextSetOverrideWebInspectorLocalizedStringsPath(WKContextRef context, WKStringRef webInspectorLocalizedStringsPath); 65 68 66 69 // FIXME: This is a workaround for testing purposes only and should be removed once a better -
trunk/Source/WebKit2/UIProcess/WebContext.cpp
r98513 r98759 245 245 parameters.databaseDirectory = databaseDirectory(); 246 246 parameters.localStorageDirectory = localStorageDirectory(); 247 parameters.webInspectorLocalizedStringsPath = m_overrideWebInspectorLocalizedStringsPath; 248 247 249 #if PLATFORM(MAC) 250 parameters.webInspectorBaseDirectory = m_overrideWebInspectorBaseDirectory; 248 251 parameters.presenterApplicationPid = getpid(); 249 252 #endif -
trunk/Source/WebKit2/UIProcess/WebContext.h
r98513 r98759 170 170 void setLocalStorageDirectory(const String& dir) { m_overrideLocalStorageDirectory = dir; } 171 171 172 String overrideWebInspectorBaseDirectory() const { return m_overrideWebInspectorBaseDirectory; } 173 void setOverrideWebInspectorBaseDirectory(const String& path) { m_overrideWebInspectorBaseDirectory = path; } 174 175 String overrideWebInspectorPagePath() const { return m_overrideWebInspectorPagePath; } 176 void setOverrideWebInspectorPagePath(const String& path) { m_overrideWebInspectorPagePath = path; } 177 178 void setOverrideWebInspectorLocalizedStringsPath(const String& path) { m_overrideWebInspectorLocalizedStringsPath = path; } 179 172 180 void ensureWebProcess(); 173 181 void warmInitialProcess(); … … 280 288 RetainPtr<CFTypeRef> m_enhancedAccessibilityObserver; 281 289 #endif 282 290 283 291 String m_overrideDatabaseDirectory; 284 292 String m_overrideIconDatabasePath; 285 293 String m_overrideLocalStorageDirectory; 294 String m_overrideWebInspectorBaseDirectory; 295 String m_overrideWebInspectorPagePath; 296 String m_overrideWebInspectorLocalizedStringsPath; 286 297 287 298 bool m_processTerminationEnabled; -
trunk/Source/WebKit2/UIProcess/mac/WebInspectorProxyMac.mm
r97819 r98759 30 30 31 31 #import "WKAPICast.h" 32 #import "WebContext.h" 32 33 #import "WKInspectorMac.h" 33 34 #import "WKViewPrivate.h" … … 249 250 String WebInspectorProxy::inspectorPageURL() const 250 251 { 251 NSString *path = [[NSBundle bundleWithIdentifier:@"com.apple.WebCore"] pathForResource:@"inspector" ofType:@"html" inDirectory:@"inspector"]; 252 ASSERT(path); 252 NSString *path = page()->process()->context()->overrideWebInspectorPagePath(); 253 if (![path length]) 254 path = [[NSBundle bundleWithIdentifier:@"com.apple.WebCore"] pathForResource:@"inspector" ofType:@"html" inDirectory:@"inspector"]; 255 256 ASSERT([path length]); 253 257 254 258 return [[NSURL fileURLWithPath:path] absoluteString]; … … 257 261 String WebInspectorProxy::inspectorBaseURL() const 258 262 { 259 // Web Inspector uses localized strings, so it's not contained within inspector directory. 260 NSString *path = [[NSBundle bundleWithIdentifier:@"com.apple.WebCore"] resourcePath]; 261 ASSERT(path); 263 NSString *path = page()->process()->context()->overrideWebInspectorBaseDirectory(); 264 if (![path length]) { 265 // WebCore's Web Inspector uses localized strings, which are not contained within inspector directory. 266 path = [[NSBundle bundleWithIdentifier:@"com.apple.WebCore"] resourcePath]; 267 } 268 269 ASSERT([path length]); 262 270 263 271 return [[NSURL fileURLWithPath:path] absoluteString]; -
trunk/Source/WebKit2/WebProcess/WebPage/WebInspector.h
r95901 r98759 61 61 void stopPageProfiling(); 62 62 63 #if PLATFORM(MAC) 64 static void setLocalizedStringsPath(const String&); 65 #endif 66 63 67 private: 64 68 friend class WebInspectorClient; -
trunk/Source/WebKit2/WebProcess/WebPage/mac/WebInspectorMac.mm
r95901 r98759 31 31 namespace WebKit { 32 32 33 static String& globalInspectorLocalizedStringsURL() 34 { 35 DEFINE_STATIC_LOCAL(String, inspectorLocalizedStringsURL, ()); 36 return inspectorLocalizedStringsURL; 37 } 38 39 void WebInspector::setLocalizedStringsPath(const String& path) 40 { 41 if (!path.isEmpty()) 42 globalInspectorLocalizedStringsURL() = [[NSURL fileURLWithPath:path] absoluteString]; 43 else 44 globalInspectorLocalizedStringsURL() = String(); 45 } 46 33 47 String WebInspector::localizedStringsURL() const 34 48 { 35 NSString *path = [[NSBundle bundleWithIdentifier:@"com.apple.WebCore"] pathForResource:@"localizedStrings" ofType:@"js"]; 36 if (path) 37 return [[NSURL fileURLWithPath:path] absoluteString]; 38 return String(); 49 return globalInspectorLocalizedStringsURL(); 39 50 } 40 51 -
trunk/Source/WebKit2/WebProcess/com.apple.WebProcess.sb
r95113 r98759 121 121 (if (positive? (string-length (param "WEBKIT_APPLICATION_CACHE_DIR"))) 122 122 (allow file* (subpath (param "WEBKIT_APPLICATION_CACHE_DIR")))) 123 124 ;; The Web Inspector directory. 125 (if (positive? (string-length (param "WEBKIT_WEB_INSPECTOR_DIR"))) 126 (allow file-read* (subpath (param "WEBKIT_WEB_INSPECTOR_DIR")))) 123 127 124 128 ;; The NSURLCache directory. -
trunk/Source/WebKit2/WebProcess/mac/WebProcessMac.mm
r95901 r98759 29 29 #import "SandboxExtension.h" 30 30 #import "WKFullKeyboardAccessWatcher.h" 31 #import "WebInspector.h" 31 32 #import "WebPage.h" 32 33 #import "WebProcessCreationParameters.h" … … 160 161 static void appendReadonlySandboxDirectory(Vector<const char*>& vector, const char* name, NSString *path) 161 162 { 162 appendSandboxParameterPathInternal(vector, name, [ (NSString *)path fileSystemRepresentation]);163 appendSandboxParameterPathInternal(vector, name, [path length] ? [(NSString *)path fileSystemRepresentation] : ""); 163 164 } 164 165 … … 189 190 appendReadonlySandboxDirectory(sandboxParameters, "WEBKIT2_FRAMEWORK_DIR", [[[NSBundle bundleForClass:NSClassFromString(@"WKView")] bundlePath] stringByDeletingLastPathComponent]); 190 191 appendReadonlySandboxDirectory(sandboxParameters, "UI_PROCESS_BUNDLE_RESOURCE_DIR", parameters.uiProcessBundleResourcePath); 192 appendReadonlySandboxDirectory(sandboxParameters, "WEBKIT_WEB_INSPECTOR_DIR", parameters.webInspectorBaseDirectory); 191 193 192 194 // These are read-write getconf paths. … … 246 248 } 247 249 250 WebInspector::setLocalizedStringsPath(parameters.webInspectorLocalizedStringsPath); 251 248 252 m_compositingRenderServerPort = parameters.acceleratedCompositingPort.port(); 249 253
Note:
See TracChangeset
for help on using the changeset viewer.