Had a weird window crash this morning, possible fix.
This commit is contained in:
parent
5ea325448c
commit
3b5501787b
1 changed files with 6 additions and 1 deletions
|
@ -14,12 +14,17 @@ chrome.app.runtime.onLaunched.addListener(function(launchData) {
|
||||||
|
|
||||||
//launchData.items will contain files from file manager
|
//launchData.items will contain files from file manager
|
||||||
chrome.storage.local.get("bounds", function(data) {
|
chrome.storage.local.get("bounds", function(data) {
|
||||||
var bounds = data.bounds || {
|
var defaults = {
|
||||||
width: 800,
|
width: 800,
|
||||||
height: 600,
|
height: 600,
|
||||||
left: 50,
|
left: 50,
|
||||||
top: 50
|
top: 50
|
||||||
};
|
};
|
||||||
|
var bounds = data.bounds || defaults;
|
||||||
|
//sanity check the bounds information -- also need to add maximums
|
||||||
|
if (bounds.left < 0 || bounds.top < 0 || bounds.width < 0 || bounds.height < 0) {
|
||||||
|
bounds = defaults;
|
||||||
|
}
|
||||||
chrome.app.window.create("main.html", {
|
chrome.app.window.create("main.html", {
|
||||||
bounds: bounds
|
bounds: bounds
|
||||||
}, function(win) {
|
}, function(win) {
|
||||||
|
|
Loading…
Reference in a new issue