javascript: href mangled when character reference is used

VERIFIED DUPLICATE of bug 51355

Status

()

VERIFIED DUPLICATE of bug 51355
18 years ago
17 years ago

People

(Reporter: markus.kuehni, Assigned: jst)

Tracking

({dom0})

Trunk
mozilla1.0
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Reporter)

Description

18 years ago
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; 0.8) Gecko/20010215
BuildID:    2001011508

A javascript: href containing an HTML character reference (numeric encoding
using the &#ddd; form) is re-encoded using the URI %xx form. This breaks the
JavaScript code.  

Reproducible: Always
Steps to Reproduce:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <title>Testcase javascript: href problem</title>
</head>
<body>
  <h1>Testcase <code>javascript:</code> href problem</h1>
  <p>
    Shows how Mozilla 0.8 is confused by character references in
<code>javascript:</code> hrefs. 
    It seems to find it necessary to re-encode the href value using the %xx
notation. 
    While this is probably the right thing to do for ordinary URIs it obviously
breaks JavaScript:
  </p>
  <ol>
    <li>Please open the JavaScript console (<var>Tasks/Tools/JavaScript
Console</var>)</li>
    <li><a href="javascript:alert('&#183;Hello World&#183;')">Test it!</a> 
      (should display an alert box showing <code>&#183;Hello
World&#183;</code>)</li>
  </ol>
  <p>
    The code works fine on IE 5.5 and Opera 5.02.
  </p>
</body>
</html>
(Reporter)

Comment 1

18 years ago
Created attachment 25434 [details]
Test case

Comment 2

18 years ago
Confirmed under 2001021606/Linux as well.

Comment 3

18 years ago
Confirming and setting OS all.
Status: UNCONFIRMED → NEW
Ever confirmed: true
OS: Windows 2000 → All

Comment 4

18 years ago
updating component.
Assignee: asa → jst
Component: Browser-General → DOM Level 0
QA Contact: doronr → desale
Keywords: dom0

Comment 5

18 years ago
I think this might not be a bug, ccing hixie.
(Assignee)

Comment 6

18 years ago
Yet one more problem with escaping/unescaping javascript: URL's. Trying for
mozilla1.0
Hardware: PC → All
Target Milestone: --- → mozilla1.0

Comment 7

18 years ago
I think this is a duplicate of bug 51355.

Comment 8

18 years ago

*** This bug has been marked as a duplicate of 51355 ***
Status: NEW → RESOLVED
Last Resolved: 18 years ago
Resolution: --- → DUPLICATE

Comment 9

17 years ago
Verified Duplicate.
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.