diff --git a/mozilla/browser/components/feeds/Makefile.in b/mozilla/browser/components/feeds/Makefile.in
index 75057f2de43..f1c4c9825fc 100644
--- a/mozilla/browser/components/feeds/Makefile.in
+++ b/mozilla/browser/components/feeds/Makefile.in
@@ -43,4 +43,8 @@ include $(DEPTH)/config/autoconf.mk
DIRS = public src
+ifdef MOZ_MOCHITEST
+DIRS += test
+endif
+
include $(topsrcdir)/config/rules.mk
diff --git a/mozilla/browser/components/feeds/src/FeedWriter.js b/mozilla/browser/components/feeds/src/FeedWriter.js
index b12db5b2ba3..2924ee09300 100755
--- a/mozilla/browser/components/feeds/src/FeedWriter.js
+++ b/mozilla/browser/components/feeds/src/FeedWriter.js
@@ -130,8 +130,9 @@ FeedWriter.prototype = {
getService(Ci.nsIScriptSecurityManager);
const flags = Ci.nsIScriptSecurityManager.DISALLOW_INHERIT_PRINCIPAL;
try {
- secman.checkLoadURIStr(this._window.location.href, uri, flags);
- // checkLoadURIStr will throw if the link URI should not be loaded per
+ secman.checkLoadURIStrWithPrincipal(this._feedPrincipal, uri, flags);
+ // checkLoadURIStrWithPrincipal will throw if the link URI should not be
+ // loaded, either because our feedURI isn't allowed to load it or per
// the rules specified in |flags|, so we'll never "linkify" the link...
element.setAttribute(attribute, uri);
}
@@ -776,6 +777,7 @@ FeedWriter.prototype = {
_window: null,
_document: null,
_feedURI: null,
+ _feedPrincipal: null,
// nsIFeedWriter
init: function FW_init(aWindow) {
@@ -790,6 +792,10 @@ FeedWriter.prototype = {
this._window = window;
this._document = window.document;
+ var secman = Cc["@mozilla.org/scriptsecuritymanager;1"].
+ getService(Ci.nsIScriptSecurityManager);
+ this._feedPrincipal = secman.getCodebasePrincipal(this._feedURI);
+
LOG("Subscribe Preview: feed uri = " + this._window.location.href);
// Set up the subscription UI
diff --git a/mozilla/browser/components/feeds/test/Makefile.in b/mozilla/browser/components/feeds/test/Makefile.in
new file mode 100644
index 00000000000..ab6965a1538
--- /dev/null
+++ b/mozilla/browser/components/feeds/test/Makefile.in
@@ -0,0 +1,51 @@
+# ***** BEGIN LICENSE BLOCK *****
+# Version: MPL 1.1/GPL 2.0/LGPL 2.1
+#
+# The contents of this file are subject to the Mozilla Public License Version
+# 1.1 (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+# http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+# for the specific language governing rights and limitations under the
+# License.
+#
+# The Original Code is mozilla.org code.
+#
+# The Initial Developer of the Original Code is
+# Phil Ringnalda.
+# Portions created by the Initial Developer are Copyright (C) 2007
+# the Initial Developer. All Rights Reserved.
+#
+# Contributor(s):
+#
+# Alternatively, the contents of this file may be used under the terms of
+# either of the GNU General Public License Version 2 or later (the "GPL"),
+# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+# in which case the provisions of the GPL or the LGPL are applicable instead
+# of those above. If you wish to allow use of your version of this file only
+# under the terms of either the GPL or the LGPL, and not to allow others to
+# use your version of this file under the terms of the MPL, indicate your
+# decision by deleting the provisions above and replace them with the notice
+# and other provisions required by the GPL or the LGPL. If you do not delete
+# the provisions above, a recipient may use your version of this file under
+# the terms of any one of the MPL, the GPL or the LGPL.
+#
+# ***** END LICENSE BLOCK *****
+
+DEPTH = ../../../..
+topsrcdir = @top_srcdir@
+srcdir = @srcdir@
+VPATH = @srcdir@
+relativesrcdir = browser/components/feeds/test
+
+include $(DEPTH)/config/autoconf.mk
+include $(topsrcdir)/config/rules.mk
+
+_TEST_FILES = test_bug408328.html \
+ bug408328-data.xml \
+ $(NULL)
+
+libs:: $(_TEST_FILES)
+ $(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
diff --git a/mozilla/browser/components/feeds/test/bug408328-data.xml b/mozilla/browser/components/feeds/test/bug408328-data.xml
new file mode 100644
index 00000000000..e9385e5ab1e
--- /dev/null
+++ b/mozilla/browser/components/feeds/test/bug408328-data.xml
@@ -0,0 +1,63 @@
+
+
+ ++ + +