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));
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);
NS_ENSURE_TRUE(val, NS_ERROR_UNEXPECTED);
nsDependentJSString depStr;
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>

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

@ -140,7 +140,6 @@ _TEST_FILES = \
test_bug642026.html \
test_bug648465.html \
test_bug654137.html \
test_bug684544.html \
test_window_bar.html \
file_window_bar.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
* @param aRect [inout] rect into which its bounds should be unioned
* @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
AccumulateFrameBounds(nsIFrame* aContainerFrame,
nsIFrame* aFrame,
PRBool aUseWholeLineHeightForInlines,
nsRect& aRect,
PRBool& aHaveRect,
nsIFrame*& aPrevBlock,
nsAutoLineIterator& aLines,
PRInt32& aCurLine)
PRBool& aHaveRect)
{
nsRect frameBounds = aFrame->GetRect() +
aFrame->GetParent()->GetOffsetTo(aContainerFrame);
@ -4079,22 +4073,17 @@ AccumulateFrameBounds(nsIFrame* aContainerFrame,
f &&
frameType == nsGkAtoms::blockFrame) {
// find the line containing aFrame and increase the top of |offset|.
if (f != aPrevBlock) {
aLines = f->GetLineIterator();
aPrevBlock = f;
aCurLine = 0;
}
if (aLines) {
PRInt32 index = aLines->FindLineContaining(prevFrame, aCurLine);
nsAutoLineIterator lines = f->GetLineIterator();
if (lines) {
PRInt32 index = lines->FindLineContaining(prevFrame);
if (index >= 0) {
aCurLine = index;
nsIFrame *trash1;
PRInt32 trash2;
nsRect lineBounds;
PRUint32 trash3;
if (NS_SUCCEEDED(aLines->GetLine(index, &trash1, &trash2,
lineBounds, &trash3))) {
if (NS_SUCCEEDED(lines->GetLine(index, &trash1, &trash2,
lineBounds, &trash3))) {
lineBounds += f->GetOffsetTo(aContainerFrame);
if (lineBounds.y < frameBounds.y) {
frameBounds.height = frameBounds.YMost() - lineBounds.y;
@ -4297,16 +4286,9 @@ PresShell::DoScrollContentIntoView(nsIContent* aContent,
nsRect frameBounds;
PRBool haveRect = PR_FALSE;
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 {
AccumulateFrameBounds(container, frame, useWholeLineHeightForInlines,
frameBounds, haveRect, prevBlock, lines, curLine);
frameBounds, haveRect);
} while ((frame = frame->GetNextContinuation()));
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
* and return that line index, as long as it's at least as big as
* aStartLine. Returns -1 if the frame cannot be found on lines
* starting with aStartLine.
* and return that line index. Returns -1 if the frame cannot be found.
*/
virtual PRInt32 FindLineContaining(nsIFrame* aFrame,
PRInt32 aStartLine = 0) = 0;
virtual PRInt32 FindLineContaining(nsIFrame* aFrame) = 0;
// Given a line number and an X coordinate, find the frame on the
// line that is nearest to the X coordinate. The

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

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

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

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

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

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

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

@ -258,12 +258,10 @@ public:
/** Given a frame that's a child of the rowgroup, find which line its on.
* @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
* frame and the index is at least aStartLine.
* -1 if the frame cannot be found.
* frame. -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
* coordinate X.

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

@ -94,38 +94,12 @@ void GetURIStringFromRequest(nsIRequest* request, nsACString &name)
}
#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
{
nsRequestInfo(const void *key)
: 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() {
@ -137,7 +111,9 @@ struct nsRequestInfo : public PLDHashEntryHdr
PRInt64 mMaxProgress;
PRBool mUploading;
nsAutoPtr<nsStatusInfo> mLastStatus;
PRBool mIsDone;
nsString mLastStatus;
nsresult mLastStatusCode;
};
@ -210,8 +186,6 @@ nsDocLoader::nsDocLoader()
ClearInternalProgress();
PR_INIT_CLIST(&mStatusInfoList);
PR_LOG(gDocLoaderLog, PR_LOG_DEBUG,
("DocLoader:%p: created.\n", this));
}
@ -627,10 +601,7 @@ nsDocLoader::OnStopRequest(nsIRequest *aRequest,
//
nsRequestInfo *info = GetRequestInfo(aRequest);
if (info) {
// Null out mLastStatus now so we don't find it when looking for
// status from now on. This destroys the nsStatusInfo and hence
// removes it from our list.
info->mLastStatus = nsnull;
info->mIsDone = PR_TRUE;
PRInt64 oldMax = info->mMaxProgress;
@ -904,6 +875,24 @@ void nsDocLoader::doStartURLLoad(nsIRequest *request)
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)
{
#if defined(DEBUG)
@ -922,14 +911,15 @@ void nsDocLoader::doStopURLLoad(nsIRequest *request, nsresult aStatus)
nsIWebProgressListener::STATE_IS_REQUEST,
aStatus);
// Fire a status change message for the most recent unfinished
// request to make sure that the displayed status is not outdated.
if (!PR_CLIST_IS_EMPTY(&mStatusInfoList)) {
nsStatusInfo* statusInfo =
static_cast<nsStatusInfo*>(PR_LIST_HEAD(&mStatusInfoList));
FireOnStatusChange(this, statusInfo->mRequest,
statusInfo->mStatusCode,
statusInfo->mStatusMessage.get());
// Fire a status change message for a random unfinished request to make sure
// that the displayed status is not outdated.
nsRequestInfo* unfinishedRequest = nsnull;
PL_DHashTableEnumerate(&mRequestInfoHash, FindUnfinishedRequestCallback,
&unfinishedRequest);
if (unfinishedRequest) {
FireOnStatusChange(this, unfinishedRequest->Request(),
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
// already done.
if (info) {
if (!info->mLastStatus) {
info->mLastStatus = new nsStatusInfo(aRequest);
} 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);
info->mLastStatus = msg;
info->mLastStatusCode = aStatus;
}
FireOnStatusChange(this, aRequest, aStatus, msg);
}

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

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