Closed
Bug 305583
Opened 20 years ago
Closed 20 years ago
allow explicit use of XMLList constructor with E4X disabled
Categories
(Core :: JavaScript Engine, defect)
Core
JavaScript Engine
Tracking
()
RESOLVED
FIXED
People
(Reporter: sync2d, Assigned: mrbkap)
References
()
Details
(Keywords: fixed1.8)
Attachments
(1 file)
1.82 KB,
patch
|
brendan
:
review+
brendan
:
approval1.8b4+
|
Details | Diff | Splinter Review |
Explicit use of the XMLList constructor with E4X disabled should be
allowed, like explicit use of the XML constructor (see bug 301574).
In other words,
data:text/html,<script>alert(XMLList("<p>text</p>"));</script>
should work without an error "invalid XML markup".
Updated•20 years ago
|
Assignee | ||
Comment 1•20 years ago
|
||
I should have done this when I did the same thing for the XML constructor. It
looks like XML and XMLList should have the same behavior here (wrt the XML
option).
Assignee: general → mrbkap
Status: UNCONFIRMED → ASSIGNED
Attachment #193584 -
Flags: review?(brendan)
Comment 2•20 years ago
|
||
Comment on attachment 193584 [details] [diff] [review]
do the toggle!
>@@ -7035,22 +7036,27 @@ XMLList(JSContext *cx, JSObject *obj, ui
> return JS_FALSE;
> *rval = OBJECT_TO_JSVAL(listobj);
>
> list = (JSXML *) JS_GetPrivate(cx, listobj);
> if (!Append(cx, list, xml))
> return JS_FALSE;
> return JS_TRUE;
> }
> }
> }
Blank line here, please.
>+ /* Toggle on XML support since the script has explicitly requested it. */
>+ oldopts = cx->options;
>+ JS_SetOptions(cx, oldopts | JSOPTION_XML);
>
> listobj = ToXMLList(cx, v);
>+
>+ JS_SetOptions(cx, oldopts);
> if (!listobj)
> return JS_FALSE;
Super-nit: I'd crunch everything above together, and put a blank line here
instead.
> *rval = OBJECT_TO_JSVAL(listobj);
> return JS_TRUE;
> }
/be
Attachment #193584 -
Flags: review?(brendan)
Attachment #193584 -
Flags: review+
Attachment #193584 -
Flags: approval1.8b4+
Assignee | ||
Comment 3•20 years ago
|
||
Fix checked into MOZILLA_1_8_BRANCH and trunk.
Comment 4•20 years ago
|
||
test covered in js1_6/Regress/regress-301574.js
Checking in regress-301574.js;
/cvsroot/mozilla/js/tests/js1_6/Regress/regress-301574.js,v <-- regress-301574.js
new revision: 1.2; previous revision: 1.1
done
Flags: testcase+
(In reply to comment #4)
> test covered in js1_6/Regress/regress-301574.js
http://lxr.mozilla.org/mozilla/source/js/tests/js1_6/Regress/regress-301574.js
58 try
59 {
60 var xml = XML('<p>text</p>');
61 }
62 catch(e)
63 {
64 actual = 'error: ' + e;
65 }
66
67 reportCompare(expect, actual, summary + ': XMLList()');
line 60 should call XMLList()...
Comment 6•19 years ago
|
||
(In reply to comment #5)
Checking in regress-301574.js;
/cvsroot/mozilla/js/tests/js1_6/Regress/regress-301574.js,v <-- regress-301574.js
new revision: 1.3; previous revision: 1.2
done
thanks shutdown.
You need to log in
before you can comment on or make changes to this bug.
Description
•