summaryrefslogtreecommitdiffstats
path: root/docshell
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@gmail.com>2018-03-15 09:11:31 +0100
committerwolfbeast <mcwerewolf@gmail.com>2018-03-15 09:11:31 +0100
commit82b361dc4463b13ebda30090e239db487f5aa308 (patch)
treefdc6fd06e695188735d636da57b02b6c7e0c1c5f /docshell
parent4bb98e2b61ce75d7f5d19398b658441a7ceed04b (diff)
parent71429dc7ecc496c5924c770746e8c28449ecb7a2 (diff)
downloadUXP-82b361dc4463b13ebda30090e239db487f5aa308.tar
UXP-82b361dc4463b13ebda30090e239db487f5aa308.tar.gz
UXP-82b361dc4463b13ebda30090e239db487f5aa308.tar.lz
UXP-82b361dc4463b13ebda30090e239db487f5aa308.tar.xz
UXP-82b361dc4463b13ebda30090e239db487f5aa308.zip
Merge branch 'ported-upstream'
Diffstat (limited to 'docshell')
-rw-r--r--docshell/base/nsDocShell.cpp21
-rw-r--r--docshell/base/nsIRefreshURI.idl15
-rwxr-xr-x[-rw-r--r--]docshell/test/chrome/test_bug453650.xul4
3 files changed, 19 insertions, 21 deletions
diff --git a/docshell/base/nsDocShell.cpp b/docshell/base/nsDocShell.cpp
index 2e08e6720..50641508d 100644
--- a/docshell/base/nsDocShell.cpp
+++ b/docshell/base/nsDocShell.cpp
@@ -6806,9 +6806,17 @@ nsDocShell::ForceRefreshURI(nsIURI* aURI, int32_t aDelay, bool aMetaRefresh, nsI
*/
loadInfo->SetReferrer(mCurrentURI);
- /* Don't ever "guess" on which principal to use to avoid picking
- * the current principal.
- */
+ // Set the triggering pricipal to aPrincipal if available, or current
+ // document's principal otherwise.
+ nsCOMPtr<nsIPrincipal> principal = aPrincipal;
+ if (!principal) {
+ nsCOMPtr<nsIDocument> doc = GetDocument();
+ if (!doc) {
+ return NS_ERROR_FAILURE;
+ }
+ principal = doc->NodePrincipal();
+ }
+ loadInfo->SetTriggeringPrincipal(principal);
loadInfo->SetPrincipalIsExplicit(true);
/* Check if this META refresh causes a redirection
@@ -6836,13 +6844,6 @@ nsDocShell::ForceRefreshURI(nsIURI* aURI, int32_t aDelay, bool aMetaRefresh, nsI
loadInfo->SetLoadType(nsIDocShellLoadInfo::loadRefresh);
}
- // If the principal is null, the refresh will have a triggeringPrincipal
- // derived from the referrer URI, or will be set to the system principal
- // if there is no refererrer. See LoadURI()
- if (aPrincipal) {
- loadInfo->SetTriggeringPrincipal(aPrincipal);
- }
-
/*
* LoadURI(...) will cancel all refresh timers... This causes the
* Timer and its refreshData instance to be released...
diff --git a/docshell/base/nsIRefreshURI.idl b/docshell/base/nsIRefreshURI.idl
index 5abd829da..04f18eee0 100644
--- a/docshell/base/nsIRefreshURI.idl
+++ b/docshell/base/nsIRefreshURI.idl
@@ -19,9 +19,8 @@ interface nsIRefreshURI : nsISupports {
*
* @param aUri The uri to refresh.
* @param aPrincipal The triggeringPrincipal for the refresh load
- * May be null, in which case a principal will be built based on the
- * referrer URI of the previous docshell load, or will use the system
- * principal when there is no referrer.
+ * May be null, in which case the principal of current document will be
+ * applied.
* @param aMillis The number of milliseconds to wait.
* @param aRepeat Flag to indicate if the uri is to be
* repeatedly refreshed every aMillis milliseconds.
@@ -37,9 +36,8 @@ interface nsIRefreshURI : nsISupports {
*
* @param aURI The URI to refresh.
* @param aPrincipal The triggeringPrincipal for the refresh load
- * May be null, in which case a principal will be built based on the
- * referrer URI of the previous docshell load, or will use the system
- * principal when there is no referrer.
+ * May be null, in which case the principal of current document will be
+ * applied.
* @param aMillis The number of milliseconds by which this refresh would
* be delayed if it were not being forced.
* @param aMetaRefresh Flag to indicate if this is a meta refresh.
@@ -70,9 +68,8 @@ interface nsIRefreshURI : nsISupports {
*
* @param aBaseURI base URI to resolve refresh uri with.
* @param aPrincipal The triggeringPrincipal for the refresh load
- * May be null, in which case a principal will be built based on the
- * referrer URI of the previous docshell load, or will use the system
- * principal when there is no referrer.
+ * May be null, in which case the principal of current document will be
+ * applied.
* @param aHeader The meta refresh header string.
*/
void setupRefreshURIFromHeader(in nsIURI aBaseURI,
diff --git a/docshell/test/chrome/test_bug453650.xul b/docshell/test/chrome/test_bug453650.xul
index 2837e56d8..04acefe6d 100644..100755
--- a/docshell/test/chrome/test_bug453650.xul
+++ b/docshell/test/chrome/test_bug453650.xul
@@ -61,7 +61,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=453650
}
info("times: " + start + ", " + end);
- ok(start < end, "reflow start time lower than end time");
+ ok(start <= end, "reflow start time lower than end time");
done();
},
@@ -73,7 +73,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=453650
}
info("times: " + start + ", " + end);
- ok(start < end, "reflow start time lower than end time");
+ ok(start <= end, "reflow start time lower than end time");
done();
},