dteviot / WebToEpub

A simple Chrome (and Firefox) Extension that converts Web Novels (and other web pages) into an EPUB.
Other
676 stars 132 forks source link

Do not call alert() inside a promise. #69

Closed dteviot closed 7 years ago

dteviot commented 8 years ago

Chrome v53 will not allow alert() to be called as part of a promise. e.g. This will fail.

new Promise(function(res,rej) { resolver = res }).then(function() { alert(42); });
res(23);

See: https://bugs.chromium.org/p/chromium/issues/detail?id=605517 for more details. Suggested solution: replace alert with

setTimeout(function() { alert('error occurred'); }, 0)

This might be useful: https://developer.mozilla.org/en-US/docs/Web/API/notification

dteviot commented 8 years ago

@typhoon71

As Google is removing support for window.alert() in next release of Chrome, I've updated the ExperimentalTabMode branch with a "roll my own" verion of alert(). Can you give it a go and let me know what you think of it please?

typhoon71 commented 8 years ago

Ok, but am I supposed to look for something specific? Seems to be working OK here.

dteviot commented 8 years ago

@typhoon71

Ok, but am I supposed to look for something specific?

Well, it's code for giving error messages, so:

Anything else you can think of to make it fault.

typhoon71 commented 8 years ago

Trying to parse a page there's no parser: it correctly tells you there's no parser.

Taking the network out (midway):

fetch of URL(https://www.baka-tsuki.org/project/index.php?title=File:BloodSign_v02_008.jpg) failed. Error: Error: fetch of URL(https://www.baka-tsuki.org/project/index.php?title=File:BloodSign_v02_008.jpg) failed. Error: at HttpClient.onError (chrome-extension://agfpeiicolmhejoffeadiiildggjdkka/js/HttpClient.js:14:16) at XMLHttpRequest.xhr.onerror (chrome-extension://agfpeiicolmhejoffeadiiildggjdkka/js/HttpClient.js:24:51)

Which is expected. Similar error if net is disconnected afterthe addon loaded the page.

Dungeon Defense on RNL: usual issue with images (wrong link):

fetch of URL(https://shalvationtranslations.files.wordpress.com/2016/06/xcqoevp.jpg?w=700) failed. Error: Error: fetch of URL(https://shalvationtranslations.files.wordpress.com/2016/06/xcqoevp.jpg?w=700) failed. Error: at HttpClient.onError (chrome-extension://agfpeiicolmhejoffeadiiildggjdkka/js/HttpClient.js:14:16) at HttpClient.validateStatus (chrome-extension://agfpeiicolmhejoffeadiiildggjdkka/js/HttpClient.js:37:22) at HttpClient.onLoadHtml (chrome-extension://agfpeiicolmhejoffeadiiildggjdkka/js/HttpClient.js:47:18) at XMLHttpRequest.xhr.onload (chrome-extension://agfpeiicolmhejoffeadiiildggjdkka/js/HttpClient.js:23:50)

WuxiaWorld: I checked WMW, if you launch the addon from the "single" chapter page it downloads stuff wrongly; I think it should be better if the addon would recognize the index pages only.

This is with chrome

dteviot commented 8 years ago

@typhoon71

Thanks,