|
Lines 229-244
static NS_DEFINE_CID(kAppShellCID, NS_AP
|
Link Here
|
---|
|
229 |
#endif |
229 |
#endif |
230 |
|
230 |
|
231 |
#include "nsContentErrors.h" |
231 |
#include "nsContentErrors.h" |
232 |
#include "nsIChannelPolicy.h" |
232 |
#include "nsIChannelPolicy.h" |
233 |
#include "nsIContentSecurityPolicy.h" |
233 |
#include "nsIContentSecurityPolicy.h" |
234 |
|
234 |
|
235 |
#include "nsXULAppAPI.h" |
235 |
#include "nsXULAppAPI.h" |
236 |
|
236 |
|
|
|
237 |
#include "nsDOMNavigationTiming.h" |
238 |
|
237 |
using namespace mozilla; |
239 |
using namespace mozilla; |
238 |
|
240 |
|
239 |
// Number of documents currently loading |
241 |
// Number of documents currently loading |
240 |
static PRInt32 gNumberOfDocumentsLoading = 0; |
242 |
static PRInt32 gNumberOfDocumentsLoading = 0; |
241 |
|
243 |
|
242 |
// Global count of existing docshells. |
244 |
// Global count of existing docshells. |
243 |
static PRInt32 gDocShellCount = 0; |
245 |
static PRInt32 gDocShellCount = 0; |
244 |
|
246 |
|
Lines 668-683
DispatchPings(nsIContent *content, nsIUR
|
Link Here
|
---|
|
668 |
return; |
670 |
return; |
669 |
|
671 |
|
670 |
info.numPings = 0; |
672 |
info.numPings = 0; |
671 |
info.referrer = referrer; |
673 |
info.referrer = referrer; |
672 |
|
674 |
|
673 |
ForEachPing(content, SendPing, &info); |
675 |
ForEachPing(content, SendPing, &info); |
674 |
} |
676 |
} |
675 |
|
677 |
|
|
|
678 |
static nsDOMPerformanceNavigationType |
679 |
ConvertLoadTypeToNavigationType(PRUint32 aLoadType) |
680 |
{ |
681 |
nsDOMPerformanceNavigationType result = nsIDOMPerformanceNavigation::TYPE_RESERVED; |
682 |
switch (aLoadType) { |
683 |
case LOAD_NORMAL: |
684 |
case LOAD_NORMAL_EXTERNAL: |
685 |
case LOAD_NORMAL_BYPASS_CACHE: |
686 |
case LOAD_NORMAL_BYPASS_PROXY: |
687 |
case LOAD_NORMAL_BYPASS_PROXY_AND_CACHE: |
688 |
case LOAD_LINK: |
689 |
result = nsIDOMPerformanceNavigation::TYPE_NAVIGATE; |
690 |
break; |
691 |
case LOAD_HISTORY: |
692 |
result = nsIDOMPerformanceNavigation::TYPE_BACK_FORWARD; |
693 |
break; |
694 |
case LOAD_RELOAD_NORMAL: |
695 |
case LOAD_RELOAD_CHARSET_CHANGE: |
696 |
case LOAD_RELOAD_BYPASS_CACHE: |
697 |
case LOAD_RELOAD_BYPASS_PROXY: |
698 |
case LOAD_RELOAD_BYPASS_PROXY_AND_CACHE: |
699 |
result = nsIDOMPerformanceNavigation::TYPE_RELOAD; |
700 |
break; |
701 |
case LOAD_NORMAL_REPLACE: |
702 |
case LOAD_STOP_CONTENT: |
703 |
case LOAD_STOP_CONTENT_AND_REPLACE: |
704 |
case LOAD_REFRESH: |
705 |
case LOAD_BYPASS_HISTORY: |
706 |
case LOAD_ERROR_PAGE: |
707 |
case LOAD_PUSHSTATE: |
708 |
result = nsIDOMPerformanceNavigation::TYPE_RESERVED; |
709 |
break; |
710 |
default: |
711 |
// NS_NOTREACHED("Unexpected load type value"); |
712 |
result = nsIDOMPerformanceNavigation::TYPE_RESERVED; |
713 |
break; |
714 |
} |
715 |
|
716 |
return result; |
717 |
} |
718 |
|
676 |
static nsISHEntry* GetRootSHEntry(nsISHEntry *entry); |
719 |
static nsISHEntry* GetRootSHEntry(nsISHEntry *entry); |
677 |
|
720 |
|
678 |
//***************************************************************************** |
721 |
//***************************************************************************** |
679 |
//*** nsDocShell: Object Management |
722 |
//*** nsDocShell: Object Management |
680 |
//***************************************************************************** |
723 |
//***************************************************************************** |
681 |
|
724 |
|
682 |
static PRUint64 gDocshellIDCounter = 0; |
725 |
static PRUint64 gDocshellIDCounter = 0; |
683 |
|
726 |
|
Lines 690-705
nsDocShell::nsDocShell():
|
Link Here
|
---|
|
690 |
mCharsetReloadState(eCharsetReloadInit), |
733 |
mCharsetReloadState(eCharsetReloadInit), |
691 |
mChildOffset(0), |
734 |
mChildOffset(0), |
692 |
mBusyFlags(BUSY_FLAGS_NONE), |
735 |
mBusyFlags(BUSY_FLAGS_NONE), |
693 |
mAppType(nsIDocShell::APP_TYPE_UNKNOWN), |
736 |
mAppType(nsIDocShell::APP_TYPE_UNKNOWN), |
694 |
mMarginWidth(-1), |
737 |
mMarginWidth(-1), |
695 |
mMarginHeight(-1), |
738 |
mMarginHeight(-1), |
696 |
mItemType(typeContent), |
739 |
mItemType(typeContent), |
697 |
mPreviousTransIndex(-1), |
740 |
mPreviousTransIndex(-1), |
|
|
741 |
mLoadType(0), |
698 |
mLoadedTransIndex(-1), |
742 |
mLoadedTransIndex(-1), |
699 |
mAllowSubframes(PR_TRUE), |
743 |
mAllowSubframes(PR_TRUE), |
700 |
mAllowPlugins(PR_TRUE), |
744 |
mAllowPlugins(PR_TRUE), |
701 |
mAllowJavascript(PR_TRUE), |
745 |
mAllowJavascript(PR_TRUE), |
702 |
mAllowMetaRedirects(PR_TRUE), |
746 |
mAllowMetaRedirects(PR_TRUE), |
703 |
mAllowImages(PR_TRUE), |
747 |
mAllowImages(PR_TRUE), |
704 |
mAllowDNSPrefetch(PR_TRUE), |
748 |
mAllowDNSPrefetch(PR_TRUE), |
705 |
mCreatingDocument(PR_FALSE), |
749 |
mCreatingDocument(PR_FALSE), |
|
1514 |
nsDocShell::FirePageHideNotification(PRBool aIsUnload) |
1558 |
nsDocShell::FirePageHideNotification(PRBool aIsUnload) |
1515 |
{ |
1559 |
{ |
1516 |
if (mContentViewer && !mFiredUnloadEvent) { |
1560 |
if (mContentViewer && !mFiredUnloadEvent) { |
1517 |
// Keep an explicit reference since calling PageHide could release |
1561 |
// Keep an explicit reference since calling PageHide could release |
1518 |
// mContentViewer |
1562 |
// mContentViewer |
1519 |
nsCOMPtr<nsIContentViewer> kungFuDeathGrip(mContentViewer); |
1563 |
nsCOMPtr<nsIContentViewer> kungFuDeathGrip(mContentViewer); |
1520 |
mFiredUnloadEvent = PR_TRUE; |
1564 |
mFiredUnloadEvent = PR_TRUE; |
1521 |
|
1565 |
|
|
|
1566 |
if (mTiming) { |
1567 |
mTiming->NotifyUnloadEventStart(); |
1568 |
} |
1569 |
|
1522 |
mContentViewer->PageHide(aIsUnload); |
1570 |
mContentViewer->PageHide(aIsUnload); |
1523 |
|
1571 |
|
|
|
1572 |
if (mTiming) { |
1573 |
mTiming->NotifyUnloadEventEnd(); |
1574 |
} |
1575 |
|
1524 |
nsAutoTArray<nsCOMPtr<nsIDocShell>, 8> kids; |
1576 |
nsAutoTArray<nsCOMPtr<nsIDocShell>, 8> kids; |
1525 |
PRInt32 i, n = mChildList.Count(); |
1577 |
PRInt32 i, n = mChildList.Count(); |
1526 |
kids.SetCapacity(n); |
1578 |
kids.SetCapacity(n); |
1527 |
for (i = 0; i < n; i++) { |
1579 |
for (i = 0; i < n; i++) { |
1528 |
kids.AppendElement(do_QueryInterface(ChildAt(i))); |
1580 |
kids.AppendElement(do_QueryInterface(ChildAt(i))); |
1529 |
} |
1581 |
} |
1530 |
|
1582 |
|
1531 |
n = kids.Length(); |
1583 |
n = kids.Length(); |
Lines 1537-1552
nsDocShell::FirePageHideNotification(PRB
|
Link Here
|
---|
|
1537 |
// Now make sure our editor, if any, is detached before we go |
1589 |
// Now make sure our editor, if any, is detached before we go |
1538 |
// any farther. |
1590 |
// any farther. |
1539 |
DetachEditorFromWindow(); |
1591 |
DetachEditorFromWindow(); |
1540 |
} |
1592 |
} |
1541 |
|
1593 |
|
1542 |
return NS_OK; |
1594 |
return NS_OK; |
1543 |
} |
1595 |
} |
1544 |
|
1596 |
|
|
|
1597 |
nsresult |
1598 |
nsDocShell::MaybeInitTiming() |
1599 |
{ |
1600 |
if (mTiming) { |
1601 |
return NS_OK; |
1602 |
} |
1603 |
|
1604 |
PRBool enabled; |
1605 |
nsresult rv = mPrefs->GetBoolPref("dom.enable_performance", &enabled); |
1606 |
if (NS_SUCCEEDED(rv) && enabled) { |
1607 |
mTiming = new nsDOMNavigationTiming(); |
1608 |
mTiming->NotifyNavigationStart(); |
1609 |
} |
1610 |
return NS_OK; |
1611 |
} |
1612 |
|
1613 |
|
1545 |
// |
1614 |
// |
1546 |
// Bug 13871: Prevent frameset spoofing |
1615 |
// Bug 13871: Prevent frameset spoofing |
1547 |
// |
1616 |
// |
1548 |
// This routine answers: 'Is origin's document from same domain as |
1617 |
// This routine answers: 'Is origin's document from same domain as |
1549 |
// target's document?' |
1618 |
// target's document?' |
1550 |
// |
1619 |
// |
1551 |
// file: uris are considered the same domain for the purpose of |
1620 |
// file: uris are considered the same domain for the purpose of |
1552 |
// frame navigation regardless of script accessibility (bug 420425) |
1621 |
// frame navigation regardless of script accessibility (bug 420425) |
Lines 5824-5848
nsDocShell::OnProgressChange(nsIWebProgr
|
Link Here
|
---|
|
5824 |
|
5893 |
|
5825 |
NS_IMETHODIMP |
5894 |
NS_IMETHODIMP |
5826 |
nsDocShell::OnStateChange(nsIWebProgress * aProgress, nsIRequest * aRequest, |
5895 |
nsDocShell::OnStateChange(nsIWebProgress * aProgress, nsIRequest * aRequest, |
5827 |
PRUint32 aStateFlags, nsresult aStatus) |
5896 |
PRUint32 aStateFlags, nsresult aStatus) |
5828 |
{ |
5897 |
{ |
5829 |
nsresult rv; |
5898 |
nsresult rv; |
5830 |
|
5899 |
|
5831 |
if ((~aStateFlags & (STATE_START | STATE_IS_NETWORK)) == 0) { |
5900 |
if ((~aStateFlags & (STATE_START | STATE_IS_NETWORK)) == 0) { |
|
|
5901 |
// Save timing statistics. |
5902 |
nsCOMPtr<nsIChannel> channel(do_QueryInterface(aRequest)); |
5903 |
nsCOMPtr<nsIURI> uri; |
5904 |
channel->GetURI(getter_AddRefs(uri)); |
5905 |
nsCAutoString aURI; |
5906 |
uri->GetAsciiSpec(aURI); |
5907 |
// If load type is not set, this is not a 'normal' load. |
5908 |
// No need to collect timing. |
5909 |
if (mLoadType == 0) { |
5910 |
mTiming = nsnull; |
5911 |
} |
5912 |
else { |
5913 |
rv = MaybeInitTiming(); |
5914 |
} |
5915 |
if (mTiming) { |
5916 |
mTiming->NotifyFetchStart(uri, ConvertLoadTypeToNavigationType(mLoadType)); |
5917 |
} |
5918 |
|
5832 |
nsCOMPtr<nsIWyciwygChannel> wcwgChannel(do_QueryInterface(aRequest)); |
5919 |
nsCOMPtr<nsIWyciwygChannel> wcwgChannel(do_QueryInterface(aRequest)); |
5833 |
nsCOMPtr<nsIWebProgress> webProgress = |
5920 |
nsCOMPtr<nsIWebProgress> webProgress = |
5834 |
do_QueryInterface(GetAsSupports(this)); |
5921 |
do_QueryInterface(GetAsSupports(this)); |
5835 |
|
5922 |
|
5836 |
// Was the wyciwyg document loaded on this docshell? |
5923 |
// Was the wyciwyg document loaded on this docshell? |
5837 |
if (wcwgChannel && !mLSHE && (mItemType == typeContent) && aProgress == webProgress.get()) { |
5924 |
if (wcwgChannel && !mLSHE && (mItemType == typeContent) && aProgress == webProgress.get()) { |
5838 |
nsCOMPtr<nsIURI> uri; |
|
|
5839 |
wcwgChannel->GetURI(getter_AddRefs(uri)); |
5840 |
|
5841 |
PRBool equalUri = PR_TRUE; |
5925 |
PRBool equalUri = PR_TRUE; |
5842 |
// Store the wyciwyg url in session history, only if it is |
5926 |
// Store the wyciwyg url in session history, only if it is |
5843 |
// being loaded fresh for the first time. We don't want |
5927 |
// being loaded fresh for the first time. We don't want |
5844 |
// multiple entries for successive loads |
5928 |
// multiple entries for successive loads |
5845 |
if (mCurrentURI && |
5929 |
if (mCurrentURI && |
5846 |
NS_SUCCEEDED(uri->Equals(mCurrentURI, &equalUri)) && |
5930 |
NS_SUCCEEDED(uri->Equals(mCurrentURI, &equalUri)) && |
5847 |
!equalUri) { |
5931 |
!equalUri) { |
5848 |
|
5932 |
|
Lines 5955-5970
nsDocShell::OnRedirectStateChange(nsICha
|
Link Here
|
---|
|
5955 |
return; // not a toplevel document |
6039 |
return; // not a toplevel document |
5956 |
|
6040 |
|
5957 |
nsCOMPtr<nsIURI> oldURI, newURI; |
6041 |
nsCOMPtr<nsIURI> oldURI, newURI; |
5958 |
aOldChannel->GetURI(getter_AddRefs(oldURI)); |
6042 |
aOldChannel->GetURI(getter_AddRefs(oldURI)); |
5959 |
aNewChannel->GetURI(getter_AddRefs(newURI)); |
6043 |
aNewChannel->GetURI(getter_AddRefs(newURI)); |
5960 |
if (!oldURI || !newURI) { |
6044 |
if (!oldURI || !newURI) { |
5961 |
return; |
6045 |
return; |
5962 |
} |
6046 |
} |
|
|
6047 |
// On session restore we get a redirect from page to itself. Don't count it. |
6048 |
PRBool equals = PR_FALSE; |
6049 |
if (mTiming && |
6050 |
!(mLoadType == LOAD_HISTORY && |
6051 |
NS_SUCCEEDED(newURI->Equals(oldURI, &equals)) && equals)) { |
6052 |
mTiming->NotifyRedirect(oldURI, newURI); |
6053 |
} |
5963 |
|
6054 |
|
5964 |
// Below a URI visit is saved (see AddURIVisit method doc). |
6055 |
// Below a URI visit is saved (see AddURIVisit method doc). |
5965 |
// The visit chain looks something like: |
6056 |
// The visit chain looks something like: |
5966 |
// ... |
6057 |
// ... |
5967 |
// Site N - 1 |
6058 |
// Site N - 1 |
5968 |
// => Site N |
6059 |
// => Site N |
5969 |
// (redirect to =>) Site N + 1 (we are here!) |
6060 |
// (redirect to =>) Site N + 1 (we are here!) |
5970 |
|
6061 |
|
Lines 6038-6054
nsDocShell::EndPageLoad(nsIWebProgress *
|
Link Here
|
---|
|
6038 |
nsIChannel * aChannel, nsresult aStatus) |
6129 |
nsIChannel * aChannel, nsresult aStatus) |
6039 |
{ |
6130 |
{ |
6040 |
if(!aChannel) |
6131 |
if(!aChannel) |
6041 |
return NS_ERROR_NULL_POINTER; |
6132 |
return NS_ERROR_NULL_POINTER; |
6042 |
|
6133 |
|
6043 |
nsCOMPtr<nsIURI> url; |
6134 |
nsCOMPtr<nsIURI> url; |
6044 |
nsresult rv = aChannel->GetURI(getter_AddRefs(url)); |
6135 |
nsresult rv = aChannel->GetURI(getter_AddRefs(url)); |
6045 |
if (NS_FAILED(rv)) return rv; |
6136 |
if (NS_FAILED(rv)) return rv; |
6046 |
|
6137 |
|
|
|
6138 |
// Timing is picked up by the window, we don't need it anymore |
6139 |
mTiming = nsnull; |
6140 |
|
6047 |
// clean up reload state for meta charset |
6141 |
// clean up reload state for meta charset |
6048 |
if (eCharsetReloadRequested == mCharsetReloadState) |
6142 |
if (eCharsetReloadRequested == mCharsetReloadState) |
6049 |
mCharsetReloadState = eCharsetReloadStopOrigional; |
6143 |
mCharsetReloadState = eCharsetReloadStopOrigional; |
6050 |
else |
6144 |
else |
6051 |
mCharsetReloadState = eCharsetReloadInit; |
6145 |
mCharsetReloadState = eCharsetReloadInit; |
6052 |
|
6146 |
|
6053 |
// Save a pointer to the currently-loading history entry. |
6147 |
// Save a pointer to the currently-loading history entry. |
6054 |
// nsDocShell::EndPageLoad will clear mLSHE, but we may need this history |
6148 |
// nsDocShell::EndPageLoad will clear mLSHE, but we may need this history |
Lines 6469-6495
nsDocShell::CreateAboutBlankContentViewe
|
Link Here
|
---|
|
6469 |
nsCOMPtr<nsIDocShell> kungFuDeathGrip(this); |
6563 |
nsCOMPtr<nsIDocShell> kungFuDeathGrip(this); |
6470 |
|
6564 |
|
6471 |
if (mContentViewer) { |
6565 |
if (mContentViewer) { |
6472 |
// We've got a content viewer already. Make sure the user |
6566 |
// We've got a content viewer already. Make sure the user |
6473 |
// permits us to discard the current document and replace it |
6567 |
// permits us to discard the current document and replace it |
6474 |
// with about:blank. And also ensure we fire the unload events |
6568 |
// with about:blank. And also ensure we fire the unload events |
6475 |
// in the current document. |
6569 |
// in the current document. |
6476 |
|
6570 |
|
|
|
6571 |
// Make sure timing is created. Unload gets fired first for |
6572 |
// document loaded from the session history. |
6573 |
rv = MaybeInitTiming(); |
6574 |
if (mTiming) { |
6575 |
mTiming->NotifyBeforeUnload(); |
6576 |
} |
6577 |
|
6477 |
PRBool okToUnload; |
6578 |
PRBool okToUnload; |
6478 |
rv = mContentViewer->PermitUnload(PR_FALSE, &okToUnload); |
6579 |
rv = mContentViewer->PermitUnload(PR_FALSE, &okToUnload); |
6479 |
|
6580 |
|
6480 |
if (NS_SUCCEEDED(rv) && !okToUnload) { |
6581 |
if (NS_SUCCEEDED(rv) && !okToUnload) { |
6481 |
// The user chose not to unload the page, interrupt the load. |
6582 |
// The user chose not to unload the page, interrupt the load. |
6482 |
return NS_ERROR_FAILURE; |
6583 |
return NS_ERROR_FAILURE; |
6483 |
} |
6584 |
} |
6484 |
|
6585 |
|
6485 |
mSavingOldViewer = aTryToSaveOldPresentation && |
6586 |
mSavingOldViewer = aTryToSaveOldPresentation && |
6486 |
CanSavePresentation(LOAD_NORMAL, nsnull, nsnull); |
6587 |
CanSavePresentation(LOAD_NORMAL, nsnull, nsnull); |
6487 |
|
6588 |
|
|
|
6589 |
if (mTiming) { |
6590 |
mTiming->NotifyUnloadAccepted(mCurrentURI); |
6591 |
} |
6592 |
|
6488 |
// Make sure to blow away our mLoadingURI just in case. No loads |
6593 |
// Make sure to blow away our mLoadingURI just in case. No loads |
6489 |
// from inside this pagehide. |
6594 |
// from inside this pagehide. |
6490 |
mLoadingURI = nsnull; |
6595 |
mLoadingURI = nsnull; |
6491 |
|
6596 |
|
6492 |
// Stop any in-progress loading, so that we don't accidentally trigger any |
6597 |
// Stop any in-progress loading, so that we don't accidentally trigger any |
6493 |
// PageShow notifications from Embed() interrupting our loading below. |
6598 |
// PageShow notifications from Embed() interrupting our loading below. |
6494 |
Stop(); |
6599 |
Stop(); |
6495 |
|
6600 |
|
Lines 7699-7714
nsDocShell::SetupNewViewer(nsIContentVie
|
Link Here
|
---|
|
7699 |
|
7804 |
|
7700 |
mContentViewer = aNewViewer; |
7805 |
mContentViewer = aNewViewer; |
7701 |
|
7806 |
|
7702 |
nsCOMPtr<nsIWidget> widget; |
7807 |
nsCOMPtr<nsIWidget> widget; |
7703 |
NS_ENSURE_SUCCESS(GetMainWidget(getter_AddRefs(widget)), NS_ERROR_FAILURE); |
7808 |
NS_ENSURE_SUCCESS(GetMainWidget(getter_AddRefs(widget)), NS_ERROR_FAILURE); |
7704 |
|
7809 |
|
7705 |
nsIntRect bounds(x, y, cx, cy); |
7810 |
nsIntRect bounds(x, y, cx, cy); |
7706 |
|
7811 |
|
|
|
7812 |
nsCOMPtr<nsIDocumentViewer> docviewer = |
7813 |
do_QueryInterface(mContentViewer); |
7814 |
if (docviewer) { |
7815 |
docviewer->SetNavigationTiming(mTiming); |
7816 |
} |
7817 |
|
7707 |
if (NS_FAILED(mContentViewer->Init(widget, bounds))) { |
7818 |
if (NS_FAILED(mContentViewer->Init(widget, bounds))) { |
7708 |
mContentViewer = nsnull; |
7819 |
mContentViewer = nsnull; |
7709 |
NS_ERROR("ContentViewer Initialization failed"); |
7820 |
NS_ERROR("ContentViewer Initialization failed"); |
7710 |
return NS_ERROR_FAILURE; |
7821 |
return NS_ERROR_FAILURE; |
7711 |
} |
7822 |
} |
7712 |
|
7823 |
|
7713 |
// If we have old state to copy, set the old state onto the new content |
7824 |
// If we have old state to copy, set the old state onto the new content |
7714 |
// viewer |
7825 |
// viewer |
Lines 7731-7749
nsDocShell::SetupNewViewer(nsIContentVie
|
Link Here
|
---|
|
7731 |
NS_ENSURE_SUCCESS(newMUDV->SetFullZoom(pageZoom), |
7842 |
NS_ENSURE_SUCCESS(newMUDV->SetFullZoom(pageZoom), |
7732 |
NS_ERROR_FAILURE); |
7843 |
NS_ERROR_FAILURE); |
7733 |
NS_ENSURE_SUCCESS(newMUDV->SetAuthorStyleDisabled(styleDisabled), |
7844 |
NS_ENSURE_SUCCESS(newMUDV->SetAuthorStyleDisabled(styleDisabled), |
7734 |
NS_ERROR_FAILURE); |
7845 |
NS_ERROR_FAILURE); |
7735 |
} |
7846 |
} |
7736 |
|
7847 |
|
7737 |
// Stuff the bgcolor from the old pres shell into the new |
7848 |
// Stuff the bgcolor from the old pres shell into the new |
7738 |
// pres shell. This improves page load continuity. |
7849 |
// pres shell. This improves page load continuity. |
7739 |
nsCOMPtr<nsIDocumentViewer> docviewer = |
|
|
7740 |
do_QueryInterface(mContentViewer); |
7741 |
|
7742 |
if (docviewer) { |
7850 |
if (docviewer) { |
7743 |
nsCOMPtr<nsIPresShell> shell; |
7851 |
nsCOMPtr<nsIPresShell> shell; |
7744 |
docviewer->GetPresShell(getter_AddRefs(shell)); |
7852 |
docviewer->GetPresShell(getter_AddRefs(shell)); |
7745 |
|
7853 |
|
7746 |
if (shell) { |
7854 |
if (shell) { |
7747 |
shell->SetCanvasBackground(bgcolor); |
7855 |
shell->SetCanvasBackground(bgcolor); |
7748 |
} |
7856 |
} |
7749 |
} |
7857 |
} |
Lines 8514-8542
nsDocShell::InternalLoad(nsIURI * aURI,
|
Link Here
|
---|
|
8514 |
} |
8622 |
} |
8515 |
|
8623 |
|
8516 |
// mContentViewer->PermitUnload can destroy |this| docShell, which |
8624 |
// mContentViewer->PermitUnload can destroy |this| docShell, which |
8517 |
// causes the next call of CanSavePresentation to crash. |
8625 |
// causes the next call of CanSavePresentation to crash. |
8518 |
// Hold onto |this| until we return, to prevent a crash from happening. |
8626 |
// Hold onto |this| until we return, to prevent a crash from happening. |
8519 |
// (bug#331040) |
8627 |
// (bug#331040) |
8520 |
nsCOMPtr<nsIDocShell> kungFuDeathGrip(this); |
8628 |
nsCOMPtr<nsIDocShell> kungFuDeathGrip(this); |
8521 |
|
8629 |
|
|
|
8630 |
rv = MaybeInitTiming(); |
8631 |
if (mTiming) { |
8632 |
mTiming->NotifyBeforeUnload(); |
8633 |
} |
8522 |
// Check if the page doesn't want to be unloaded. The javascript: |
8634 |
// Check if the page doesn't want to be unloaded. The javascript: |
8523 |
// protocol handler deals with this for javascript: URLs. |
8635 |
// protocol handler deals with this for javascript: URLs. |
8524 |
if (!bIsJavascript && mContentViewer) { |
8636 |
if (!bIsJavascript && mContentViewer) { |
8525 |
PRBool okToUnload; |
8637 |
PRBool okToUnload; |
8526 |
rv = mContentViewer->PermitUnload(PR_FALSE, &okToUnload); |
8638 |
rv = mContentViewer->PermitUnload(PR_FALSE, &okToUnload); |
8527 |
|
8639 |
|
8528 |
if (NS_SUCCEEDED(rv) && !okToUnload) { |
8640 |
if (NS_SUCCEEDED(rv) && !okToUnload) { |
8529 |
// The user chose not to unload the page, interrupt the |
8641 |
// The user chose not to unload the page, interrupt the |
8530 |
// load. |
8642 |
// load. |
8531 |
return NS_OK; |
8643 |
return NS_OK; |
8532 |
} |
8644 |
} |
8533 |
} |
8645 |
} |
8534 |
|
8646 |
|
|
|
8647 |
if (mTiming) { |
8648 |
mTiming->NotifyUnloadAccepted(mCurrentURI); |
8649 |
} |
8650 |
|
8535 |
// Check for saving the presentation here, before calling Stop(). |
8651 |
// Check for saving the presentation here, before calling Stop(). |
8536 |
// This is necessary so that we can catch any pending requests. |
8652 |
// This is necessary so that we can catch any pending requests. |
8537 |
// Since the new request has not been created yet, we pass null for the |
8653 |
// Since the new request has not been created yet, we pass null for the |
8538 |
// new request parameter. |
8654 |
// new request parameter. |
8539 |
// Also pass nsnull for the document, since it doesn't affect the return |
8655 |
// Also pass nsnull for the document, since it doesn't affect the return |
8540 |
// value for our purposes here. |
8656 |
// value for our purposes here. |
8541 |
PRBool savePresentation = CanSavePresentation(aLoadType, nsnull, nsnull); |
8657 |
PRBool savePresentation = CanSavePresentation(aLoadType, nsnull, nsnull); |
8542 |
|
8658 |
|