211 Commits

Author SHA1 Message Date
brendan%mozilla.org
555021e00b - Added strict warning "reference to undefined XML name {0}" to cope with
ECMA-357 botch where * or @b or (given valid namespace reference n) n::id
  results in undefined, instead of a TypeError.

- Lazily bootstrap AnyName and AttributeName classes, instead of leaving the
  former uninitialized, and initializing the latter only if QName is init'ed.
  These classes, representing ECMA-357 internal types, must be initialized
  in order to string conversion and default value on them to return useful
  results.  So this change also requires the shared qname_toString to cope
  with these classes, which ape QName in having a JSXMLQName as private data.

- Revise Filtering Predicate Expressions bytecode schema to avoid bogo-script
  creating in js_FilterXMLObject.  With a new JSOP_ENDFILTER bytecode acting
  in lieu of JSOP_POPV, but also exiting the nested js_Interpret() call, the
  runtime can avoid trying to fake a JSScript for the subsequence of script
  bytecode in parens in x.(e), that contains the bytecode for e plus the pop
  or endfilter op.

  This requires a historic reparameterization of js_Interpret to take the
  starting pc!  I cleaned up order of declaration, use, and useless init nits
  for a few variables while messing with it.

- Based on the above change, fix the decompiler to handle filtered predicate
  expressions -- that code was stubbed out till now, and I forgot to go back.
  All better now, especially thanks to JSOP_ENDFILTER.

- Also while fixing filtered predicates, eliminate the useless TOK_RP parse
  node above the parenthesized expression, to avoid a JSOP_GROUP bytecode.

- Fix js_GetAttributeNameObject so it doesn't take over its QName parameter's
  object and rebind it to an object of class AttributeName -- instead, clone
  the qn if necessary.  This is important to cope with the errata, noticed a
  while ago but finally recorded:

9.2.1.2 Step 2(e)(i, ii),
9.2.1.2 Step 7(e)(i),
9.2.1.3 Step 2(b)(ii)(1)(a)
        All uses of a.[[Name]] for an attribute a in these sections that pass
        that QName object to [[Delete]] must pass an AttributeName cloned from
        a.[[Name]].  The [[Name]] internal property is always a QName instance
        and never an AttributeName or AnyName instance.  But [[Delete]] will
        not operate on x.[[Attributes]] when given a QName by these sections,
        so a child could be wrongly deleted instead of the attribute of the
        same name.

  This rework exposed a bug in the XML.prototype.name() impl, where it was
  returning an AttributeName, not a QName, for attribute-class XML objects.
  Clearly wrong -- the E4X spec makes plain early on that [[Name]] is always
  a QName -- but the spec and e4x testsuite seemed to require it due to the
  above-noted errata.


git-svn-id: svn://10.0.0.236/trunk@166845 18797224-902f-48f8-a5cc-f745e15eee43
2004-12-18 02:28:21 +00:00
brendan%mozilla.org
f28e3637eb Expand tabs.
git-svn-id: svn://10.0.0.236/trunk@166467 18797224-902f-48f8-a5cc-f745e15eee43
2004-12-09 01:32:19 +00:00
brendan%mozilla.org
5c8a062a04 Scanner fixes for better diagnostics; XML/XMLList parent() fixes to match spec and fixed tests (246411, r=self).
git-svn-id: svn://10.0.0.236/trunk@165900 18797224-902f-48f8-a5cc-f745e15eee43
2004-11-29 20:48:56 +00:00
brendan%mozilla.org
2e6bee01c4 Don't forget to call the new-script and destroy-script hooks in js_FilterXMLList, so the debugger knows about the script cloned there.
git-svn-id: svn://10.0.0.236/trunk@165772 18797224-902f-48f8-a5cc-f745e15eee43
2004-11-25 06:57:17 +00:00
brendan%mozilla.org
720352377b Fix memcmp length gaffe, plus polish a few comments (246411).
git-svn-id: svn://10.0.0.236/trunk@165771 18797224-902f-48f8-a5cc-f745e15eee43
2004-11-25 04:37:18 +00:00
brendan%mozilla.org
f84407acf4 - Add declared flag to JSXMLNamespace, to implement the intent and test-wanted
effect of ECMA-357, specifically x.namespaceDeclarations() should not include
  the default namespace inherited from the <parent> tag wrapped around a string
  argument "<x>...</x>" by ToXML, whereas x.inScopeNamespaces() should.

  This case implies errata against 10.3.1, 10.4.1, and 13.4.4.24 (at least).

- Consolidate common code in an XMLArrayInsert function, renaming the misnamed
  precursor to XMLArrayAddMember.  XMLArrayInsert properly notifies any cursors
  iterating over the array, fixing for/in and for-each/in bugs such as this:

    var l = <><a/><c/><d/></>;
    var i = 0;
    for each (var x in l) {
        print(x.toXMLString());
        if (i == 1) l[0] += <b/>;
        i++;
    }

- Fix the bug induced by this erratum from ECMA-357:

9.2.1.2 step 2(c)(ii) sets _y.[[Parent]] = r_ where _r_ is the result of
        [[ResolveValue]] called on _x.[[TargetObject]] in 2(a)(i).  This can
        result in text parenting text:

        var MYXML = new XML();
        MYXML.appendChild(new XML("<TEAM>Giants</TEAM>"));

        (testcase from Werner Sharp <wsharp@macromedia.com>).

        To match insertChildAfter, insertChildBefore, prependChild, and
        setChildren, we should silently do nothing in this case.

- Fix PN2X_OUTERMOST not to overlay XSF_CACHE_VALID, causing it to appear to be
  set when cx->xmlSettingFlags were "translated" into ParseNodeToXML flags.  To
  avoid further such stupidity, consolidated all similar flags into XSF_* bits
  and eliminated the PN2X_* duals.

- Redo the way the default namespace is inherited by parsed XML from the
  <parent> tag under ToXML and ToXMLList, and implicitly inherited in the
  js_ParseNodeToXMLObject alternative path to ToXML.

- Handle null prefix (meaning undefined in ECMA-357, that is, no prefix was
  passed to the Namespace constructor) and empty prefix (which is normalized
  from null for the empty URI "no namespace" case) better in the parsing and
  ToXMLString code.

- Fixed a bug in PutProperty where it implements 9.2.1.2 2(c)(vii)(1) (whew!).
  Fixed another bug near that which stupidly assumed all XML nodes have names,
  leading to an obvious null pointer crash.

This should be the final round of work for bug 246411.  With the appropriate
testsuite patches, this passes all tests except e4x/Regress/regress-264369.js
(which probably should be invalidated by a correction to the ECMA-357 spec).


git-svn-id: svn://10.0.0.236/trunk@165769 18797224-902f-48f8-a5cc-f745e15eee43
2004-11-25 03:07:22 +00:00
brendan%mozilla.org
9f868d3f52 In the Replace-calls-Insert case, where V is an XMLList, avoid creating holes and botching x.[[Length]] (246441 followup, rs=shaver).
git-svn-id: svn://10.0.0.236/trunk@165538 18797224-902f-48f8-a5cc-f745e15eee43
2004-11-20 02:34:09 +00:00
brendan%mozilla.org
036b7c131b E4X, configured off, code-complete.
git-svn-id: svn://10.0.0.236/trunk@165420 18797224-902f-48f8-a5cc-f745e15eee43
2004-11-17 07:43:01 +00:00
brendan%mozilla.org
29ca7132f8 Instrument allocation a bit, DEBUG_brendan or METERING only change.
git-svn-id: svn://10.0.0.236/trunk@163318 18797224-902f-48f8-a5cc-f745e15eee43
2004-10-06 21:03:35 +00:00
brendan%mozilla.org
1f06a72acd Use &dummy_sprop consistently (followup to 246441).
git-svn-id: svn://10.0.0.236/trunk@163241 18797224-902f-48f8-a5cc-f745e15eee43
2004-10-05 11:44:14 +00:00
brendan%mozilla.org
e1d64a36be Initial E4X check-in, configured off (246441, rs=shaver).
git-svn-id: svn://10.0.0.236/trunk@163236 18797224-902f-48f8-a5cc-f745e15eee43
2004-10-05 10:19:07 +00:00