New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 836316 link

Starred by 2 users

Issue metadata

Status: WontFix
Owner: ----
Closed: Jul 9
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Mac
Pri: 2
Type: Bug



Sign in to add a comment

chrome.contextMenus.onClicked.addListener(): `Cannot access contents of the page` on Google Doc

Reported by vitaly.z...@gmail.com, Apr 24 2018

Issue description

UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36

Steps to reproduce the problem:
Create test extension:

manifest.json:
{
  "manifest_version": 2,
  "name": "test",
  "permissions": ["activeTab", "contextMenus"],
  "background": {
    "scripts": ["eventPage.js"],
    "persistent": false
  },
  "version": "0"
}

eventPage.js:
chrome.contextMenus.create({
    'title': 'Click',
    'id': 'root',
    'contexts': ['all']
})

chrome.contextMenus.onClicked.addListener(_ => {
    chrome.tabs.executeScript({
        'code': 'console.log("Message from event page")'
    });
});

Open some random Google Doc, for example https://docs.google.com/document/d/1lA3fL5ScQut_4aDd0SBzxTJSKAlMsDobLsijLnh_zms/edit?usp=sharing

Open Devtools -> Console.

Context menu on page: 'Click'.

What is the expected behavior?
Message in JS console: 'Message from event page'.

What went wrong?
Error in JS Console of the event page:

`Unchecked runtime.lastError while running tabs.executeScript: Cannot access contents of the page. Extension manifest must request permission to access the respective host.`

Did this work before? N/A 

Does this work in other browsers? Yes

Chrome version: 65.0.3325.181  Channel: n/a
OS Version: OS X 10.13.4
Flash Version: 

The same code works as expected in Firefox.
 
Labels: Needs-Triage-M65
Cc: vamshi.kommuri@chromium.org
Labels: Triaged-ET Needs-Feedback
Thanks for filing the issue!

@Reporter: As it would be out of scope for creating an extension from our end, Could you please share a sample test extension which helps us to triage the issue in a better way from TE end. 
The code from first post.
extension-test.zip
849 bytes Download
Project Member

Comment 4 by sheriffbot@chromium.org, Apr 26 2018

Labels: -Needs-Feedback
Thank you for providing more feedback. Adding the requester to the cc list.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
Components: -Blink>JavaScript Platform>Extensions
Cc: sindhu.chelamcherla@chromium.org
Labels: Needs-Feedback
Unable to reproduce the issue on reported version 65.0.3325.181 and on latest stable 66.0.3359.181 using Mac 10.13.3 with steps mentioned below.

1. Installed attached extension
2. Opened doc specified and opened devtools console
3. Selected "Click" option from context menu and observed "Message from event page" message. Attaching screenshot for reference.

@Reporter: Please check the screenshot and let us know if we miss anything. Also please upgrade chrome to latest stable and check this issue. You can download latest build from https://www.chromium.org/getting-involved/dev-channel.
836316.png
181 KB View Download
Status: WontFix (was: Unconfirmed)
This is WontFix from our side. Extensions have to expressly request permissions to access pages they want to interact with.
After click to the button or context menu item we can interact with the current page without permissions.

Sign in to add a comment