Closed Bug 204961 Opened 21 years ago Closed 21 years ago

Apply XBL bindings before interpreting JavaScripts?

Categories

(Core :: XBL, defect)

x86
Windows 98
defect
Not set
normal

Tracking

()

RESOLVED WONTFIX

People

(Reporter: WeirdAl, Assigned: hyatt)

Details

Note attachment 122801 [details] (zipped testcase) from bug 204957.

The testcase, by opening the nsScriptAttrTest.xml file, uses XBL to insert an
alert before the comment in the second script (html > head > script).  The
inserted alert does not currently run through the interpreter.

If the XBL bindings applied before the scripts entered the interpreter, it would
allow for modifying one script which in and of itself isn't compatible with
Mozilla into another which is (a la XML Events, under Handlers, section 3.3)

For instance, XML Events gives the following example:

<script type="application/x-javascript"
        ev:event="submit" ev:observer="form1">
   return docheck(event);
</script>

With a little care, that could transform into:

<script type="application/x-javascript"><![CDATA[
document.getElementById("form1").addEventListener("submit", function(event) {
   return docheck(event);
}, false);
]]></script>

See bug 164482 for progress on XML Events.
Actually, it'd be:

<script type="application/x-javascript"><![CDATA[
document.getElementById("form1").addEventListener("submit", function(event) {
]]>
<![CDATA[
   return docheck(event);
]]>
<![CDATA[
}, false);
]]></script>
I don't really think this is the right way to go. Hyatt?
No longer blocks: XMLEvents
I don't think we should do this -- the content of script is not a presentational
or behavioral property of the script, really...
I would be fine with doing this unless it affects performance, and if someone
steps up to the plate to do this. I don't however think that we should
implements xml-events in this way, i'd rather see a "real" implementation in C++
> unless it affects performance

Doing this will, if nothing else, force script evaluation at frame construction
time instead of content creation time...  that will require that all scripts
always flush the content sink (to ensure that the frames get constructed right
there and then).

So yes, it will hurt performance of loading vanilla HTML pages.
I really don't think it is semantically right to expect XBL to affect compiling
of scripts. At all. :-)
Right.  That was comment 3.

With sicking and Ian's leave, WONTFIX.
Status: NEW → RESOLVED
Closed: 21 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.