summaryrefslogtreecommitdiffstats
path: root/dom/xul/templates/tests/chrome/test_bug441785.xul
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /dom/xul/templates/tests/chrome/test_bug441785.xul
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'dom/xul/templates/tests/chrome/test_bug441785.xul')
-rw-r--r--dom/xul/templates/tests/chrome/test_bug441785.xul148
1 files changed, 148 insertions, 0 deletions
diff --git a/dom/xul/templates/tests/chrome/test_bug441785.xul b/dom/xul/templates/tests/chrome/test_bug441785.xul
new file mode 100644
index 000000000..7be6df198
--- /dev/null
+++ b/dom/xul/templates/tests/chrome/test_bug441785.xul
@@ -0,0 +1,148 @@
+<?xml version="1.0" ?>
+<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
+<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
+
+<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+ <tree flex="20" id="t" ref="urn:data:row" datasources="rdf:null" seltype="single">
+ <treecols>
+ <treecol flex="1" id="id" label="id" sort="rdf:http://dummy/rdf#id" />
+ <splitter class="tree-splitter"/>
+ <treecol flex="1" id="title" label="title" sort="rdf:http://dummy/rdf#title" sortActive="true" sortDirection="ascending" /><splitter class="tree-splitter"/>
+ </treecols>
+ <template>
+ <treechildren>
+ <treeitem uri="rdf:*" seltype="single">
+ <treerow >
+ <treecell label="rdf:http://dummy/rdf#id"/>
+ <treecell label="rdf:http://dummy/rdf#title"/>
+ </treerow>
+ </treeitem>
+ </treechildren>
+ </template>
+ </tree>
+ <tree flex="20" id="tc" ref="urn:data:row" datasources="rdf:null" seltype="single" flags="dont-build-content">
+ <treecols>
+ <treecol flex="1" id="idc" label="id" sort="rdf:http://dummy/rdf#id" />
+ <splitter class="tree-splitter"/>
+ <treecol flex="1" id="titlec" label="title" sort="rdf:http://dummy/rdf#title" sortActive="true" sortDirection="ascending" /><splitter class="tree-splitter"/>
+ </treecols>
+ <template>
+ <treechildren>
+ <treeitem uri="rdf:*" seltype="single">
+ <treerow >
+ <treecell label="rdf:http://dummy/rdf#id"/>
+ <treecell label="rdf:http://dummy/rdf#title"/>
+ </treerow>
+ </treeitem>
+ </treechildren>
+ </template>
+ </tree>
+
+<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
+
+<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+
+<script type="application/x-javascript">
+<![CDATA[
+
+var buildCount = 0;
+
+SimpleTest.waitForExplicitFinish();
+
+var TemplateBuilderListener = {
+ willRebuild: function(aBuilder) {
+ },
+
+ didRebuild: function(aBuilder) {
+ ++buildCount;
+ var remove = false;
+ if (buildCount == 2) {
+ remove =true;
+ setTimeout(nextDataSource, 0);
+ } else if (buildCount == 4) {
+ remove = true;
+ setTimeout(continueTest, 0);
+ }
+ if (remove) {
+ var tree = document.getElementById('t');
+ var treec = document.getElementById('tc');
+ tree.builder.removeListener(TemplateBuilderListener);
+ treec.builder.removeListener(TemplateBuilderListener);
+ }
+ },
+
+ QueryInterface: function (aIID)
+ {
+ if (!aIID.equals(Components.interfaces.nsIXULBuilderListener) &&
+ !aIID.equals(Components.interfaces.nsISupports))
+ throw Components.results.NS_ERROR_NO_INTERFACE;
+ return this;
+ }
+};
+
+function runTest() {
+ var tree = document.getElementById('t');
+ var treec = document.getElementById('tc');
+
+ try {
+ var rdfService = Components.classes["@mozilla.org/rdf/rdf-service;1"].
+ getService(Components.interfaces.nsIRDFService);
+
+ var s1 = window.location.href.replace(/test_bug441785.xul/, "bug441785-1.rdf");
+ var ds1 = rdfService.GetDataSourceBlocking(s1);
+
+ var s2 = window.location.href.replace(/test_bug441785.xul/, "bug441785-2.rdf");
+ var ds2 = rdfService.GetDataSourceBlocking(s2);
+ } catch (ex) { }
+
+ tree.builder.addListener(TemplateBuilderListener);
+ treec.builder.addListener(TemplateBuilderListener);
+ tree.setAttribute('datasources', 'bug441785-1.rdf');
+ treec.setAttribute('datasources', 'bug441785-1.rdf');
+}
+
+var oldtreefirstrow, oldtreecfirstrow;
+
+function nextDataSource()
+{
+ var tree = document.getElementById('t');
+ var treec = document.getElementById('tc');
+ tree.treeBoxObject.scrollToRow(10);
+ treec.treeBoxObject.scrollToRow(10);
+
+ is(tree.treeBoxObject.getFirstVisibleRow(), 10, "first tree row count datasource 1");
+ is(treec.treeBoxObject.getFirstVisibleRow(), 10, "second tree row count datasource 1");
+
+ tree.builder.addListener(TemplateBuilderListener);
+ treec.builder.addListener(TemplateBuilderListener);
+ tree.setAttribute('datasources', 'bug441785-2.rdf');
+ treec.setAttribute('datasources', 'bug441785-2.rdf');
+}
+
+function continueTest() {
+ var tree = document.getElementById('t');
+ var treec = document.getElementById('tc');
+
+ is(tree.treeBoxObject.getFirstVisibleRow(), 0, "first tree row count datasource 2");
+ is(treec.treeBoxObject.getFirstVisibleRow(), 0, "second tree row count datasource 2");
+
+ try {
+ window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
+ .getInterface(Components.interfaces.nsIDOMWindowUtils)
+ .garbageCollect();
+ }
+ catch (e) { }
+
+ // Hit the bug, crash
+ // (not exactly the same kind of crash as 441785, but from the same cause)
+ tree.parentNode.removeChild(tree);
+ treec.parentNode.removeChild(treec);
+
+ SimpleTest.finish();
+}
+
+window.addEventListener("load", runTest, false);
+
+]]>
+</script>
+</window>