Closed Bug 1302710 Opened 8 years ago Closed 8 years ago

Error "this.cloneScope is null 1 ExtensionUtils.jsm:338:1" when background script call callback function in content script WebExtension

Categories

(WebExtensions :: General, defect)

50 Branch
x86_64
Windows 7
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WORKSFORME

People

(Reporter: u562210, Unassigned)

Details

Attachments

(1 file)

User Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:48.0) Gecko/20100101 Firefox/48.0
Build ID: 20160823121617

Steps to reproduce:

1. Install the extension as temporary unsigned extension.
2. Hover the cursor above some text in a web page.


Actual results:

I get error in Browser Console:
TypeError: this.cloneScope is null 1 ExtensionUtils.jsm:304:1
And the callback function not running.



Expected results:

The background script should run the callback function in the content script, and show the results.
Component: Untriaged → Extension Compatibility
OS: Unspecified → Windows 7
Hardware: Unspecified → x86
Hardware: x86 → x86_64
This issue happens also in FF 48.0.2 64bit in Windows 7.
Summary: Error "this.cloneScope is null 1 ExtensionUtils.jsm:338:1" when trying to use runtime.sendMessage in WebExtention → Error "this.cloneScope is null 1 ExtensionUtils.jsm:338:1" when background script call callback function in content script WebExtension
Component: Extension Compatibility → WebExtensions: Untriaged
Product: Firefox → Toolkit
I can't reproduce this error, but there are definitely some problems with your code.

For a start, you can just make an XMLHttpRequest from your content script, without needing to send a message to your background script.

If you *do* send a message to your background script, and want to respond asynchronously, the message handler needs to return `true`.
It's just an extension for Chrome, that I'm trying to port to FF.
Shouldn't it be compatible? Because in Chrome this code working without any changes.
(In reply to Saul K from comment #3)
> It's just an extension for Chrome, that I'm trying to port to FF.
> Shouldn't it be compatible? Because in Chrome this code working without any
> changes.

Well, it shouldn't work on Chrome, either. Not as far as the documented behavior is concerned, anyway. But, regardless, a) it would be much simpler, and considerably more efficient, if you made the XMLHttpRequest directly from your content script, and b) I still can't reproduce this error. Can you reproduce it in Developer Edition or nightlies?
Component: WebExtensions: Untriaged → WebExtensions: General
Yes, I did it in Developer Edition.

Anyway Chrome support this code, so I don't know where is the problem.
Maybe you should check why in Chrome it's working.
I made the XHR request from the content script, so my issue solved.
Status: UNCONFIRMED → RESOLVED
Closed: 8 years ago
Resolution: --- → WORKSFORME
I am also having this issue in FF 51.  Here is the extension I am running: https://git.teknik.io/Teknikode/Teknik-Extension

It is working correctly in Chrome, so the functionality is sound.
(In reply to admin from comment #6)
> I am also having this issue in FF 51.  Here is the extension I am running:
> https://git.teknik.io/Teknikode/Teknik-Extension
> 
> It is working correctly in Chrome, so the functionality is sound.

Specifically, the error is reproducible by loading the extension, clicking the toolbar icon, then clicking the upload icon and choosing a file.  This will fail to run, and the error 'TypeError: this.cloneScope is null' will be shown in the console.

The file/line in my extension where this occurring is: scripts/popup.js:18
Your issue is unrelated to the one reported in this bug. Please file a separate bug for it.

Thanks.
Product: Toolkit → WebExtensions
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: