Firefox插件在运行Windows时不会将jquery作为内容脚本加载

我创建了一个将jQuery加载为内容脚本的插件。 这是为了确保依赖jQuery的其他内容脚本可以使用它。

在OSX上运行时,扩展按预期工作,jQuery在扩展启动时加载。 然而,在Windows上运行的相同应用程序不会加载jQuery。我在两台机器上都使用Firefox 40,并且我已经在扩展中尝试了jQuery的2.0和1.x版本,以确保它不会这样做。

有没有人有任何想法可能导致这个问题?

main.js

tabs.on('ready', function(tab) {
  if(tab.url.indexOf(pageurl) === -1) return;
  worker = tab.attach({ 

  contentScriptFile: [   
  data.url("./app/scripts/jquery.js"),  
  data.url("./app/scripts/google.js")]
  });
  worker.port.on("request-cookie", function(){
      console.log("index.js received cookie request");
      worker.port.emit("response-cookie", getBungieCookies());
    });
});

控制台错误

$ jpm run
JPM [info] Starting jpm run on My Jetpack Addon
JPM [warning] Using existing install.rdf. This file is usually auto-generated.
JPM [warning] Using existing bootstrap.js. This file is usually auto-generated.
Creating XPI
JPM [info] XPI created at C:UserssomalleyAppDataLocalTemp@testaddon-0.0.1.xpi (31090ms)
Created XPI at C:UserssomalleyAppDataLocalTemp@testaddon-0.0.1.xpi
JPM [info] Creating a new profile
console.error: testaddon:
Object
    - _errorType = ReferenceError
    - message = jQuery is not defined
    - fileName = resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/commonjs/sdk/loader/sandbox.js -> resource://testaddon/data/ap
p/scripts/ScrollToFixed.js
    - lineNumber = 558
    - stack = @resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/commonjs/sdk/loader/sandbox.js -> resource://testaddon/data/app/
scripts/ScrollToFixed.js:558:1|
    - name = ReferenceError
console.error: testaddon:
Object
    - _errorType = ReferenceError
    - message = $ is not defined
    - fileName = resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/commonjs/sdk/loader/sandbox.js -> resource://testaddon/data/ap
p/scripts/dimApp.config.js
    - lineNumber = 136
    - stack = @resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/commonjs/sdk/loader/sandbox.js -> resource://testaddon/data/app/
scripts/dimApp.config.js:136:1|
    - name = ReferenceError
console.error: testaddon:
Object
    - _errorType = TypeError
    - message = s is undefined
    - fileName = resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/commonjs/sdk/loader/sandbox.js -> resource://testaddon/data/ap
p/scripts/google.js
    - lineNumber = 8
    - stack = @resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/commonjs/sdk/loader/sandbox.js -> resource://testaddon/data/app/
scripts/google.js:8:55|@resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/commonjs/sdk/loader/sandbox.js -> resource://testaddon/
data/app/scripts/google.js:5:2|
    - name = TypeError
链接地址: http://www.djcxy.com/p/45755.html

上一篇: Firefox addon won't load jquery as content script on when running Windows

下一篇: how do we check if this is a content script?