summaryrefslogtreecommitdiffstats
path: root/toolkit/components/places/PlacesUtils.jsm
diff options
context:
space:
mode:
Diffstat (limited to 'toolkit/components/places/PlacesUtils.jsm')
-rw-r--r--toolkit/components/places/PlacesUtils.jsm14
1 files changed, 10 insertions, 4 deletions
diff --git a/toolkit/components/places/PlacesUtils.jsm b/toolkit/components/places/PlacesUtils.jsm
index 04f2f91..18be841 100644
--- a/toolkit/components/places/PlacesUtils.jsm
+++ b/toolkit/components/places/PlacesUtils.jsm
@@ -947,6 +947,7 @@ var PlacesUtils = {
* @param type
* The content type of the blob.
* @returns An array of objects representing each item contained by the source.
+ * @throws if the blob contains invalid data.
*/
unwrapNodes: function PU_unwrapNodes(blob, type) {
// We split on "\n" because the transferable system converts "\r\n" to "\n"
@@ -977,7 +978,8 @@ var PlacesUtils = {
} catch (ex) {}
}
// note: Services.io.newURI() will throw if uriString is not a valid URI
- if (Services.io.newURI(uriString)) {
+ let uri = Services.io.newURI(uriString);
+ if (Services.io.newURI(uriString) && uri.scheme != "place") {
nodes.push({ uri: uriString,
title: titleString ? titleString : uriString,
type: this.TYPE_X_MOZ_URL });
@@ -990,14 +992,18 @@ var PlacesUtils = {
for (let i = 0; i < parts.length; i++) {
let uriString = parts[i];
// text/uri-list is converted to TYPE_UNICODE but it could contain
- // comments line prepended by #, we should skip them
- if (uriString.substr(0, 1) == "\x23")
+ // comments line prepended by #, we should skip them, as well as
+ // empty uris.
+ if (uriString.substr(0, 1) == "\x23" || uriString == "") {
continue;
+ }
// note: Services.io.newURI) will throw if uriString is not a valid URI
- if (uriString != "" && Services.io.newURI(uriString))
+ let uri = Services.io.newURI(uriString);
+ if (uri.scheme != "place") {
nodes.push({ uri: uriString,
title: uriString,
type: this.TYPE_X_MOZ_URL });
+ }
}
break;
}