Chromium Code Reviews| Index: chrome/browser/extensions/api/tabs/tabs_api.cc |
| diff --git a/chrome/browser/extensions/api/tabs/tabs_api.cc b/chrome/browser/extensions/api/tabs/tabs_api.cc |
| index f88b0deeae98c3416334ee7929c938bc7d42b816..533b6b21438d70de89a2d3012fb8843ef71801db 100644 |
| --- a/chrome/browser/extensions/api/tabs/tabs_api.cc |
| +++ b/chrome/browser/extensions/api/tabs/tabs_api.cc |
| @@ -1834,9 +1834,11 @@ bool ExecuteCodeInTabFunction::CanExecuteScriptOnPage() { |
| // If |tab_id| is specified, look for the tab. Otherwise default to selected |
| // tab in the current window. |
| + LOG(WARNING) << "Checking host"; |
| CHECK_GE(execute_tab_id_, 0); |
| if (!GetTabById(execute_tab_id_, browser_context(), include_incognito(), |
| nullptr, nullptr, &contents, nullptr, &error_)) { |
| + LOG(WARNING) << "No tab"; |
| return false; |
| } |
| @@ -1847,6 +1849,7 @@ bool ExecuteCodeInTabFunction::CanExecuteScriptOnPage() { |
| content::RenderFrameHost* rfh = |
| ExtensionApiFrameIdMap::GetRenderFrameHostById(contents, frame_id); |
| if (!rfh) { |
| + LOG(WARNING) << "No frame"; |
|
karandeepb
2017/07/18 19:26:59
Remove logging.
Devlin
2017/07/18 20:53:46
Whoops, done.
|
| error_ = ErrorUtils::FormatErrorMessage(keys::kFrameNotFoundError, |
| base::IntToString(frame_id), |
| base::IntToString(execute_tab_id_)); |
| @@ -1857,13 +1860,16 @@ bool ExecuteCodeInTabFunction::CanExecuteScriptOnPage() { |
| // if the extension has permission to access the frame's origin, so also allow |
| // programmatic content scripts at about:-URLs for allowed origins. |
| GURL effective_document_url(rfh->GetLastCommittedURL()); |
| + LOG(WARNING) << "Effective1: " << effective_document_url; |
| bool is_about_url = effective_document_url.SchemeIs(url::kAboutScheme); |
| if (is_about_url && details_->match_about_blank && |
| *details_->match_about_blank) { |
| effective_document_url = GURL(rfh->GetLastCommittedOrigin().Serialize()); |
| + LOG(WARNING) << "Effective2: " << effective_document_url; |
| } |
| if (!effective_document_url.is_valid()) { |
| + LOG(WARNING) << "Invalid, skipping"; |
| // Unknown URL, e.g. because no load was committed yet. Allow for now, the |
| // renderer will check again and fail the injection if needed. |
| return true; |
| @@ -1873,6 +1879,7 @@ bool ExecuteCodeInTabFunction::CanExecuteScriptOnPage() { |
| // we check again in the renderer. |
| if (!extension()->permissions_data()->CanAccessPage( |
| extension(), effective_document_url, execute_tab_id_, &error_)) { |
| + LOG(WARNING) << "Denied"; |
| if (is_about_url && |
| extension()->permissions_data()->active_permissions().HasAPIPermission( |
| APIPermission::kTab)) { |
| @@ -1884,6 +1891,7 @@ bool ExecuteCodeInTabFunction::CanExecuteScriptOnPage() { |
| return false; |
| } |
| + LOG(WARNING) << "Accepted"; |
| return true; |
| } |