agektmr / ProjectTabManager

Have too many tabs opened on Chrome? This extension helps you organize your tabs on windows per projects.
https://chrome.google.com/webstore/detail/project-tab-manager/iapdnheekciiecjijobcglkcgeckpoia
111 stars 25 forks source link

Empty tab title breaks extension #48

Closed makern closed 8 years ago

makern commented 9 years ago

One of my tabs has an empty string as title which prevents the extension's popup from populating with the following error:

Error in event handler for runtime.onMessage: TypeError: Cannot read property 'title' of null
    at new FieldEntity (chrome-extension://iapdnheekciiecjijobcglkcgeckpoia/js/background.js:1507:51)
    at Object.ProjectEntity.load (chrome-extension://iapdnheekciiecjijobcglkcgeckpoia/js/background.js:1644:26)
    at Object.ProjectEntity (chrome-extension://iapdnheekciiecjijobcglkcgeckpoia/js/background.js:1531:10)
    at Object.ProjectManager.update (chrome-extension://iapdnheekciiecjijobcglkcgeckpoia/js/background.js:1852:19)
    at chrome-extension://iapdnheekciiecjijobcglkcgeckpoia/js/background.js:1970:41handler @

The line causing the issue is:

this.title = tab && tab.title || bookmark.title;

tab.title is "" here and bookmark is null. A reasonable fix would perhaps be

this.title = tab && (tab.title || tab.url) || bookmark && (bookmark.title || bookmark.url);
makern commented 9 years ago

Upon closer inspection this is actually not a currently open tab but one saved in chrome.storage.local.

agektmr commented 8 years ago

Sorry for belated response and thanks for your feedback. This issue will be fixed in the next version. See polymer branch for details.