Bug 654137 - Make window.top not replacable; r=bz

This commit is contained in:
Ms2ger 2011-05-10 20:24:44 +02:00
Родитель 9926796429
Коммит 65b08d69be
5 изменённых файлов: 30 добавлений и 8 удалений

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

@ -1564,7 +1564,6 @@ PRBool nsDOMClassInfo::sDisableDocumentAllSupport = PR_FALSE;
PRBool nsDOMClassInfo::sDisableGlobalScopePollutionSupport = PR_FALSE;
jsid nsDOMClassInfo::sTop_id = JSID_VOID;
jsid nsDOMClassInfo::sParent_id = JSID_VOID;
jsid nsDOMClassInfo::sScrollbars_id = JSID_VOID;
jsid nsDOMClassInfo::sLocation_id = JSID_VOID;
@ -1899,7 +1898,6 @@ nsDOMClassInfo::DefineStaticJSVals(JSContext *cx)
JSAutoRequest ar(cx);
SET_JSID_TO_STRING(sTop_id, cx, "top");
SET_JSID_TO_STRING(sParent_id, cx, "parent");
SET_JSID_TO_STRING(sScrollbars_id, cx, "scrollbars");
SET_JSID_TO_STRING(sLocation_id, cx, "location");
@ -5022,7 +5020,6 @@ nsDOMClassInfo::ShutDown()
}
}
sTop_id = JSID_VOID;
sParent_id = JSID_VOID;
sScrollbars_id = JSID_VOID;
sLocation_id = JSID_VOID;

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

@ -202,8 +202,7 @@ protected:
static inline PRBool IsReadonlyReplaceable(jsid id)
{
return (id == sTop_id ||
id == sParent_id ||
return (id == sParent_id ||
id == sScrollbars_id ||
id == sContent_id ||
id == sMenubar_id ||
@ -246,7 +245,6 @@ protected:
static PRBool sDisableGlobalScopePollutionSupport;
public:
static jsid sTop_id;
static jsid sParent_id;
static jsid sScrollbars_id;
static jsid sLocation_id;

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

@ -138,6 +138,7 @@ _TEST_FILES = \
test_bug633133.html \
test_bug642026.html \
test_bug648465.html \
test_bug654137.html \
test_window_bar.html \
file_window_bar.html \
$(NULL)

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

@ -0,0 +1,26 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=654137
-->
<head>
<title>Test for Bug 654137</title>
<script type="application/javascript" src="/MochiKit/packed.js"></script>
<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=654137">Mozilla Bug 654137</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script type="application/javascript">
/** Test for Bug 654137 **/
var prev = window.top;
top = "Fail";
is(top, prev, "top should not have been replaced");
</script>
</pre>
</body>
</html>

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

@ -184,8 +184,8 @@ function checkContextMenu(event)
var frombase = (gTestId == -1 || gTestId == 1);
if (!frombase)
rect = event.originalTarget.getBoundingClientRect();
left = frombase ? rect.left + 7 : rect.left;
top = frombase ? rect.top + 4 : rect.bottom;
var left = frombase ? rect.left + 7 : rect.left;
var top = frombase ? rect.top + 4 : rect.bottom;
isRoundedX(event.clientX, left, gTestElement + " clientX " + gSelectionStep + " " + gTestId + "," + frombase);
isRoundedY(event.clientY, top, gTestElement + " clientY " + gSelectionStep + " " + gTestId);