Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(51)

Unified Diff: ios/web/web_state/ui/crw_web_controller.mm

Issue 2542303002: Do not inject windowID into non-HTML documents. (Closed)
Patch Set: Fixed unit tests Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/web/web_state/ui/crw_web_controller.mm
diff --git a/ios/web/web_state/ui/crw_web_controller.mm b/ios/web/web_state/ui/crw_web_controller.mm
index 48d769aa20fed54c05f1f2487d72968d2b62bcb0..3834555f284743f3f0483e47c2512f78f8c8567a 100644
--- a/ios/web/web_state/ui/crw_web_controller.mm
+++ b/ios/web/web_state/ui/crw_web_controller.mm
@@ -5252,10 +5252,6 @@ const NSTimeInterval kSnapshotOverlayTransition = 0.5;
didCommitNavigation:(WKNavigation*)navigation {
DCHECK_EQ(_webView, webView);
_certVerificationErrors->Clear();
- // This point should closely approximate the document object change, so reset
- // the list of injected scripts to those that are automatically injected.
- _injectedScriptManagers.reset([[NSMutableSet alloc] init]);
- [self injectWindowID];
// This is the point where the document's URL has actually changed, and
// pending navigation information should be applied to state information.
@@ -5284,6 +5280,17 @@ const NSTimeInterval kSnapshotOverlayTransition = 0.5;
base::SysNSStringToUTF8(storedMIMEType));
}
}
+
+ // This point should closely approximate the document object change, so reset
+ // the list of injected scripts to those that are automatically injected.
+ _injectedScriptManagers.reset([[NSMutableSet alloc] init]);
+ if ([self contentIsHTML] || self.webState->GetContentsMimeType().empty()) {
+ // In unit tests MIME type will be empty, because loadHTML:forURL: does not
+ // notify web view delegate about received response, so web controller does
+ // not get a chance to properly update MIME type.
+ [self injectWindowID];
+ }
+
[self webPageChanged];
[self updateSSLStatusForCurrentNavigationItem];
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698