From 048b79dfa5e8d87db259e616f916dfce0d8b7ce0 Mon Sep 17 00:00:00 2001 From: "rjc%netscape.com" Date: Wed, 25 Aug 1999 01:30:17 +0000 Subject: [PATCH] Try resolving URL property before opening a bookmark, in case its a IE favorite (under Windows, or BeOS) or a internet search result. git-svn-id: svn://10.0.0.236/trunk@44424 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/suite/browser/navigator.js | 36 ++++++++++--------- mozilla/suite/browser/navigator.xul | 8 ++--- .../browser/resources/content/navigator.js | 36 ++++++++++--------- .../browser/resources/content/navigator.xul | 8 ++--- 4 files changed, 46 insertions(+), 42 deletions(-) diff --git a/mozilla/suite/browser/navigator.js b/mozilla/suite/browser/navigator.js index 2122586a3a9..e6b2d322682 100644 --- a/mozilla/suite/browser/navigator.js +++ b/mozilla/suite/browser/navigator.js @@ -451,7 +451,7 @@ function UpdateBookmarksLastVisitiedDate(event) RefreshUrlbar(); } - function OpenBookmarkURL(node) + function OpenBookmarkURL(node, root) { if (node.getAttribute('container') == "true") { return false; @@ -460,24 +460,26 @@ function UpdateBookmarksLastVisitiedDate(event) var url = node.getAttribute('id'); try { - // add support for IE favorites under Win32, and NetPositive URLs under BeOS - if (url.indexOf("file://") == 0) + var rootNode = document.getElementById(root); + var ds = null; + if (rootNode) { - var rdf = Components.classes["component://netscape/rdf/rdf-service"].getService(); - if (rdf) rdf = rdf.QueryInterface(Components.interfaces.nsIRDFService); - if (rdf) + 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 (ds) { - var fileSys = rdf.GetDataSource("rdf:files"); - if (fileSys) - { - var src = rdf.GetResource(url, true); - var prop = rdf.GetResource("http://home.netscape.com/NC-rdf#URL", true); - var target = fileSys.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 = ds.GetTarget(src, prop, true); + if (target) target = target.QueryInterface(Components.interfaces.nsIRDFLiteral); + if (target) target = target.Value; + if (target) url = target; + } } } diff --git a/mozilla/suite/browser/navigator.xul b/mozilla/suite/browser/navigator.xul index 462a1e541f9..12c481369a7 100644 --- a/mozilla/suite/browser/navigator.xul +++ b/mozilla/suite/browser/navigator.xul @@ -346,7 +346,7 @@ Contributor(s): ______________________________________. --> + datasources="rdf:bookmarks rdf:files rdf:find rdf:internetsearch" id="BookmarksMenu" ref="NC:BookmarksRoot"> @@ -514,14 +514,14 @@ Contributor(s): ______________________________________. --> - + diff --git a/mozilla/xpfe/browser/resources/content/navigator.js b/mozilla/xpfe/browser/resources/content/navigator.js index 2122586a3a9..e6b2d322682 100644 --- a/mozilla/xpfe/browser/resources/content/navigator.js +++ b/mozilla/xpfe/browser/resources/content/navigator.js @@ -451,7 +451,7 @@ function UpdateBookmarksLastVisitiedDate(event) RefreshUrlbar(); } - function OpenBookmarkURL(node) + function OpenBookmarkURL(node, root) { if (node.getAttribute('container') == "true") { return false; @@ -460,24 +460,26 @@ function UpdateBookmarksLastVisitiedDate(event) var url = node.getAttribute('id'); try { - // add support for IE favorites under Win32, and NetPositive URLs under BeOS - if (url.indexOf("file://") == 0) + var rootNode = document.getElementById(root); + var ds = null; + if (rootNode) { - var rdf = Components.classes["component://netscape/rdf/rdf-service"].getService(); - if (rdf) rdf = rdf.QueryInterface(Components.interfaces.nsIRDFService); - if (rdf) + 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 (ds) { - var fileSys = rdf.GetDataSource("rdf:files"); - if (fileSys) - { - var src = rdf.GetResource(url, true); - var prop = rdf.GetResource("http://home.netscape.com/NC-rdf#URL", true); - var target = fileSys.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 = ds.GetTarget(src, prop, true); + if (target) target = target.QueryInterface(Components.interfaces.nsIRDFLiteral); + if (target) target = target.Value; + if (target) url = target; + } } } diff --git a/mozilla/xpfe/browser/resources/content/navigator.xul b/mozilla/xpfe/browser/resources/content/navigator.xul index 462a1e541f9..12c481369a7 100644 --- a/mozilla/xpfe/browser/resources/content/navigator.xul +++ b/mozilla/xpfe/browser/resources/content/navigator.xul @@ -346,7 +346,7 @@ Contributor(s): ______________________________________. --> + datasources="rdf:bookmarks rdf:files rdf:find rdf:internetsearch" id="BookmarksMenu" ref="NC:BookmarksRoot"> @@ -514,14 +514,14 @@ Contributor(s): ______________________________________. --> - +