Fix bug # 19089: use the correct document's list of RDF datasources, and try and resolve URLs (anonymous, as well as those with "#URL" properties) before loading them in. Approval: chofmann

This commit is contained in:
rjc%netscape.com 1999-12-18 04:20:28 +00:00
Родитель 64b7811b77
Коммит efff9222b9
8 изменённых файлов: 32 добавлений и 48 удалений

Просмотреть файл

@ -811,7 +811,7 @@ function UpdateBookmarksLastVisitedDate(event)
RefreshUrlbar();
}
function OpenBookmarkURL(node, root)
function OpenBookmarkURL(node, datasources)
{
if (node.getAttribute('container') == "true") {
return false;
@ -820,27 +820,17 @@ function UpdateBookmarksLastVisitedDate(event)
var url = node.getAttribute('id');
try
{
var rootNode = document.getElementById(root);
var ds = null;
if (rootNode)
{
ds = rootNode.database;
}
// add support for IE favorites under Win32, and NetPositive URLs under BeOS
var rdf = Components.classes["component://netscape/rdf/rdf-service"].getService();
if (rdf) rdf = rdf.QueryInterface(Components.interfaces.nsIRDFService);
if (rdf)
if (rdf && datasources)
{
if (ds)
{
var src = rdf.GetResource(url, true);
var prop = rdf.GetResource("http://home.netscape.com/NC-rdf#URL", true);
var target = ds.GetTarget(src, prop, true);
if (target) target = target.QueryInterface(Components.interfaces.nsIRDFLiteral);
if (target) target = target.Value;
if (target) url = target;
}
var src = rdf.GetResource(url, true);
var prop = rdf.GetResource("http://home.netscape.com/NC-rdf#URL", true);
var target = datasources.GetTarget(src, prop, true);
if (target) target = target.QueryInterface(Components.interfaces.nsIRDFLiteral);
if (target) target = target.Value;
if (target) url = target;
}
}
catch(ex)

Просмотреть файл

@ -226,7 +226,7 @@ Contributor(s): ______________________________________. -->
// we can get this button into rdf. We can't allow drags on this
// container so we have to be able to identify it (bug 19588).
// - pinkerton
<menu datasources="rdf:bookmarks rdf:files rdf:localsearch rdf:internetsearch" ref="NC:BookmarksRoot">
<menu id="PersonalMenu" datasources="rdf:bookmarks rdf:files rdf:localsearch rdf:internetsearch" ref="NC:BookmarksRoot">
<titledbutton class="bookmarkFolder" align="right" container="true"
value="&bookmarksButton.label;" crop="right"/>
<template>
@ -248,7 +248,7 @@ Contributor(s): ______________________________________. -->
<menupopup>
<menuitem align="left" uri="..."
value="rdf:http://home.netscape.com/NC-rdf#Name"
oncommand="OpenBookmarkURL(event.target, 'PersonalToolbar')"/>
oncommand="OpenBookmarkURL(event.target, document.getElementById('PersonalMenu').database)"/>
</menupopup>
</rule>
</template>
@ -274,7 +274,8 @@ Contributor(s): ______________________________________. -->
</rule>
<rule parent="box">
<titledbutton class="bookmarkbutton" uri="rdf:*" align="left"
value="rdf:http://home.netscape.com/NC-rdf#Name" crop="right" oncommand="OpenBookmarkURL(event.target, 'PersonalToolbar')"/>
value="rdf:http://home.netscape.com/NC-rdf#Name" crop="right"
oncommand="OpenBookmarkURL(event.target, document.getElementById('innermostBox').database)"/>
<spring uri="rdf:*" class="personaltoolbarspacer" flex="1"/>
</rule>
@ -295,7 +296,8 @@ Contributor(s): ______________________________________. -->
<rule>
<menupopup>
<menuitem align="left" uri="..."
value="rdf:http://home.netscape.com/NC-rdf#Name" oncommand="OpenBookmarkURL(event.target, 'PersonalToolbar')"/>
value="rdf:http://home.netscape.com/NC-rdf#Name"
oncommand="OpenBookmarkURL(event.target, document.getElementById('innermostBox').database)"/>
</menupopup>
</rule>
</template>

Просмотреть файл

@ -414,7 +414,7 @@ Contributor(s): ______________________________________. -->
</rule>
<rule>
<menupopup>
<menuitem uri="rdf:*" value="rdf:http://home.netscape.com/NC-rdf#Name" oncommand="OpenBookmarkURL(event.target, 'BookmarksMenu')" />
<menuitem uri="rdf:*" value="rdf:http://home.netscape.com/NC-rdf#Name" oncommand="OpenBookmarkURL(event.target, document.getElementById('BookmarksMenu').database)" />
</menupopup>
</rule>
</template>

Просмотреть файл

@ -33,7 +33,7 @@ function clicked(event, target) {
}
} else {
if (event.clickCount == 2) {
top.OpenBookmarkURL(target, 'bookmarksTree');
top.OpenBookmarkURL(target, document.getElementById('bookmarksTree').database);
}
}
}

Просмотреть файл

@ -811,7 +811,7 @@ function UpdateBookmarksLastVisitedDate(event)
RefreshUrlbar();
}
function OpenBookmarkURL(node, root)
function OpenBookmarkURL(node, datasources)
{
if (node.getAttribute('container') == "true") {
return false;
@ -820,27 +820,17 @@ function UpdateBookmarksLastVisitedDate(event)
var url = node.getAttribute('id');
try
{
var rootNode = document.getElementById(root);
var ds = null;
if (rootNode)
{
ds = rootNode.database;
}
// add support for IE favorites under Win32, and NetPositive URLs under BeOS
var rdf = Components.classes["component://netscape/rdf/rdf-service"].getService();
if (rdf) rdf = rdf.QueryInterface(Components.interfaces.nsIRDFService);
if (rdf)
if (rdf && datasources)
{
if (ds)
{
var src = rdf.GetResource(url, true);
var prop = rdf.GetResource("http://home.netscape.com/NC-rdf#URL", true);
var target = ds.GetTarget(src, prop, true);
if (target) target = target.QueryInterface(Components.interfaces.nsIRDFLiteral);
if (target) target = target.Value;
if (target) url = target;
}
var src = rdf.GetResource(url, true);
var prop = rdf.GetResource("http://home.netscape.com/NC-rdf#URL", true);
var target = datasources.GetTarget(src, prop, true);
if (target) target = target.QueryInterface(Components.interfaces.nsIRDFLiteral);
if (target) target = target.Value;
if (target) url = target;
}
}
catch(ex)

Просмотреть файл

@ -226,7 +226,7 @@ Contributor(s): ______________________________________. -->
// we can get this button into rdf. We can't allow drags on this
// container so we have to be able to identify it (bug 19588).
// - pinkerton
<menu datasources="rdf:bookmarks rdf:files rdf:localsearch rdf:internetsearch" ref="NC:BookmarksRoot">
<menu id="PersonalMenu" datasources="rdf:bookmarks rdf:files rdf:localsearch rdf:internetsearch" ref="NC:BookmarksRoot">
<titledbutton class="bookmarkFolder" align="right" container="true"
value="&bookmarksButton.label;" crop="right"/>
<template>
@ -248,7 +248,7 @@ Contributor(s): ______________________________________. -->
<menupopup>
<menuitem align="left" uri="..."
value="rdf:http://home.netscape.com/NC-rdf#Name"
oncommand="OpenBookmarkURL(event.target, 'PersonalToolbar')"/>
oncommand="OpenBookmarkURL(event.target, document.getElementById('PersonalMenu').database)"/>
</menupopup>
</rule>
</template>
@ -274,7 +274,8 @@ Contributor(s): ______________________________________. -->
</rule>
<rule parent="box">
<titledbutton class="bookmarkbutton" uri="rdf:*" align="left"
value="rdf:http://home.netscape.com/NC-rdf#Name" crop="right" oncommand="OpenBookmarkURL(event.target, 'PersonalToolbar')"/>
value="rdf:http://home.netscape.com/NC-rdf#Name" crop="right"
oncommand="OpenBookmarkURL(event.target, document.getElementById('innermostBox').database)"/>
<spring uri="rdf:*" class="personaltoolbarspacer" flex="1"/>
</rule>
@ -295,7 +296,8 @@ Contributor(s): ______________________________________. -->
<rule>
<menupopup>
<menuitem align="left" uri="..."
value="rdf:http://home.netscape.com/NC-rdf#Name" oncommand="OpenBookmarkURL(event.target, 'PersonalToolbar')"/>
value="rdf:http://home.netscape.com/NC-rdf#Name"
oncommand="OpenBookmarkURL(event.target, document.getElementById('innermostBox').database)"/>
</menupopup>
</rule>
</template>

Просмотреть файл

@ -414,7 +414,7 @@ Contributor(s): ______________________________________. -->
</rule>
<rule>
<menupopup>
<menuitem uri="rdf:*" value="rdf:http://home.netscape.com/NC-rdf#Name" oncommand="OpenBookmarkURL(event.target, 'BookmarksMenu')" />
<menuitem uri="rdf:*" value="rdf:http://home.netscape.com/NC-rdf#Name" oncommand="OpenBookmarkURL(event.target, document.getElementById('BookmarksMenu').database)" />
</menupopup>
</rule>
</template>

Просмотреть файл

@ -33,7 +33,7 @@ function clicked(event, target) {
}
} else {
if (event.clickCount == 2) {
top.OpenBookmarkURL(target, 'bookmarksTree');
top.OpenBookmarkURL(target, document.getElementById('bookmarksTree').database);
}
}
}