Bug 1140636 - Test CPOW function identity. r=billm
authorBlake Kaplan <mrbkap@gmail.com>
Fri, 06 Mar 2015 15:46:00 +0100
changeset 232749 ce40549140aba20e47b57eaff5fb8a95767109be
parent 232748 38c6b849c9f86c2e2961a499bde97da5a06862c2
child 232750 132344b49ba6ddb63998e919af682fc1675c733d
push id28392
push userkwierso@gmail.com
push dateTue, 10 Mar 2015 22:33:53 +0000
treeherdermozilla-central@440b80b56ba6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbillm
bugs1140636
milestone39.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1140636 - Test CPOW function identity. r=billm
dom/base/test/chrome/cpows_parent.xul
--- a/dom/base/test/chrome/cpows_parent.xul
+++ b/dom/base/test/chrome/cpows_parent.xul
@@ -204,16 +204,26 @@
 
     let savedElement = null;
     function recvDomTest(message) {
       savedElement = message.objects.element;
 
       // Test to ensure that we don't pass CPOWs to C++-implemented interfaces.
       // See bug 1072980.
       if (test_state == "remote") {
+        // This doesn't work because we intercept toString specially
+        // and don't cache the function pointer.
+        // See bug 1140636.
+        todo_is(savedElement.toString, savedElement.toString, "toString identity works");
+
+        // This does work because we create a CPOW for isEqualNode that stays
+        // alive as long as we have a reference to the first CPOW (so as long
+        // as it's detectable).
+        is(savedElement.isEqualNode, savedElement.isEqualNode, "webidl function identity works");
+
         let walker = Components.classes["@mozilla.org/inspector/deep-tree-walker;1"]
                                .createInstance(Components.interfaces.inIDeepTreeWalker);
         const SHOW_ELEMENT = Components.interfaces.nsIDOMNodeFilter.SHOW_ELEMENT;
         walker.showAnonymousContent = true;
         walker.showSubDocuments = false;
 
         try {
           walker.init(savedElement, SHOW_ELEMENT);