Changeset 126899 in webkit
- Timestamp:
- Aug 28, 2012, 11:11:53 AM (14 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 9 edited
-
ChangeLog (modified) (1 diff)
-
WebProcess/InjectedBundle/API/c/WKBundle.cpp (modified) (1 diff)
-
WebProcess/InjectedBundle/API/c/WKBundlePrivate.h (modified) (3 diffs)
-
WebProcess/InjectedBundle/InjectedBundle.cpp (modified) (2 diffs)
-
WebProcess/InjectedBundle/InjectedBundle.h (modified) (1 diff)
-
WebProcess/Notifications/NotificationPermissionRequestManager.cpp (modified) (1 diff)
-
WebProcess/Notifications/NotificationPermissionRequestManager.h (modified) (2 diffs)
-
WebProcess/Notifications/WebNotificationManager.cpp (modified) (1 diff)
-
WebProcess/Notifications/WebNotificationManager.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r126884 r126899 1 2012-08-28 Jon Lee <jonlee@apple.com> 2 3 [WK2] Add SPI for injected bundle to manually set permissions 4 https://bugs.webkit.org/show_bug.cgi?id=95127 5 <rdar://problem/12182635> 6 7 Reviewed by Jessie Berlin. 8 9 This is work toward providing Mac support for web notifications in DRT and WTR (77969). 10 11 Add support functions to WebKit2 which maintain the map of permissions to origins for web notifications. 12 For WebKit1 the map is managed by DumpRenderTree. 13 14 * WebProcess/InjectedBundle/InjectedBundle.h: Add TestRunner SPI. 15 * WebProcess/InjectedBundle/InjectedBundle.cpp: 16 (WebKit::InjectedBundle::setWebNotificationPermission): 17 (WebKit::InjectedBundle::removeAllWebNotificationPermissions): 18 19 * WebProcess/InjectedBundle/API/c/WKBundlePrivate.h: Expose as WK API. Also, rearrange the ordering of the 20 functions so that it reflects the same order found in InjectedBundle.h. 21 * WebProcess/InjectedBundle/API/c/WKBundle.cpp: 22 23 * WebProcess/Notifications/NotificationPermissionRequestManager.cpp: 24 (WebKit::NotificationPermissionRequestManager::setPermissionLevelForTesting): Manually set the permission 25 level for an origin. 26 (WebKit::NotificationPermissionRequestManager::removeAllPermissionsForTesting): 27 * WebProcess/Notifications/NotificationPermissionRequestManager.h: 28 (NotificationPermissionRequestManager): 29 * WebProcess/Notifications/WebNotificationManager.cpp: 30 (WebKit::WebNotificationManager::removeAllPermissionsForTesting): Clear the permission map. 31 * WebProcess/Notifications/WebNotificationManager.h: Promote didUpdateNotificationDecision message as public 32 function, so that NotificationPermissionRequestManager can update the permission map. 33 1 34 2012-08-28 Christophe Dumez <christophe.dumez@intel.com> 2 35 -
trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.cpp
r124477 r126899 261 261 toImpl(bundleRef)->setUserStyleSheetLocation(toImpl(pageGroupRef), toImpl(location)->string()); 262 262 } 263 264 void WKBundleSetWebNotificationPermission(WKBundleRef bundleRef, WKBundlePageRef pageRef, WKStringRef originStringRef, bool allowed) 265 { 266 toImpl(bundleRef)->setWebNotificationPermission(toImpl(pageRef), toImpl(originStringRef)->string(), allowed); 267 } 268 269 void WKBundleRemoveAllWebNotificationPermissions(WKBundleRef bundleRef, WKBundlePageRef pageRef) 270 { 271 toImpl(bundleRef)->removeAllWebNotificationPermissions(toImpl(pageRef)); 272 } -
trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePrivate.h
r124477 r126899 37 37 #endif 38 38 39 WK_EXPORT void WKBundleSetShouldTrackVisitedLinks(WKBundleRef bundle, bool shouldTrackVisitedLinks);40 WK_EXPORT void WKBundleRemoveAllVisitedLinks(WKBundleRef bundle);41 WK_EXPORT void WKBundleActivateMacFontAscentHack(WKBundleRef bundle);42 WK_EXPORT void WKBundleGarbageCollectJavaScriptObjects(WKBundleRef bundle);43 WK_EXPORT void WKBundleGarbageCollectJavaScriptObjectsOnAlternateThreadForDebugging(WKBundleRef bundle, bool waitUntilDone);44 WK_EXPORT size_t WKBundleGetJavaScriptObjectsCount(WKBundleRef bundle);45 46 39 enum WKUserScriptInjectionTime { 47 40 kWKInjectAtDocumentStart, … … 56 49 typedef enum WKUserContentInjectedFrames WKUserContentInjectedFrames; 57 50 51 // TestRunner only SPI 52 WK_EXPORT void WKBundleSetShouldTrackVisitedLinks(WKBundleRef bundle, bool shouldTrackVisitedLinks); 53 WK_EXPORT void WKBundleSetAlwaysAcceptCookies(WKBundleRef bundle, bool); 54 WK_EXPORT void WKBundleRemoveAllVisitedLinks(WKBundleRef bundle); 55 WK_EXPORT void WKBundleActivateMacFontAscentHack(WKBundleRef bundle); 56 // Will make WebProcess ignore this preference until a preferences change notification, only for WebKitTestRunner use. 57 WK_EXPORT void WKBundleOverrideBoolPreferenceForTestRunner(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, WKStringRef preference, bool enabled); 58 WK_EXPORT void WKBundleSetAllowUniversalAccessFromFileURLs(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, bool enabled); 59 WK_EXPORT void WKBundleSetAllowFileAccessFromFileURLs(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, bool enabled); 60 WK_EXPORT void WKBundleSetFrameFlatteningEnabled(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, bool enabled); 61 WK_EXPORT void WKBundleSetPluginsEnabled(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, bool enabled); 62 WK_EXPORT void WKBundleSetGeolocationPermission(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, bool enabled); 63 WK_EXPORT void WKBundleSetJavaScriptCanAccessClipboard(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, bool enabled); 64 WK_EXPORT void WKBundleSetPrivateBrowsingEnabled(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, bool enabled); 65 WK_EXPORT void WKBundleSetPopupBlockingEnabled(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, bool enabled); 66 WK_EXPORT void WKBundleSwitchNetworkLoaderToNewTestingSession(WKBundleRef bundle); 67 WK_EXPORT void WKBundleSetAuthorAndUserStylesEnabled(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, bool enabled); 68 WK_EXPORT void WKBundleAddOriginAccessWhitelistEntry(WKBundleRef bundle, WKStringRef, WKStringRef, WKStringRef, bool); 69 WK_EXPORT void WKBundleRemoveOriginAccessWhitelistEntry(WKBundleRef bundle, WKStringRef, WKStringRef, WKStringRef, bool); 70 WK_EXPORT void WKBundleResetOriginAccessWhitelists(WKBundleRef bundle); 71 WK_EXPORT int WKBundleNumberOfPages(WKBundleRef bundle, WKBundleFrameRef frameRef, double pageWidthInPixels, double pageHeightInPixels); 72 WK_EXPORT int WKBundlePageNumberForElementById(WKBundleRef bundle, WKBundleFrameRef frameRef, WKStringRef idRef, double pageWidthInPixels, double pageHeightInPixels); 73 WK_EXPORT WKStringRef WKBundlePageSizeAndMarginsInPixels(WKBundleRef bundle, WKBundleFrameRef frameRef, int, int, int, int, int, int, int); 74 WK_EXPORT bool WKBundleIsPageBoxVisible(WKBundleRef bundle, WKBundleFrameRef frameRef, int); 75 WK_EXPORT void WKBundleSetUserStyleSheetLocation(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, WKStringRef location); 76 WK_EXPORT void WKBundleSetWebNotificationPermission(WKBundleRef bundle, WKBundlePageRef page, WKStringRef originStringRef, bool allowed); 77 WK_EXPORT void WKBundleRemoveAllWebNotificationPermissions(WKBundleRef bundle, WKBundlePageRef page); 78 79 // UserContent API 58 80 WK_EXPORT void WKBundleAddUserScript(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, WKBundleScriptWorldRef scriptWorld, WKStringRef source, WKURLRef url, WKArrayRef whitelist, WKArrayRef blacklist, WKUserScriptInjectionTime injectionTime, WKUserContentInjectedFrames injectedFrames); 59 81 WK_EXPORT void WKBundleAddUserStyleSheet(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, WKBundleScriptWorldRef scriptWorld, WKStringRef source, WKURLRef url, WKArrayRef whitelist, WKArrayRef blacklist, WKUserContentInjectedFrames injectedFrames); … … 64 86 WK_EXPORT void WKBundleRemoveAllUserContent(WKBundleRef bundle, WKBundlePageGroupRef pageGroup); 65 87 66 // Will make WebProcess ignore this preference until a preferences change notification, only for WebKitTestRunner use. 67 WK_EXPORT void WKBundleOverrideBoolPreferenceForTestRunner(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, WKStringRef preference, bool enabled); 68 69 WK_EXPORT void WKBundleSetAllowUniversalAccessFromFileURLs(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, bool enabled); 70 WK_EXPORT void WKBundleSetAllowFileAccessFromFileURLs(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, bool enabled); 71 WK_EXPORT void WKBundleSetFrameFlatteningEnabled(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, bool enabled); 72 WK_EXPORT void WKBundleSetPluginsEnabled(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, bool enabled); 73 WK_EXPORT void WKBundleSetGeolocationPermission(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, bool enabled); 74 WK_EXPORT void WKBundleSetJavaScriptCanAccessClipboard(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, bool enabled); 75 WK_EXPORT void WKBundleSetPrivateBrowsingEnabled(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, bool enabled); 76 WK_EXPORT void WKBundleSetPopupBlockingEnabled(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, bool enabled); 77 WK_EXPORT void WKBundleSetUserStyleSheetLocation(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, WKStringRef location); 78 WK_EXPORT void WKBundleSetAuthorAndUserStylesEnabled(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, bool enabled); 88 // Local storage API 79 89 WK_EXPORT void WKBundleClearAllDatabases(WKBundleRef bundle); 80 90 WK_EXPORT void WKBundleSetDatabaseQuota(WKBundleRef bundle, uint64_t); 91 92 // Application Cache API 81 93 WK_EXPORT void WKBundleClearApplicationCache(WKBundleRef bundle); 82 94 WK_EXPORT void WKBundleSetAppCacheMaximumSize(WKBundleRef bundle, uint64_t size); 83 WK_EXPORT int WKBundleNumberOfPages(WKBundleRef bundle, WKBundleFrameRef frameRef, double pageWidthInPixels, double pageHeightInPixels); 84 WK_EXPORT int WKBundlePageNumberForElementById(WKBundleRef bundle, WKBundleFrameRef frameRef, WKStringRef idRef, double pageWidthInPixels, double pageHeightInPixels); 85 WK_EXPORT WKStringRef WKBundlePageSizeAndMarginsInPixels(WKBundleRef bundle, WKBundleFrameRef frameRef, int, int, int, int, int, int, int); 86 WK_EXPORT bool WKBundleIsPageBoxVisible(WKBundleRef bundle, WKBundleFrameRef frameRef, int); 87 WK_EXPORT void WKBundleAddOriginAccessWhitelistEntry(WKBundleRef bundle, WKStringRef, WKStringRef, WKStringRef, bool); 88 WK_EXPORT void WKBundleRemoveOriginAccessWhitelistEntry(WKBundleRef bundle, WKStringRef, WKStringRef, WKStringRef, bool); 89 WK_EXPORT void WKBundleResetOriginAccessWhitelists(WKBundleRef bundle); 90 WK_EXPORT void WKBundleSetAlwaysAcceptCookies(WKBundleRef bundle, bool); 95 96 // Garbage collection API 97 WK_EXPORT void WKBundleGarbageCollectJavaScriptObjects(WKBundleRef bundle); 98 WK_EXPORT void WKBundleGarbageCollectJavaScriptObjectsOnAlternateThreadForDebugging(WKBundleRef bundle, bool waitUntilDone); 99 WK_EXPORT size_t WKBundleGetJavaScriptObjectsCount(WKBundleRef bundle); 91 100 92 101 WK_EXPORT bool WKBundleIsProcessingUserGesture(WKBundleRef bundle); 93 94 WK_EXPORT void WKBundleSwitchNetworkLoaderToNewTestingSession(WKBundleRef bundle);95 102 96 103 WK_EXPORT void WKBundleSetPageVisibilityState(WKBundleRef bundle, WKBundlePageRef page, int state, bool isInitialState); -
trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp
r126311 r126899 33 33 #include "InjectedBundleUserMessageCoders.h" 34 34 #include "LayerTreeHost.h" 35 #include "NotificationPermissionRequestManager.h" 35 36 #include "WKAPICast.h" 36 37 #include "WKBundleAPICast.h" … … 535 536 } 536 537 538 void InjectedBundle::setWebNotificationPermission(WebPage* page, const String& originString, bool allowed) 539 { 540 #if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) 541 page->notificationPermissionRequestManager()->setPermissionLevelForTesting(originString, allowed ? NotificationClient::PermissionAllowed : NotificationClient::PermissionDenied); 542 #else 543 UNUSED_PARAM(page); 544 UNUSED_PARAM(originString); 545 UNUSED_PARAM(allowed); 546 #endif 547 } 548 549 void InjectedBundle::removeAllWebNotificationPermissions(WebPage* page) 550 { 551 #if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) 552 page->notificationPermissionRequestManager()->removeAllPermissionsForTesting(); 553 #else 554 UNUSED_PARAM(page); 555 #endif 556 } 557 537 558 } // namespace WebKit -
trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.h
r126311 r126899 125 125 bool isPageBoxVisible(WebFrame*, int); 126 126 void setUserStyleSheetLocation(WebPageGroupProxy*, const String&); 127 void setWebNotificationPermission(WebPage*, const String& originString, bool allowed); 128 void removeAllWebNotificationPermissions(WebPage*); 127 129 128 130 // UserContent API -
trunk/Source/WebKit2/WebProcess/Notifications/NotificationPermissionRequestManager.cpp
r125370 r126899 129 129 } 130 130 131 void NotificationPermissionRequestManager::setPermissionLevelForTesting(const String& originString, WebCore::NotificationClient::Permission permission) 132 { 133 #if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) 134 WebProcess::shared().notificationManager().didUpdateNotificationDecision(originString, permission); 135 #else 136 UNUSED_PARAM(originString); 137 UNUSED_PARAM(permission); 138 #endif 139 } 140 141 void NotificationPermissionRequestManager::removeAllPermissionsForTesting() 142 { 143 #if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) 144 WebProcess::shared().notificationManager().removeAllPermissionsForTesting(); 145 #endif 146 } 147 131 148 void NotificationPermissionRequestManager::didReceiveNotificationPermissionDecision(uint64_t requestID, bool allowed) 132 149 { -
trunk/Source/WebKit2/WebProcess/Notifications/NotificationPermissionRequestManager.h
r125370 r126899 33 33 #include <wtf/RefCounted.h> 34 34 #include <wtf/RefPtr.h> 35 #include <wtf/text/WTFString.h> 35 36 36 37 namespace WebCore { … … 56 57 void cancelRequest(WebCore::SecurityOrigin*); 57 58 58 // Synchronous call to retrieve permission level for given security origin59 59 WebCore::NotificationClient::Permission permissionLevel(WebCore::SecurityOrigin*); 60 61 // For testing purposes only. 62 void setPermissionLevelForTesting(const String& originString, WebCore::NotificationClient::Permission); 63 void removeAllPermissionsForTesting(); 60 64 61 65 void didReceiveNotificationPermissionDecision(uint64_t notificationID, bool allowed); -
trunk/Source/WebKit2/WebProcess/Notifications/WebNotificationManager.cpp
r126837 r126899 106 106 } 107 107 108 void WebNotificationManager::removeAllPermissionsForTesting() 109 { 110 #if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) 111 m_permissionsMap.clear(); 112 #endif 113 } 114 108 115 bool WebNotificationManager::show(Notification* notification, WebPage* page) 109 116 { -
trunk/Source/WebKit2/WebProcess/Notifications/WebNotificationManager.h
r110784 r126899 69 69 WebCore::NotificationClient::Permission policyForOrigin(WebCore::SecurityOrigin*) const; 70 70 71 void didUpdateNotificationDecision(const String& originString, bool allowed); 72 73 // For testing purposes only. 74 void removeAllPermissionsForTesting(); 75 71 76 private: 72 77 // Implemented in generated WebNotificationManagerMessageReceiver.cpp … … 76 81 void didClickNotification(uint64_t notificationID); 77 82 void didCloseNotifications(const Vector<uint64_t>& notificationIDs); 78 void didUpdateNotificationDecision(const String& originString, bool allowed);79 83 void didRemoveNotificationDecisions(const Vector<String>& originStrings); 80 84
Note:
See TracChangeset
for help on using the changeset viewer.