后台脚本加载顺序

时间:2013-11-07 19:38:24

标签: javascript google-chrome google-chrome-extension

我观察到一些奇怪的事情。我有一些背景脚本,实际上很多 - 比如18

....
"background": {
  "scripts": [
    "scripts/namespace.js",
    "scripts/frameworks/honeybadger.js",
    "scripts/frameworks/underscore.js",
    "scripts/frameworks/mixin.js",
    "scripts/frameworks/analytics.js",
    "scripts/modules/worker.js",
    "scripts/modules/i18n.js",
    "scripts/modules/url.js",
    "scripts/trackers/error_tracker.js",
    "scripts/trackers/analytics_tracker.js",
    "scripts/lib/page_context_menu.js",
    "scripts/lib/selection_context_menu.js",
    "scripts/lib/omnibox.js",
    "scripts/lib/sync_store.js",
    "scripts/lib/local_store.js",
    "scripts/lib/example_tags.js",
    "scripts/persistence/tag.js",
    "scripts/init/tag_feature.js",
    "scripts/initialize_background.js"
  ],
  "persistent": false
}, 
....

我有HoneyBadger错误跟踪,并且我看到了与加载顺序相关的错误。最后一个脚本initialize_background.js旨在成为起点。然而,我发现错误如下:

  • 未捕获的ReferenceError:_未定义(第三个脚本已加载)
  • 未捕获的ReferenceError:未定义_qag(已加载第五个脚本)

之前有人发生过这种情况吗?可以信任脚本数组按顺序加载脚本吗?应该注意我无法重现这一点。

0 个答案:

没有答案