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

Side by Side Diff: chrome/renderer/extensions/chrome_extensions_dispatcher_delegate.cc

Issue 708713003: Don't crash when granting permissions to active tab. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/renderer/extensions/chrome_extensions_dispatcher_delegate.h" 5 #include "chrome/renderer/extensions/chrome_extensions_dispatcher_delegate.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/sha1.h" 8 #include "base/sha1.h"
9 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "chrome/common/chrome_switches.h" 10 #include "chrome/common/chrome_switches.h"
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 } 300 }
301 } 301 }
302 302
303 void ChromeExtensionsDispatcherDelegate::UpdateTabSpecificPermissions( 303 void ChromeExtensionsDispatcherDelegate::UpdateTabSpecificPermissions(
304 const extensions::Dispatcher* dispatcher, 304 const extensions::Dispatcher* dispatcher,
305 const GURL& url, 305 const GURL& url,
306 int tab_id, 306 int tab_id,
307 const std::string& extension_id, 307 const std::string& extension_id,
308 const extensions::URLPatternSet& origin_set) { 308 const extensions::URLPatternSet& origin_set) {
309 content::RenderView* view = extensions::TabFinder::Find(tab_id); 309 content::RenderView* view = extensions::TabFinder::Find(tab_id);
310 if (!view)
311 return;
310 312
311 // For now, the message should only be sent to the render view that contains 313 // For now, the message should only be sent to the render view that contains
not at google - send to devlin 2014/11/12 16:28:09 Was this actually crashing before? The comment ind
msimonides 2014/11/13 17:13:20 Unfortunately I'm unable to reproduce the crash, w
not at google - send to devlin 2014/11/13 18:17:37 Good question. I'm seeing crashes on line 312, GUR
312 // the target tab. This may change. Either way, if this is the target tab it 314 // the target tab. This may change. Either way, if this is the target tab it
313 // gives us the chance to check against the URL to avoid races. 315 // gives us the chance to check against the URL to avoid races.
314 DCHECK(view);
315 GURL active_url(view->GetWebView()->mainFrame()->document().url()); 316 GURL active_url(view->GetWebView()->mainFrame()->document().url());
316 if (active_url != url) 317 if (active_url != url)
317 return; 318 return;
318 319
319 const extensions::Extension* extension = 320 const extensions::Extension* extension =
320 dispatcher->extensions()->GetByID(extension_id); 321 dispatcher->extensions()->GetByID(extension_id);
321 if (!extension) 322 if (!extension)
322 return; 323 return;
323 324
324 extension->permissions_data()->UpdateTabSpecificPermissions( 325 extension->permissions_data()->UpdateTabSpecificPermissions(
325 tab_id, 326 tab_id,
326 new extensions::PermissionSet(extensions::APIPermissionSet(), 327 new extensions::PermissionSet(extensions::APIPermissionSet(),
327 extensions::ManifestPermissionSet(), 328 extensions::ManifestPermissionSet(),
328 origin_set, 329 origin_set,
329 extensions::URLPatternSet())); 330 extensions::URLPatternSet()));
330 } 331 }
OLDNEW
« 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