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

RESOLVED WORKSFORME

Status

RESOLVED WORKSFORME
2 years ago
3 months ago

People

(Reporter: saul.kredi, Unassigned)

Tracking

50 Branch
x86_64
Windows 7

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Reporter)

Description

2 years ago
Created attachment 8791174 [details]
Hebrew Tooltip Translation for Firefox3.xpi

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.
(Reporter)

Updated

2 years ago
Component: Untriaged → Extension Compatibility
OS: Unspecified → Windows 7
Hardware: Unspecified → x86
(Reporter)

Updated

2 years ago
Hardware: x86 → x86_64
(Reporter)

Comment 1

2 years ago
This issue happens also in FF 48.0.2 64bit in Windows 7.
(Reporter)

Updated

2 years ago
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

Updated

2 years ago
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`.
(Reporter)

Comment 3

2 years ago
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?

Updated

2 years ago
Component: WebExtensions: Untriaged → WebExtensions: General
(Reporter)

Comment 5

2 years ago
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.

Updated

2 years ago
Status: UNCONFIRMED → RESOLVED
Last Resolved: 2 years ago
Resolution: --- → WORKSFORME

Comment 6

2 years ago
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.

Comment 7

2 years ago
(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.

Updated

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