webextensions-examples icon indicating copy to clipboard operation
webextensions-examples copied to clipboard

Inject scripts error: Script returned non-structured-clonable data on Firefox extension when use browser.tabs.executeScript

Open tamvo94 opened this issue 9 years ago • 1 comments

I want to inject script from firefox web extension to tabId thought browser.tabs.executeScript API.

I have a file Browser.js

MyFunc.Browser = (function() {
  var self;

  function Browser() {
    self = this;
  }

  Browser.getExtensionURI = function() {
    return "chrome-extension://";
  };

  return Browser;

})();

And execute script function:

var executing = browser.tabs.executeScript(tabId, {
            file: "js/contentscripts/Browser.js"
          });
 executing.then(function(results) {
    console.log("url: " + tabUrl + ", result", results);

 }, function(error) {
    return console.log("Inject scripts error: " + error);
 });

But script cannot inject to tab and show error.

How I can fix it?

tamvo94 avatar Jun 15 '17 12:06 tamvo94

This is not a support forum for general WebExtension questions. Please use https://wiki.mozilla.org/Add-ons#Getting_in_touch instead.

andymckay avatar Jun 15 '17 17:06 andymckay