Closed Bug 225508 Opened 21 years ago Closed 21 years ago

View selection source doesn't work: contains many %u escape sequences

Categories

(Core Graveyard :: View Source, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: isaachh, Assigned: jshin1987)

References

()

Details

(Keywords: intl, regression)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.6b) Gecko/20031112 Firebird/0.7+
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.6b) Gecko/20031112 Firebird/0.7+

This can be best spotted in non-Western charset pages. Western charset page also
has the problem. Highlighted selection in the source view doesn't appear and the
selection delimeters are displayed as %uxxxx.

Javascript console spews an error:

Error: [Exception... "Component returned failure code: 0x80070057
(NS_ERROR_ILLEGAL_VALUE) [nsISelection.getRangeAt]"  nsresult: "0x80070057
(NS_ERROR_ILLEGAL_VALUE)"  location: "JS frame ::
chrome://navigator/content/viewPartialSource.js :: drawSelection :: line 267" 
data: no]
Source File: chrome://navigator/content/viewPartialSource.js
Line: 267

Reproducible: Always

Steps to Reproduce:
1. Go to URL and select something.
2. Right click and select View Selection Source.


Actual Results:  
Many %uxxxx escape sequences show up in the windows.

Expected Results:  
Pre-11/12 behavior.
I'm not sure what this bug is about. I'm running  the latest nightly
(2003-11-12) of Firebird on Linux and I don't see any problem in 'View Source'.
It's not likely that ViewSource has a platform-dependent behavior.

 Isaac, could you give us more details (how to reproduce and/or a screenshot)?
What are 'selection delimeters'? 
> and I don't see any problem in 'View Source'

"view selection source" and "view source" are different beasts.  See
http://lxr.mozilla.org/seamonkey/source/xpfe/browser/resources/content/viewPartialSource.js#198
for where the escaping happens and
http://lxr.mozilla.org/seamonkey/source/netwerk/protocol/data/src/nsDataChannel.cpp#178
for where the unescaping happens.

Unfortunately, Mozilla's nsEscape stuff does not handle the %u escapes, so all
of this breaks.

Steps to reproduce are as listed in comment 0 -- select some non-ascii text and
choose "view selection source" from the context menu.
Assignee: doronr → jshin
Status: UNCONFIRMED → NEW
Ever confirmed: true
Keywords: regression
OS: Windows XP → All
Hardware: PC → All
Thanks. 
I've never used the feature.  Anyway, I'll look into the problem. So, the
problem is 'nsUnescape()' in nsEscape.cpp doesn't unescape '%uxxxx'  A fix for
this could be pretty ugly, I'm afraid. I hope it won't be. Is it possible to
call 'unescape()' of the JS engine from there? 
Keywords: intl
No idea, but I doubt it's easy...

In any case, this is hardly the only place where people expect NS_Unescape to
handle whatever's URL-escaped...
See comments in bug 225695 (and patch there).
Depends on: 225695
It sounds like the behavior I'm seeing in FB 20031120 is a little bit different
from what's described here.  On any page, including this one, selecting any text
and then picking "View selection source" from the menu results in tons of %uxxxx
characters showing up.  For example, if I select the word "Additional Comments"
in the heading for Boris's comments above, I get:
<pre>
%u200B%u200B%u200B%u200B%u200BAdditional Comment%u200B%u200B%u200B%u200B%u200B
</pre>
even though there are no non-Western characters in that.  I see this on every
page I've tested with.
To confirm what Scott posed, this does happen with ANY text selected. EG,
selecting the 'A' in comment 0, shows this in view sel. source:

<pre>User-%u200B%u200B%u200B%u200B%u200BA%u200B%u200B%u200B%u200B%u200Bgent: [...]

Note that the %u spewing occurs at the point of the original selection. Hope
that's of some help.
This is going to be fixed by bug 225695. It is a regression from the patch that
was used to fix bug 44272.
The patch for bug 225695 (browser part) checked at 12-03 fixed this bug.
Resolved to FIXED
Status: NEW → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
Product: Browser → Seamonkey
Product: SeaMonkey → Core Graveyard
You need to log in before you can comment on or make changes to this bug.