| Index: ios/web/webui/crw_web_ui_manager.mm
|
| diff --git a/ios/web/webui/crw_web_ui_manager.mm b/ios/web/webui/crw_web_ui_manager.mm
|
| index 2efc12b796a6cf8ffb054b1564144422b28cf330..a456bc9b3f71f115905d3f731c4c6e367a3821d5 100644
|
| --- a/ios/web/webui/crw_web_ui_manager.mm
|
| +++ b/ios/web/webui/crw_web_ui_manager.mm
|
| @@ -113,21 +113,16 @@ const char kScriptCommandPrefix[] = "webui";
|
| if (!web::GetWebClient()->IsAppSpecificURL(URL))
|
| return;
|
|
|
| - GURL navigationURL(URL);
|
| - // Add request group ID to the URL, if not present. Request group ID may
|
| - // already be added if restoring state to a WebUI page.
|
| - GURL requestURL =
|
| - web::ExtractRequestGroupIDFromURL(net::NSURLWithGURL(URL))
|
| - ? URL
|
| - : net::GURLWithNSURL(web::AddRequestGroupIDToURL(
|
| - net::NSURLWithGURL(URL), _webState->GetRequestGroupID()));
|
| + // Copy |URL| as it is passed by reference which does not work correctly
|
| + // with blocks (if the object is destroyed the block will have a dangling
|
| + // reference).
|
| + GURL copyURL(URL);
|
| base::WeakNSObject<CRWWebUIManager> weakSelf(self);
|
| - [self loadWebUIPageForURL:requestURL
|
| + [self loadWebUIPageForURL:copyURL
|
| completionHandler:^(NSString* HTML) {
|
| web::WebStateImpl* webState = [weakSelf webState];
|
| if (webState) {
|
| - webState->LoadWebUIHtml(base::SysNSStringToUTF16(HTML),
|
| - navigationURL);
|
| + webState->LoadWebUIHtml(base::SysNSStringToUTF16(HTML), copyURL);
|
| }
|
| }];
|
| }
|
|
|