Updates:
        Summary: Safari DOMExceptions are not properly tamed
        Status: Accepted
        Owner: [email protected]

Comment #2 on issue 1772 by kpreid.switchb.org: Safari DOMExceptions are not properly tamed
http://code.google.com/p/google-caja/issues/detail?id=1772

First diagnosis: directConstructor misidentifies host DOMExceptions as record objects, because of the following oddity:

window.e = (function() { try { document.querySelector({}); } catch (f) { return f; } }())
e.constructor
DOMExceptionConstructor
Object.getPrototypeOf(e).constructor
function Object() { ...

Since it is a record, it gets all its properties tamed as forwarding wrappers, and the result is not frozen (issue 1608) which means the scanner complains about finding unfrozen objects.

Note that these error objects would be problematic even if they are not misrecognized by directConstructor, because:
e instanceof Error  // even in the same frame
false
Object.prototype.toString.call(e)
"[object DOMException]"

On the other hand, other DOMExceptions, such as the one from document.appendChild(document), are somehow recognized as Errors by the membrane — I'm not sure why. Any fix for this issue should check both cases.

Proposed fixes:

• If we decide that this cruft is harmless, then fixing issue 1608 will shut up the scanner. Note that this means that the taming membrane passes through all properties of such host exceptions, not selected ones as it's written to do.

• If we want these to be tamed properly, then the least bad thing that comes to mind is to change tameException to _assume_ its argument is an exception and tame it as such (if it doesn't already have a tame twin).

Since this is sort of a taming membrane design question, passing it to Ihab for further comment.

--
You received this message because this project is configured to send all issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

--

--- You received this message because you are subscribed to the Google Groups "Google Caja Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to