mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 14:22:01 +00:00
For a given node, try asking the grap for the URL before falling back to using the node's ID. They might be different. REALLY!
This commit is contained in:
parent
495d2575d3
commit
e581724190
@ -415,7 +415,31 @@
|
|||||||
if (node.getAttribute('container') == "true") {
|
if (node.getAttribute('container') == "true") {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
url = node.getAttribute('id');
|
|
||||||
|
var url = node.getAttribute('id');
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// first try asking RDF's graph for the URL
|
||||||
|
var rdf = Components.classes["component://netscape/rdf/rdf-service"].getService();
|
||||||
|
if (rdf) rdf = rdf.QueryInterface(Components.interfaces.nsIRDFService);
|
||||||
|
if (rdf)
|
||||||
|
{
|
||||||
|
var Bookmarks = rdf.GetDataSource("rdf:bookmarks");
|
||||||
|
if (Bookmarks)
|
||||||
|
{
|
||||||
|
var src = rdf.GetResource(url, true);
|
||||||
|
var prop = rdf.GetResource("http://home.netscape.com/NC-rdf#URL", true);
|
||||||
|
var target = Bookmarks.GetTarget(src, prop, true);
|
||||||
|
if (target) target = target.QueryInterface(Components.interfaces.nsIRDFLiteral);
|
||||||
|
if (target) target = target.Value;
|
||||||
|
if (target) url = target;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch(ex)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
// Ignore "NC:" urls.
|
// Ignore "NC:" urls.
|
||||||
if (url.substring(0, 3) == "NC:") {
|
if (url.substring(0, 3) == "NC:") {
|
||||||
|
@ -56,6 +56,30 @@ function OpenURL(event, node)
|
|||||||
|
|
||||||
var url = node.getAttribute('id');
|
var url = node.getAttribute('id');
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// first try asking RDF's graph for the URL
|
||||||
|
var rdf = Components.classes["component://netscape/rdf/rdf-service"].getService();
|
||||||
|
if (rdf) rdf = rdf.QueryInterface(Components.interfaces.nsIRDFService);
|
||||||
|
if (rdf)
|
||||||
|
{
|
||||||
|
var Bookmarks = rdf.GetDataSource("rdf:bookmarks");
|
||||||
|
if (Bookmarks)
|
||||||
|
{
|
||||||
|
var src = rdf.GetResource(url, true);
|
||||||
|
var prop = rdf.GetResource("http://home.netscape.com/NC-rdf#URL", true);
|
||||||
|
var target = Bookmarks.GetTarget(src, prop, true);
|
||||||
|
if (target) target = target.QueryInterface(Components.interfaces.nsIRDFLiteral);
|
||||||
|
if (target) target = target.Value;
|
||||||
|
if (target) url = target;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch(ex)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
// Ignore "NC:" urls.
|
// Ignore "NC:" urls.
|
||||||
if (url.substring(0, 3) == "NC:")
|
if (url.substring(0, 3) == "NC:")
|
||||||
{
|
{
|
||||||
|
@ -415,7 +415,31 @@
|
|||||||
if (node.getAttribute('container') == "true") {
|
if (node.getAttribute('container') == "true") {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
url = node.getAttribute('id');
|
|
||||||
|
var url = node.getAttribute('id');
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// first try asking RDF's graph for the URL
|
||||||
|
var rdf = Components.classes["component://netscape/rdf/rdf-service"].getService();
|
||||||
|
if (rdf) rdf = rdf.QueryInterface(Components.interfaces.nsIRDFService);
|
||||||
|
if (rdf)
|
||||||
|
{
|
||||||
|
var Bookmarks = rdf.GetDataSource("rdf:bookmarks");
|
||||||
|
if (Bookmarks)
|
||||||
|
{
|
||||||
|
var src = rdf.GetResource(url, true);
|
||||||
|
var prop = rdf.GetResource("http://home.netscape.com/NC-rdf#URL", true);
|
||||||
|
var target = Bookmarks.GetTarget(src, prop, true);
|
||||||
|
if (target) target = target.QueryInterface(Components.interfaces.nsIRDFLiteral);
|
||||||
|
if (target) target = target.Value;
|
||||||
|
if (target) url = target;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch(ex)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
// Ignore "NC:" urls.
|
// Ignore "NC:" urls.
|
||||||
if (url.substring(0, 3) == "NC:") {
|
if (url.substring(0, 3) == "NC:") {
|
||||||
|
@ -56,6 +56,30 @@ function OpenURL(event, node)
|
|||||||
|
|
||||||
var url = node.getAttribute('id');
|
var url = node.getAttribute('id');
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// first try asking RDF's graph for the URL
|
||||||
|
var rdf = Components.classes["component://netscape/rdf/rdf-service"].getService();
|
||||||
|
if (rdf) rdf = rdf.QueryInterface(Components.interfaces.nsIRDFService);
|
||||||
|
if (rdf)
|
||||||
|
{
|
||||||
|
var Bookmarks = rdf.GetDataSource("rdf:bookmarks");
|
||||||
|
if (Bookmarks)
|
||||||
|
{
|
||||||
|
var src = rdf.GetResource(url, true);
|
||||||
|
var prop = rdf.GetResource("http://home.netscape.com/NC-rdf#URL", true);
|
||||||
|
var target = Bookmarks.GetTarget(src, prop, true);
|
||||||
|
if (target) target = target.QueryInterface(Components.interfaces.nsIRDFLiteral);
|
||||||
|
if (target) target = target.Value;
|
||||||
|
if (target) url = target;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch(ex)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
// Ignore "NC:" urls.
|
// Ignore "NC:" urls.
|
||||||
if (url.substring(0, 3) == "NC:")
|
if (url.substring(0, 3) == "NC:")
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user