Closed Bug 1214001 Opened 5 years ago Closed 5 years ago

chrome is undefined in WebExtension page

Categories

(WebExtensions :: Untriaged, defect)

44 Branch
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 1214658

People

(Reporter: doncodes, Unassigned)

Details

Attachments

(1 file)

41.73 KB, application/x-zip-compressed
Details
Attached file impotentframe.zip
User Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.64 Safari/537.36

Steps to reproduce:

1. Install the attached extension.

2. Navigate to some page, which will then be replaced with moz-extension://[extension id]/chromeboxui.html




Actual results:

It will show FAIL:  chrome.runtime.sendMessage because the script does not have access to the chrome.* API methods



Expected results:


A page of an extension should have access to chrome.runtime.sendMessage.

So should iframes that are displaying an extension page even if they are running in a non-extension page.  We rely on this behavior.
Summary: Not running WebExtension-based page in correct API context → chrome is undefined
Summary: chrome is undefined → chrome is undefined in WebExtension page
I'm guessing this may be because the page is marked as web_accessible.  If so, this is a major limitation that doesn't exist in Chrome.

This functionality is important because you need to mark content as web_accessible if you are going to inject your own UI into a page via an iframe (a common thing to do).  This bug was first encountered when trying to port an extension that uses an iframe for UI...without this support, there's no way to even communicate with the background page with chrome.runtime.sendMessage.
Component: Untriaged → WebExtensions
Product: Firefox → Toolkit
Status: UNCONFIRMED → RESOLVED
Closed: 5 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 1214658
Product: Toolkit → WebExtensions
You need to log in before you can comment on or make changes to this bug.