|
Lines 226-241
static NS_DEFINE_CID(kAppShellCID, NS_AP
|
Link Here
|
---|
|
226 |
#endif |
226 |
#endif |
227 |
|
227 |
|
228 |
#include "nsContentErrors.h" |
228 |
#include "nsContentErrors.h" |
229 |
#include "nsIChannelPolicy.h" |
229 |
#include "nsIChannelPolicy.h" |
230 |
#include "nsIContentSecurityPolicy.h" |
230 |
#include "nsIContentSecurityPolicy.h" |
231 |
|
231 |
|
232 |
#include "nsXULAppAPI.h" |
232 |
#include "nsXULAppAPI.h" |
233 |
|
233 |
|
|
|
234 |
#include "nsDOMNavigationTiming.h" |
235 |
|
234 |
using namespace mozilla; |
236 |
using namespace mozilla; |
235 |
|
237 |
|
236 |
// Number of documents currently loading |
238 |
// Number of documents currently loading |
237 |
static PRInt32 gNumberOfDocumentsLoading = 0; |
239 |
static PRInt32 gNumberOfDocumentsLoading = 0; |
238 |
|
240 |
|
239 |
// Global count of existing docshells. |
241 |
// Global count of existing docshells. |
240 |
static PRInt32 gDocShellCount = 0; |
242 |
static PRInt32 gDocShellCount = 0; |
241 |
|
243 |
|
Lines 667-682
DispatchPings(nsIContent *content, nsIUR
|
Link Here
|
---|
|
667 |
return; |
669 |
return; |
668 |
|
670 |
|
669 |
info.numPings = 0; |
671 |
info.numPings = 0; |
670 |
info.referrer = referrer; |
672 |
info.referrer = referrer; |
671 |
|
673 |
|
672 |
ForEachPing(content, SendPing, &info); |
674 |
ForEachPing(content, SendPing, &info); |
673 |
} |
675 |
} |
674 |
|
676 |
|
|
|
677 |
static nsDOMPerformanceNavigationType |
678 |
ConvertLoadTypeToNavigationType(PRUint32 aLoadType) |
679 |
{ |
680 |
nsDOMPerformanceNavigationType result = nsIDOMPerformanceNavigation::TYPE_RESERVED; |
681 |
switch (aLoadType) { |
682 |
case LOAD_NORMAL: |
683 |
case LOAD_NORMAL_EXTERNAL: |
684 |
case LOAD_NORMAL_BYPASS_CACHE: |
685 |
case LOAD_NORMAL_BYPASS_PROXY: |
686 |
case LOAD_NORMAL_BYPASS_PROXY_AND_CACHE: |
687 |
case LOAD_LINK: |
688 |
result = nsIDOMPerformanceNavigation::TYPE_NAVIGATE; |
689 |
break; |
690 |
case LOAD_HISTORY: |
691 |
result = nsIDOMPerformanceNavigation::TYPE_BACK_FORWARD; |
692 |
break; |
693 |
case LOAD_RELOAD_NORMAL: |
694 |
case LOAD_RELOAD_CHARSET_CHANGE: |
695 |
case LOAD_RELOAD_BYPASS_CACHE: |
696 |
case LOAD_RELOAD_BYPASS_PROXY: |
697 |
case LOAD_RELOAD_BYPASS_PROXY_AND_CACHE: |
698 |
result = nsIDOMPerformanceNavigation::TYPE_RELOAD; |
699 |
break; |
700 |
case LOAD_NORMAL_REPLACE: |
701 |
case LOAD_STOP_CONTENT: |
702 |
case LOAD_STOP_CONTENT_AND_REPLACE: |
703 |
case LOAD_REFRESH: |
704 |
case LOAD_BYPASS_HISTORY: |
705 |
case LOAD_ERROR_PAGE: |
706 |
case LOAD_PUSHSTATE: |
707 |
result = nsIDOMPerformanceNavigation::TYPE_RESERVED; |
708 |
break; |
709 |
default: |
710 |
NS_NOTREACHED("Unexpected load type value"); |
711 |
} |
712 |
|
713 |
return result; |
714 |
} |
715 |
|
675 |
static nsISHEntry* GetRootSHEntry(nsISHEntry *entry); |
716 |
static nsISHEntry* GetRootSHEntry(nsISHEntry *entry); |
676 |
|
717 |
|
677 |
//***************************************************************************** |
718 |
//***************************************************************************** |
678 |
//*** nsDocShell: Object Management |
719 |
//*** nsDocShell: Object Management |
679 |
//***************************************************************************** |
720 |
//***************************************************************************** |
680 |
|
721 |
|
681 |
static PRUint64 gDocshellIDCounter = 0; |
722 |
static PRUint64 gDocshellIDCounter = 0; |
682 |
|
723 |
|
|
1508 |
nsDocShell::FirePageHideNotification(PRBool aIsUnload) |
1549 |
nsDocShell::FirePageHideNotification(PRBool aIsUnload) |
1509 |
{ |
1550 |
{ |
1510 |
if (mContentViewer && !mFiredUnloadEvent) { |
1551 |
if (mContentViewer && !mFiredUnloadEvent) { |
1511 |
// Keep an explicit reference since calling PageHide could release |
1552 |
// Keep an explicit reference since calling PageHide could release |
1512 |
// mContentViewer |
1553 |
// mContentViewer |
1513 |
nsCOMPtr<nsIContentViewer> kungFuDeathGrip(mContentViewer); |
1554 |
nsCOMPtr<nsIContentViewer> kungFuDeathGrip(mContentViewer); |
1514 |
mFiredUnloadEvent = PR_TRUE; |
1555 |
mFiredUnloadEvent = PR_TRUE; |
1515 |
|
1556 |
|
|
|
1557 |
if (mTiming) { |
1558 |
mTiming->NotifyUnloadEventStart(); |
1559 |
} |
1560 |
|
1516 |
mContentViewer->PageHide(aIsUnload); |
1561 |
mContentViewer->PageHide(aIsUnload); |
1517 |
|
1562 |
|
|
|
1563 |
if (mTiming) { |
1564 |
mTiming->NotifyUnloadEventEnd(); |
1565 |
} |
1566 |
|
1518 |
nsAutoTArray<nsCOMPtr<nsIDocShell>, 8> kids; |
1567 |
nsAutoTArray<nsCOMPtr<nsIDocShell>, 8> kids; |
1519 |
PRInt32 i, n = mChildList.Count(); |
1568 |
PRInt32 i, n = mChildList.Count(); |
1520 |
kids.SetCapacity(n); |
1569 |
kids.SetCapacity(n); |
1521 |
for (i = 0; i < n; i++) { |
1570 |
for (i = 0; i < n; i++) { |
1522 |
kids.AppendElement(do_QueryInterface(ChildAt(i))); |
1571 |
kids.AppendElement(do_QueryInterface(ChildAt(i))); |
1523 |
} |
1572 |
} |
1524 |
|
1573 |
|
1525 |
n = kids.Length(); |
1574 |
n = kids.Length(); |
Lines 1531-1546
nsDocShell::FirePageHideNotification(PRB
|
Link Here
|
---|
|
1531 |
// Now make sure our editor, if any, is detached before we go |
1580 |
// Now make sure our editor, if any, is detached before we go |
1532 |
// any farther. |
1581 |
// any farther. |
1533 |
DetachEditorFromWindow(); |
1582 |
DetachEditorFromWindow(); |
1534 |
} |
1583 |
} |
1535 |
|
1584 |
|
1536 |
return NS_OK; |
1585 |
return NS_OK; |
1537 |
} |
1586 |
} |
1538 |
|
1587 |
|
|
|
1588 |
nsresult |
1589 |
nsDocShell::InitTiming() |
1590 |
{ |
1591 |
if (mTiming) { |
1592 |
return NS_OK; |
1593 |
} |
1594 |
|
1595 |
PRBool enabled; |
1596 |
nsresult rv = mPrefs->GetBoolPref("dom.enable_performance", &enabled); |
1597 |
if (NS_SUCCEEDED(rv) && enabled) { |
1598 |
mTiming = new nsDOMNavigationTiming(); |
1599 |
NS_ENSURE_TRUE(mTiming, NS_ERROR_OUT_OF_MEMORY); |
1600 |
mTiming->NotifyNavigationStart(); |
1601 |
} |
1602 |
return NS_OK; |
1603 |
} |
1604 |
|
1605 |
|
1539 |
// |
1606 |
// |
1540 |
// Bug 13871: Prevent frameset spoofing |
1607 |
// Bug 13871: Prevent frameset spoofing |
1541 |
// |
1608 |
// |
1542 |
// This routine answers: 'Is origin's document from same domain as |
1609 |
// This routine answers: 'Is origin's document from same domain as |
1543 |
// target's document?' |
1610 |
// target's document?' |
1544 |
// |
1611 |
// |
1545 |
// file: uris are considered the same domain for the purpose of |
1612 |
// file: uris are considered the same domain for the purpose of |
1546 |
// frame navigation regardless of script accessibility (bug 420425) |
1613 |
// frame navigation regardless of script accessibility (bug 420425) |
Lines 5812-5836
nsDocShell::OnProgressChange(nsIWebProgr
|
Link Here
|
---|
|
5812 |
|
5879 |
|
5813 |
NS_IMETHODIMP |
5880 |
NS_IMETHODIMP |
5814 |
nsDocShell::OnStateChange(nsIWebProgress * aProgress, nsIRequest * aRequest, |
5881 |
nsDocShell::OnStateChange(nsIWebProgress * aProgress, nsIRequest * aRequest, |
5815 |
PRUint32 aStateFlags, nsresult aStatus) |
5882 |
PRUint32 aStateFlags, nsresult aStatus) |
5816 |
{ |
5883 |
{ |
5817 |
nsresult rv; |
5884 |
nsresult rv; |
5818 |
|
5885 |
|
5819 |
if ((~aStateFlags & (STATE_START | STATE_IS_NETWORK)) == 0) { |
5886 |
if ((~aStateFlags & (STATE_START | STATE_IS_NETWORK)) == 0) { |
|
|
5887 |
// Save timing statistics. |
5888 |
nsCOMPtr<nsIChannel> channel(do_QueryInterface(aRequest)); |
5889 |
// Make sure timing is created |
5890 |
rv = InitTiming(); |
5891 |
NS_ENSURE_SUCCESS(rv, rv); |
5892 |
nsCOMPtr<nsIURI> uri; |
5893 |
channel->GetURI(getter_AddRefs(uri)); |
5894 |
if (mTiming) { |
5895 |
mTiming->NotifyFetchStart(uri, ConvertLoadTypeToNavigationType(mLoadType)); |
5896 |
} |
5897 |
|
5820 |
nsCOMPtr<nsIWyciwygChannel> wcwgChannel(do_QueryInterface(aRequest)); |
5898 |
nsCOMPtr<nsIWyciwygChannel> wcwgChannel(do_QueryInterface(aRequest)); |
5821 |
nsCOMPtr<nsIWebProgress> webProgress = |
5899 |
nsCOMPtr<nsIWebProgress> webProgress = |
5822 |
do_QueryInterface(GetAsSupports(this)); |
5900 |
do_QueryInterface(GetAsSupports(this)); |
5823 |
|
5901 |
|
5824 |
// Was the wyciwyg document loaded on this docshell? |
5902 |
// Was the wyciwyg document loaded on this docshell? |
5825 |
if (wcwgChannel && !mLSHE && (mItemType == typeContent) && aProgress == webProgress.get()) { |
5903 |
if (wcwgChannel && !mLSHE && (mItemType == typeContent) && aProgress == webProgress.get()) { |
5826 |
nsCOMPtr<nsIURI> uri; |
|
|
5827 |
wcwgChannel->GetURI(getter_AddRefs(uri)); |
5828 |
|
5829 |
PRBool equalUri = PR_TRUE; |
5904 |
PRBool equalUri = PR_TRUE; |
5830 |
// Store the wyciwyg url in session history, only if it is |
5905 |
// Store the wyciwyg url in session history, only if it is |
5831 |
// being loaded fresh for the first time. We don't want |
5906 |
// being loaded fresh for the first time. We don't want |
5832 |
// multiple entries for successive loads |
5907 |
// multiple entries for successive loads |
5833 |
if (mCurrentURI && |
5908 |
if (mCurrentURI && |
5834 |
NS_SUCCEEDED(uri->Equals(mCurrentURI, &equalUri)) && |
5909 |
NS_SUCCEEDED(uri->Equals(mCurrentURI, &equalUri)) && |
5835 |
!equalUri) { |
5910 |
!equalUri) { |
5836 |
|
5911 |
|
Lines 5940-5958
nsDocShell::OnRedirectStateChange(nsICha
|
Link Here
|
---|
|
5940 |
NS_ASSERTION(aStateFlags & STATE_REDIRECTING, |
6015 |
NS_ASSERTION(aStateFlags & STATE_REDIRECTING, |
5941 |
"Calling OnRedirectStateChange when there is no redirect"); |
6016 |
"Calling OnRedirectStateChange when there is no redirect"); |
5942 |
if (!(aStateFlags & STATE_IS_DOCUMENT)) |
6017 |
if (!(aStateFlags & STATE_IS_DOCUMENT)) |
5943 |
return; // not a toplevel document |
6018 |
return; // not a toplevel document |
5944 |
|
6019 |
|
5945 |
nsCOMPtr<nsIURI> oldURI, newURI; |
6020 |
nsCOMPtr<nsIURI> oldURI, newURI; |
5946 |
aOldChannel->GetURI(getter_AddRefs(oldURI)); |
6021 |
aOldChannel->GetURI(getter_AddRefs(oldURI)); |
5947 |
aNewChannel->GetURI(getter_AddRefs(newURI)); |
6022 |
aNewChannel->GetURI(getter_AddRefs(newURI)); |
|
|
6023 |
|
5948 |
if (!oldURI || !newURI) { |
6024 |
if (!oldURI || !newURI) { |
5949 |
return; |
6025 |
return; |
5950 |
} |
6026 |
} |
|
|
6027 |
// On session restore we get a redirect from page to itself. Don't count it. |
6028 |
PRBool equals = PR_FALSE; |
6029 |
if (mTiming && |
6030 |
!(mLoadType == LOAD_HISTORY && |
6031 |
NS_SUCCEEDED(newURI->Equals(oldURI, &equals)) && equals)) { |
6032 |
mTiming->NotifyRedirect(oldURI, newURI); |
6033 |
} |
5951 |
|
6034 |
|
5952 |
// Below a URI visit is saved (see AddURIVisit method doc). |
6035 |
// Below a URI visit is saved (see AddURIVisit method doc). |
5953 |
// The visit chain looks something like: |
6036 |
// The visit chain looks something like: |
5954 |
// ... |
6037 |
// ... |
5955 |
// Site N - 1 |
6038 |
// Site N - 1 |
5956 |
// => Site N |
6039 |
// => Site N |
5957 |
// (redirect to =>) Site N + 1 (we are here!) |
6040 |
// (redirect to =>) Site N + 1 (we are here!) |
5958 |
|
6041 |
|
Lines 6026-6042
nsDocShell::EndPageLoad(nsIWebProgress *
|
Link Here
|
---|
|
6026 |
nsIChannel * aChannel, nsresult aStatus) |
6109 |
nsIChannel * aChannel, nsresult aStatus) |
6027 |
{ |
6110 |
{ |
6028 |
if(!aChannel) |
6111 |
if(!aChannel) |
6029 |
return NS_ERROR_NULL_POINTER; |
6112 |
return NS_ERROR_NULL_POINTER; |
6030 |
|
6113 |
|
6031 |
nsCOMPtr<nsIURI> url; |
6114 |
nsCOMPtr<nsIURI> url; |
6032 |
nsresult rv = aChannel->GetURI(getter_AddRefs(url)); |
6115 |
nsresult rv = aChannel->GetURI(getter_AddRefs(url)); |
6033 |
if (NS_FAILED(rv)) return rv; |
6116 |
if (NS_FAILED(rv)) return rv; |
6034 |
|
6117 |
|
|
|
6118 |
// Timing is picked up by the window, we don't need it anymore |
6119 |
mTiming = nsnull; |
6120 |
|
6035 |
// clean up reload state for meta charset |
6121 |
// clean up reload state for meta charset |
6036 |
if (eCharsetReloadRequested == mCharsetReloadState) |
6122 |
if (eCharsetReloadRequested == mCharsetReloadState) |
6037 |
mCharsetReloadState = eCharsetReloadStopOrigional; |
6123 |
mCharsetReloadState = eCharsetReloadStopOrigional; |
6038 |
else |
6124 |
else |
6039 |
mCharsetReloadState = eCharsetReloadInit; |
6125 |
mCharsetReloadState = eCharsetReloadInit; |
6040 |
|
6126 |
|
6041 |
// Save a pointer to the currently-loading history entry. |
6127 |
// Save a pointer to the currently-loading history entry. |
6042 |
// nsDocShell::EndPageLoad will clear mLSHE, but we may need this history |
6128 |
// nsDocShell::EndPageLoad will clear mLSHE, but we may need this history |
Lines 6455-6481
nsDocShell::CreateAboutBlankContentViewe
|
Link Here
|
---|
|
6455 |
nsCOMPtr<nsIDocShell> kungFuDeathGrip(this); |
6541 |
nsCOMPtr<nsIDocShell> kungFuDeathGrip(this); |
6456 |
|
6542 |
|
6457 |
if (mContentViewer) { |
6543 |
if (mContentViewer) { |
6458 |
// We've got a content viewer already. Make sure the user |
6544 |
// We've got a content viewer already. Make sure the user |
6459 |
// permits us to discard the current document and replace it |
6545 |
// permits us to discard the current document and replace it |
6460 |
// with about:blank. And also ensure we fire the unload events |
6546 |
// with about:blank. And also ensure we fire the unload events |
6461 |
// in the current document. |
6547 |
// in the current document. |
6462 |
|
6548 |
|
|
|
6549 |
// Make sure timing is created. Unload gets fired first for |
6550 |
// document loaded from the session history. |
6551 |
rv = InitTiming(); |
6552 |
if (mTiming) { |
6553 |
mTiming->NotifyBeforeUnload(); |
6554 |
} |
6555 |
|
6463 |
PRBool okToUnload; |
6556 |
PRBool okToUnload; |
6464 |
rv = mContentViewer->PermitUnload(PR_FALSE, &okToUnload); |
6557 |
rv = mContentViewer->PermitUnload(PR_FALSE, &okToUnload); |
6465 |
|
6558 |
|
6466 |
if (NS_SUCCEEDED(rv) && !okToUnload) { |
6559 |
if (NS_SUCCEEDED(rv) && !okToUnload) { |
6467 |
// The user chose not to unload the page, interrupt the load. |
6560 |
// The user chose not to unload the page, interrupt the load. |
6468 |
return NS_ERROR_FAILURE; |
6561 |
return NS_ERROR_FAILURE; |
6469 |
} |
6562 |
} |
6470 |
|
6563 |
|
6471 |
mSavingOldViewer = aTryToSaveOldPresentation && |
6564 |
mSavingOldViewer = aTryToSaveOldPresentation && |
6472 |
CanSavePresentation(LOAD_NORMAL, nsnull, nsnull); |
6565 |
CanSavePresentation(LOAD_NORMAL, nsnull, nsnull); |
6473 |
|
6566 |
|
|
|
6567 |
if (mTiming) { |
6568 |
mTiming->NotifyUnloadAccepted(mCurrentURI); |
6569 |
} |
6474 |
// Make sure to blow away our mLoadingURI just in case. No loads |
6570 |
// Make sure to blow away our mLoadingURI just in case. No loads |
6475 |
// from inside this pagehide. |
6571 |
// from inside this pagehide. |
6476 |
mLoadingURI = nsnull; |
6572 |
mLoadingURI = nsnull; |
6477 |
|
6573 |
|
6478 |
// Notify the current document that it is about to be unloaded!! |
6574 |
// Notify the current document that it is about to be unloaded!! |
6479 |
// |
6575 |
// |
6480 |
// It is important to fire the unload() notification *before* any state |
6576 |
// It is important to fire the unload() notification *before* any state |
6481 |
// is changed within the DocShell - otherwise, javascript will get the |
6577 |
// is changed within the DocShell - otherwise, javascript will get the |
Lines 7688-7703
nsDocShell::SetupNewViewer(nsIContentVie
|
Link Here
|
---|
|
7688 |
|
7784 |
|
7689 |
mContentViewer = aNewViewer; |
7785 |
mContentViewer = aNewViewer; |
7690 |
|
7786 |
|
7691 |
nsCOMPtr<nsIWidget> widget; |
7787 |
nsCOMPtr<nsIWidget> widget; |
7692 |
NS_ENSURE_SUCCESS(GetMainWidget(getter_AddRefs(widget)), NS_ERROR_FAILURE); |
7788 |
NS_ENSURE_SUCCESS(GetMainWidget(getter_AddRefs(widget)), NS_ERROR_FAILURE); |
7693 |
|
7789 |
|
7694 |
nsIntRect bounds(x, y, cx, cy); |
7790 |
nsIntRect bounds(x, y, cx, cy); |
7695 |
|
7791 |
|
|
|
7792 |
nsCOMPtr<nsIDocumentViewer> docviewer = |
7793 |
do_QueryInterface(mContentViewer); |
7794 |
if (docviewer) { |
7795 |
docviewer->SetNavigationTiming(mTiming); |
7796 |
} |
7797 |
|
7696 |
if (NS_FAILED(mContentViewer->Init(widget, bounds))) { |
7798 |
if (NS_FAILED(mContentViewer->Init(widget, bounds))) { |
7697 |
mContentViewer = nsnull; |
7799 |
mContentViewer = nsnull; |
7698 |
NS_ERROR("ContentViewer Initialization failed"); |
7800 |
NS_ERROR("ContentViewer Initialization failed"); |
7699 |
return NS_ERROR_FAILURE; |
7801 |
return NS_ERROR_FAILURE; |
7700 |
} |
7802 |
} |
7701 |
|
7803 |
|
7702 |
// If we have old state to copy, set the old state onto the new content |
7804 |
// If we have old state to copy, set the old state onto the new content |
7703 |
// viewer |
7805 |
// viewer |
Lines 7720-7738
nsDocShell::SetupNewViewer(nsIContentVie
|
Link Here
|
---|
|
7720 |
NS_ENSURE_SUCCESS(newMUDV->SetFullZoom(pageZoom), |
7822 |
NS_ENSURE_SUCCESS(newMUDV->SetFullZoom(pageZoom), |
7721 |
NS_ERROR_FAILURE); |
7823 |
NS_ERROR_FAILURE); |
7722 |
NS_ENSURE_SUCCESS(newMUDV->SetAuthorStyleDisabled(styleDisabled), |
7824 |
NS_ENSURE_SUCCESS(newMUDV->SetAuthorStyleDisabled(styleDisabled), |
7723 |
NS_ERROR_FAILURE); |
7825 |
NS_ERROR_FAILURE); |
7724 |
} |
7826 |
} |
7725 |
|
7827 |
|
7726 |
// Stuff the bgcolor from the old pres shell into the new |
7828 |
// Stuff the bgcolor from the old pres shell into the new |
7727 |
// pres shell. This improves page load continuity. |
7829 |
// pres shell. This improves page load continuity. |
7728 |
nsCOMPtr<nsIDocumentViewer> docviewer = |
|
|
7729 |
do_QueryInterface(mContentViewer); |
7730 |
|
7731 |
if (docviewer) { |
7830 |
if (docviewer) { |
7732 |
nsCOMPtr<nsIPresShell> shell; |
7831 |
nsCOMPtr<nsIPresShell> shell; |
7733 |
docviewer->GetPresShell(getter_AddRefs(shell)); |
7832 |
docviewer->GetPresShell(getter_AddRefs(shell)); |
7734 |
|
7833 |
|
7735 |
if (shell) { |
7834 |
if (shell) { |
7736 |
shell->SetCanvasBackground(bgcolor); |
7835 |
shell->SetCanvasBackground(bgcolor); |
7737 |
} |
7836 |
} |
7738 |
} |
7837 |
} |
Lines 8433-8462
nsDocShell::InternalLoad(nsIURI * aURI,
|
Link Here
|
---|
|
8433 |
} |
8532 |
} |
8434 |
} |
8533 |
} |
8435 |
|
8534 |
|
8436 |
// mContentViewer->PermitUnload can destroy |this| docShell, which |
8535 |
// mContentViewer->PermitUnload can destroy |this| docShell, which |
8437 |
// causes the next call of CanSavePresentation to crash. |
8536 |
// causes the next call of CanSavePresentation to crash. |
8438 |
// Hold onto |this| until we return, to prevent a crash from happening. |
8537 |
// Hold onto |this| until we return, to prevent a crash from happening. |
8439 |
// (bug#331040) |
8538 |
// (bug#331040) |
8440 |
nsCOMPtr<nsIDocShell> kungFuDeathGrip(this); |
8539 |
nsCOMPtr<nsIDocShell> kungFuDeathGrip(this); |
8441 |
|
8540 |
|
|
|
8541 |
rv = InitTiming(); |
8542 |
if (mTiming) { |
8543 |
mTiming->NotifyBeforeUnload(); |
8544 |
} |
8442 |
// Check if the page doesn't want to be unloaded. The javascript: |
8545 |
// Check if the page doesn't want to be unloaded. The javascript: |
8443 |
// protocol handler deals with this for javascript: URLs. |
8546 |
// protocol handler deals with this for javascript: URLs. |
8444 |
if (!bIsJavascript && mContentViewer) { |
8547 |
if (!bIsJavascript && mContentViewer) { |
8445 |
PRBool okToUnload; |
8548 |
PRBool okToUnload; |
8446 |
rv = mContentViewer->PermitUnload(PR_FALSE, &okToUnload); |
8549 |
rv = mContentViewer->PermitUnload(PR_FALSE, &okToUnload); |
8447 |
|
8550 |
|
8448 |
if (NS_SUCCEEDED(rv) && !okToUnload) { |
8551 |
if (NS_SUCCEEDED(rv) && !okToUnload) { |
8449 |
// The user chose not to unload the page, interrupt the |
8552 |
// The user chose not to unload the page, interrupt the |
8450 |
// load. |
8553 |
// load. |
8451 |
return NS_OK; |
8554 |
return NS_OK; |
8452 |
} |
8555 |
} |
8453 |
} |
8556 |
} |
8454 |
|
8557 |
|
|
|
8558 |
if (mTiming) { |
8559 |
mTiming->NotifyUnloadAccepted(mCurrentURI); |
8560 |
} |
8561 |
|
8455 |
// Check for saving the presentation here, before calling Stop(). |
8562 |
// Check for saving the presentation here, before calling Stop(). |
8456 |
// This is necessary so that we can catch any pending requests. |
8563 |
// This is necessary so that we can catch any pending requests. |
8457 |
// Since the new request has not been created yet, we pass null for the |
8564 |
// Since the new request has not been created yet, we pass null for the |
8458 |
// new request parameter. |
8565 |
// new request parameter. |
8459 |
// Also pass nsnull for the document, since it doesn't affect the return |
8566 |
// Also pass nsnull for the document, since it doesn't affect the return |
8460 |
// value for our purposes here. |
8567 |
// value for our purposes here. |
8461 |
PRBool savePresentation = CanSavePresentation(aLoadType, nsnull, nsnull); |
8568 |
PRBool savePresentation = CanSavePresentation(aLoadType, nsnull, nsnull); |
8462 |
|
8569 |
|
Lines 11734-11750
nsDocShell::GetPrintPreview(nsIWebBrowse
|
Link Here
|
---|
|
11734 |
nsCOMPtr<nsIWebBrowserPrint> result = do_QueryInterface(print); |
11841 |
nsCOMPtr<nsIWebBrowserPrint> result = do_QueryInterface(print); |
11735 |
result.forget(aPrintPreview); |
11842 |
result.forget(aPrintPreview); |
11736 |
return NS_OK; |
11843 |
return NS_OK; |
11737 |
#else |
11844 |
#else |
11738 |
return NS_ERROR_NOT_IMPLEMENTED; |
11845 |
return NS_ERROR_NOT_IMPLEMENTED; |
11739 |
#endif |
11846 |
#endif |
11740 |
} |
11847 |
} |
11741 |
|
11848 |
|
11742 |
|
|
|
11743 |
#ifdef DEBUG |
11849 |
#ifdef DEBUG |
11744 |
unsigned long nsDocShell::gNumberOfDocShells = 0; |
11850 |
unsigned long nsDocShell::gNumberOfDocShells = 0; |
11745 |
#endif |
11851 |
#endif |
11746 |
|
11852 |
|
11747 |
NS_IMETHODIMP |
11853 |
NS_IMETHODIMP |
11748 |
nsDocShell::GetCanExecuteScripts(PRBool *aResult) |
11854 |
nsDocShell::GetCanExecuteScripts(PRBool *aResult) |
11749 |
{ |
11855 |
{ |
11750 |
NS_ENSURE_ARG_POINTER(aResult); |
11856 |
NS_ENSURE_ARG_POINTER(aResult); |