RESOLVED FIXED184345
importScripts() should throw exception with a reason when it fails to load a script from the network
https://bugs.webkit.org/show_bug.cgi?id=184345
Summary importScripts() should throw exception with a reason when it fails to load a ...
Daniel Bates
Reported 2018-04-05 17:12:21 PDT
importScripts() should throw exception with a reason when it fails to load a script from the network.
Attachments
Patch (5.70 KB, patch)
2018-04-05 17:12 PDT, Daniel Bates
no flags
Archive of layout-test-results from ews100 for mac-sierra (2.42 MB, application/zip)
2018-04-05 18:12 PDT, EWS Watchlist
no flags
Archive of layout-test-results from ews107 for mac-sierra-wk2 (3.00 MB, application/zip)
2018-04-05 18:17 PDT, EWS Watchlist
no flags
Archive of layout-test-results from ews200 for win-future (12.40 MB, application/zip)
2018-04-05 18:43 PDT, EWS Watchlist
no flags
Archive of layout-test-results from ews124 for ios-simulator-wk2 (2.22 MB, application/zip)
2018-04-05 18:45 PDT, EWS Watchlist
no flags
Archive of layout-test-results from ews115 for mac-sierra (3.06 MB, application/zip)
2018-04-05 19:12 PDT, EWS Watchlist
no flags
Patch (5.70 KB, patch)
2018-04-06 09:21 PDT, Daniel Bates
ap: review+
Daniel Bates
Comment 1 2018-04-05 17:12:58 PDT
EWS Watchlist
Comment 2 2018-04-05 18:12:28 PDT Comment hidden (obsolete)
EWS Watchlist
Comment 3 2018-04-05 18:12:29 PDT Comment hidden (obsolete)
EWS Watchlist
Comment 4 2018-04-05 18:17:17 PDT Comment hidden (obsolete)
EWS Watchlist
Comment 5 2018-04-05 18:17:18 PDT Comment hidden (obsolete)
EWS Watchlist
Comment 6 2018-04-05 18:43:22 PDT Comment hidden (obsolete)
EWS Watchlist
Comment 7 2018-04-05 18:43:33 PDT Comment hidden (obsolete)
EWS Watchlist
Comment 8 2018-04-05 18:45:31 PDT Comment hidden (obsolete)
EWS Watchlist
Comment 9 2018-04-05 18:45:32 PDT Comment hidden (obsolete)
EWS Watchlist
Comment 10 2018-04-05 19:12:14 PDT Comment hidden (obsolete)
EWS Watchlist
Comment 11 2018-04-05 19:12:15 PDT Comment hidden (obsolete)
Daniel Bates
Comment 12 2018-04-06 09:21:18 PDT
Alexey Proskuryakov
Comment 13 2018-04-06 09:37:41 PDT
Comment on attachment 337368 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=337368&action=review > Source/WebCore/workers/WorkerGlobalScope.cpp:292 > + return Exception { NetworkError, String { scriptLoader->error().localizedDescription() } }; I thought that the policy was that developer facing error messages were not localized. Is that incorrect? Also, why is constructing a String necessary here?
Daniel Bates
Comment 14 2018-04-06 09:48:47 PDT
(In reply to Alexey Proskuryakov from comment #13) > Comment on attachment 337368 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=337368&action=review > > > Source/WebCore/workers/WorkerGlobalScope.cpp:292 > > + return Exception { NetworkError, String { scriptLoader->error().localizedDescription() } }; > > I thought that the policy was that developer facing error messages were not > localized. Is that incorrect? > As I wrote on IRC today (04/06): [09:40am] dydx: ap: ResourceError extends ResourceErrorBase and ResourceErrorBase owns a single string ResourceErrorBase::m_localizedDescription As far as I can tell ResourceErrorBase::m_localizedDescription is a misnomer. It always represents a non-localized string. We should consider renaming it. > Also, why is constructing a String necessary here? [09:41am] dydx: ap: Exception takes an optional message as its second argument by rvalue reference; => we need to copy the String [09:41am] dydx: ap: We should change Exception to take a String then it will support both moving and copying semantics based on how the caller passes the String
Alexey Proskuryakov
Comment 15 2018-04-06 10:25:46 PDT
Comment on attachment 337368 [details] Patch > As far as I can tell ResourceErrorBase::m_localizedDescription is a misnomer. It always represents a non-localized string. We should consider renaming it. How did you come to this conclusion? On Mac at least, it's calling an SPI which performs localization work. However, there is a lot of precedent for using this particular ResourceError function. I think that it is unfortunate that we are mixing localized platform error strings with non-localized WebCore strings. As mentioned before, my understanding is that we want both non-localized, but I don't really know.
Daniel Bates
Comment 16 2018-04-06 10:41:27 PDT
(In reply to Alexey Proskuryakov from comment #15) > Comment on attachment 337368 [details] > Patch > > > As far as I can tell ResourceErrorBase::m_localizedDescription is a misnomer. It always represents a non-localized string. We should consider renaming it. > > How did you come to this conclusion? On Mac at least, it's calling an SPI > which performs localization work. > I'm blind.
Daniel Bates
Comment 17 2018-04-06 12:12:40 PDT
Daniel Bates
Comment 18 2018-04-06 12:13:52 PDT
(In reply to Daniel Bates from comment #14) > > Also, why is constructing a String necessary here? > > [09:41am] dydx: ap: Exception takes an optional message as its second > argument by rvalue reference; => we need to copy the String > [09:41am] dydx: ap: We should change Exception to take a String then it will > support both moving and copying semantics based on how the caller passes the > String For completeness, I chose to teach Exception to take a String by value in the patch for bug #184360 and updated this patch to remove the explicit call to the String constructor.
Radar WebKit Bug Importer
Comment 19 2018-04-06 12:14:23 PDT
Note You need to log in before you can comment on or make changes to this bug.