Back out fc945dec50bb and de06684dabc4 (bug 642551), 64c328251a24 (bug 683952) and 9d0d13998ebb (bug 684544) for orange on a CLOSED TREE

This commit is contained in:
Phil Ringnalda 2011-09-06 21:42:54 -07:00
Родитель 353c30193a
Коммит 8c67e09e0b
11 изменённых файлов: 59 добавлений и 162 удалений

Просмотреть файл

@ -6378,25 +6378,19 @@ LocationSetterGuts(JSContext *cx, JSObject *obj, jsval *vp)
nsresult rv = xpcomObj->GetLocation(getter_AddRefs(location)); nsresult rv = xpcomObj->GetLocation(getter_AddRefs(location));
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
// We have to wrap location into vp before null-checking location, to
// avoid assigning the wrong thing into the slot.
nsCOMPtr<nsIXPConnectJSObjectHolder> holder;
rv = WrapNative(cx, JS_GetGlobalForScopeChain(cx), location,
&NS_GET_IID(nsIDOMLocation), PR_TRUE, vp,
getter_AddRefs(holder));
if (!location) {
// Make this a no-op
return NS_OK;
}
JSString *val = ::JS_ValueToString(cx, *vp); JSString *val = ::JS_ValueToString(cx, *vp);
NS_ENSURE_TRUE(val, NS_ERROR_UNEXPECTED); NS_ENSURE_TRUE(val, NS_ERROR_UNEXPECTED);
nsDependentJSString depStr; nsDependentJSString depStr;
NS_ENSURE_TRUE(depStr.init(cx, val), NS_ERROR_UNEXPECTED); NS_ENSURE_TRUE(depStr.init(cx, val), NS_ERROR_UNEXPECTED);
return location->SetHref(depStr); rv = location->SetHref(depStr);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIXPConnectJSObjectHolder> holder;
return WrapNative(cx, JS_GetGlobalForScopeChain(cx), location,
&NS_GET_IID(nsIDOMLocation), PR_TRUE, vp,
getter_AddRefs(holder));
} }
template<class Interface> template<class Interface>

Просмотреть файл

@ -140,7 +140,6 @@ _TEST_FILES = \
test_bug642026.html \ test_bug642026.html \
test_bug648465.html \ test_bug648465.html \
test_bug654137.html \ test_bug654137.html \
test_bug684544.html \
test_window_bar.html \ test_window_bar.html \
file_window_bar.html \ file_window_bar.html \
test_resize_move_windows.html \ test_resize_move_windows.html \

Просмотреть файл

@ -1,48 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=
-->
<head>
<title>Test for Bug </title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=">Mozilla Bug </a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script type="application/javascript">
/** Test for Bug **/
var f = document.createElement("iframe");
document.body.appendChild(f);
var win = f.contentWindow;
// Set location once to make sure it's resolved
win.location = "data:text/html,1";
// Now try to make the location object go away.
f.parentNode.removeChild(f);
// Check that location is now null. If it's not, the test needs changing
// (e.g. to use window.close() so that it's null).
is("location" in win, true, "Should still have a location property");
todo_is(win.location, null, "There should be no location object now");
// Just set the location. This should not crash.
win.location = "data:text/html,2";
// And check that we didn't override the slot in the process.
is(typeof(win.location), "object", "Location should not have become a string");
is(win.location, null,
"There should be no location object for real after the set");
</script>
</pre>
</body>
</html>

Просмотреть файл

@ -4044,19 +4044,13 @@ PresShell::ScrollToAnchor()
* we should include the top of the line in the added rectangle * we should include the top of the line in the added rectangle
* @param aRect [inout] rect into which its bounds should be unioned * @param aRect [inout] rect into which its bounds should be unioned
* @param aHaveRect [inout] whether aRect contains data yet * @param aHaveRect [inout] whether aRect contains data yet
* @param aPrevBlock [inout] the block aLines is a line iterator for
* @param aLines [inout] the line iterator we're using
* @param aCurLine [inout] the line to start looking from in this iterator
*/ */
static void static void
AccumulateFrameBounds(nsIFrame* aContainerFrame, AccumulateFrameBounds(nsIFrame* aContainerFrame,
nsIFrame* aFrame, nsIFrame* aFrame,
PRBool aUseWholeLineHeightForInlines, PRBool aUseWholeLineHeightForInlines,
nsRect& aRect, nsRect& aRect,
PRBool& aHaveRect, PRBool& aHaveRect)
nsIFrame*& aPrevBlock,
nsAutoLineIterator& aLines,
PRInt32& aCurLine)
{ {
nsRect frameBounds = aFrame->GetRect() + nsRect frameBounds = aFrame->GetRect() +
aFrame->GetParent()->GetOffsetTo(aContainerFrame); aFrame->GetParent()->GetOffsetTo(aContainerFrame);
@ -4079,21 +4073,16 @@ AccumulateFrameBounds(nsIFrame* aContainerFrame,
f && f &&
frameType == nsGkAtoms::blockFrame) { frameType == nsGkAtoms::blockFrame) {
// find the line containing aFrame and increase the top of |offset|. // find the line containing aFrame and increase the top of |offset|.
if (f != aPrevBlock) { nsAutoLineIterator lines = f->GetLineIterator();
aLines = f->GetLineIterator(); if (lines) {
aPrevBlock = f; PRInt32 index = lines->FindLineContaining(prevFrame);
aCurLine = 0;
}
if (aLines) {
PRInt32 index = aLines->FindLineContaining(prevFrame, aCurLine);
if (index >= 0) { if (index >= 0) {
aCurLine = index;
nsIFrame *trash1; nsIFrame *trash1;
PRInt32 trash2; PRInt32 trash2;
nsRect lineBounds; nsRect lineBounds;
PRUint32 trash3; PRUint32 trash3;
if (NS_SUCCEEDED(aLines->GetLine(index, &trash1, &trash2, if (NS_SUCCEEDED(lines->GetLine(index, &trash1, &trash2,
lineBounds, &trash3))) { lineBounds, &trash3))) {
lineBounds += f->GetOffsetTo(aContainerFrame); lineBounds += f->GetOffsetTo(aContainerFrame);
if (lineBounds.y < frameBounds.y) { if (lineBounds.y < frameBounds.y) {
@ -4297,16 +4286,9 @@ PresShell::DoScrollContentIntoView(nsIContent* aContent,
nsRect frameBounds; nsRect frameBounds;
PRBool haveRect = PR_FALSE; PRBool haveRect = PR_FALSE;
PRBool useWholeLineHeightForInlines = aVPercent != NS_PRESSHELL_SCROLL_ANYWHERE; PRBool useWholeLineHeightForInlines = aVPercent != NS_PRESSHELL_SCROLL_ANYWHERE;
// Reuse the same line iterator across calls to AccumulateFrameBounds. We set
// it every time we detect a new block (stored in prevBlock).
nsIFrame* prevBlock = nsnull;
nsAutoLineIterator lines;
// The last line we found a continuation on in |lines|. We assume that later
// continuations cannot come on earlier lines.
PRInt32 curLine = 0;
do { do {
AccumulateFrameBounds(container, frame, useWholeLineHeightForInlines, AccumulateFrameBounds(container, frame, useWholeLineHeightForInlines,
frameBounds, haveRect, prevBlock, lines, curLine); frameBounds, haveRect);
} while ((frame = frame->GetNextContinuation())); } while ((frame = frame->GetNextContinuation()));
ScrollFrameRectIntoView(container, frameBounds, aVPercent, aHPercent, ScrollFrameRectIntoView(container, frameBounds, aVPercent, aHPercent,

Просмотреть файл

@ -104,12 +104,9 @@ public:
/** /**
* Given a frame that's a child of the block, find which line its on * Given a frame that's a child of the block, find which line its on
* and return that line index, as long as it's at least as big as * and return that line index. Returns -1 if the frame cannot be found.
* aStartLine. Returns -1 if the frame cannot be found on lines
* starting with aStartLine.
*/ */
virtual PRInt32 FindLineContaining(nsIFrame* aFrame, virtual PRInt32 FindLineContaining(nsIFrame* aFrame) = 0;
PRInt32 aStartLine = 0) = 0;
// Given a line number and an X coordinate, find the frame on the // Given a line number and an X coordinate, find the frame on the
// line that is nearest to the X coordinate. The // line that is nearest to the X coordinate. The

Просмотреть файл

@ -626,16 +626,15 @@ nsLineIterator::GetLine(PRInt32 aLineNumber,
} }
PRInt32 PRInt32
nsLineIterator::FindLineContaining(nsIFrame* aFrame, PRInt32 aStartLine) nsLineIterator::FindLineContaining(nsIFrame* aFrame)
{ {
NS_PRECONDITION(aStartLine <= mNumLines, "Bogus line numbers"); nsLineBox* line = mLines[0];
PRInt32 lineNumber = aStartLine; PRInt32 lineNumber = 0;
while (lineNumber != mNumLines) { while (lineNumber != mNumLines) {
nsLineBox* line = mLines[lineNumber];
if (line->Contains(aFrame)) { if (line->Contains(aFrame)) {
return lineNumber; return lineNumber;
} }
++lineNumber; line = mLines[++lineNumber];
} }
return -1; return -1;
} }

Просмотреть файл

@ -1581,7 +1581,7 @@ public:
PRInt32* aNumFramesOnLine, PRInt32* aNumFramesOnLine,
nsRect& aLineBounds, nsRect& aLineBounds,
PRUint32* aLineFlags); PRUint32* aLineFlags);
virtual PRInt32 FindLineContaining(nsIFrame* aFrame, PRInt32 aStartLine = 0); virtual PRInt32 FindLineContaining(nsIFrame* aFrame);
NS_IMETHOD FindFrameAt(PRInt32 aLineNumber, NS_IMETHOD FindFrameAt(PRInt32 aLineNumber,
nscoord aX, nscoord aX,
nsIFrame** aFrameFound, nsIFrame** aFrameFound,

Просмотреть файл

@ -1706,16 +1706,14 @@ nsTableRowGroupFrame::GetLine(PRInt32 aLineNumber,
} }
PRInt32 PRInt32
nsTableRowGroupFrame::FindLineContaining(nsIFrame* aFrame, PRInt32 aStartLine) nsTableRowGroupFrame::FindLineContaining(nsIFrame* aFrame)
{ {
NS_ENSURE_ARG_POINTER(aFrame); NS_ENSURE_ARG_POINTER(aFrame);
nsTableRowFrame *rowFrame = do_QueryFrame(aFrame); nsTableRowFrame *rowFrame = do_QueryFrame(aFrame);
NS_ASSERTION(rowFrame, "RowGroup contains a frame that is not a row"); NS_ASSERTION(rowFrame, "RowGroup contains a frame that is not a row");
PRInt32 rowIndexInGroup = rowFrame->GetRowIndex() - GetStartRowIndex(); return rowFrame->GetRowIndex() - GetStartRowIndex();
return rowIndexInGroup >= aStartLine ? rowIndexInGroup : -1;
} }
#ifdef IBMBIDI #ifdef IBMBIDI

Просмотреть файл

@ -258,12 +258,10 @@ public:
/** Given a frame that's a child of the rowgroup, find which line its on. /** Given a frame that's a child of the rowgroup, find which line its on.
* @param aFrame - frame, should be a row * @param aFrame - frame, should be a row
* @param aStartLine - minimal index to return
* @return row index relative to the row group if this a row * @return row index relative to the row group if this a row
* frame and the index is at least aStartLine. * frame. -1 if the frame cannot be found.
* -1 if the frame cannot be found.
*/ */
virtual PRInt32 FindLineContaining(nsIFrame* aFrame, PRInt32 aStartLine = 0); virtual PRInt32 FindLineContaining(nsIFrame* aFrame);
/** Find the orginating cell frame on a row that is the nearest to the /** Find the orginating cell frame on a row that is the nearest to the
* coordinate X. * coordinate X.

Просмотреть файл

@ -94,38 +94,12 @@ void GetURIStringFromRequest(nsIRequest* request, nsACString &name)
} }
#endif /* DEBUG */ #endif /* DEBUG */
struct nsStatusInfo : public PRCList
{
nsString mStatusMessage;
nsresult mStatusCode;
// Weak mRequest is ok; we'll be told if it decides to go away.
nsIRequest * const mRequest;
nsStatusInfo(nsIRequest *aRequest) :
mRequest(aRequest)
{
MOZ_COUNT_CTOR(nsStatusInfo);
PR_INIT_CLIST(this);
}
~nsStatusInfo()
{
MOZ_COUNT_DTOR(nsStatusInfo);
PR_REMOVE_LINK(this);
}
};
struct nsRequestInfo : public PLDHashEntryHdr struct nsRequestInfo : public PLDHashEntryHdr
{ {
nsRequestInfo(const void *key) nsRequestInfo(const void *key)
: mKey(key), mCurrentProgress(0), mMaxProgress(0), mUploading(PR_FALSE) : mKey(key), mCurrentProgress(0), mMaxProgress(0), mUploading(PR_FALSE)
, mLastStatus(nsnull) , mIsDone(PR_FALSE)
{ {
MOZ_COUNT_CTOR(nsRequestInfo);
}
~nsRequestInfo()
{
MOZ_COUNT_DTOR(nsRequestInfo);
} }
nsIRequest* Request() { nsIRequest* Request() {
@ -137,7 +111,9 @@ struct nsRequestInfo : public PLDHashEntryHdr
PRInt64 mMaxProgress; PRInt64 mMaxProgress;
PRBool mUploading; PRBool mUploading;
nsAutoPtr<nsStatusInfo> mLastStatus; PRBool mIsDone;
nsString mLastStatus;
nsresult mLastStatusCode;
}; };
@ -210,8 +186,6 @@ nsDocLoader::nsDocLoader()
ClearInternalProgress(); ClearInternalProgress();
PR_INIT_CLIST(&mStatusInfoList);
PR_LOG(gDocLoaderLog, PR_LOG_DEBUG, PR_LOG(gDocLoaderLog, PR_LOG_DEBUG,
("DocLoader:%p: created.\n", this)); ("DocLoader:%p: created.\n", this));
} }
@ -627,10 +601,7 @@ nsDocLoader::OnStopRequest(nsIRequest *aRequest,
// //
nsRequestInfo *info = GetRequestInfo(aRequest); nsRequestInfo *info = GetRequestInfo(aRequest);
if (info) { if (info) {
// Null out mLastStatus now so we don't find it when looking for info->mIsDone = PR_TRUE;
// status from now on. This destroys the nsStatusInfo and hence
// removes it from our list.
info->mLastStatus = nsnull;
PRInt64 oldMax = info->mMaxProgress; PRInt64 oldMax = info->mMaxProgress;
@ -904,6 +875,24 @@ void nsDocLoader::doStartURLLoad(nsIRequest *request)
NS_OK); NS_OK);
} }
// PLDHashTable enumeration callback that finds a RequestInfo that's not done
// yet.
static PLDHashOperator
FindUnfinishedRequestCallback(PLDHashTable *table, PLDHashEntryHdr *hdr,
PRUint32 number, void *arg)
{
nsRequestInfo* info = static_cast<nsRequestInfo *>(hdr);
nsRequestInfo** retval = static_cast<nsRequestInfo**>(arg);
if (!info->mIsDone && !info->mLastStatus.IsEmpty()) {
*retval = info;
return PL_DHASH_STOP;
}
return PL_DHASH_NEXT;
}
void nsDocLoader::doStopURLLoad(nsIRequest *request, nsresult aStatus) void nsDocLoader::doStopURLLoad(nsIRequest *request, nsresult aStatus)
{ {
#if defined(DEBUG) #if defined(DEBUG)
@ -922,14 +911,15 @@ void nsDocLoader::doStopURLLoad(nsIRequest *request, nsresult aStatus)
nsIWebProgressListener::STATE_IS_REQUEST, nsIWebProgressListener::STATE_IS_REQUEST,
aStatus); aStatus);
// Fire a status change message for the most recent unfinished // Fire a status change message for a random unfinished request to make sure
// request to make sure that the displayed status is not outdated. // that the displayed status is not outdated.
if (!PR_CLIST_IS_EMPTY(&mStatusInfoList)) { nsRequestInfo* unfinishedRequest = nsnull;
nsStatusInfo* statusInfo = PL_DHashTableEnumerate(&mRequestInfoHash, FindUnfinishedRequestCallback,
static_cast<nsStatusInfo*>(PR_LIST_HEAD(&mStatusInfoList)); &unfinishedRequest);
FireOnStatusChange(this, statusInfo->mRequest, if (unfinishedRequest) {
statusInfo->mStatusCode, FireOnStatusChange(this, unfinishedRequest->Request(),
statusInfo->mStatusMessage.get()); unfinishedRequest->mLastStatusCode,
unfinishedRequest->mLastStatus.get());
} }
} }
@ -1199,17 +1189,8 @@ NS_IMETHODIMP nsDocLoader::OnStatus(nsIRequest* aRequest, nsISupports* ctxt,
// don't display, for example, "Transferring" messages for requests that are // don't display, for example, "Transferring" messages for requests that are
// already done. // already done.
if (info) { if (info) {
if (!info->mLastStatus) { info->mLastStatus = msg;
info->mLastStatus = new nsStatusInfo(aRequest); info->mLastStatusCode = aStatus;
} else {
// We're going to move it to the front of the list, so remove
// it from wherever it is now.
PR_REMOVE_LINK(info->mLastStatus);
}
info->mLastStatus->mStatusMessage = msg;
info->mLastStatus->mStatusCode = aStatus;
// Put the info at the front of the list
PR_INSERT_LINK(info->mLastStatus, &mStatusInfoList);
} }
FireOnStatusChange(this, aRequest, aStatus, msg); FireOnStatusChange(this, aRequest, aStatus, msg);
} }

Просмотреть файл

@ -59,7 +59,6 @@
#include "nsISupportsPriority.h" #include "nsISupportsPriority.h"
#include "nsCOMPtr.h" #include "nsCOMPtr.h"
#include "pldhash.h" #include "pldhash.h"
#include "prclist.h"
struct nsRequestInfo; struct nsRequestInfo;
struct nsListenerInfo; struct nsListenerInfo;
@ -235,8 +234,6 @@ protected:
PLDHashTable mRequestInfoHash; PLDHashTable mRequestInfoHash;
PRInt64 mCompletedTotalProgress; PRInt64 mCompletedTotalProgress;
PRCList mStatusInfoList;
/* /*
* This flag indicates that the loader is loading a document. It is set * This flag indicates that the loader is loading a document. It is set
* from the call to LoadDocument(...) until the OnConnectionsComplete(...) * from the call to LoadDocument(...) until the OnConnectionsComplete(...)