Changeset 160662 in webkit
- Timestamp:
- Dec 16, 2013 2:17:24 PM (10 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r160661 r160662 1 2013-12-16 Dan Bernstein <mitz@apple.com> 2 3 [Cocoa] Expose whether the page contains only secure content 4 https://bugs.webkit.org/show_bug.cgi?id=125758 5 6 Reviewed by Anders Carlsson. 7 8 * UIProcess/API/Cocoa/WKBrowsingContextController.mm: 9 (-[WKBrowsingContextController hasOnlySecureContent]): Added a getter that calls 10 PageLoadState::hasOnlySecureContent. 11 * UIProcess/API/Cocoa/WKBrowsingContextControllerPrivate.h: Declared new property. 12 13 * UIProcess/PageLoadState.cpp: 14 (WebKit::PageLoadState::commitChanges): Notify observers of hasOnlySecureContent() changes. 15 (WebKit::PageLoadState::reset): Reset hasInsecureContent in the uncommitted state. 16 (WebKit::PageLoadState::hasOnlySecureContent): Added. Returns true if there is no insecure 17 content and the URL is an HTTPS URL. 18 (WebKit::PageLoadState::didCommitLoad): Set hasInsecureContent to false in the uncommitted 19 state. 20 (WebKit::PageLoadState::didDisplayOrRunInsecureContent): Set hasInsecureContent to true in 21 the uncommitted state. 22 * UIProcess/PageLoadState.h: 23 (WebKit::PageLoadState::Data::Data): Added hasInsecureContent member. 24 25 * UIProcess/WebPageProxy.cpp: 26 (WebKit::WebPageProxy::didDisplayInsecureContentForFrame): Call 27 PageLoadState::didDisplayOrRunInsecureContent and commit the change before calling out to 28 the client. 29 (WebKit::WebPageProxy::didRunInsecureContentForFrame): Ditto. 30 1 31 2013-12-16 Benjamin Poulain <bpoulain@apple.com> 2 32 -
trunk/Source/WebKit2/UIProcess/API/Cocoa/WKBrowsingContextController.mm
r160653 r160662 95 95 } 96 96 97 virtual void willChangeHasOnlySecureContent() OVERRIDE 98 { 99 [m_controller willChangeValueForKey:@"hasOnlySecureContent"]; 100 } 101 102 virtual void didChangeHasOnlySecureContent() OVERRIDE 103 { 104 [m_controller didChangeValueForKey:@"hasOnlySecureContent"]; 105 } 106 97 107 virtual void willChangeEstimatedProgress() OVERRIDE 98 108 { … … 328 338 { 329 339 return [NSURL _web_URLWithWTFString:_page->pageLoadState().unreachableURL()]; 340 } 341 342 - (BOOL)hasOnlySecureContent 343 { 344 return _page->pageLoadState().hasOnlySecureContent(); 330 345 } 331 346 -
trunk/Source/WebKit2/UIProcess/API/Cocoa/WKBrowsingContextControllerPrivate.h
r159874 r160662 44 44 @property (readonly) WKPageRef _pageRef; 45 45 46 @property (readonly) BOOL hasOnlySecureContent; 47 46 48 @property WKBrowsingContextPaginationMode paginationMode; 47 49 -
trunk/Source/WebKit2/UIProcess/PageLoadState.cpp
r160405 r160662 76 76 bool isLoadingChanged = isLoadingState(m_committedState.state) != isLoadingState(m_uncommittedState.state); 77 77 bool activeURLChanged = activeURL(m_committedState) != activeURL(m_uncommittedState); 78 bool hasOnlySecureContentChanged = hasOnlySecureContent(m_committedState) != hasOnlySecureContent(m_uncommittedState); 78 79 bool estimatedProgressChanged = estimatedProgress(m_committedState) != estimatedProgress(m_uncommittedState); 79 80 … … 84 85 if (activeURLChanged) 85 86 callObserverCallback(&Observer::willChangeActiveURL); 87 if (hasOnlySecureContentChanged) 88 callObserverCallback(&Observer::willChangeHasOnlySecureContent); 86 89 if (estimatedProgressChanged) 87 90 callObserverCallback(&Observer::willChangeEstimatedProgress); … … 92 95 if (estimatedProgressChanged) 93 96 callObserverCallback(&Observer::didChangeEstimatedProgress); 97 if (hasOnlySecureContentChanged) 98 callObserverCallback(&Observer::didChangeHasOnlySecureContent); 94 99 if (activeURLChanged) 95 100 callObserverCallback(&Observer::didChangeActiveURL); … … 105 110 106 111 m_uncommittedState.state = State::Finished; 112 m_uncommittedState.hasInsecureContent = false; 107 113 108 114 m_uncommittedState.pendingAPIRequestURL = String(); … … 151 157 } 152 158 159 bool PageLoadState::hasOnlySecureContent(const Data& data) 160 { 161 if (data.hasInsecureContent) 162 return false; 163 164 return data.url.startsWith("https:", false); 165 } 166 167 bool PageLoadState::hasOnlySecureContent() const 168 { 169 return hasOnlySecureContent(m_committedState); 170 } 171 153 172 double PageLoadState::estimatedProgress(const Data& data) 154 173 { … … 218 237 219 238 m_uncommittedState.state = State::Committed; 239 m_uncommittedState.hasInsecureContent = false; 220 240 221 241 m_uncommittedState.url = m_uncommittedState.provisionalURL; … … 248 268 249 269 m_uncommittedState.url = url; 270 } 271 272 void PageLoadState::didDisplayOrRunInsecureContent(const Transaction::Token& token) 273 { 274 ASSERT_UNUSED(token, &token.m_pageLoadState == this); 275 ASSERT(m_uncommittedState.url.startsWith("https:", false)); 276 277 m_uncommittedState.hasInsecureContent = true; 250 278 } 251 279 -
trunk/Source/WebKit2/UIProcess/PageLoadState.h
r160405 r160662 54 54 virtual void willChangeActiveURL() = 0; 55 55 virtual void didChangeActiveURL() = 0; 56 57 virtual void willChangeHasOnlySecureContent() = 0; 58 virtual void didChangeHasOnlySecureContent() = 0; 56 59 57 60 virtual void willChangeEstimatedProgress() = 0; … … 117 120 String activeURL() const; 118 121 122 bool hasOnlySecureContent() const; 123 119 124 double estimatedProgress() const; 120 125 … … 132 137 133 138 void didSameDocumentNavigation(const Transaction::Token&, const String& url); 139 140 void didDisplayOrRunInsecureContent(const Transaction::Token&); 134 141 135 142 void setUnreachableURL(const Transaction::Token&, const String&); … … 155 162 Data() 156 163 : state(State::Finished) 164 , hasInsecureContent(false) 157 165 , estimatedProgress(0) 158 166 { … … 160 168 161 169 State state; 170 bool hasInsecureContent; 162 171 163 172 String pendingAPIRequestURL; … … 174 183 175 184 static String activeURL(const Data&); 185 static bool hasOnlySecureContent(const Data&); 176 186 static double estimatedProgress(const Data&); 177 187 -
trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp
r160653 r160662 2384 2384 MESSAGE_CHECK(frame); 2385 2385 2386 auto transaction = m_pageLoadState.transaction(); 2387 m_pageLoadState.didDisplayOrRunInsecureContent(transaction); 2388 2389 m_pageLoadState.commitChanges(); 2386 2390 m_loaderClient.didDisplayInsecureContentForFrame(this, frame, userData.get()); 2387 2391 } … … 2397 2401 MESSAGE_CHECK(frame); 2398 2402 2403 auto transaction = m_pageLoadState.transaction(); 2404 m_pageLoadState.didDisplayOrRunInsecureContent(transaction); 2405 2406 m_pageLoadState.commitChanges(); 2399 2407 m_loaderClient.didRunInsecureContentForFrame(this, frame, userData.get()); 2400 2408 }
Note: See TracChangeset
for help on using the changeset viewer.