Closed Bug 367129 Opened 17 years ago Closed 12 years ago

XUL Template causes Firefox crash using static RDF source

Categories

(Core Graveyard :: RDF, defect)

x86
Windows 2000
defect
Not set
critical

Tracking

(Not tracked)

RESOLVED INCOMPLETE

People

(Reporter: robin.macharg, Unassigned)

Details

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.0; en-GB; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-GB; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1

A simple XUL template causes a repeatable Firefox crash when using a static (file-based) RDF source, derived from a simple bookmark serialization.

A trivial extension is set up and tested via a chrome:// URI.
The rdf:bookmarks datasource is serialized to RDF/XML.  It is formatted for legibility and has had the NC:parseType="Date" attributes removed.  With this change it validates correctly using the W3C validator.

Some trivial XUL Template code is added to show <label>s for a variety of queries, of which the folowing is one example.  The result is either no output or, as in this case, a browser crash.

---BEGIN: XUL---
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<window xmlns     = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
	    xmlns:rdf = "http://www.w3.org/1999/02/22-rdf-syntax-ns#"
	    xmlns:NC  = "http://home.netscape.com/NC-rdf#">
	<hbox flex="1">
       <vbox flex="2" 
		      datasources="chrome://favouritism/content/data/bookmarks.rdf"
			          ref="NC:BookmarksRoot">
			<label value="Template test follows:"/>
			<template>
				<rule>
					<conditions>
						<content uri="?start"/>
						<triple subject="?start"
						predicate="http://home.netscape.com/NC-rdf#Name"
						object="?name"/>
					</conditions>
					<action>
						<label uri="?name" value="hello"/>
					</action>
				</rule>
			</template>
			<label value="end"/>
		</vbox>
	</hbox>
</window>
---END---

---BEGIN: RDF---
<?xml version="1.0"?>
<RDF:RDF xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
	xmlns:NS="http://home.netscape.com/WEB-rdf#"
	xmlns:NC="http://home.netscape.com/NC-rdf#"
	xmlns:FP="http://developer.mozilla.org/rdf/vocabulary/forward-proxy#">
	<RDF:Seq RDF:about="NC:BookmarksTopRoot">
		<RDF:li RDF:resource="NC:BookmarksRoot" />
	</RDF:Seq>
	<NC:Folder RDF:about="NC:BookmarksTopRoot" />
	<RDF:Seq RDF:about="NC:BookmarksRoot">
		<RDF:li RDF:resource="rdf:#$FvPhC3" />
		<RDF:li RDF:resource="rdf:#$NsUHO3" />
		<RDF:li RDF:resource="rdf:#$SzKqD1" />
	</RDF:Seq>
	<NC:Folder RDF:about="NC:BookmarksRoot" NC:Name="Bookmarks">
		<NS:LastModifiedDate>
			Tue, 16 Jan 2007 11:39:46 GMT +000000
		</NS:LastModifiedDate>
	</NC:Folder>
	<RDF:Seq RDF:about="rdf:#$FvPhC3" />
	<NC:Folder RDF:about="rdf:#$FvPhC3" NC:BookmarksToolbarFolder="true"
		NC:Name="Bookmarks Toolbar Folder"
		NC:Description="Add bookmarks to this folder to see them displayed on the Bookmarks Toolbar">
		<NS:LastModifiedDate>
			Tue, 16 Jan 2007 11:39:44 GMT +000000
		</NS:LastModifiedDate>
	</NC:Folder>
	<NC:Bookmark RDF:about="rdf:#$NsUHO3"
		NC:URL="http://www.google.com/" NC:Name="Google">
		<NC:BookmarkAddDate>
			Fri, 05 Jan 2007 11:02:08 GMT +000000
		</NC:BookmarkAddDate>
		<NS:LastVisitDate>
			Fri, 05 Jan 2007 11:55:03 GMT +000000
		</NS:LastVisitDate>
	</NC:Bookmark>
	<NC:Bookmark RDF:about="rdf:#$SzKqD1"
		NC:URL="chrome://favouritism/content/XUL/window.xul"
		NC:Name="window.xul">
		<NC:BookmarkAddDate>
			Mon, 08 Jan 2007 09:43:41 GMT +000000
		</NC:BookmarkAddDate>
		<NS:LastModifiedDate>
			Tue, 16 Jan 2007 11:35:47 GMT +000000
		</NS:LastModifiedDate>
		<NS:LastVisitDate>
			Tue, 16 Jan 2007 14:59:09 GMT +809192
		</NS:LastVisitDate>
	</NC:Bookmark>
</RDF:RDF>
---END--- 

Changing the <label uri="?name" value="hello"/> line makes the problem disappear - there's no output, though.

Reproducible: Always

Steps to Reproduce:
Load XUL via a chrome:// URI.
Actual Results:  
Browser crashed.

Expected Results:  
label(s)
Which builds are you testing? The trunk should produce no output, and the branch (firefox 2) will randomly crash.

The issue is because you're using an rdf literal as the member variable (uri="?name") which isn't valid.
 xmlns:NS="http://home.netscape.com/WEB-rdf#"
 xmlns:NC="http://home.netscape.com/NC-rdf#"

--> page 404 not found ...

nothing related to this: http://slashdot.org/articles/07/01/14/1359213.shtml ???
(In reply to comment #1)
> Which builds are you testing? The trunk should produce no output, and the
> branch (firefox 2) will randomly crash.

I'm using Firefox 2, so "branch", I guess?

> The issue is because you're using an rdf literal as the member variable
> (uri="?name") which isn't valid.

I'm still learning the intricacies of RDF; I'm not sure from your explanation if you mean that the use of ?name conflicts with an RDF literal (...#Name)? or whether the use of "uri=..." in the label is the issue.  My understanding was that the "uri=..." attribute indicates the content to be repeated.

These aren't the forums, but is there any chance of a more verbose explanation? That way I can understand how this is not a bug. TIA!
(In reply to comment #1)
> The issue is because you're using an rdf literal as the member variable
> (uri="?name") which isn't valid.

I think I understand things a little better now.  The following template code - in both standard and simple syntax - is able to access the RDF literal (...#Name) I was trying to get earlier, by starting one level further up the chain (BookmarksTopRoot). i.e. resource -> resource -> literal. I've hardwired the <triple> predicate for brevity; I guess this should more correctly be done via a <member> indirection.

This does raise another issue, though: is it the case that the template builder is unable to directly access literals connected to the root resource? i.e. resource -> literal ? If it can are you able to provide an example?

If not, should I re-file this bug as an enhancement request?

---BEGIN: XUL extract---
<window xmlns     = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
	    xmlns:rdf = "http://www.w3.org/1999/02/22-rdf-syntax-ns#"
	    xmlns:NC  = "http://home.netscape.com/NC-rdf#">
	<hbox flex="1">
       <vbox flex="2" 
		      datasources="chrome://favouritism/content/data/bookmarks.rdf"
			          ref="NC:BookmarksTopRoot">
			<label value="Template test follows:"/>
			<template>
				<rule>
					<conditions>
						<content uri="?start"/>
						<triple subject="?start" predicate="http://www.w3.org/1999/02/22-rdf-syntax-ns#_1" object="?broot"/>
					</conditions>
					<bindings>
						<binding subject="?broot" predicate="http://home.netscape.com/NC-rdf#Name" object="?myname"/>
					</bindings>
					<action>
						<label uri="?broot" value="?myname"/>
					</action>
				</rule>
			</template>
			<label value="end"/>
		</vbox>
	</hbox>
	<hbox flex="1">
       <vbox flex="2" 
		      datasources="chrome://favouritism/content/data/bookmarks.rdf"
			          ref="NC:BookmarksTopRoot">
			<label value="Template test2 follows:"/>
			<template>
				<rule>
					<label uri="rdf:*" value="rdf:http://home.netscape.com/NC-rdf#Name"/>
				</rule>
			</template>
			<label value="end"/>
		</vbox>
	</hbox>
</window>

---END---
(In reply to comment #2)
>  xmlns:NS="http://home.netscape.com/WEB-rdf#"
>  xmlns:NC="http://home.netscape.com/NC-rdf#"
> 
> --> page 404 not found ...
> 
> nothing related to this: http://slashdot.org/articles/07/01/14/1359213.shtml
> ???
> 

I don't believe so, since I got something working (see comment #4) but an interesting read anyway.
Could you provide what output you're expecting?

If you're starting at NC:BookmarksRoot and trying to display a label with 'Bookmarks' then that isn't possible on firefox 2. This capability has only been added to the trunk.
 
Closing as incomplete.
Status: UNCONFIRMED → RESOLVED
Closed: 12 years ago
Resolution: --- → INCOMPLETE
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.