zap-devel mailing list
To subscribe, send a mail with subject 'subscribe' to zap-devel(at)croczilla.com.
Likewise, to unsubscribe, send a mail with subject 'unsubscribe'
to zap-devel(at)croczilla.com.
|
[
ClassUtils / Filip Dalüge <filip.daluege(at)gmx... ]
[
Zap Media Kit / Alex Fritze ... ]
Re: [zap-devel] ClassUtils
Filip Dalüge <filip.daluege(at)gmx.de> |
2005-08-11 18:28:10 |
[ FULL ]
|
Execuse me. It doesn't seem to be makeClass, rather it's that
_deserializeHeaders just doesn't exist as a member of SipSIPURI (see
SipSyntaxFactory.js line 695). Why is it called?
Filip
|
Re: [zap-devel] ClassUtils
Filip Dalüge <filip.daluege(at)gmx.de> |
2005-08-11 18:57:52 |
[ FULL ]
|
Well ... it was a version conflict.
|
Re: [zap-devel] ClassUtils
Alex Fritze <alex(at)croczilla.com> |
2005-08-16 17:09:10 |
[ FULL ]
|
[...]
The problem here is that the metafunction SipSyntaxObject.parsedHash()
discriminates between objects and regexps based on what 'typeof'
returns. According to the JS specs 'typeof a' should return 'function'
if a is a regexp and 'object' if a is an object.
Unfortunately this behaviour was recently silently changed. Mozilla now
reports 'object' for regexps and objects. See bug#289933
http://bugzilla.mozilla.org/show_bug.cgi?id=289933.
I've reopened the bug and asked for the change to be backed out, but
I'll have a workaround ready in a bit.
- Alex
|
Re: [zap-devel] ClassUtils
Filip Dalüge <filip.daluege(at)gmx.de> |
2005-08-16 19:00:42 |
[ FULL ]
|
Hi Alex,
Alex Fritze schrieb:[...]
in my point of view, the typeof operator in ECMAScript isn't very
reliable anyways, as strings or regexps are just objects with a special
behaviour. For example:
typeof "hello" == "string"
typeof new String("hello") == "string"
but
typeof function() {} == typeof new Function("", "") == "function".
For your case, wouldn't it be a better solution to check for (a
instanceof RegExp)?
Filip
|
Re: [zap-devel] ClassUtils
Alex Fritze <alex(at)croczilla.com> |
2005-08-16 19:14:20 |
[ FULL ]
|
Filip Dalüge wrote:
[...]
The ECMA specs are _relatively_ clear on this. If an object implements
[[Call]], typeof should return 'function'.
[...]
that our module system introduces.
E.g.:
----------------------------------------------
File A.js :
MOZ_EXPORT=[aregexpA, RegExpA];
var aregexpA = /foo/;
var RegExpA = RegExp;
----------------------------------------------
----------------------------------------------
File B.js:
importModule("A.js");
instanceof aregexpA == RegExp; // 1.
instanceof aregexpA == RegExpA; // 2.
RegExp == RegExp; // 3.
----------------------------------------------
Each module gets its own set of the standard classes, so
expressions 1 & 3 will evaluate to 'false',
expression 2 will evaluate to 'true'.
This behaviour (which has its good and bad points) is likely to change
at some point in the future though.
In any case, I have got a workaround which will be checked in within the
hour.
Basically, the object/regexp discrimination code was used to make some
parameters in the parsedAttrib and parsedHash meta-functions optional,
but I have now inserted the optional arguments everywhere and backed out
the offending code.
- Alex
|
Re: [zap-devel] ClassUtils
Alex Fritze <alex(at)croczilla.com> |
2005-08-16 21:24:27 |
[ FULL ]
|
[...]
This problem is now fixed in CVS.
- Alex
|
Re: [zap-devel] ClassUtils
Filip Dalüge <filip.daluege(at)gmx.de> |
2005-08-16 21:53:17 |
[ FULL ]
|
Alex Fritze schrieb:
[...]
OK, but there are some other rules that may lead to confusing cases in
connection with typeof:
- null is of type "object" but throws an Exception when a script
accesses its properties
- the type of a string depends on wether it has been created by the new
operator (type "object") or it is represented as a string value (type
"string") (that's what I meant to express in my last post but I mistyped)
- non-native objects may claim to be an object although they don't
implement the properties of the Object prototype object
So I for myself prefer instanceof where possible.
[...]
As the imported module's global object is accessible, someone can also
access the non-native standard classes:
var mod = importModule("A.js");
if(mod.aregexpA == instanceof mod.RegExp) /*...*/;
That's fine :-)
[...]
Great, thanks!
Filip
|
Re: [zap-devel] Linux amd64
Alex Fritze <alex(at)croczilla.com> |
2005-08-20 10:29:21 |
[ FULL ]
|
Marc Petit-Huguenin wrote:
[...]
bugzilla bug on this.
Have you tried compiling xulrunner or firefox?
- Alex
|
|
|