Crash fixes for chromium

My current version of chromium inexplicably exposes a crippled version
of chrome.browserAction even though we are now a packaged app and should
not have that functionality exposed to us anymore. This results in some
errors to the tune of "property 'foo' of undefined".

It also doesn't support the innerBounds property for window creation,
only the older (deprecated) bounds property.
This commit is contained in:
lilia 2015-05-15 12:09:50 -07:00
parent 7ec377950c
commit f6a326577d

View file

@ -32,7 +32,7 @@
self.tabs = tabs;
self.setBadgeText = function (text) {
if (chrome.browserAction) {
if (chrome.browserAction && chrome.browserAction.setBadgeText) {
chrome.browserAction.setBadgeText({text: String(text)});
}
};
@ -146,7 +146,7 @@
};
extension.onLaunched = function(callback) {
if (chrome.browserAction) {
if (chrome.browserAction && chrome.browserAction.onClicked) {
chrome.browserAction.onClicked.addListener(callback);
}
if (chrome.app && chrome.app.runtime) {
@ -176,7 +176,7 @@
extension.windows.open({
id: id,
url: url,
innerBounds: { width: 800, height: 666 }
bounds: { width: 800, height: 666 }
});
};