Chrome应用/扩展程序 - 后台请求错误,或允许应用程序问题加载Google Doc API

时间:2013-09-10 15:19:12

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

我不确定有什么问题它说Google Doc API不能允许安装桌面应用程序,因为我之前在Chrome 27.0中可以使用它。我知道。

这是我的Manifest.Json文件:

{
  "name": "__MSG_extName__",
  "description": "__MSG_extDescription__",
  "version": "4.0",
  "default_locale": "en_US",
"background": {
  "page": "background.html"
},
  "offline_enabled": true,
  "options_page": "options.html",
  "manifest_version": 2,
  "app": {
    "launch": {
      "local_path": "index.html"
    }
  },
  "icons": {
    "16": "16icon.png",
    "48": "48icon.png",
    "128": "icon.png"
  },
  "permissions": [
    "<all_urls>",
    "unlimited_storage",
    "notifications",
    "tabs",
      "https://docs.google.com/feeds/*",
      "https://www.google.com/accounts/OAuthGetRequestToken",
      "https://www.google.com/accounts/OAuthAuthorizeToken",
      "https://www.google.com/accounts/OAuthGetAccessToken"

  ],

   "content_security_policy": "script-src 'self'; object-src 'self'",


  "web_accessible_resources": [
    "chrome_ex_oauthsimple.js",
    "chrome_ex_oauth.html", 
    "back-main.js",
    "cloud.js"  
  ]

}

我在background.html这里也看到了一个错误。

ChromeExOAuth.prototype.onAccessToken = function(callback, xhr) {
  if (xhr.readyState == 4) {
    var bg = chrome.extension.getBackgroundPage();
    if (xhr.status == 200) {
      var params = ChromeExOAuth.formDecode(xhr.responseText);
      var token = params["oauth_token"];
      var secret = params["oauth_token_secret"];
      this.setToken(token);
      this.setTokenSecret(secret);
      bg.chromeExOAuthRequestingAccess = false;
      callback(token, secret);
    } else {
      bg.chromeExOAuthRequestingAccess = false;
      throw new Error("Fetching access token failed with status " + xhr.status);
    }
  }
};

1 个答案:

答案 0 :(得分:0)

我一直担心同样的状态。 但我刚用“setTimeout”清除了这个状态,但是chrome ver是29.x. 程序代码在这里......

filename:chrome_ex_oauth.js行:约77

77>  chrome.tabs.onUpdated.addListener(function(tabId, changeInfo, tab) {

      //original_midify/////////////////////////////////////////////////
      setTimeout(function(){

78>    if (changeInfo.url &&
79>      changeInfo.url.substr(0, url_match.length) === url_match &&
80>      changeInfo.url != tabs[tabId] &&
81>        window.chromeExOAuthRequestingAccess == false) {
82>      chrome.tabs.create({ 'url' : changeInfo.url }, function(tab) {
83>        tabs[tab.id] = tab.url;
84>        chrome.tabs.remove(tabId);
85>      });
86>    }

      //original_midify/////////////////////////////////////////////////
      },500);

87>  });

怎么样?