Closed Bug 1104875 Opened 10 years ago Closed 10 years ago

Long unresponsive scripts should be truncated so that they don't extend past screen

Categories

(Core :: DOM: Core & HTML, enhancement)

36 Branch
enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla37
Iteration:
37.1

People

(Reporter: rfeeley, Assigned: bzbarsky)

References

Details

Attachments

(2 files, 1 obsolete file)

Attached image unresponsive-script.png
Stop script button was out of view because the script is is not wrapping or not being truncated.
The code here:

http://hg.mozilla.org/mozilla-central/annotate/acde07cb4e4d/dom/base/nsGlobalWindow.cpp#l11171

should truncate scriptLocation in some way. Backlogging this.
Component: General → DOM
Flags: qe-verify-
Flags: in-testsuite-
Flags: firefox-backlog+
OS: Mac OS X → All
Product: Firefox → Core
Hardware: x86 → All
Hmm.  I guess the UI can't do that because we're using a generic dialog?

The big issue is this: what width to truncate at?  I don't see a way for this code to tell....
(In reply to Please do not ask for reviews for a bit [:bz] from comment #2)
> Hmm.  I guess the UI can't do that because we're using a generic dialog?

Yes. That and we concatenate it with the l10n string so there's really very little way to tell anything what/how to truncate otherwise.

> The big issue is this: what width to truncate at?  I don't see a way for
> this code to tell....

Fair! I would just lowball it at 60 characters, take the first/last 30 and add an ellipsis in the middle. That will still not be good enough for customized windows themes that have a really high font-size for message-box text, but that's not the 99% case, and this dialog isn't either, so it doesn't seem to me like we should do the (significant amount of) work here to get it right 100% of the time.
Assignee: nobody → bzbarsky
Status: NEW → ASSIGNED
Comment on attachment 8529234 [details] [diff] [review]
Ellipsize long unresponsive script locations so they don't make the slow script dialog too big

Er, no, this is bunk.  It's better to do on UTF-16, because what I have totally fails on multibyte UTF-8 sequences!
Attachment #8529234 - Flags: review?(peterv) → review-
Attachment #8529234 - Attachment is obsolete: true
Comment on attachment 8529252 [details] [diff] [review]
Ellipsize long unresponsive script locations so they don't make the slow script dialog too big

Review of attachment 8529252 [details] [diff] [review]:
-----------------------------------------------------------------

::: dom/base/nsGlobalWindow.cpp
@@ +11187,5 @@
> +      MOZ_ASSERT(cutLength > 0);
> +      if (NS_IS_LOW_SURROGATE(filenameUTF16[cutStart])) {
> +        // Don't truncate before the low surrogate, in case it's preceded by a
> +        // high surrogate and forms a single Unicode character.  Instead, just
> +        // inlude the low surrogate.

include
Attachment #8529252 - Flags: review?(peterv) → review+
Fixed typo and https://hg.mozilla.org/integration/mozilla-inbound/rev/7e81094bc8f9
Target Milestone: --- → mozilla37
https://hg.mozilla.org/mozilla-central/rev/7e81094bc8f9
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Iteration: --- → 37.1
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: