{"action":"created","issue":{"url":"https://api.github.com/repos/EEXCESS/chrome-extension/issues/50","labels_url":"https://api.github.com/repos/EEXCESS/chrome-extension/issues/50/labels{/name}","comments_url":"https://api.github.com/repos/EEXCESS/chrome-extension/issues/50/comments","events_url":"https://api.github.com/repos/EEXCESS/chrome-extension/issues/50/events","html_url":"https://github.com/EEXCESS/chrome-extension/issues/50","id":115749113,"number":50,"title":"When QueryCrumbs History load fails, paragraph detection is also broken","user":{"login":"mgrani","id":1941683,"avatar_url":"https://avatars.githubusercontent.com/u/1941683?v=3","gravatar_id":"","url":"https://api.github.com/users/mgrani","html_url":"https://github.com/mgrani","followers_url":"https://api.github.com/users/mgrani/followers","following_url":"https://api.github.com/users/mgrani/following{/other_user}","gists_url":"https://api.github.com/users/mgrani/gists{/gist_id}","starred_url":"https://api.github.com/users/mgrani/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mgrani/subscriptions","organizations_url":"https://api.github.com/users/mgrani/orgs","repos_url":"https://api.github.com/users/mgrani/repos","events_url":"https://api.github.com/users/mgrani/events{/privacy}","received_events_url":"https://api.github.com/users/mgrani/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/EEXCESS/chrome-extension/labels/bug","name":"bug","color":"fc2929"}],"state":"closed","locked":false,"assignee":{"login":"schloett","id":4618499,"avatar_url":"https://avatars.githubusercontent.com/u/4618499?v=3","gravatar_id":"","url":"https://api.github.com/users/schloett","html_url":"https://github.com/schloett","followers_url":"https://api.github.com/users/schloett/followers","following_url":"https://api.github.com/users/schloett/following{/other_user}","gists_url":"https://api.github.com/users/schloett/gists{/gist_id}","starred_url":"https://api.github.com/users/schloett/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/schloett/subscriptions","organizations_url":"https://api.github.com/users/schloett/orgs","repos_url":"https://api.github.com/users/schloett/repos","events_url":"https://api.github.com/users/schloett/events{/privacy}","received_events_url":"https://api.github.com/users/schloett/received_events","type":"User","site_admin":false},"milestone":null,"comments":3,"created_at":"2015-11-08T17:59:25Z","updated_at":"2015-11-09T09:46:39Z","closed_at":"2015-11-09T09:46:39Z","body":"I have been switching to the developer version from the web store version in order to test a new feature (version [92ae5c8](https://github.com/EEXCESS/chrome-extension/commit/92ae5c8ef530f3aefb419a5a840260dba95e95c2)). It seemed that the query crumbs search history failed to load (see below).\r\n\r\nIt would seem a good idea to make the code more secure here.\r\n\r\n\r\nException: \r\n\r\n    Error in response to storage.get: TypeError: Cannot read property 'slice' of undefined\r\n    at eval (eval at <anonymous> (chrome-extension://gieldaokbpofcmgipcgoejicflmfnhmc/js/requireContent.js:7:21), <anonymous>:551:49)\r\n    at Object.callback (chrome-extension://gieldaokbpofcmgipcgoejicflmfnhmc/js/content.js:142:37)\r\n    at Object.chrome.storage.sync.get.searchBar.init.queryCrumbs.storage.getHistory [as getHistoryCallback] (chrome-extension://gieldaokbpofcmgipcgoejicflmfnhmc/js/content.js:141:54)\r\n    at Object.init (eval at <anonymous> (chrome-extension://gieldaokbpofcmgipcgoejicflmfnhmc/js/requireContent.js:7:21), <anonymous>:541:18)\r\n    at Object.init (eval at <anonymous> (chrome-extension://gieldaokbpofcmgipcgoejicflmfnhmc/js/requireContent.js:7:21), <anonymous>:439:20)\r\n    at chrome-extension://gieldaokbpofcmgipcgoejicflmfnhmc/js/content.js:125:27\r\n    at Object.context.execCb (chrome-extension://gieldaokbpofcmgipcgoejicflmfnhmc/js/lib/requirejs/require.js:1678:33)\r\n    at Object.Module.check (chrome-extension://gieldaokbpofcmgipcgoejicflmfnhmc/js/lib/requirejs/require.js:878:51)\r\n    at Object.<anonymous> (chrome-extension://gieldaokbpofcmgipcgoejicflmfnhmc/js/lib/requirejs/require.js:1128:34)\r\n\r\nSource Code:\r\n\r\n    storage: {\r\n                            getHistory: function(callback) {\r\n                                chrome.storage.local.get('queryCrumbs_history', function(res) {\r\n                                    callback(res.queryCrumbs_history); //here the exception happens\r\n                                });\r\n                            },\r\n                            setHistory: function(history) {\r\n                                chrome.storage.local.set({queryCrumbs_history: history});\r\n                            }\r\n                        },\r\n\r\n\r\nAnd the callback:\r\n\r\n     self.getHistoryCallback(function(loadedHistory) {\r\n                if (typeof loadedHistory === 'undefined' || loadedHistory === null) {\r\n                    loadedHistory = {\r\n                        history: [],\r\n                        base_color: QueryCrumbsConfiguration.BaseColorManager.getInitialColor(),\r\n                        currentQueryID: -1\r\n                    };\r\n                }\r\n                self.base_color = loadedHistory.base_color;\r\n                var currentQueryID = loadedHistory.currentQueryID;\r\n                var hist = loadedHistory.history.slice(Math.max(loadedHistory.history.length - QueryCrumbsConfiguration.dimensions.HISTORY_LENGTH, 0));\r\n                self.visualData = [];\r\n                for (var nodeIdx = 0; nodeIdx < hist.length; nodeIdx++) {\r\n                    self.CORE.addVisualNode(hist[nodeIdx]);\r\n                }\r\n                self.RENDERING.redraw(self.visualData);\r\n                self.RENDERING.setCurrentQuery(currentQueryID);\r\n            });\r\n        },\r\n\r\n\r\nThe error occures in `var hist = loadedHistory.history.slice(Math.max(loadedHistory.history.length - QueryCrumbsConfiguration.dimensions.HISTORY_LENGTH, 0));`"},"comment":{"url":"https://api.github.com/repos/EEXCESS/chrome-extension/issues/comments/155013004","html_url":"https://github.com/EEXCESS/chrome-extension/issues/50#issuecomment-155013004","issue_url":"https://api.github.com/repos/EEXCESS/chrome-extension/issues/50","id":155013004,"user":{"login":"schloett","id":4618499,"avatar_url":"https://avatars.githubusercontent.com/u/4618499?v=3","gravatar_id":"","url":"https://api.github.com/users/schloett","html_url":"https://github.com/schloett","followers_url":"https://api.github.com/users/schloett/followers","following_url":"https://api.github.com/users/schloett/following{/other_user}","gists_url":"https://api.github.com/users/schloett/gists{/gist_id}","starred_url":"https://api.github.com/users/schloett/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/schloett/subscriptions","organizations_url":"https://api.github.com/users/schloett/orgs","repos_url":"https://api.github.com/users/schloett/repos","events_url":"https://api.github.com/users/schloett/events{/privacy}","received_events_url":"https://api.github.com/users/schloett/received_events","type":"User","site_admin":false},"created_at":"2015-11-09T09:46:39Z","updated_at":"2015-11-09T09:46:39Z","body":"They probably are related, the problem seemed to be caused by the storage handling in the extension. Should be fixed now, see issue #49."}}