Bug 542406. Make readonly='true' on XBL fields work again. r=sicking
authorBoris Zbarsky <bzbarsky@mit.edu>
Wed, 03 Feb 2010 16:17:55 -0500
changeset 37879 6de23691694a49a5bde438b26b8a54d31da8c262
parent 37878 eba15b3faf31635a1cfa391edb016c1664cf21a6
child 37880 5ea413d845bf711f939ad53941abb11ae36a6b60
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewerssicking
bugs542406
milestone1.9.3a1pre
Bug 542406. Make readonly='true' on XBL fields work again. r=sicking
content/xbl/src/nsXBLProtoImplField.cpp
content/xbl/test/Makefile.in
content/xbl/test/test_bug542406.xhtml
--- a/content/xbl/src/nsXBLProtoImplField.cpp
+++ b/content/xbl/src/nsXBLProtoImplField.cpp
@@ -54,17 +54,17 @@ nsXBLProtoImplField::nsXBLProtoImplField
     mFieldTextLength(0),
     mLineNumber(0)
 {
   MOZ_COUNT_CTOR(nsXBLProtoImplField);
   mName = NS_strdup(aName);  // XXXbz make more sense to use a stringbuffer?
   
   mJSAttributes = JSPROP_ENUMERATE;
   if (aReadOnly) {
-    nsAutoString readOnly; readOnly.Assign(*aReadOnly);
+    nsAutoString readOnly; readOnly.Assign(aReadOnly);
     if (readOnly.LowerCaseEqualsLiteral("true"))
       mJSAttributes |= JSPROP_READONLY;
   }
 }
 
 nsXBLProtoImplField::~nsXBLProtoImplField()
 {
   MOZ_COUNT_DTOR(nsXBLProtoImplField);
--- a/content/xbl/test/Makefile.in
+++ b/content/xbl/test/Makefile.in
@@ -66,12 +66,13 @@ include $(topsrcdir)/config/rules.mk
 		file_bug379959_data.html \
 		file_bug379959_cross.html \
 		file_bug379959_xbl.xml \
 		test_bug468210.xhtml \
 		test_bug481558.html \
 		file_bug481558css.sjs \
 		file_bug481558.xbl \
 		test_bug526178.xhtml \
+		test_bug542406.xhtml \
 		$(NULL)
 
 libs:: $(_TEST_FILES)
 	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
new file mode 100644
--- /dev/null
+++ b/content/xbl/test/test_bug542406.xhtml
@@ -0,0 +1,45 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=542406
+-->
+<head>
+  <bindings xmlns="http://www.mozilla.org/xbl">
+    <binding id="foo">
+      <content><children/></content>
+      <implementation>
+        <field name="one" readonly="true">1</field>
+        <field name="three">3</field>
+      </implementation>
+    </binding>
+  </bindings>
+  <title>Test for Bug 542406</title>
+  <script type="application/javascript" src="/MochiKit/packed.js"></script>
+  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=542406">Mozilla Bug 542406</a>
+<p id="display" style="-moz-binding: url(#foo)"></p>
+<div id="content" style="display: none">
+  
+</div>
+<pre id="test">
+<script type="application/javascript">
+<![CDATA[
+
+/** Test for Bug 542406 **/
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(function() {
+  is($("display").one, 1, "Field one not installed?");
+  $("display").one = 2;
+  is($("display").one, 1, "Field one not readonly");
+  is($("display").three, 3, "Field three not installed?");
+  $("display").three = 4;
+  is($("display").three, 4, "Field three readonly?");
+  SimpleTest.finish();
+});
+]]>
+</script>
+</pre>
+</body>
+</html>