зеркало из https://github.com/mozilla/gecko-dev.git
Merge m-c to s-c
This commit is contained in:
Коммит
2269cee9c9
|
@ -2509,6 +2509,7 @@ function URLBarSetURI(aURI) {
|
|||
}
|
||||
|
||||
gURLBar.value = value;
|
||||
gURLBar.valueIsTyped = !valid;
|
||||
SetPageProxyState(valid ? "valid" : "invalid");
|
||||
}
|
||||
|
||||
|
|
|
@ -63,6 +63,7 @@ let tests = [
|
|||
expected: testURL,
|
||||
setup: function() {
|
||||
gURLBar.value = testActionURL;
|
||||
gURLBar.valueIsTyped = true;
|
||||
is(gURLBar.value, testActionURL, "gURLBar.value starts with correct value");
|
||||
|
||||
// Focus the urlbar so we can select it all & copy
|
||||
|
@ -103,6 +104,7 @@ let tests = [
|
|||
setup: function() {
|
||||
// Reset urlbar value
|
||||
gURLBar.value = testActionURL;
|
||||
gURLBar.valueIsTyped = true;
|
||||
// Sanity check that we have the right value
|
||||
is(gURLBar.value, testActionURL, "gURLBar.value starts with correct value");
|
||||
|
||||
|
|
|
@ -126,8 +126,10 @@ function nextTest() {
|
|||
|
||||
function runTest(test, cb) {
|
||||
function doCheck() {
|
||||
if (test.setURL || test.loadURL)
|
||||
if (test.setURL || test.loadURL) {
|
||||
gURLBar.valueIsTyped = !!test.setURL;
|
||||
is(gURLBar.value, test.expectedURL, "url bar value set");
|
||||
}
|
||||
|
||||
testCopy(test.copyVal, test.copyExpected, cb);
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
function testVal(originalValue, targetValue) {
|
||||
gURLBar.value = originalValue;
|
||||
gURLBar.valueIsTyped = false;
|
||||
is(gURLBar.value, targetValue || originalValue, "url bar value set");
|
||||
}
|
||||
|
||||
|
@ -63,6 +64,7 @@ function test() {
|
|||
|
||||
testCopy("example.com", "http://example.com/", function () {
|
||||
SetPageProxyState("invalid");
|
||||
gURLBar.valueIsTyped = true;
|
||||
testCopy("example.com", "example.com", finish);
|
||||
});
|
||||
}, true);
|
||||
|
|
|
@ -185,6 +185,8 @@
|
|||
<method name="trimValue">
|
||||
<parameter name="aURL"/>
|
||||
<body><![CDATA[
|
||||
// This method must not modify the given URL such that calling
|
||||
// nsIURIFixup::createFixupURI with the result will produce a different URI.
|
||||
return this._mayTrimURLs ? trimURL(aURL) : aURL;
|
||||
]]></body>
|
||||
</method>
|
||||
|
@ -497,13 +499,21 @@
|
|||
|
||||
// If the selection doesn't start at the beginning or URL bar is
|
||||
// modified, nothing else to do here.
|
||||
if (this.getAttribute("pageproxystate") != "valid" || this.selectionStart > 0)
|
||||
if (this.selectionStart > 0 || this.valueIsTyped)
|
||||
return selectedVal;
|
||||
|
||||
let uriFixup = Cc["@mozilla.org/docshell/urifixup;1"].getService(Ci.nsIURIFixup);
|
||||
|
||||
let uri;
|
||||
try {
|
||||
uri = uriFixup.createFixupURI(inputVal, Ci.nsIURIFixup.FIXUP_FLAG_NONE);
|
||||
} catch (e) {}
|
||||
if (!uri)
|
||||
return selectedVal;
|
||||
|
||||
let uri = gBrowser.currentURI;
|
||||
// Only copy exposable URIs
|
||||
try {
|
||||
uri = Cc["@mozilla.org/docshell/urifixup;1"].getService(Ci.nsIURIFixup).createExposableURI(uri);
|
||||
uri = uriFixup.createExposableURI(uri);
|
||||
} catch (ex) {}
|
||||
|
||||
// If the entire URL is selected, just use the actual loaded URI.
|
||||
|
|
|
@ -1,5 +1,11 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
// Instead of loading ChromeUtils.js into the test scope in browser-test.js for all tests,
|
||||
// we only need ChromeUtils.js for a few files which is why we are using loadSubScript.
|
||||
var chromeUtils = {};
|
||||
this._scriptLoader = Cc["@mozilla.org/moz/jssubscript-loader;1"].
|
||||
getService(Ci.mozIJSSubScriptLoader);
|
||||
this._scriptLoader.loadSubScript("chrome://mochikit/content/tests/SimpleTest/ChromeUtils.js", chromeUtils);
|
||||
|
||||
function test() {
|
||||
// Make sure the bookmarks bar is visible and restore its state on cleanup.
|
||||
|
@ -31,11 +37,11 @@ function test() {
|
|||
let simulateDragDrop = function(aEffect, aMimeType) {
|
||||
const uriSpec = "http://www.mozilla.org/D1995729-A152-4e30-8329-469B01F30AA7";
|
||||
let uri = makeURI(uriSpec);
|
||||
EventUtils.synthesizeDrop(placesItems.childNodes[0],
|
||||
chromeUtils.synthesizeDrop(placesItems.childNodes[0],
|
||||
placesItems,
|
||||
[[{type: aMimeType,
|
||||
data: uriSpec}]],
|
||||
aEffect, window);
|
||||
aEffect, window, EventUtils);
|
||||
|
||||
// Verify that the drop produces exactly one bookmark.
|
||||
let bookmarkIds = PlacesUtils.bookmarks
|
||||
|
|
|
@ -1,3 +1,10 @@
|
|||
// Instead of loading ChromeUtils.js into the test scope in browser-test.js for all tests,
|
||||
// we only need ChromeUtils.js for a few files which is why we are using loadSubScript.
|
||||
var chromeUtils = {};
|
||||
this._scriptLoader = Cc["@mozilla.org/moz/jssubscript-loader;1"].
|
||||
getService(Ci.mozIJSSubScriptLoader);
|
||||
this._scriptLoader.loadSubScript("chrome://mochikit/content/tests/SimpleTest/ChromeUtils.js", chromeUtils);
|
||||
|
||||
function test() {
|
||||
waitForExplicitFinish();
|
||||
|
||||
|
@ -137,7 +144,7 @@ function test() {
|
|||
searchBar.addEventListener("popupshowing", stopPopup, true);
|
||||
// drop on the search button so that we don't need to worry about the
|
||||
// default handlers for textboxes.
|
||||
EventUtils.synthesizeDrop(searchBar.searchButton, searchBar.searchButton, [[ {type: "text/plain", data: "Some Text" } ]], "copy", window);
|
||||
chromeUtils.synthesizeDrop(searchBar.searchButton, searchBar.searchButton, [[ {type: "text/plain", data: "Some Text" } ]], "copy", window, EventUtils);
|
||||
doOnloadOnce(function(event) {
|
||||
is(searchBar.value, "Some Text", "drop text/plain on searchbar");
|
||||
testDropInternalText();
|
||||
|
@ -146,7 +153,7 @@ function test() {
|
|||
|
||||
function testDropInternalText() {
|
||||
init();
|
||||
EventUtils.synthesizeDrop(searchBar.searchButton, searchBar.searchButton, [[ {type: "text/x-moz-text-internal", data: "More Text" } ]], "copy", window);
|
||||
chromeUtils.synthesizeDrop(searchBar.searchButton, searchBar.searchButton, [[ {type: "text/x-moz-text-internal", data: "More Text" } ]], "copy", window, EventUtils);
|
||||
doOnloadOnce(function(event) {
|
||||
is(searchBar.value, "More Text", "drop text/x-moz-text-internal on searchbar");
|
||||
testDropLink();
|
||||
|
@ -155,7 +162,7 @@ function test() {
|
|||
|
||||
function testDropLink() {
|
||||
init();
|
||||
EventUtils.synthesizeDrop(searchBar.searchButton, searchBar.searchButton, [[ {type: "text/uri-list", data: "http://www.mozilla.org" } ]], "copy", window);
|
||||
chromeUtils.synthesizeDrop(searchBar.searchButton, searchBar.searchButton, [[ {type: "text/uri-list", data: "http://www.mozilla.org" } ]], "copy", window, EventUtils);
|
||||
is(searchBar.value, "More Text", "drop text/uri-list on searchbar");
|
||||
SimpleTest.executeSoon(testRightClick);
|
||||
}
|
||||
|
|
|
@ -1355,12 +1355,18 @@ protected:
|
|||
/* Event stuff that documents and elements share. This needs to be
|
||||
NS_IMETHOD because some subclasses implement DOM methods with
|
||||
this exact name and signature and then the calling convention
|
||||
needs to match. */
|
||||
needs to match.
|
||||
|
||||
Note that we include DOCUMENT_ONLY_EVENT events here so that we
|
||||
can forward all the document stuff to this implementation.
|
||||
*/
|
||||
#define EVENT(name_, id_, type_, struct_) \
|
||||
NS_IMETHOD GetOn##name_(JSContext *cx, jsval *vp); \
|
||||
NS_IMETHOD SetOn##name_(JSContext *cx, const jsval &v);
|
||||
#define TOUCH_EVENT EVENT
|
||||
#define DOCUMENT_ONLY_EVENT EVENT
|
||||
#include "nsEventNameList.h"
|
||||
#undef DOCUMENT_ONLY_EVENT
|
||||
#undef TOUCH_EVENT
|
||||
#undef EVENT
|
||||
|
||||
|
|
|
@ -441,10 +441,9 @@ nsIdentifierMapEntry::AddNameElement(nsIDocument* aDocument, Element* aElement)
|
|||
void
|
||||
nsIdentifierMapEntry::RemoveNameElement(Element* aElement)
|
||||
{
|
||||
NS_ASSERTION(mNameContentList &&
|
||||
mNameContentList->IndexOf(aElement, PR_FALSE) >= 0,
|
||||
"Attmpting to remove named element that doesn't exist");
|
||||
mNameContentList->RemoveElement(aElement);
|
||||
if (mNameContentList) {
|
||||
mNameContentList->RemoveElement(aElement);
|
||||
}
|
||||
}
|
||||
|
||||
// Helper structs for the content->subdoc map
|
||||
|
@ -2571,7 +2570,7 @@ nsDocument::RemoveFromNameTable(Element *aElement, nsIAtom* aName)
|
|||
|
||||
nsIdentifierMapEntry *entry =
|
||||
mIdentifierMap.GetEntry(nsDependentAtomString(aName));
|
||||
if (!entry) // Should never be false unless we had OOM when adding the entry
|
||||
if (!entry) // Could be false if the element was anonymous, hence never added
|
||||
return;
|
||||
|
||||
entry->RemoveNameElement(aElement);
|
||||
|
@ -8688,6 +8687,8 @@ nsDocument::SizeOf() const
|
|||
return nsINode::SetOn##name_(cx, v); \
|
||||
}
|
||||
#define TOUCH_EVENT EVENT
|
||||
#define DOCUMENT_ONLY_EVENT EVENT
|
||||
#include "nsEventNameList.h"
|
||||
#undef DOCUMENT_ONLY_EVENT
|
||||
#undef TOUCH_EVENT
|
||||
#undef EVENT
|
||||
|
|
|
@ -650,7 +650,7 @@ ContentScriptErrorReporter(JSContext* aCx,
|
|||
#endif
|
||||
}
|
||||
|
||||
nsDataHashtable<nsStringHashKey, nsFrameScriptExecutorJSObjectHolder*>*
|
||||
nsDataHashtable<nsStringHashKey, nsFrameJSScriptExecutorHolder*>*
|
||||
nsFrameScriptExecutor::sCachedScripts = nsnull;
|
||||
nsRefPtr<nsScriptCacheCleaner> nsFrameScriptExecutor::sScriptCacheCleaner;
|
||||
|
||||
|
@ -660,7 +660,7 @@ nsFrameScriptExecutor::DidCreateCx()
|
|||
NS_ASSERTION(mCx, "Should have mCx!");
|
||||
if (!sCachedScripts) {
|
||||
sCachedScripts =
|
||||
new nsDataHashtable<nsStringHashKey, nsFrameScriptExecutorJSObjectHolder*>;
|
||||
new nsDataHashtable<nsStringHashKey, nsFrameJSScriptExecutorHolder*>;
|
||||
sCachedScripts->Init();
|
||||
|
||||
sScriptCacheCleaner = new nsScriptCacheCleaner();
|
||||
|
@ -689,11 +689,11 @@ nsFrameScriptExecutor::DestroyCx()
|
|||
|
||||
static PLDHashOperator
|
||||
CachedScriptUnrooter(const nsAString& aKey,
|
||||
nsFrameScriptExecutorJSObjectHolder*& aData,
|
||||
nsFrameJSScriptExecutorHolder*& aData,
|
||||
void* aUserArg)
|
||||
{
|
||||
JSContext* cx = static_cast<JSContext*>(aUserArg);
|
||||
JS_RemoveObjectRoot(cx, &(aData->mObject));
|
||||
JS_RemoveScriptRoot(cx, &(aData->mScript));
|
||||
delete aData;
|
||||
return PL_DHASH_REMOVE;
|
||||
}
|
||||
|
@ -730,7 +730,7 @@ nsFrameScriptExecutor::LoadFrameScriptInternal(const nsAString& aURL)
|
|||
return;
|
||||
}
|
||||
|
||||
nsFrameScriptExecutorJSObjectHolder* holder = sCachedScripts->Get(aURL);
|
||||
nsFrameJSScriptExecutorHolder* holder = sCachedScripts->Get(aURL);
|
||||
if (holder) {
|
||||
nsContentUtils::ThreadJSContextStack()->Push(mCx);
|
||||
{
|
||||
|
@ -740,7 +740,7 @@ nsFrameScriptExecutor::LoadFrameScriptInternal(const nsAString& aURL)
|
|||
JSObject* global = nsnull;
|
||||
mGlobal->GetJSObject(&global);
|
||||
if (global) {
|
||||
(void) JS_ExecuteScript(mCx, global, holder->mObject, nsnull);
|
||||
(void) JS_ExecuteScript(mCx, global, holder->mScript, nsnull);
|
||||
}
|
||||
}
|
||||
JSContext* unused;
|
||||
|
@ -798,7 +798,7 @@ nsFrameScriptExecutor::LoadFrameScriptInternal(const nsAString& aURL)
|
|||
uint32 oldopts = JS_GetOptions(mCx);
|
||||
JS_SetOptions(mCx, oldopts | JSOPTION_NO_SCRIPT_RVAL);
|
||||
|
||||
JSObject* scriptObj =
|
||||
JSScript* script =
|
||||
JS_CompileUCScriptForPrincipals(mCx, nsnull, jsprin,
|
||||
(jschar*)dataString.get(),
|
||||
dataString.Length(),
|
||||
|
@ -806,19 +806,19 @@ nsFrameScriptExecutor::LoadFrameScriptInternal(const nsAString& aURL)
|
|||
|
||||
JS_SetOptions(mCx, oldopts);
|
||||
|
||||
if (scriptObj) {
|
||||
if (script) {
|
||||
nsCAutoString scheme;
|
||||
uri->GetScheme(scheme);
|
||||
// We don't cache data: scripts!
|
||||
if (!scheme.EqualsLiteral("data")) {
|
||||
nsFrameScriptExecutorJSObjectHolder* holder =
|
||||
new nsFrameScriptExecutorJSObjectHolder(scriptObj);
|
||||
nsFrameJSScriptExecutorHolder* holder =
|
||||
new nsFrameJSScriptExecutorHolder(script);
|
||||
// Root the object also for caching.
|
||||
JS_AddNamedObjectRoot(mCx, &(holder->mObject),
|
||||
JS_AddNamedScriptRoot(mCx, &(holder->mScript),
|
||||
"Cached message manager script");
|
||||
sCachedScripts->Put(aURL, holder);
|
||||
}
|
||||
(void) JS_ExecuteScript(mCx, global, scriptObj, nsnull);
|
||||
(void) JS_ExecuteScript(mCx, global, script, nsnull);
|
||||
}
|
||||
//XXX Argh, JSPrincipals are manually refcounted!
|
||||
JSPRINCIPALS_DROP(mCx, jsprin);
|
||||
|
|
|
@ -197,13 +197,13 @@ ContentScriptErrorReporter(JSContext* aCx,
|
|||
|
||||
class nsScriptCacheCleaner;
|
||||
|
||||
struct nsFrameScriptExecutorJSObjectHolder
|
||||
struct nsFrameJSScriptExecutorHolder
|
||||
{
|
||||
nsFrameScriptExecutorJSObjectHolder(JSObject* aObject) : mObject(aObject)
|
||||
{ MOZ_COUNT_CTOR(nsFrameScriptExecutorJSObjectHolder); }
|
||||
~nsFrameScriptExecutorJSObjectHolder()
|
||||
{ MOZ_COUNT_DTOR(nsFrameScriptExecutorJSObjectHolder); }
|
||||
JSObject* mObject;
|
||||
nsFrameJSScriptExecutorHolder(JSScript* aScript) : mScript(aScript)
|
||||
{ MOZ_COUNT_CTOR(nsFrameJSScriptExecutorHolder); }
|
||||
~nsFrameJSScriptExecutorHolder()
|
||||
{ MOZ_COUNT_DTOR(nsFrameJSScriptExecutorHolder); }
|
||||
JSScript* mScript;
|
||||
};
|
||||
|
||||
class nsFrameScriptExecutor
|
||||
|
@ -228,7 +228,7 @@ protected:
|
|||
PRUint32 mCxStackRefCnt;
|
||||
PRPackedBool mDelayedCxDestroy;
|
||||
nsCOMPtr<nsIPrincipal> mPrincipal;
|
||||
static nsDataHashtable<nsStringHashKey, nsFrameScriptExecutorJSObjectHolder*>* sCachedScripts;
|
||||
static nsDataHashtable<nsStringHashKey, nsFrameJSScriptExecutorHolder*>* sCachedScripts;
|
||||
static nsRefPtr<nsScriptCacheCleaner> sScriptCacheCleaner;
|
||||
};
|
||||
|
||||
|
|
|
@ -5527,7 +5527,9 @@ nsGenericElement::SizeOf() const
|
|||
return elm->SetJSEventListenerToJsval(nsGkAtoms::on##name_, cx, obj, v); \
|
||||
}
|
||||
#define TOUCH_EVENT EVENT
|
||||
#define DOCUMENT_ONLY_EVENT EVENT
|
||||
#include "nsEventNameList.h"
|
||||
#undef DOCUMENT_ONLY_EVENT
|
||||
#undef TOUCH_EVENT
|
||||
#undef EVENT
|
||||
|
||||
|
|
|
@ -507,10 +507,12 @@ _TEST_FILES2 = \
|
|||
file_bug675121.sjs \
|
||||
test_bug654352.html \
|
||||
test_bug675166.html \
|
||||
test_bug682554.html \
|
||||
test_bug682592.html \
|
||||
bug682592-subframe.html \
|
||||
bug682592-subframe-ref.html \
|
||||
test_bug685798.html \
|
||||
test_bug686449.xhtml \
|
||||
$(NULL)
|
||||
|
||||
_CHROME_FILES = \
|
||||
|
|
|
@ -7,6 +7,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=574596
|
|||
<title>Test for Bug 574596</title>
|
||||
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
|
||||
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/ChromeUtils.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=682554
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 682554</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=682554">Mozilla Bug 682554</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
|
||||
/** Test for Bug 682554 **/
|
||||
is("onreadystatechange" in window, false,
|
||||
"Window should not have an onreadystatechange");
|
||||
is("onreadystatechange" in document, true,
|
||||
"Document should have an onreadystatechange");
|
||||
is("onreadystatechange" in document.createElement("script"), false,
|
||||
"<script> element should not have an onreadystatechange");
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,79 @@
|
|||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=686449
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 686449</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=686449">Mozilla Bug 686449</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
|
||||
</div>
|
||||
<div id="rangetest">abcd<div id="picontainer1"><?pi efgh?></div><div>ijkl</div><div id="picontainer2"><?pi mnop?></div>qrst</div>
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
<![CDATA[
|
||||
|
||||
/** Test for Bug 686449 **/
|
||||
|
||||
var pi = document.createProcessingInstruction("t", "data");
|
||||
ok("target" in pi, "No target?");
|
||||
ok("data" in pi, "No data?");
|
||||
ok("length" in pi, "No length?");
|
||||
ok("substringData" in pi, "No substringData?");
|
||||
ok("appendData" in pi, "No appendData?");
|
||||
ok("insertData" in pi, "No insertData?");
|
||||
ok("deleteData" in pi, "No deleteData?");
|
||||
ok("replaceData" in pi, "No replaceData?");
|
||||
|
||||
is(pi.substringData(0, pi.length), pi.data, "wrong data?");
|
||||
var olddata = pi.data;
|
||||
var appenddata = "foo"
|
||||
pi.appendData(appenddata);
|
||||
is(pi.data, olddata + appenddata, "appendData doesn't work?");
|
||||
pi.deleteData(olddata.length, appenddata.length);
|
||||
is(pi.data, olddata, "deleteData doesn't work?");
|
||||
pi.replaceData(0, 0, olddata);
|
||||
is(pi.data, olddata + olddata, "replaceData doesn't work?");
|
||||
pi.insertData(0, olddata);
|
||||
is(pi.data, olddata + olddata + olddata, "insertData doesn't work?");
|
||||
pi.data = olddata;
|
||||
is(pi.data, olddata, "setting data doesn't work?");
|
||||
|
||||
var r = document.createRange();
|
||||
r.selectNodeContents(pi);
|
||||
is(r.startContainer, pi, "Wrong startContainer!");
|
||||
is(r.startOffset, 0, "Wrong startOffset!");
|
||||
is(r.endContainer, pi, "Wrong endContainer!");
|
||||
is(r.endOffset, pi.length, "Wrong endOffset!");
|
||||
|
||||
var df = r.cloneContents();
|
||||
is(df.childNodes.length, 1, "Unexpected child nodes?");
|
||||
ok(df.firstChild.isEqualNode(pi), "Wrong cloning?");
|
||||
|
||||
r.setStart(pi, 1);
|
||||
r.setEnd(pi, 3);
|
||||
df = r.cloneContents();
|
||||
is(df.childNodes.length, 1, "Unexpected child nodes?");
|
||||
ok(!df.firstChild.isEqualNode(pi), "Should clone to similar pi!");
|
||||
is(df.firstChild.data, "at", "Wrong data cloning?");
|
||||
|
||||
r.selectNode(document.getElementById("rangetest"));
|
||||
is(r.toString(), document.getElementById("rangetest").textContent,
|
||||
"Wrong range stringification!");
|
||||
ok(r.cloneContents().firstChild.firstChild.nextSibling.firstChild.
|
||||
isEqualNode(document.getElementById("picontainer1").firstChild),
|
||||
"Wrong pi cloning!");
|
||||
ok(r.cloneContents().firstChild.firstChild.nextSibling.nextSibling.nextSibling.firstChild.
|
||||
isEqualNode(document.getElementById("picontainer2").firstChild),
|
||||
"Wrong pi cloning!");
|
||||
|
||||
]]>
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
|
@ -71,6 +71,10 @@
|
|||
* are otherwise equivalent to those enclosed in EVENT. If
|
||||
* TOUCH_EVENT is not defined, it will be defined to the empty string.
|
||||
*
|
||||
* Event names that are only exposed as IDL attributes on Documents
|
||||
* should be enclosed in the DOCUMENT_ONLY_EVENT macro. If this macro is
|
||||
* not defined, it will be defined to the empty string.
|
||||
*
|
||||
* Event names that are not exposed as IDL attributes at all should be
|
||||
* enclosed in NON_IDL_EVENT. If NON_IDL_EVENT is not defined, it
|
||||
* will be defined to the empty string.
|
||||
|
@ -112,6 +116,15 @@
|
|||
#define DEFINED_TOUCH_EVENT
|
||||
#endif /* TOUCH_EVENT */
|
||||
|
||||
#ifdef DEFINED_DOCUMENT_ONLY_EVENT
|
||||
#error "Don't define DEFINED_DOCUMENT_ONLY_EVENT"
|
||||
#endif /* DEFINED_DOCUMENT_ONLY_EVENT */
|
||||
|
||||
#ifndef DOCUMENT_ONLY_EVENT
|
||||
#define DOCUMENT_ONLY_EVENT(_name, _id, _type, _struct)
|
||||
#define DEFINED_DOCUMENT_ONLY_EVENT
|
||||
#endif /* DOCUMENT_ONLY_EVENT */
|
||||
|
||||
#ifdef DEFINED_NON_IDL_EVENT
|
||||
#error "Don't define DEFINED_NON_IDL_EVENT"
|
||||
#endif /* DEFINED_NON_IDL_EVENT */
|
||||
|
@ -277,10 +290,6 @@ EVENT(ratechange,
|
|||
NS_RATECHANGE,
|
||||
EventNameType_HTML,
|
||||
NS_EVENT_NULL)
|
||||
EVENT(readystatechange,
|
||||
NS_READYSTATECHANGE,
|
||||
EventNameType_HTMLXUL,
|
||||
NS_EVENT_NULL)
|
||||
EVENT(reset,
|
||||
NS_FORM_RESET,
|
||||
EventNameType_HTMLXUL,
|
||||
|
@ -457,6 +466,11 @@ TOUCH_EVENT(touchcancel,
|
|||
EventNameType_All,
|
||||
NS_INPUT_EVENT)
|
||||
|
||||
DOCUMENT_ONLY_EVENT(readystatechange,
|
||||
NS_READYSTATECHANGE,
|
||||
EventNameType_HTMLXUL,
|
||||
NS_EVENT_NULL)
|
||||
|
||||
NON_IDL_EVENT(MozMouseHittest,
|
||||
NS_MOUSE_MOZHITTEST,
|
||||
EventNameType_None,
|
||||
|
@ -756,6 +770,11 @@ NON_IDL_EVENT(animationiteration,
|
|||
#undef TOUCH_EVENT
|
||||
#endif /* DEFINED_TOUCH_EVENT */
|
||||
|
||||
#ifdef DEFINED_DOCUMENT_ONLY_EVENT
|
||||
#undef DEFINED_DOCUMENT_ONLY_EVENT
|
||||
#undef DOCUMENT_ONLY_EVENT
|
||||
#endif /* DEFINED_DOCUMENT_ONLY_EVENT */
|
||||
|
||||
#ifdef DEFINED_NON_IDL_EVENT
|
||||
#undef DEFINED_NON_IDL_EVENT
|
||||
#undef NON_IDL_EVENT
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
<?xml-stylesheet href="chrome://browser/skin/" type="text/css"?>
|
||||
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" xmlns:html="http://www.w3.org/1999/xhtml">
|
||||
|
||||
<box id="e">
|
||||
<box id="b" name="e" style="-moz-binding:url(680922-binding.xml#xbl);">
|
||||
</box>
|
||||
</box>
|
||||
|
||||
</window>
|
|
@ -0,0 +1,7 @@
|
|||
<bindings xmlns="http://www.mozilla.org/xbl" xmlns:html="http://www.w3.org/1999/xhtml">
|
||||
<binding id="xbl" inheritstyle="false">
|
||||
<content>
|
||||
<html:form id="g" observes="b"/>
|
||||
</content>
|
||||
</binding>
|
||||
</bindings>
|
|
@ -29,5 +29,6 @@ load 614279.html
|
|||
load 614988-1.html
|
||||
load 620078-1.html
|
||||
load 620078-2.html
|
||||
load 680922-1.xul
|
||||
load 682058.xhtml
|
||||
load 682460.html
|
||||
|
|
|
@ -277,6 +277,7 @@ _TEST_FILES = \
|
|||
test_checked.html \
|
||||
test_bug677658.html \
|
||||
test_bug677463.html \
|
||||
test_bug682886.html \
|
||||
file_fullscreen-api.html \
|
||||
file_fullscreen-api-keys.html \
|
||||
test_fullscreen-api.html \
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=682886
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 682886</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=682886">Mozilla Bug 682886</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
|
||||
/** Test for Bug 682886 **/
|
||||
|
||||
|
||||
var m = document.createElement("menu");
|
||||
var s = "<menuitem>foo</menuitem>";
|
||||
m.innerHTML = s;
|
||||
is(m.innerHTML, s, "Wrong menuitem serialization!");
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
|
@ -102,6 +102,7 @@ DOMCI_NODE_DATA(ProcessingInstruction, nsXMLProcessingInstruction)
|
|||
NS_INTERFACE_TABLE_HEAD(nsXMLProcessingInstruction)
|
||||
NS_NODE_OFFSET_AND_INTERFACE_TABLE_BEGIN(nsXMLProcessingInstruction)
|
||||
NS_INTERFACE_TABLE_ENTRY(nsXMLProcessingInstruction, nsIDOMNode)
|
||||
NS_INTERFACE_TABLE_ENTRY(nsXMLProcessingInstruction, nsIDOMCharacterData)
|
||||
NS_INTERFACE_TABLE_ENTRY(nsXMLProcessingInstruction,
|
||||
nsIDOMProcessingInstruction)
|
||||
NS_OFFSET_AND_INTERFACE_TABLE_END
|
||||
|
@ -122,18 +123,6 @@ nsXMLProcessingInstruction::GetTarget(nsAString& aTarget)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXMLProcessingInstruction::SetData(const nsAString& aData)
|
||||
{
|
||||
return SetNodeValue(aData);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXMLProcessingInstruction::GetData(nsAString& aData)
|
||||
{
|
||||
return nsGenericDOMDataNode::GetData(aData);
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsXMLProcessingInstruction::GetAttrValue(nsIAtom *aName, nsAString& aValue)
|
||||
{
|
||||
|
|
|
@ -59,6 +59,9 @@ public:
|
|||
// nsIDOMNode
|
||||
NS_FORWARD_NSIDOMNODE(nsGenericDOMDataNode::)
|
||||
|
||||
// nsIDOMCharacterData
|
||||
NS_FORWARD_NSIDOMCHARACTERDATA(nsGenericDOMDataNode::)
|
||||
|
||||
// nsIDOMProcessingInstruction
|
||||
NS_DECL_NSIDOMPROCESSINGINSTRUCTION
|
||||
|
||||
|
|
|
@ -1,48 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is TransforMiiX XSLT processor code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2001
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Peter Van der Beken <peterv@propagandism.org>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef TRANSFRMX_ATOMS_H
|
||||
#define TRANSFRMX_ATOMS_H
|
||||
|
||||
#include "nsGkAtoms.h"
|
||||
typedef class nsGkAtoms txXPathAtoms;
|
||||
typedef class nsGkAtoms txXMLAtoms;
|
||||
typedef class nsGkAtoms txXSLTAtoms;
|
||||
typedef class nsGkAtoms txHTMLAtoms;
|
||||
|
||||
#endif
|
|
@ -37,7 +37,7 @@
|
|||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "txNamespaceMap.h"
|
||||
#include "txAtoms.h"
|
||||
#include "nsGkAtoms.h"
|
||||
#include "txXPathNode.h"
|
||||
|
||||
txNamespaceMap::txNamespaceMap()
|
||||
|
@ -53,7 +53,7 @@ txNamespaceMap::txNamespaceMap(const txNamespaceMap& aOther)
|
|||
nsresult
|
||||
txNamespaceMap::mapNamespace(nsIAtom* aPrefix, const nsAString& aNamespaceURI)
|
||||
{
|
||||
nsIAtom* prefix = aPrefix == txXMLAtoms::_empty ? nsnull : aPrefix;
|
||||
nsIAtom* prefix = aPrefix == nsGkAtoms::_empty ? nsnull : aPrefix;
|
||||
|
||||
PRInt32 nsId;
|
||||
if (prefix && aNamespaceURI.IsEmpty()) {
|
||||
|
@ -101,11 +101,11 @@ txNamespaceMap::mapNamespace(nsIAtom* aPrefix, const nsAString& aNamespaceURI)
|
|||
PRInt32
|
||||
txNamespaceMap::lookupNamespace(nsIAtom* aPrefix)
|
||||
{
|
||||
if (aPrefix == txXMLAtoms::xml) {
|
||||
if (aPrefix == nsGkAtoms::xml) {
|
||||
return kNameSpaceID_XML;
|
||||
}
|
||||
|
||||
nsIAtom* prefix = aPrefix == txXMLAtoms::_empty ? 0 : aPrefix;
|
||||
nsIAtom* prefix = aPrefix == nsGkAtoms::_empty ? 0 : aPrefix;
|
||||
|
||||
PRInt32 index = mPrefixes.IndexOf(prefix);
|
||||
if (index >= 0) {
|
||||
|
@ -131,7 +131,7 @@ PRInt32
|
|||
txNamespaceMap::lookupNamespaceWithDefault(const nsAString& aPrefix)
|
||||
{
|
||||
nsCOMPtr<nsIAtom> prefix = do_GetAtom(aPrefix);
|
||||
if (prefix != txXSLTAtoms::_poundDefault) {
|
||||
if (prefix != nsGkAtoms::_poundDefault) {
|
||||
return lookupNamespace(prefix);
|
||||
}
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
#include "txXMLUtils.h"
|
||||
#include "nsString.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "txAtoms.h"
|
||||
#include "nsGkAtoms.h"
|
||||
#include "txStringUtils.h"
|
||||
#include "txNamespaceMap.h"
|
||||
#include "txXPathTreeWalker.h"
|
||||
|
@ -235,11 +235,11 @@ MBool XMLUtils::getXMLSpacePreserve(const txXPathNode& aNode)
|
|||
nsAutoString value;
|
||||
txXPathTreeWalker walker(aNode);
|
||||
do {
|
||||
if (walker.getAttr(txXMLAtoms::space, kNameSpaceID_XML, value)) {
|
||||
if (TX_StringEqualsAtom(value, txXMLAtoms::preserve)) {
|
||||
if (walker.getAttr(nsGkAtoms::space, kNameSpaceID_XML, value)) {
|
||||
if (TX_StringEqualsAtom(value, nsGkAtoms::preserve)) {
|
||||
return PR_TRUE;
|
||||
}
|
||||
if (TX_StringEqualsAtom(value, txXMLAtoms::_default)) {
|
||||
if (TX_StringEqualsAtom(value, nsGkAtoms::_default)) {
|
||||
return PR_FALSE;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
#include "txExpr.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "txNodeSet.h"
|
||||
#include "txAtoms.h"
|
||||
#include "nsGkAtoms.h"
|
||||
#include "txIXPathContext.h"
|
||||
#include "nsWhitespaceTokenizer.h"
|
||||
#include "txXPathTreeWalker.h"
|
||||
|
@ -59,36 +59,36 @@ struct txCoreFunctionDescriptor
|
|||
// If you change one, change the other.
|
||||
static const txCoreFunctionDescriptor descriptTable[] =
|
||||
{
|
||||
{ 1, 1, Expr::NUMBER_RESULT, &txXPathAtoms::count }, // COUNT
|
||||
{ 1, 1, Expr::NODESET_RESULT, &txXPathAtoms::id }, // ID
|
||||
{ 0, 0, Expr::NUMBER_RESULT, &txXPathAtoms::last }, // LAST
|
||||
{ 0, 1, Expr::STRING_RESULT, &txXPathAtoms::localName }, // LOCAL_NAME
|
||||
{ 0, 1, Expr::STRING_RESULT, &txXPathAtoms::namespaceUri }, // NAMESPACE_URI
|
||||
{ 0, 1, Expr::STRING_RESULT, &txXPathAtoms::name }, // NAME
|
||||
{ 0, 0, Expr::NUMBER_RESULT, &txXPathAtoms::position }, // POSITION
|
||||
{ 1, 1, Expr::NUMBER_RESULT, &nsGkAtoms::count }, // COUNT
|
||||
{ 1, 1, Expr::NODESET_RESULT, &nsGkAtoms::id }, // ID
|
||||
{ 0, 0, Expr::NUMBER_RESULT, &nsGkAtoms::last }, // LAST
|
||||
{ 0, 1, Expr::STRING_RESULT, &nsGkAtoms::localName }, // LOCAL_NAME
|
||||
{ 0, 1, Expr::STRING_RESULT, &nsGkAtoms::namespaceUri }, // NAMESPACE_URI
|
||||
{ 0, 1, Expr::STRING_RESULT, &nsGkAtoms::name }, // NAME
|
||||
{ 0, 0, Expr::NUMBER_RESULT, &nsGkAtoms::position }, // POSITION
|
||||
|
||||
{ 2, -1, Expr::STRING_RESULT, &txXPathAtoms::concat }, // CONCAT
|
||||
{ 2, 2, Expr::BOOLEAN_RESULT, &txXPathAtoms::contains }, // CONTAINS
|
||||
{ 0, 1, Expr::STRING_RESULT, &txXPathAtoms::normalizeSpace }, // NORMALIZE_SPACE
|
||||
{ 2, 2, Expr::BOOLEAN_RESULT, &txXPathAtoms::startsWith }, // STARTS_WITH
|
||||
{ 0, 1, Expr::STRING_RESULT, &txXPathAtoms::string }, // STRING
|
||||
{ 0, 1, Expr::NUMBER_RESULT, &txXPathAtoms::stringLength }, // STRING_LENGTH
|
||||
{ 2, 3, Expr::STRING_RESULT, &txXPathAtoms::substring }, // SUBSTRING
|
||||
{ 2, 2, Expr::STRING_RESULT, &txXPathAtoms::substringAfter }, // SUBSTRING_AFTER
|
||||
{ 2, 2, Expr::STRING_RESULT, &txXPathAtoms::substringBefore }, // SUBSTRING_BEFORE
|
||||
{ 3, 3, Expr::STRING_RESULT, &txXPathAtoms::translate }, // TRANSLATE
|
||||
{ 2, -1, Expr::STRING_RESULT, &nsGkAtoms::concat }, // CONCAT
|
||||
{ 2, 2, Expr::BOOLEAN_RESULT, &nsGkAtoms::contains }, // CONTAINS
|
||||
{ 0, 1, Expr::STRING_RESULT, &nsGkAtoms::normalizeSpace }, // NORMALIZE_SPACE
|
||||
{ 2, 2, Expr::BOOLEAN_RESULT, &nsGkAtoms::startsWith }, // STARTS_WITH
|
||||
{ 0, 1, Expr::STRING_RESULT, &nsGkAtoms::string }, // STRING
|
||||
{ 0, 1, Expr::NUMBER_RESULT, &nsGkAtoms::stringLength }, // STRING_LENGTH
|
||||
{ 2, 3, Expr::STRING_RESULT, &nsGkAtoms::substring }, // SUBSTRING
|
||||
{ 2, 2, Expr::STRING_RESULT, &nsGkAtoms::substringAfter }, // SUBSTRING_AFTER
|
||||
{ 2, 2, Expr::STRING_RESULT, &nsGkAtoms::substringBefore }, // SUBSTRING_BEFORE
|
||||
{ 3, 3, Expr::STRING_RESULT, &nsGkAtoms::translate }, // TRANSLATE
|
||||
|
||||
{ 0, 1, Expr::NUMBER_RESULT, &txXPathAtoms::number }, // NUMBER
|
||||
{ 1, 1, Expr::NUMBER_RESULT, &txXPathAtoms::round }, // ROUND
|
||||
{ 1, 1, Expr::NUMBER_RESULT, &txXPathAtoms::floor }, // FLOOR
|
||||
{ 1, 1, Expr::NUMBER_RESULT, &txXPathAtoms::ceiling }, // CEILING
|
||||
{ 1, 1, Expr::NUMBER_RESULT, &txXPathAtoms::sum }, // SUM
|
||||
{ 0, 1, Expr::NUMBER_RESULT, &nsGkAtoms::number }, // NUMBER
|
||||
{ 1, 1, Expr::NUMBER_RESULT, &nsGkAtoms::round }, // ROUND
|
||||
{ 1, 1, Expr::NUMBER_RESULT, &nsGkAtoms::floor }, // FLOOR
|
||||
{ 1, 1, Expr::NUMBER_RESULT, &nsGkAtoms::ceiling }, // CEILING
|
||||
{ 1, 1, Expr::NUMBER_RESULT, &nsGkAtoms::sum }, // SUM
|
||||
|
||||
{ 1, 1, Expr::BOOLEAN_RESULT, &txXPathAtoms::boolean }, // BOOLEAN
|
||||
{ 0, 0, Expr::BOOLEAN_RESULT, &txXPathAtoms::_false }, // _FALSE
|
||||
{ 1, 1, Expr::BOOLEAN_RESULT, &txXPathAtoms::lang }, // LANG
|
||||
{ 1, 1, Expr::BOOLEAN_RESULT, &txXPathAtoms::_not }, // _NOT
|
||||
{ 0, 0, Expr::BOOLEAN_RESULT, &txXPathAtoms::_true } // _TRUE
|
||||
{ 1, 1, Expr::BOOLEAN_RESULT, &nsGkAtoms::boolean }, // BOOLEAN
|
||||
{ 0, 0, Expr::BOOLEAN_RESULT, &nsGkAtoms::_false }, // _FALSE
|
||||
{ 1, 1, Expr::BOOLEAN_RESULT, &nsGkAtoms::lang }, // LANG
|
||||
{ 1, 1, Expr::BOOLEAN_RESULT, &nsGkAtoms::_not }, // _NOT
|
||||
{ 0, 0, Expr::BOOLEAN_RESULT, &nsGkAtoms::_true } // _TRUE
|
||||
};
|
||||
|
||||
|
||||
|
@ -636,7 +636,7 @@ txCoreFunctionCall::evaluate(txIEvalContext* aContext, txAExprResult** aResult)
|
|||
nsAutoString lang;
|
||||
PRBool found;
|
||||
do {
|
||||
found = walker.getAttr(txXMLAtoms::lang, kNameSpaceID_XML,
|
||||
found = walker.getAttr(nsGkAtoms::lang, kNameSpaceID_XML,
|
||||
lang);
|
||||
} while (!found && walker.moveToParent());
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
*/
|
||||
|
||||
#include "txExprLexer.h"
|
||||
#include "txAtoms.h"
|
||||
#include "nsGkAtoms.h"
|
||||
#include "nsString.h"
|
||||
#include "txError.h"
|
||||
#include "txXMLUtils.h"
|
||||
|
@ -180,16 +180,16 @@ txExprLexer::parse(const nsASingleFragmentString& aPattern)
|
|||
}
|
||||
if (nextIsOperatorToken(prevToken)) {
|
||||
nsDependentSubstring op(Substring(start, mPosition));
|
||||
if (txXPathAtoms::_and->Equals(op)) {
|
||||
if (nsGkAtoms::_and->Equals(op)) {
|
||||
defType = Token::AND_OP;
|
||||
}
|
||||
else if (txXPathAtoms::_or->Equals(op)) {
|
||||
else if (nsGkAtoms::_or->Equals(op)) {
|
||||
defType = Token::OR_OP;
|
||||
}
|
||||
else if (txXPathAtoms::mod->Equals(op)) {
|
||||
else if (nsGkAtoms::mod->Equals(op)) {
|
||||
defType = Token::MODULUS_OP;
|
||||
}
|
||||
else if (txXPathAtoms::div->Equals(op)) {
|
||||
else if (nsGkAtoms::div->Equals(op)) {
|
||||
defType = Token::DIVIDE_OP;
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
#include "txExprLexer.h"
|
||||
#include "txExpr.h"
|
||||
#include "txStack.h"
|
||||
#include "txAtoms.h"
|
||||
#include "nsGkAtoms.h"
|
||||
#include "txError.h"
|
||||
#include "txIXPathContext.h"
|
||||
#include "txStringUtils.h"
|
||||
|
@ -518,43 +518,43 @@ txExprParser::createLocationStep(txExprLexer& lexer, txIParseContext* aContext,
|
|||
//-- eat token
|
||||
lexer.nextToken();
|
||||
nsCOMPtr<nsIAtom> axis = do_GetAtom(tok->Value());
|
||||
if (axis == txXPathAtoms::ancestor) {
|
||||
if (axis == nsGkAtoms::ancestor) {
|
||||
axisIdentifier = LocationStep::ANCESTOR_AXIS;
|
||||
}
|
||||
else if (axis == txXPathAtoms::ancestorOrSelf) {
|
||||
else if (axis == nsGkAtoms::ancestorOrSelf) {
|
||||
axisIdentifier = LocationStep::ANCESTOR_OR_SELF_AXIS;
|
||||
}
|
||||
else if (axis == txXPathAtoms::attribute) {
|
||||
else if (axis == nsGkAtoms::attribute) {
|
||||
axisIdentifier = LocationStep::ATTRIBUTE_AXIS;
|
||||
}
|
||||
else if (axis == txXPathAtoms::child) {
|
||||
else if (axis == nsGkAtoms::child) {
|
||||
axisIdentifier = LocationStep::CHILD_AXIS;
|
||||
}
|
||||
else if (axis == txXPathAtoms::descendant) {
|
||||
else if (axis == nsGkAtoms::descendant) {
|
||||
axisIdentifier = LocationStep::DESCENDANT_AXIS;
|
||||
}
|
||||
else if (axis == txXPathAtoms::descendantOrSelf) {
|
||||
else if (axis == nsGkAtoms::descendantOrSelf) {
|
||||
axisIdentifier = LocationStep::DESCENDANT_OR_SELF_AXIS;
|
||||
}
|
||||
else if (axis == txXPathAtoms::following) {
|
||||
else if (axis == nsGkAtoms::following) {
|
||||
axisIdentifier = LocationStep::FOLLOWING_AXIS;
|
||||
}
|
||||
else if (axis == txXPathAtoms::followingSibling) {
|
||||
else if (axis == nsGkAtoms::followingSibling) {
|
||||
axisIdentifier = LocationStep::FOLLOWING_SIBLING_AXIS;
|
||||
}
|
||||
else if (axis == txXPathAtoms::_namespace) {
|
||||
else if (axis == nsGkAtoms::_namespace) {
|
||||
axisIdentifier = LocationStep::NAMESPACE_AXIS;
|
||||
}
|
||||
else if (axis == txXPathAtoms::parent) {
|
||||
else if (axis == nsGkAtoms::parent) {
|
||||
axisIdentifier = LocationStep::PARENT_AXIS;
|
||||
}
|
||||
else if (axis == txXPathAtoms::preceding) {
|
||||
else if (axis == nsGkAtoms::preceding) {
|
||||
axisIdentifier = LocationStep::PRECEDING_AXIS;
|
||||
}
|
||||
else if (axis == txXPathAtoms::precedingSibling) {
|
||||
else if (axis == nsGkAtoms::precedingSibling) {
|
||||
axisIdentifier = LocationStep::PRECEDING_SIBLING_AXIS;
|
||||
}
|
||||
else if (axis == txXPathAtoms::self) {
|
||||
else if (axis == nsGkAtoms::self) {
|
||||
axisIdentifier = LocationStep::SELF_AXIS;
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
|
||||
#include "txExpr.h"
|
||||
#include "nsIAtom.h"
|
||||
#include "txAtoms.h"
|
||||
#include "nsGkAtoms.h"
|
||||
#include "txXPathTreeWalker.h"
|
||||
#include "txIXPathContext.h"
|
||||
|
||||
|
@ -47,7 +47,7 @@ txNameTest::txNameTest(nsIAtom* aPrefix, nsIAtom* aLocalName, PRInt32 aNSID,
|
|||
:mPrefix(aPrefix), mLocalName(aLocalName), mNamespace(aNSID),
|
||||
mNodeType(aNodeType)
|
||||
{
|
||||
if (aPrefix == txXMLAtoms::_empty)
|
||||
if (aPrefix == nsGkAtoms::_empty)
|
||||
mPrefix = 0;
|
||||
NS_ASSERTION(aLocalName, "txNameTest without a local name?");
|
||||
NS_ASSERTION(aNodeType == txXPathNodeType::DOCUMENT_NODE ||
|
||||
|
@ -68,7 +68,7 @@ PRBool txNameTest::matches(const txXPathNode& aNode, txIMatchContext* aContext)
|
|||
}
|
||||
|
||||
// Totally wild?
|
||||
if (mLocalName == txXPathAtoms::_asterix && !mPrefix)
|
||||
if (mLocalName == nsGkAtoms::_asterix && !mPrefix)
|
||||
return MB_TRUE;
|
||||
|
||||
// Compare namespaces
|
||||
|
@ -79,7 +79,7 @@ PRBool txNameTest::matches(const txXPathNode& aNode, txIMatchContext* aContext)
|
|||
return MB_FALSE;
|
||||
|
||||
// Name wild?
|
||||
if (mLocalName == txXPathAtoms::_asterix)
|
||||
if (mLocalName == nsGkAtoms::_asterix)
|
||||
return MB_TRUE;
|
||||
|
||||
// Compare local-names
|
||||
|
@ -91,7 +91,7 @@ PRBool txNameTest::matches(const txXPathNode& aNode, txIMatchContext* aContext)
|
|||
*/
|
||||
double txNameTest::getDefaultPriority()
|
||||
{
|
||||
if (mLocalName == txXPathAtoms::_asterix) {
|
||||
if (mLocalName == nsGkAtoms::_asterix) {
|
||||
if (!mPrefix)
|
||||
return -0.5;
|
||||
return -0.25;
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
#include "txExpr.h"
|
||||
#include "nsIAtom.h"
|
||||
#include "txNodeSet.h"
|
||||
#include "txAtoms.h"
|
||||
#include "nsGkAtoms.h"
|
||||
#include "txIXPathContext.h"
|
||||
|
||||
//-------------------/
|
||||
|
@ -54,7 +54,7 @@ VariableRefExpr::VariableRefExpr(nsIAtom* aPrefix, nsIAtom* aLocalName,
|
|||
: mPrefix(aPrefix), mLocalName(aLocalName), mNamespace(aNSID)
|
||||
{
|
||||
NS_ASSERTION(mLocalName, "VariableRefExpr without local name?");
|
||||
if (mPrefix == txXMLAtoms::_empty)
|
||||
if (mPrefix == nsGkAtoms::_empty)
|
||||
mPrefix = 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
#include "txXPathOptimizer.h"
|
||||
#include "txExprResult.h"
|
||||
#include "nsIAtom.h"
|
||||
#include "txAtoms.h"
|
||||
#include "nsGkAtoms.h"
|
||||
#include "txXPathNode.h"
|
||||
#include "txExpr.h"
|
||||
#include "txIXPathContext.h"
|
||||
|
@ -175,7 +175,7 @@ txXPathOptimizer::optimizeStep(Expr* aInExpr, Expr** aOutExpr)
|
|||
if (!step->getSubExprAt(0) &&
|
||||
step->getNodeTest()->getType() == txNameTest::NAME_TEST &&
|
||||
(nameTest = static_cast<txNameTest*>(step->getNodeTest()))->
|
||||
mLocalName != txXPathAtoms::_asterix) {
|
||||
mLocalName != nsGkAtoms::_asterix) {
|
||||
|
||||
*aOutExpr = new txNamedAttributeStep(nameTest->mNamespace,
|
||||
nameTest->mPrefix,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#include "txAtoms.h"
|
||||
#include "nsGkAtoms.h"
|
||||
#include "txXSLTFunctions.h"
|
||||
#include "txExecutionState.h"
|
||||
|
||||
|
@ -54,7 +54,7 @@ CurrentFunctionCall::isSensitiveTo(ContextSensitivity aContext)
|
|||
nsresult
|
||||
CurrentFunctionCall::getNameAtom(nsIAtom** aAtom)
|
||||
{
|
||||
*aAtom = txXSLTAtoms::current;
|
||||
*aAtom = nsGkAtoms::current;
|
||||
NS_ADDREF(*aAtom);
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
* A representation of the XSLT additional function: document()
|
||||
*/
|
||||
|
||||
#include "txAtoms.h"
|
||||
#include "nsGkAtoms.h"
|
||||
#include "txIXPathContext.h"
|
||||
#include "txXSLTFunctions.h"
|
||||
#include "txExecutionState.h"
|
||||
|
@ -191,7 +191,7 @@ DocumentFunctionCall::isSensitiveTo(ContextSensitivity aContext)
|
|||
nsresult
|
||||
DocumentFunctionCall::getNameAtom(nsIAtom** aAtom)
|
||||
{
|
||||
*aAtom = txXSLTAtoms::document;
|
||||
*aAtom = nsGkAtoms::document;
|
||||
NS_ADDREF(*aAtom);
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsIAtom.h"
|
||||
#include "txAtoms.h"
|
||||
#include "nsGkAtoms.h"
|
||||
#include "txExecutionState.h"
|
||||
#include "txExpr.h"
|
||||
#include "txIXPathContext.h"
|
||||
|
@ -218,22 +218,22 @@ static const char kEXSLTDatesAndTimesNS[] = "http://exslt.org/dates-and-times";
|
|||
// txEXSLTFunctionCall::eType enum
|
||||
static txEXSLTFunctionDescriptor descriptTable[] =
|
||||
{
|
||||
{ 1, 1, Expr::NODESET_RESULT, &txXSLTAtoms::nodeSet, 0, kEXSLTCommonNS }, // NODE_SET
|
||||
{ 1, 1, Expr::STRING_RESULT, &txXSLTAtoms::objectType, 0, kEXSLTCommonNS }, // OBJECT_TYPE
|
||||
{ 2, 2, Expr::NODESET_RESULT, &txXSLTAtoms::difference, 0, kEXSLTSetsNS }, // DIFFERENCE
|
||||
{ 1, 1, Expr::NODESET_RESULT, &txXSLTAtoms::distinct, 0, kEXSLTSetsNS }, // DISTINCT
|
||||
{ 2, 2, Expr::BOOLEAN_RESULT, &txXSLTAtoms::hasSameNode, 0, kEXSLTSetsNS }, // HAS_SAME_NODE
|
||||
{ 2, 2, Expr::NODESET_RESULT, &txXSLTAtoms::intersection, 0, kEXSLTSetsNS }, // INTERSECTION
|
||||
{ 2, 2, Expr::NODESET_RESULT, &txXSLTAtoms::leading, 0, kEXSLTSetsNS }, // LEADING
|
||||
{ 2, 2, Expr::NODESET_RESULT, &txXSLTAtoms::trailing, 0, kEXSLTSetsNS }, // TRAILING
|
||||
{ 1, 1, Expr::STRING_RESULT, &txXSLTAtoms::concat, 0, kEXSLTStringsNS }, // CONCAT
|
||||
{ 1, 2, Expr::STRING_RESULT, &txXSLTAtoms::split, 0, kEXSLTStringsNS }, // SPLIT
|
||||
{ 1, 2, Expr::STRING_RESULT, &txXSLTAtoms::tokenize, 0, kEXSLTStringsNS }, // TOKENIZE
|
||||
{ 1, 1, Expr::NUMBER_RESULT, &txXSLTAtoms::max, 0, kEXSLTMathNS }, // MAX
|
||||
{ 1, 1, Expr::NUMBER_RESULT, &txXSLTAtoms::min, 0, kEXSLTMathNS }, // MIN
|
||||
{ 1, 1, Expr::NODESET_RESULT, &txXSLTAtoms::highest, 0, kEXSLTMathNS }, // HIGHEST
|
||||
{ 1, 1, Expr::NODESET_RESULT, &txXSLTAtoms::lowest, 0, kEXSLTMathNS }, // LOWEST
|
||||
{ 0, 0, Expr::STRING_RESULT, &txXSLTAtoms::dateTime, 0, kEXSLTDatesAndTimesNS }, // DATE_TIME
|
||||
{ 1, 1, Expr::NODESET_RESULT, &nsGkAtoms::nodeSet, 0, kEXSLTCommonNS }, // NODE_SET
|
||||
{ 1, 1, Expr::STRING_RESULT, &nsGkAtoms::objectType, 0, kEXSLTCommonNS }, // OBJECT_TYPE
|
||||
{ 2, 2, Expr::NODESET_RESULT, &nsGkAtoms::difference, 0, kEXSLTSetsNS }, // DIFFERENCE
|
||||
{ 1, 1, Expr::NODESET_RESULT, &nsGkAtoms::distinct, 0, kEXSLTSetsNS }, // DISTINCT
|
||||
{ 2, 2, Expr::BOOLEAN_RESULT, &nsGkAtoms::hasSameNode, 0, kEXSLTSetsNS }, // HAS_SAME_NODE
|
||||
{ 2, 2, Expr::NODESET_RESULT, &nsGkAtoms::intersection, 0, kEXSLTSetsNS }, // INTERSECTION
|
||||
{ 2, 2, Expr::NODESET_RESULT, &nsGkAtoms::leading, 0, kEXSLTSetsNS }, // LEADING
|
||||
{ 2, 2, Expr::NODESET_RESULT, &nsGkAtoms::trailing, 0, kEXSLTSetsNS }, // TRAILING
|
||||
{ 1, 1, Expr::STRING_RESULT, &nsGkAtoms::concat, 0, kEXSLTStringsNS }, // CONCAT
|
||||
{ 1, 2, Expr::STRING_RESULT, &nsGkAtoms::split, 0, kEXSLTStringsNS }, // SPLIT
|
||||
{ 1, 2, Expr::STRING_RESULT, &nsGkAtoms::tokenize, 0, kEXSLTStringsNS }, // TOKENIZE
|
||||
{ 1, 1, Expr::NUMBER_RESULT, &nsGkAtoms::max, 0, kEXSLTMathNS }, // MAX
|
||||
{ 1, 1, Expr::NUMBER_RESULT, &nsGkAtoms::min, 0, kEXSLTMathNS }, // MIN
|
||||
{ 1, 1, Expr::NODESET_RESULT, &nsGkAtoms::highest, 0, kEXSLTMathNS }, // HIGHEST
|
||||
{ 1, 1, Expr::NODESET_RESULT, &nsGkAtoms::lowest, 0, kEXSLTMathNS }, // LOWEST
|
||||
{ 0, 0, Expr::STRING_RESULT, &nsGkAtoms::dateTime, 0, kEXSLTDatesAndTimesNS }, // DATE_TIME
|
||||
|
||||
};
|
||||
|
||||
|
@ -541,7 +541,7 @@ txEXSLTFunctionCall::evaluate(txIEvalContext *aContext,
|
|||
nsString::const_char_iterator start = string.BeginReading();
|
||||
nsString::const_char_iterator end = string.EndReading();
|
||||
for (; start < end; ++start) {
|
||||
rv = createAndAddToResult(txXSLTAtoms::token,
|
||||
rv = createAndAddToResult(nsGkAtoms::token,
|
||||
Substring(start, start + 1),
|
||||
resultSet, docFrag);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
@ -557,7 +557,7 @@ txEXSLTFunctionCall::evaluate(txIEvalContext *aContext,
|
|||
|
||||
while (FindInReadable(pattern, start, end)) {
|
||||
if (start != strStart) {
|
||||
rv = createAndAddToResult(txXSLTAtoms::token,
|
||||
rv = createAndAddToResult(nsGkAtoms::token,
|
||||
Substring(strStart, start),
|
||||
resultSet, docFrag);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
@ -573,7 +573,7 @@ txEXSLTFunctionCall::evaluate(txIEvalContext *aContext,
|
|||
while ((found = string.FindCharInSet(pattern, start)) !=
|
||||
kNotFound) {
|
||||
if (found != start) {
|
||||
rv = createAndAddToResult(txXSLTAtoms::token,
|
||||
rv = createAndAddToResult(nsGkAtoms::token,
|
||||
Substring(string, start,
|
||||
found - start),
|
||||
resultSet, docFrag);
|
||||
|
@ -587,7 +587,7 @@ txEXSLTFunctionCall::evaluate(txIEvalContext *aContext,
|
|||
|
||||
// Add tail if needed
|
||||
if (tailIndex != (PRUint32)string.Length()) {
|
||||
rv = createAndAddToResult(txXSLTAtoms::token,
|
||||
rv = createAndAddToResult(nsGkAtoms::token,
|
||||
Substring(string, tailIndex),
|
||||
resultSet, docFrag);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "txXSLTFunctions.h"
|
||||
#include "txAtoms.h"
|
||||
#include "nsGkAtoms.h"
|
||||
#include "txIXPathContext.h"
|
||||
#include "txStylesheet.h"
|
||||
#include <math.h>
|
||||
|
@ -424,7 +424,7 @@ txFormatNumberFunctionCall::isSensitiveTo(ContextSensitivity aContext)
|
|||
nsresult
|
||||
txFormatNumberFunctionCall::getNameAtom(nsIAtom** aAtom)
|
||||
{
|
||||
*aAtom = txXSLTAtoms::formatNumber;
|
||||
*aAtom = nsGkAtoms::formatNumber;
|
||||
NS_ADDREF(*aAtom);
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "txAtoms.h"
|
||||
#include "nsGkAtoms.h"
|
||||
#include "txIXPathContext.h"
|
||||
#include "txNodeSet.h"
|
||||
#include "txXPathTreeWalker.h"
|
||||
|
@ -135,7 +135,7 @@ GenerateIdFunctionCall::isSensitiveTo(ContextSensitivity aContext)
|
|||
nsresult
|
||||
GenerateIdFunctionCall::getNameAtom(nsIAtom** aAtom)
|
||||
{
|
||||
*aAtom = txXSLTAtoms::generateId;
|
||||
*aAtom = nsGkAtoms::generateId;
|
||||
NS_ADDREF(*aAtom);
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
#include "nsIConsoleService.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "txStringUtils.h"
|
||||
#include "txAtoms.h"
|
||||
#include "nsGkAtoms.h"
|
||||
#include "txRtfHandler.h"
|
||||
#include "txNodeSorter.h"
|
||||
#include "txXSLTNumber.h"
|
||||
|
@ -136,7 +136,7 @@ txAttribute::execute(txExecutionState& aEs)
|
|||
|
||||
const PRUnichar* colon;
|
||||
if (!XMLUtils::isValidQName(name, &colon) ||
|
||||
TX_StringEqualsAtom(name, txXMLAtoms::xmlns)) {
|
||||
TX_StringEqualsAtom(name, nsGkAtoms::xmlns)) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "txExecutionState.h"
|
||||
#include "txAtoms.h"
|
||||
#include "nsGkAtoms.h"
|
||||
#include "txSingleNodeContext.h"
|
||||
#include "txXSLTFunctions.h"
|
||||
#include "nsReadableUtils.h"
|
||||
|
@ -142,7 +142,7 @@ txKeyFunctionCall::isSensitiveTo(ContextSensitivity aContext)
|
|||
nsresult
|
||||
txKeyFunctionCall::getNameAtom(nsIAtom** aAtom)
|
||||
{
|
||||
*aAtom = txXSLTAtoms::key;
|
||||
*aAtom = nsGkAtoms::key;
|
||||
NS_ADDREF(*aAtom);
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -62,7 +62,7 @@
|
|||
#include "nsMimeTypes.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsParserCIID.h"
|
||||
#include "txAtoms.h"
|
||||
#include "nsGkAtoms.h"
|
||||
#include "txLog.h"
|
||||
#include "txMozillaXSLTProcessor.h"
|
||||
#include "txStylesheetCompiler.h"
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
#include "nsContentCID.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsUnicharUtils.h"
|
||||
#include "txAtoms.h"
|
||||
#include "nsGkAtoms.h"
|
||||
#include "txLog.h"
|
||||
#include "nsIConsoleService.h"
|
||||
#include "nsIDOMDocumentFragment.h"
|
||||
|
@ -716,7 +716,7 @@ txMozillaXMLOutput::startHTMLElement(nsIContent* aElement, PRBool aIsHTML)
|
|||
nsresult rv = NS_OK;
|
||||
nsIAtom *atom = aElement->Tag();
|
||||
|
||||
if ((atom != txHTMLAtoms::tr || !aIsHTML) &&
|
||||
if ((atom != nsGkAtoms::tr || !aIsHTML) &&
|
||||
NS_PTR_TO_INT32(mTableStateStack.peek()) == ADDED_TBODY) {
|
||||
PRUint32 last = mCurrentNodeStack.Count() - 1;
|
||||
NS_ASSERTION(last != (PRUint32)-1, "empty stack");
|
||||
|
@ -726,10 +726,10 @@ txMozillaXMLOutput::startHTMLElement(nsIContent* aElement, PRBool aIsHTML)
|
|||
mTableStateStack.pop();
|
||||
}
|
||||
|
||||
if (atom == txHTMLAtoms::table && aIsHTML) {
|
||||
if (atom == nsGkAtoms::table && aIsHTML) {
|
||||
mTableState = TABLE;
|
||||
}
|
||||
else if (atom == txHTMLAtoms::tr && aIsHTML &&
|
||||
else if (atom == nsGkAtoms::tr && aIsHTML &&
|
||||
NS_PTR_TO_INT32(mTableStateStack.peek()) == TABLE) {
|
||||
nsCOMPtr<nsIContent> tbody;
|
||||
rv = createHTMLElement(nsGkAtoms::tbody, getter_AddRefs(tbody));
|
||||
|
@ -747,7 +747,7 @@ txMozillaXMLOutput::startHTMLElement(nsIContent* aElement, PRBool aIsHTML)
|
|||
|
||||
mCurrentNode = tbody;
|
||||
}
|
||||
else if (atom == txHTMLAtoms::head &&
|
||||
else if (atom == nsGkAtoms::head &&
|
||||
mOutputFormat.mMethod == eHTMLOutput) {
|
||||
// Insert META tag, according to spec, 16.2, like
|
||||
// <META http-equiv="Content-Type" content="text/html; charset=EUC-JP">
|
||||
|
@ -782,7 +782,7 @@ txMozillaXMLOutput::endHTMLElement(nsIContent* aElement)
|
|||
nsIAtom *atom = aElement->Tag();
|
||||
|
||||
if (mTableState == ADDED_TBODY) {
|
||||
NS_ASSERTION(atom == txHTMLAtoms::tbody,
|
||||
NS_ASSERTION(atom == nsGkAtoms::tbody,
|
||||
"Element flagged as added tbody isn't a tbody");
|
||||
PRUint32 last = mCurrentNodeStack.Count() - 1;
|
||||
NS_ASSERTION(last != (PRUint32)-1, "empty stack");
|
||||
|
@ -794,13 +794,13 @@ txMozillaXMLOutput::endHTMLElement(nsIContent* aElement)
|
|||
|
||||
return NS_OK;
|
||||
}
|
||||
else if (mCreatingNewDocument && atom == txHTMLAtoms::meta) {
|
||||
else if (mCreatingNewDocument && atom == nsGkAtoms::meta) {
|
||||
// handle HTTP-EQUIV data
|
||||
nsAutoString httpEquiv;
|
||||
aElement->GetAttr(kNameSpaceID_None, txHTMLAtoms::httpEquiv, httpEquiv);
|
||||
aElement->GetAttr(kNameSpaceID_None, nsGkAtoms::httpEquiv, httpEquiv);
|
||||
if (!httpEquiv.IsEmpty()) {
|
||||
nsAutoString value;
|
||||
aElement->GetAttr(kNameSpaceID_None, txHTMLAtoms::content, value);
|
||||
aElement->GetAttr(kNameSpaceID_None, nsGkAtoms::content, value);
|
||||
if (!value.IsEmpty()) {
|
||||
ToLowerCase(httpEquiv);
|
||||
nsCOMPtr<nsIAtom> header = do_GetAtom(httpEquiv);
|
||||
|
@ -816,7 +816,7 @@ void txMozillaXMLOutput::processHTTPEquiv(nsIAtom* aHeader, const nsString& aVal
|
|||
{
|
||||
// For now we only handle "refresh". There's a longer list in
|
||||
// HTMLContentSink::ProcessHeaderData
|
||||
if (aHeader == txHTMLAtoms::refresh)
|
||||
if (aHeader == nsGkAtoms::refresh)
|
||||
LossyCopyUTF16toASCII(aValue, mRefreshString);
|
||||
}
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
#include "txNodeSorter.h"
|
||||
#include "txExecutionState.h"
|
||||
#include "txXPathResultComparator.h"
|
||||
#include "txAtoms.h"
|
||||
#include "nsGkAtoms.h"
|
||||
#include "txNodeSetContext.h"
|
||||
#include "txExpr.h"
|
||||
#include "txStringUtils.h"
|
||||
|
@ -84,10 +84,10 @@ txNodeSorter::addSortElement(Expr* aSelectExpr, Expr* aLangExpr,
|
|||
rv = aOrderExpr->evaluateToString(aContext, attrValue);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (TX_StringEqualsAtom(attrValue, txXSLTAtoms::descending)) {
|
||||
if (TX_StringEqualsAtom(attrValue, nsGkAtoms::descending)) {
|
||||
ascending = MB_FALSE;
|
||||
}
|
||||
else if (!TX_StringEqualsAtom(attrValue, txXSLTAtoms::ascending)) {
|
||||
else if (!TX_StringEqualsAtom(attrValue, nsGkAtoms::ascending)) {
|
||||
// XXX ErrorReport: unknown value for order attribute
|
||||
return NS_ERROR_XSLT_BAD_VALUE;
|
||||
}
|
||||
|
@ -101,7 +101,7 @@ txNodeSorter::addSortElement(Expr* aSelectExpr, Expr* aLangExpr,
|
|||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
if (!aDataTypeExpr || TX_StringEqualsAtom(dataType, txXSLTAtoms::text)) {
|
||||
if (!aDataTypeExpr || TX_StringEqualsAtom(dataType, nsGkAtoms::text)) {
|
||||
// Text comparator
|
||||
|
||||
// Language
|
||||
|
@ -119,11 +119,11 @@ txNodeSorter::addSortElement(Expr* aSelectExpr, Expr* aLangExpr,
|
|||
rv = aCaseOrderExpr->evaluateToString(aContext, attrValue);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (TX_StringEqualsAtom(attrValue, txXSLTAtoms::upperFirst)) {
|
||||
if (TX_StringEqualsAtom(attrValue, nsGkAtoms::upperFirst)) {
|
||||
upperFirst = PR_TRUE;
|
||||
}
|
||||
else if (!TX_StringEqualsAtom(attrValue,
|
||||
txXSLTAtoms::lowerFirst)) {
|
||||
nsGkAtoms::lowerFirst)) {
|
||||
// XXX ErrorReport: unknown value for case-order attribute
|
||||
return NS_ERROR_XSLT_BAD_VALUE;
|
||||
}
|
||||
|
@ -134,7 +134,7 @@ txNodeSorter::addSortElement(Expr* aSelectExpr, Expr* aLangExpr,
|
|||
lang);
|
||||
NS_ENSURE_TRUE(key->mComparator, NS_ERROR_OUT_OF_MEMORY);
|
||||
}
|
||||
else if (TX_StringEqualsAtom(dataType, txXSLTAtoms::number)) {
|
||||
else if (TX_StringEqualsAtom(dataType, nsGkAtoms::number)) {
|
||||
// Number comparator
|
||||
key->mComparator = new txResultNumberComparator(ascending);
|
||||
NS_ENSURE_TRUE(key->mComparator, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
|
||||
#include "txPatternParser.h"
|
||||
#include "txExprLexer.h"
|
||||
#include "txAtoms.h"
|
||||
#include "nsGkAtoms.h"
|
||||
#include "txError.h"
|
||||
#include "txStringUtils.h"
|
||||
#include "txXSLTPatterns.h"
|
||||
|
@ -166,10 +166,10 @@ nsresult txPatternParser::createLocPathPattern(txExprLexer& aLexer,
|
|||
{
|
||||
nsCOMPtr<nsIAtom> nameAtom =
|
||||
do_GetAtom(aLexer.nextToken()->Value());
|
||||
if (nameAtom == txXPathAtoms::id) {
|
||||
if (nameAtom == nsGkAtoms::id) {
|
||||
rv = createIdPattern(aLexer, stepPattern);
|
||||
}
|
||||
else if (nameAtom == txXSLTAtoms::key) {
|
||||
else if (nameAtom == nsGkAtoms::key) {
|
||||
rv = createKeyPattern(aLexer, aContext, stepPattern);
|
||||
}
|
||||
if (NS_FAILED(rv))
|
||||
|
@ -302,10 +302,10 @@ nsresult txPatternParser::createStepPattern(txExprLexer& aLexer,
|
|||
MBool isAttr = MB_FALSE;
|
||||
Token* tok = aLexer.peek();
|
||||
if (tok->mType == Token::AXIS_IDENTIFIER) {
|
||||
if (TX_StringEqualsAtom(tok->Value(), txXPathAtoms::attribute)) {
|
||||
if (TX_StringEqualsAtom(tok->Value(), nsGkAtoms::attribute)) {
|
||||
isAttr = MB_TRUE;
|
||||
}
|
||||
else if (!TX_StringEqualsAtom(tok->Value(), txXPathAtoms::child)) {
|
||||
else if (!TX_StringEqualsAtom(tok->Value(), nsGkAtoms::child)) {
|
||||
// all done already for CHILD_AXIS, for all others
|
||||
// XXX report unexpected axis error
|
||||
return NS_ERROR_XPATH_PARSE_FAILURE;
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
#include "txStylesheetCompileHandlers.h"
|
||||
#include "nsWhitespaceTokenizer.h"
|
||||
#include "txInstructions.h"
|
||||
#include "txAtoms.h"
|
||||
#include "nsGkAtoms.h"
|
||||
#include "txCore.h"
|
||||
#include "txStringUtils.h"
|
||||
#include "txStylesheet.h"
|
||||
|
@ -126,7 +126,7 @@ parseUseAttrSets(txStylesheetAttr* aAttributes,
|
|||
nsresult rv = getStyleAttr(aAttributes, aAttrCount,
|
||||
aInXSLTNS ? kNameSpaceID_XSLT
|
||||
: kNameSpaceID_None,
|
||||
txXSLTAtoms::useAttributeSets, PR_FALSE,
|
||||
nsGkAtoms::useAttributeSets, PR_FALSE,
|
||||
&attr);
|
||||
if (!attr) {
|
||||
return rv;
|
||||
|
@ -155,7 +155,7 @@ parseExcludeResultPrefixes(txStylesheetAttr* aAttributes,
|
|||
{
|
||||
txStylesheetAttr* attr = nsnull;
|
||||
nsresult rv = getStyleAttr(aAttributes, aAttrCount, aNamespaceID,
|
||||
txXSLTAtoms::excludeResultPrefixes, PR_FALSE,
|
||||
nsGkAtoms::excludeResultPrefixes, PR_FALSE,
|
||||
&attr);
|
||||
if (!attr) {
|
||||
return rv;
|
||||
|
@ -354,10 +354,10 @@ getYesNoAttr(txStylesheetAttr* aAttributes,
|
|||
return rv;
|
||||
}
|
||||
|
||||
if (atom == txXSLTAtoms::yes) {
|
||||
if (atom == nsGkAtoms::yes) {
|
||||
aRes = eTrue;
|
||||
}
|
||||
else if (atom == txXSLTAtoms::no) {
|
||||
else if (atom == nsGkAtoms::no) {
|
||||
aRes = eFalse;
|
||||
}
|
||||
else if (aRequired || !aState.fcp()) {
|
||||
|
@ -501,14 +501,14 @@ txFnStartStylesheet(PRInt32 aNamespaceID,
|
|||
|
||||
txStylesheetAttr* attr;
|
||||
nsresult rv = getStyleAttr(aAttributes, aAttrCount, kNameSpaceID_None,
|
||||
txXSLTAtoms::id, PR_FALSE, &attr);
|
||||
nsGkAtoms::id, PR_FALSE, &attr);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = parseExcludeResultPrefixes(aAttributes, aAttrCount, kNameSpaceID_None);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = getStyleAttr(aAttributes, aAttrCount, kNameSpaceID_None,
|
||||
txXSLTAtoms::version, PR_TRUE, &attr);
|
||||
nsGkAtoms::version, PR_TRUE, &attr);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
return aState.pushHandlerTable(gTxImportHandler);
|
||||
|
@ -544,7 +544,7 @@ txFnStartLREStylesheet(PRInt32 aNamespaceID,
|
|||
{
|
||||
txStylesheetAttr* attr;
|
||||
nsresult rv = getStyleAttr(aAttributes, aAttrCount, kNameSpaceID_XSLT,
|
||||
txXSLTAtoms::version, PR_TRUE, &attr);
|
||||
nsGkAtoms::version, PR_TRUE, &attr);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
txExpandedName nullExpr;
|
||||
|
@ -601,8 +601,8 @@ txFnStartEmbed(PRInt32 aNamespaceID,
|
|||
return NS_OK;
|
||||
}
|
||||
if (aNamespaceID != kNameSpaceID_XSLT ||
|
||||
(aLocalName != txXSLTAtoms::stylesheet &&
|
||||
aLocalName != txXSLTAtoms::transform)) {
|
||||
(aLocalName != nsGkAtoms::stylesheet &&
|
||||
aLocalName != nsGkAtoms::transform)) {
|
||||
return NS_ERROR_XSLT_PARSE_FAILURE;
|
||||
}
|
||||
return txFnStartStylesheet(aNamespaceID, aLocalName, aPrefix,
|
||||
|
@ -659,7 +659,7 @@ txFnStartAttributeSet(PRInt32 aNamespaceID,
|
|||
{
|
||||
nsresult rv = NS_OK;
|
||||
txExpandedName name;
|
||||
rv = getQNameAttr(aAttributes, aAttrCount, txXSLTAtoms::name, PR_TRUE,
|
||||
rv = getQNameAttr(aAttributes, aAttrCount, nsGkAtoms::name, PR_TRUE,
|
||||
aState, name);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
|
@ -707,59 +707,59 @@ txFnStartDecimalFormat(PRInt32 aNamespaceID,
|
|||
{
|
||||
nsresult rv = NS_OK;
|
||||
txExpandedName name;
|
||||
rv = getQNameAttr(aAttributes, aAttrCount, txXSLTAtoms::name, PR_FALSE,
|
||||
rv = getQNameAttr(aAttributes, aAttrCount, nsGkAtoms::name, PR_FALSE,
|
||||
aState, name);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsAutoPtr<txDecimalFormat> format(new txDecimalFormat);
|
||||
NS_ENSURE_TRUE(format, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
rv = getCharAttr(aAttributes, aAttrCount, txXSLTAtoms::decimalSeparator,
|
||||
rv = getCharAttr(aAttributes, aAttrCount, nsGkAtoms::decimalSeparator,
|
||||
PR_FALSE, aState, format->mDecimalSeparator);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = getCharAttr(aAttributes, aAttrCount, txXSLTAtoms::groupingSeparator,
|
||||
rv = getCharAttr(aAttributes, aAttrCount, nsGkAtoms::groupingSeparator,
|
||||
PR_FALSE, aState, format->mGroupingSeparator);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
txStylesheetAttr* attr = nsnull;
|
||||
rv = getStyleAttr(aAttributes, aAttrCount, kNameSpaceID_None,
|
||||
txXSLTAtoms::infinity, PR_FALSE, &attr);
|
||||
nsGkAtoms::infinity, PR_FALSE, &attr);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (attr) {
|
||||
format->mInfinity = attr->mValue;
|
||||
}
|
||||
|
||||
rv = getCharAttr(aAttributes, aAttrCount, txXSLTAtoms::minusSign,
|
||||
rv = getCharAttr(aAttributes, aAttrCount, nsGkAtoms::minusSign,
|
||||
PR_FALSE, aState, format->mMinusSign);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = getStyleAttr(aAttributes, aAttrCount, kNameSpaceID_None,
|
||||
txXSLTAtoms::NaN, PR_FALSE, &attr);
|
||||
nsGkAtoms::NaN, PR_FALSE, &attr);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (attr) {
|
||||
format->mNaN = attr->mValue;
|
||||
}
|
||||
|
||||
rv = getCharAttr(aAttributes, aAttrCount, txXSLTAtoms::percent,
|
||||
rv = getCharAttr(aAttributes, aAttrCount, nsGkAtoms::percent,
|
||||
PR_FALSE, aState, format->mPercent);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = getCharAttr(aAttributes, aAttrCount, txXSLTAtoms::perMille,
|
||||
rv = getCharAttr(aAttributes, aAttrCount, nsGkAtoms::perMille,
|
||||
PR_FALSE, aState, format->mPerMille);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = getCharAttr(aAttributes, aAttrCount, txXSLTAtoms::zeroDigit,
|
||||
rv = getCharAttr(aAttributes, aAttrCount, nsGkAtoms::zeroDigit,
|
||||
PR_FALSE, aState, format->mZeroDigit);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = getCharAttr(aAttributes, aAttrCount, txXSLTAtoms::digit,
|
||||
rv = getCharAttr(aAttributes, aAttrCount, nsGkAtoms::digit,
|
||||
PR_FALSE, aState, format->mDigit);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = getCharAttr(aAttributes, aAttrCount, txXSLTAtoms::patternSeparator,
|
||||
rv = getCharAttr(aAttributes, aAttrCount, nsGkAtoms::patternSeparator,
|
||||
PR_FALSE, aState, format->mPatternSeparator);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
|
@ -799,7 +799,7 @@ txFnStartImport(PRInt32 aNamespaceID,
|
|||
|
||||
txStylesheetAttr* attr = nsnull;
|
||||
rv = getStyleAttr(aAttributes, aAttrCount, kNameSpaceID_None,
|
||||
txXSLTAtoms::href, PR_TRUE, &attr);
|
||||
nsGkAtoms::href, PR_TRUE, &attr);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsAutoString absUri;
|
||||
|
@ -830,7 +830,7 @@ txFnStartInclude(PRInt32 aNamespaceID,
|
|||
{
|
||||
txStylesheetAttr* attr = nsnull;
|
||||
nsresult rv = getStyleAttr(aAttributes, aAttrCount, kNameSpaceID_None,
|
||||
txXSLTAtoms::href, PR_TRUE, &attr);
|
||||
nsGkAtoms::href, PR_TRUE, &attr);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsAutoString absUri;
|
||||
|
@ -861,17 +861,17 @@ txFnStartKey(PRInt32 aNamespaceID,
|
|||
{
|
||||
nsresult rv = NS_OK;
|
||||
txExpandedName name;
|
||||
rv = getQNameAttr(aAttributes, aAttrCount, txXSLTAtoms::name, PR_TRUE,
|
||||
rv = getQNameAttr(aAttributes, aAttrCount, nsGkAtoms::name, PR_TRUE,
|
||||
aState, name);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsAutoPtr<txPattern> match;
|
||||
rv = getPatternAttr(aAttributes, aAttrCount, txXSLTAtoms::match, PR_TRUE,
|
||||
rv = getPatternAttr(aAttributes, aAttrCount, nsGkAtoms::match, PR_TRUE,
|
||||
aState, match);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsAutoPtr<Expr> use;
|
||||
rv = getExprAttr(aAttributes, aAttrCount, txXSLTAtoms::use, PR_TRUE,
|
||||
rv = getExprAttr(aAttributes, aAttrCount, nsGkAtoms::use, PR_TRUE,
|
||||
aState, use);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
|
@ -900,11 +900,11 @@ txFnStartNamespaceAlias(PRInt32 aNamespaceID,
|
|||
{
|
||||
txStylesheetAttr* attr = nsnull;
|
||||
nsresult rv = getStyleAttr(aAttributes, aAttrCount, kNameSpaceID_None,
|
||||
txXSLTAtoms::stylesheetPrefix, PR_TRUE, &attr);
|
||||
nsGkAtoms::stylesheetPrefix, PR_TRUE, &attr);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = getStyleAttr(aAttributes, aAttrCount, kNameSpaceID_None,
|
||||
txXSLTAtoms::resultPrefix, PR_TRUE, &attr);
|
||||
nsGkAtoms::resultPrefix, PR_TRUE, &attr);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// XXX Needs to be implemented.
|
||||
|
@ -935,7 +935,7 @@ txFnStartOutput(PRInt32 aNamespaceID,
|
|||
NS_ENSURE_TRUE(item, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
txExpandedName methodExpName;
|
||||
rv = getQNameAttr(aAttributes, aAttrCount, txXSLTAtoms::method, PR_FALSE,
|
||||
rv = getQNameAttr(aAttributes, aAttrCount, nsGkAtoms::method, PR_FALSE,
|
||||
aState, methodExpName);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
|
@ -944,13 +944,13 @@ txFnStartOutput(PRInt32 aNamespaceID,
|
|||
// The spec doesn't say what to do here so we'll just ignore the
|
||||
// value. We could possibly warn.
|
||||
}
|
||||
else if (methodExpName.mLocalName == txXSLTAtoms::html) {
|
||||
else if (methodExpName.mLocalName == nsGkAtoms::html) {
|
||||
item->mFormat.mMethod = eHTMLOutput;
|
||||
}
|
||||
else if (methodExpName.mLocalName == txXSLTAtoms::text) {
|
||||
else if (methodExpName.mLocalName == nsGkAtoms::text) {
|
||||
item->mFormat.mMethod = eTextOutput;
|
||||
}
|
||||
else if (methodExpName.mLocalName == txXSLTAtoms::xml) {
|
||||
else if (methodExpName.mLocalName == nsGkAtoms::xml) {
|
||||
item->mFormat.mMethod = eXMLOutput;
|
||||
}
|
||||
else {
|
||||
|
@ -960,41 +960,41 @@ txFnStartOutput(PRInt32 aNamespaceID,
|
|||
|
||||
txStylesheetAttr* attr = nsnull;
|
||||
getStyleAttr(aAttributes, aAttrCount, kNameSpaceID_None,
|
||||
txXSLTAtoms::version, PR_FALSE, &attr);
|
||||
nsGkAtoms::version, PR_FALSE, &attr);
|
||||
if (attr) {
|
||||
item->mFormat.mVersion = attr->mValue;
|
||||
}
|
||||
|
||||
getStyleAttr(aAttributes, aAttrCount, kNameSpaceID_None,
|
||||
txXSLTAtoms::encoding, PR_FALSE, &attr);
|
||||
nsGkAtoms::encoding, PR_FALSE, &attr);
|
||||
if (attr) {
|
||||
item->mFormat.mEncoding = attr->mValue;
|
||||
}
|
||||
|
||||
rv = getYesNoAttr(aAttributes, aAttrCount,
|
||||
txXSLTAtoms::omitXmlDeclaration, PR_FALSE, aState,
|
||||
nsGkAtoms::omitXmlDeclaration, PR_FALSE, aState,
|
||||
item->mFormat.mOmitXMLDeclaration);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = getYesNoAttr(aAttributes, aAttrCount,
|
||||
txXSLTAtoms::standalone, PR_FALSE, aState,
|
||||
nsGkAtoms::standalone, PR_FALSE, aState,
|
||||
item->mFormat.mStandalone);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
getStyleAttr(aAttributes, aAttrCount, kNameSpaceID_None,
|
||||
txXSLTAtoms::doctypePublic, PR_FALSE, &attr);
|
||||
nsGkAtoms::doctypePublic, PR_FALSE, &attr);
|
||||
if (attr) {
|
||||
item->mFormat.mPublicId = attr->mValue;
|
||||
}
|
||||
|
||||
getStyleAttr(aAttributes, aAttrCount, kNameSpaceID_None,
|
||||
txXSLTAtoms::doctypeSystem, PR_FALSE, &attr);
|
||||
nsGkAtoms::doctypeSystem, PR_FALSE, &attr);
|
||||
if (attr) {
|
||||
item->mFormat.mSystemId = attr->mValue;
|
||||
}
|
||||
|
||||
getStyleAttr(aAttributes, aAttrCount, kNameSpaceID_None,
|
||||
txXSLTAtoms::cdataSectionElements, PR_FALSE, &attr);
|
||||
nsGkAtoms::cdataSectionElements, PR_FALSE, &attr);
|
||||
if (attr) {
|
||||
nsWhitespaceTokenizer tokens(attr->mValue);
|
||||
while (tokens.hasMoreTokens()) {
|
||||
|
@ -1012,12 +1012,12 @@ txFnStartOutput(PRInt32 aNamespaceID,
|
|||
}
|
||||
|
||||
rv = getYesNoAttr(aAttributes, aAttrCount,
|
||||
txXSLTAtoms::indent, PR_FALSE, aState,
|
||||
nsGkAtoms::indent, PR_FALSE, aState,
|
||||
item->mFormat.mIndent);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
getStyleAttr(aAttributes, aAttrCount, kNameSpaceID_None,
|
||||
txXSLTAtoms::mediaType, PR_FALSE, &attr);
|
||||
nsGkAtoms::mediaType, PR_FALSE, &attr);
|
||||
if (attr) {
|
||||
item->mFormat.mMediaType = attr->mValue;
|
||||
}
|
||||
|
@ -1049,10 +1049,10 @@ txFnStartStripSpace(PRInt32 aNamespaceID,
|
|||
{
|
||||
txStylesheetAttr* attr = nsnull;
|
||||
nsresult rv = getStyleAttr(aAttributes, aAttrCount, kNameSpaceID_None,
|
||||
txXSLTAtoms::elements, PR_TRUE, &attr);
|
||||
nsGkAtoms::elements, PR_TRUE, &attr);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
PRBool strip = aLocalName == txXSLTAtoms::stripSpace;
|
||||
PRBool strip = aLocalName == nsGkAtoms::stripSpace;
|
||||
|
||||
nsAutoPtr<txStripSpaceItem> stripItem(new txStripSpaceItem);
|
||||
NS_ENSURE_TRUE(stripItem, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
@ -1089,7 +1089,7 @@ txFnStartStripSpace(PRInt32 aNamespaceID,
|
|||
}
|
||||
prefix = localName;
|
||||
}
|
||||
localName = txXPathAtoms::_asterix;
|
||||
localName = nsGkAtoms::_asterix;
|
||||
}
|
||||
if (prefix) {
|
||||
ns = aState.mElementContext->mMappings->lookupNamespace(prefix);
|
||||
|
@ -1132,22 +1132,22 @@ txFnStartTemplate(PRInt32 aNamespaceID,
|
|||
{
|
||||
nsresult rv = NS_OK;
|
||||
txExpandedName name;
|
||||
rv = getQNameAttr(aAttributes, aAttrCount, txXSLTAtoms::name, PR_FALSE,
|
||||
rv = getQNameAttr(aAttributes, aAttrCount, nsGkAtoms::name, PR_FALSE,
|
||||
aState, name);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
txExpandedName mode;
|
||||
rv = getQNameAttr(aAttributes, aAttrCount, txXSLTAtoms::mode, PR_FALSE,
|
||||
rv = getQNameAttr(aAttributes, aAttrCount, nsGkAtoms::mode, PR_FALSE,
|
||||
aState, mode);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
double prio = Double::NaN;
|
||||
rv = getNumberAttr(aAttributes, aAttrCount, txXSLTAtoms::priority,
|
||||
rv = getNumberAttr(aAttributes, aAttrCount, nsGkAtoms::priority,
|
||||
PR_FALSE, aState, prio);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsAutoPtr<txPattern> match;
|
||||
rv = getPatternAttr(aAttributes, aAttrCount, txXSLTAtoms::match,
|
||||
rv = getPatternAttr(aAttributes, aAttrCount, nsGkAtoms::match,
|
||||
name.isNull(), aState, match);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
|
@ -1190,17 +1190,17 @@ txFnStartTopVariable(PRInt32 aNamespaceID,
|
|||
{
|
||||
nsresult rv = NS_OK;
|
||||
txExpandedName name;
|
||||
rv = getQNameAttr(aAttributes, aAttrCount, txXSLTAtoms::name, PR_TRUE,
|
||||
rv = getQNameAttr(aAttributes, aAttrCount, nsGkAtoms::name, PR_TRUE,
|
||||
aState, name);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsAutoPtr<Expr> select;
|
||||
rv = getExprAttr(aAttributes, aAttrCount, txXSLTAtoms::select, PR_FALSE,
|
||||
rv = getExprAttr(aAttributes, aAttrCount, nsGkAtoms::select, PR_FALSE,
|
||||
aState, select);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsAutoPtr<txVariableItem> var(
|
||||
new txVariableItem(name, select, aLocalName == txXSLTAtoms::param));
|
||||
new txVariableItem(name, select, aLocalName == nsGkAtoms::param));
|
||||
NS_ENSURE_TRUE(var, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
aState.openInstructionContainer(var);
|
||||
|
@ -1318,7 +1318,7 @@ txFnStartLRE(PRInt32 aNamespaceID,
|
|||
attr = aAttributes + i;
|
||||
|
||||
if (attr->mNamespaceID == kNameSpaceID_XSLT) {
|
||||
if (attr->mLocalName == txXSLTAtoms::version) {
|
||||
if (attr->mLocalName == nsGkAtoms::version) {
|
||||
attr->mLocalName = nsnull;
|
||||
}
|
||||
|
||||
|
@ -1438,7 +1438,7 @@ txFnStartApplyTemplates(PRInt32 aNamespaceID,
|
|||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
txExpandedName mode;
|
||||
rv = getQNameAttr(aAttributes, aAttrCount, txXSLTAtoms::mode, PR_FALSE,
|
||||
rv = getQNameAttr(aAttributes, aAttrCount, nsGkAtoms::mode, PR_FALSE,
|
||||
aState, mode);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
|
@ -1451,7 +1451,7 @@ txFnStartApplyTemplates(PRInt32 aNamespaceID,
|
|||
instr.forget();
|
||||
|
||||
nsAutoPtr<Expr> select;
|
||||
rv = getExprAttr(aAttributes, aAttrCount, txXSLTAtoms::select, PR_FALSE,
|
||||
rv = getExprAttr(aAttributes, aAttrCount, nsGkAtoms::select, PR_FALSE,
|
||||
aState, select);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
|
@ -1538,12 +1538,12 @@ txFnStartAttribute(PRInt32 aNamespaceID,
|
|||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsAutoPtr<Expr> name;
|
||||
rv = getAVTAttr(aAttributes, aAttrCount, txXSLTAtoms::name, PR_TRUE,
|
||||
rv = getAVTAttr(aAttributes, aAttrCount, nsGkAtoms::name, PR_TRUE,
|
||||
aState, name);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsAutoPtr<Expr> nspace;
|
||||
rv = getAVTAttr(aAttributes, aAttrCount, txXSLTAtoms::_namespace, PR_FALSE,
|
||||
rv = getAVTAttr(aAttributes, aAttrCount, nsGkAtoms::_namespace, PR_FALSE,
|
||||
aState, nspace);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
|
@ -1597,7 +1597,7 @@ txFnStartCallTemplate(PRInt32 aNamespaceID,
|
|||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
txExpandedName name;
|
||||
rv = getQNameAttr(aAttributes, aAttrCount, txXSLTAtoms::name, PR_TRUE,
|
||||
rv = getQNameAttr(aAttributes, aAttrCount, nsGkAtoms::name, PR_TRUE,
|
||||
aState, name);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
|
@ -1777,7 +1777,7 @@ txFnStartCopyOf(PRInt32 aNamespaceID,
|
|||
nsresult rv = NS_OK;
|
||||
|
||||
nsAutoPtr<Expr> select;
|
||||
rv = getExprAttr(aAttributes, aAttrCount, txXSLTAtoms::select, PR_TRUE,
|
||||
rv = getExprAttr(aAttributes, aAttrCount, nsGkAtoms::select, PR_TRUE,
|
||||
aState, select);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
|
@ -1816,12 +1816,12 @@ txFnStartElement(PRInt32 aNamespaceID,
|
|||
nsresult rv = NS_OK;
|
||||
|
||||
nsAutoPtr<Expr> name;
|
||||
rv = getAVTAttr(aAttributes, aAttrCount, txXSLTAtoms::name, PR_TRUE,
|
||||
rv = getAVTAttr(aAttributes, aAttrCount, nsGkAtoms::name, PR_TRUE,
|
||||
aState, name);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsAutoPtr<Expr> nspace;
|
||||
rv = getAVTAttr(aAttributes, aAttrCount, txXSLTAtoms::_namespace, PR_FALSE,
|
||||
rv = getAVTAttr(aAttributes, aAttrCount, nsGkAtoms::_namespace, PR_FALSE,
|
||||
aState, nspace);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
|
@ -1898,7 +1898,7 @@ txFnStartForEach(PRInt32 aNamespaceID,
|
|||
nsresult rv = NS_OK;
|
||||
|
||||
nsAutoPtr<Expr> select;
|
||||
rv = getExprAttr(aAttributes, aAttrCount, txXSLTAtoms::select, PR_TRUE,
|
||||
rv = getExprAttr(aAttributes, aAttrCount, nsGkAtoms::select, PR_TRUE,
|
||||
aState, select);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
|
@ -1990,7 +1990,7 @@ txFnStartIf(PRInt32 aNamespaceID,
|
|||
nsresult rv = NS_OK;
|
||||
|
||||
nsAutoPtr<Expr> test;
|
||||
rv = getExprAttr(aAttributes, aAttrCount, txXSLTAtoms::test, PR_TRUE,
|
||||
rv = getExprAttr(aAttributes, aAttrCount, nsGkAtoms::test, PR_TRUE,
|
||||
aState, test);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
|
@ -2037,7 +2037,7 @@ txFnStartMessage(PRInt32 aNamespaceID,
|
|||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
txThreeState term;
|
||||
rv = getYesNoAttr(aAttributes, aAttrCount, txXSLTAtoms::terminate,
|
||||
rv = getYesNoAttr(aAttributes, aAttrCount, nsGkAtoms::terminate,
|
||||
PR_FALSE, aState, term);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
|
@ -2078,58 +2078,58 @@ txFnStartNumber(PRInt32 aNamespaceID,
|
|||
nsresult rv = NS_OK;
|
||||
|
||||
nsCOMPtr<nsIAtom> levelAtom;
|
||||
rv = getAtomAttr(aAttributes, aAttrCount, txXSLTAtoms::level, PR_FALSE,
|
||||
rv = getAtomAttr(aAttributes, aAttrCount, nsGkAtoms::level, PR_FALSE,
|
||||
aState, getter_AddRefs(levelAtom));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
txXSLTNumber::LevelType level = txXSLTNumber::eLevelSingle;
|
||||
if (levelAtom == txXSLTAtoms::multiple) {
|
||||
if (levelAtom == nsGkAtoms::multiple) {
|
||||
level = txXSLTNumber::eLevelMultiple;
|
||||
}
|
||||
else if (levelAtom == txXSLTAtoms::any) {
|
||||
else if (levelAtom == nsGkAtoms::any) {
|
||||
level = txXSLTNumber::eLevelAny;
|
||||
}
|
||||
else if (levelAtom && levelAtom != txXSLTAtoms::single && !aState.fcp()) {
|
||||
else if (levelAtom && levelAtom != nsGkAtoms::single && !aState.fcp()) {
|
||||
return NS_ERROR_XSLT_PARSE_FAILURE;
|
||||
}
|
||||
|
||||
nsAutoPtr<txPattern> count;
|
||||
rv = getPatternAttr(aAttributes, aAttrCount, txXSLTAtoms::count, PR_FALSE,
|
||||
rv = getPatternAttr(aAttributes, aAttrCount, nsGkAtoms::count, PR_FALSE,
|
||||
aState, count);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsAutoPtr<txPattern> from;
|
||||
rv = getPatternAttr(aAttributes, aAttrCount, txXSLTAtoms::from, PR_FALSE,
|
||||
rv = getPatternAttr(aAttributes, aAttrCount, nsGkAtoms::from, PR_FALSE,
|
||||
aState, from);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsAutoPtr<Expr> value;
|
||||
rv = getExprAttr(aAttributes, aAttrCount, txXSLTAtoms::value, PR_FALSE,
|
||||
rv = getExprAttr(aAttributes, aAttrCount, nsGkAtoms::value, PR_FALSE,
|
||||
aState, value);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsAutoPtr<Expr> format;
|
||||
rv = getAVTAttr(aAttributes, aAttrCount, txXSLTAtoms::format, PR_FALSE,
|
||||
rv = getAVTAttr(aAttributes, aAttrCount, nsGkAtoms::format, PR_FALSE,
|
||||
aState, format);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsAutoPtr<Expr> lang;
|
||||
rv = getAVTAttr(aAttributes, aAttrCount, txXSLTAtoms::lang, PR_FALSE,
|
||||
rv = getAVTAttr(aAttributes, aAttrCount, nsGkAtoms::lang, PR_FALSE,
|
||||
aState, lang);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsAutoPtr<Expr> letterValue;
|
||||
rv = getAVTAttr(aAttributes, aAttrCount, txXSLTAtoms::letterValue, PR_FALSE,
|
||||
rv = getAVTAttr(aAttributes, aAttrCount, nsGkAtoms::letterValue, PR_FALSE,
|
||||
aState, letterValue);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsAutoPtr<Expr> groupingSeparator;
|
||||
rv = getAVTAttr(aAttributes, aAttrCount, txXSLTAtoms::groupingSeparator,
|
||||
rv = getAVTAttr(aAttributes, aAttrCount, nsGkAtoms::groupingSeparator,
|
||||
PR_FALSE, aState, groupingSeparator);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsAutoPtr<Expr> groupingSize;
|
||||
rv = getAVTAttr(aAttributes, aAttrCount, txXSLTAtoms::groupingSize,
|
||||
rv = getAVTAttr(aAttributes, aAttrCount, nsGkAtoms::groupingSize,
|
||||
PR_FALSE, aState, groupingSize);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
|
@ -2197,7 +2197,7 @@ txFnStartParam(PRInt32 aNamespaceID,
|
|||
nsresult rv = NS_OK;
|
||||
|
||||
txExpandedName name;
|
||||
rv = getQNameAttr(aAttributes, aAttrCount, txXSLTAtoms::name, PR_TRUE,
|
||||
rv = getQNameAttr(aAttributes, aAttrCount, nsGkAtoms::name, PR_TRUE,
|
||||
aState, name);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
|
@ -2212,7 +2212,7 @@ txFnStartParam(PRInt32 aNamespaceID,
|
|||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsAutoPtr<Expr> select;
|
||||
rv = getExprAttr(aAttributes, aAttrCount, txXSLTAtoms::select, PR_FALSE,
|
||||
rv = getExprAttr(aAttributes, aAttrCount, nsGkAtoms::select, PR_FALSE,
|
||||
aState, select);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
|
@ -2288,7 +2288,7 @@ txFnStartPI(PRInt32 aNamespaceID,
|
|||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsAutoPtr<Expr> name;
|
||||
rv = getAVTAttr(aAttributes, aAttrCount, txXSLTAtoms::name, PR_TRUE,
|
||||
rv = getAVTAttr(aAttributes, aAttrCount, nsGkAtoms::name, PR_TRUE,
|
||||
aState, name);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
|
@ -2330,7 +2330,7 @@ txFnStartSort(PRInt32 aNamespaceID,
|
|||
nsresult rv = NS_OK;
|
||||
|
||||
nsAutoPtr<Expr> select;
|
||||
rv = getExprAttr(aAttributes, aAttrCount, txXSLTAtoms::select, PR_FALSE,
|
||||
rv = getExprAttr(aAttributes, aAttrCount, nsGkAtoms::select, PR_FALSE,
|
||||
aState, select);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
|
@ -2346,22 +2346,22 @@ txFnStartSort(PRInt32 aNamespaceID,
|
|||
}
|
||||
|
||||
nsAutoPtr<Expr> lang;
|
||||
rv = getAVTAttr(aAttributes, aAttrCount, txXSLTAtoms::lang, PR_FALSE,
|
||||
rv = getAVTAttr(aAttributes, aAttrCount, nsGkAtoms::lang, PR_FALSE,
|
||||
aState, lang);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsAutoPtr<Expr> dataType;
|
||||
rv = getAVTAttr(aAttributes, aAttrCount, txXSLTAtoms::dataType, PR_FALSE,
|
||||
rv = getAVTAttr(aAttributes, aAttrCount, nsGkAtoms::dataType, PR_FALSE,
|
||||
aState, dataType);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsAutoPtr<Expr> order;
|
||||
rv = getAVTAttr(aAttributes, aAttrCount, txXSLTAtoms::order, PR_FALSE,
|
||||
rv = getAVTAttr(aAttributes, aAttrCount, nsGkAtoms::order, PR_FALSE,
|
||||
aState, order);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsAutoPtr<Expr> caseOrder;
|
||||
rv = getAVTAttr(aAttributes, aAttrCount, txXSLTAtoms::caseOrder, PR_FALSE,
|
||||
rv = getAVTAttr(aAttributes, aAttrCount, nsGkAtoms::caseOrder, PR_FALSE,
|
||||
aState, caseOrder);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
|
@ -2397,7 +2397,7 @@ txFnStartText(PRInt32 aNamespaceID,
|
|||
nsresult rv = NS_OK;
|
||||
txThreeState doe;
|
||||
rv = getYesNoAttr(aAttributes, aAttrCount,
|
||||
txXSLTAtoms::disableOutputEscaping, PR_FALSE, aState,
|
||||
nsGkAtoms::disableOutputEscaping, PR_FALSE, aState,
|
||||
doe);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
|
@ -2443,12 +2443,12 @@ txFnStartValueOf(PRInt32 aNamespaceID,
|
|||
|
||||
txThreeState doe;
|
||||
rv = getYesNoAttr(aAttributes, aAttrCount,
|
||||
txXSLTAtoms::disableOutputEscaping, PR_FALSE, aState,
|
||||
nsGkAtoms::disableOutputEscaping, PR_FALSE, aState,
|
||||
doe);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsAutoPtr<Expr> select;
|
||||
rv = getExprAttr(aAttributes, aAttrCount, txXSLTAtoms::select, PR_TRUE,
|
||||
rv = getExprAttr(aAttributes, aAttrCount, nsGkAtoms::select, PR_TRUE,
|
||||
aState, select);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
|
@ -2486,12 +2486,12 @@ txFnStartVariable(PRInt32 aNamespaceID,
|
|||
nsresult rv = NS_OK;
|
||||
|
||||
txExpandedName name;
|
||||
rv = getQNameAttr(aAttributes, aAttrCount, txXSLTAtoms::name, PR_TRUE,
|
||||
rv = getQNameAttr(aAttributes, aAttrCount, nsGkAtoms::name, PR_TRUE,
|
||||
aState, name);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsAutoPtr<Expr> select;
|
||||
rv = getExprAttr(aAttributes, aAttrCount, txXSLTAtoms::select, PR_FALSE,
|
||||
rv = getExprAttr(aAttributes, aAttrCount, nsGkAtoms::select, PR_FALSE,
|
||||
aState, select);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
|
@ -2594,7 +2594,7 @@ txFnStartWhen(PRInt32 aNamespaceID,
|
|||
nsresult rv = NS_OK;
|
||||
|
||||
nsAutoPtr<Expr> test;
|
||||
rv = getExprAttr(aAttributes, aAttrCount, txXSLTAtoms::test, PR_TRUE,
|
||||
rv = getExprAttr(aAttributes, aAttrCount, nsGkAtoms::test, PR_TRUE,
|
||||
aState, test);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
|
@ -2651,12 +2651,12 @@ txFnStartWithParam(PRInt32 aNamespaceID,
|
|||
nsresult rv = NS_OK;
|
||||
|
||||
txExpandedName name;
|
||||
rv = getQNameAttr(aAttributes, aAttrCount, txXSLTAtoms::name, PR_TRUE,
|
||||
rv = getQNameAttr(aAttributes, aAttrCount, nsGkAtoms::name, PR_TRUE,
|
||||
aState, name);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsAutoPtr<Expr> select;
|
||||
rv = getExprAttr(aAttributes, aAttrCount, txXSLTAtoms::select, PR_FALSE,
|
||||
rv = getExprAttr(aAttributes, aAttrCount, nsGkAtoms::select, PR_FALSE,
|
||||
aState, select);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
|
||||
#include "txStylesheetCompiler.h"
|
||||
#include "txStylesheetCompileHandlers.h"
|
||||
#include "txAtoms.h"
|
||||
#include "nsGkAtoms.h"
|
||||
#include "txURIUtils.h"
|
||||
#include "nsWhitespaceTokenizer.h"
|
||||
#include "txStylesheet.h"
|
||||
|
@ -114,7 +114,7 @@ txStylesheetCompiler::startElement(PRInt32 aNamespaceID, nsIAtom* aLocalName,
|
|||
hasOwnNamespaceMap = PR_TRUE;
|
||||
}
|
||||
|
||||
if (attr->mLocalName == txXMLAtoms::xmlns) {
|
||||
if (attr->mLocalName == nsGkAtoms::xmlns) {
|
||||
mElementContext->mMappings->mapNamespace(nsnull, attr->mValue);
|
||||
}
|
||||
else {
|
||||
|
@ -159,11 +159,11 @@ txStylesheetCompiler::startElement(const PRUnichar *aName,
|
|||
atts[i].mValue.Append(aAttrs[i * 2 + 1]);
|
||||
|
||||
nsCOMPtr<nsIAtom> prefixToBind;
|
||||
if (atts[i].mPrefix == txXMLAtoms::xmlns) {
|
||||
if (atts[i].mPrefix == nsGkAtoms::xmlns) {
|
||||
prefixToBind = atts[i].mLocalName;
|
||||
}
|
||||
else if (atts[i].mNamespaceID == kNameSpaceID_XMLNS) {
|
||||
prefixToBind = txXMLAtoms::_empty;
|
||||
prefixToBind = nsGkAtoms::_empty;
|
||||
}
|
||||
|
||||
if (prefixToBind) {
|
||||
|
@ -218,14 +218,14 @@ txStylesheetCompiler::startElementInternal(PRInt32 aNamespaceID,
|
|||
|
||||
// xml:space
|
||||
if (attr->mNamespaceID == kNameSpaceID_XML &&
|
||||
attr->mLocalName == txXMLAtoms::space) {
|
||||
attr->mLocalName == nsGkAtoms::space) {
|
||||
rv = ensureNewElementContext();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (TX_StringEqualsAtom(attr->mValue, txXMLAtoms::preserve)) {
|
||||
if (TX_StringEqualsAtom(attr->mValue, nsGkAtoms::preserve)) {
|
||||
mElementContext->mPreserveWhitespace = MB_TRUE;
|
||||
}
|
||||
else if (TX_StringEqualsAtom(attr->mValue, txXMLAtoms::_default)) {
|
||||
else if (TX_StringEqualsAtom(attr->mValue, nsGkAtoms::_default)) {
|
||||
mElementContext->mPreserveWhitespace = MB_FALSE;
|
||||
}
|
||||
else {
|
||||
|
@ -235,7 +235,7 @@ txStylesheetCompiler::startElementInternal(PRInt32 aNamespaceID,
|
|||
|
||||
// xml:base
|
||||
if (attr->mNamespaceID == kNameSpaceID_XML &&
|
||||
attr->mLocalName == txXMLAtoms::base &&
|
||||
attr->mLocalName == nsGkAtoms::base &&
|
||||
!attr->mValue.IsEmpty()) {
|
||||
rv = ensureNewElementContext();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
@ -247,13 +247,13 @@ txStylesheetCompiler::startElementInternal(PRInt32 aNamespaceID,
|
|||
|
||||
// extension-element-prefixes
|
||||
if ((attr->mNamespaceID == kNameSpaceID_XSLT &&
|
||||
attr->mLocalName == txXSLTAtoms::extensionElementPrefixes &&
|
||||
attr->mLocalName == nsGkAtoms::extensionElementPrefixes &&
|
||||
aNamespaceID != kNameSpaceID_XSLT) ||
|
||||
(attr->mNamespaceID == kNameSpaceID_None &&
|
||||
attr->mLocalName == txXSLTAtoms::extensionElementPrefixes &&
|
||||
attr->mLocalName == nsGkAtoms::extensionElementPrefixes &&
|
||||
aNamespaceID == kNameSpaceID_XSLT &&
|
||||
(aLocalName == txXSLTAtoms::stylesheet ||
|
||||
aLocalName == txXSLTAtoms::transform))) {
|
||||
(aLocalName == nsGkAtoms::stylesheet ||
|
||||
aLocalName == nsGkAtoms::transform))) {
|
||||
rv = ensureNewElementContext();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
|
@ -276,13 +276,13 @@ txStylesheetCompiler::startElementInternal(PRInt32 aNamespaceID,
|
|||
|
||||
// version
|
||||
if ((attr->mNamespaceID == kNameSpaceID_XSLT &&
|
||||
attr->mLocalName == txXSLTAtoms::version &&
|
||||
attr->mLocalName == nsGkAtoms::version &&
|
||||
aNamespaceID != kNameSpaceID_XSLT) ||
|
||||
(attr->mNamespaceID == kNameSpaceID_None &&
|
||||
attr->mLocalName == txXSLTAtoms::version &&
|
||||
attr->mLocalName == nsGkAtoms::version &&
|
||||
aNamespaceID == kNameSpaceID_XSLT &&
|
||||
(aLocalName == txXSLTAtoms::stylesheet ||
|
||||
aLocalName == txXSLTAtoms::transform))) {
|
||||
(aLocalName == nsGkAtoms::stylesheet ||
|
||||
aLocalName == nsGkAtoms::transform))) {
|
||||
rv = ensureNewElementContext();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
|
@ -861,7 +861,7 @@ nsresult
|
|||
txStylesheetCompilerState::resolveNamespacePrefix(nsIAtom* aPrefix,
|
||||
PRInt32& aID)
|
||||
{
|
||||
NS_ASSERTION(aPrefix && aPrefix != txXMLAtoms::_empty,
|
||||
NS_ASSERTION(aPrefix && aPrefix != nsGkAtoms::_empty,
|
||||
"caller should handle default namespace ''");
|
||||
aID = mElementContext->mMappings->lookupNamespace(aPrefix);
|
||||
return (aID != kNameSpaceID_Unknown) ? NS_OK : NS_ERROR_FAILURE;
|
||||
|
@ -927,39 +927,39 @@ TX_ConstructXSLTFunction(nsIAtom* aName, PRInt32 aNamespaceID,
|
|||
txStylesheetCompilerState* aState,
|
||||
FunctionCall** aFunction)
|
||||
{
|
||||
if (aName == txXSLTAtoms::document) {
|
||||
if (aName == nsGkAtoms::document) {
|
||||
*aFunction =
|
||||
new DocumentFunctionCall(aState->mElementContext->mBaseURI);
|
||||
}
|
||||
else if (aName == txXSLTAtoms::key) {
|
||||
else if (aName == nsGkAtoms::key) {
|
||||
*aFunction =
|
||||
new txKeyFunctionCall(aState->mElementContext->mMappings);
|
||||
}
|
||||
else if (aName == txXSLTAtoms::formatNumber) {
|
||||
else if (aName == nsGkAtoms::formatNumber) {
|
||||
*aFunction =
|
||||
new txFormatNumberFunctionCall(aState->mStylesheet,
|
||||
aState->mElementContext->mMappings);
|
||||
}
|
||||
else if (aName == txXSLTAtoms::current) {
|
||||
else if (aName == nsGkAtoms::current) {
|
||||
*aFunction = new CurrentFunctionCall();
|
||||
}
|
||||
else if (aName == txXSLTAtoms::unparsedEntityUri) {
|
||||
else if (aName == nsGkAtoms::unparsedEntityUri) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
else if (aName == txXSLTAtoms::generateId) {
|
||||
else if (aName == nsGkAtoms::generateId) {
|
||||
*aFunction = new GenerateIdFunctionCall();
|
||||
}
|
||||
else if (aName == txXSLTAtoms::systemProperty) {
|
||||
else if (aName == nsGkAtoms::systemProperty) {
|
||||
*aFunction = new txXSLTEnvironmentFunctionCall(
|
||||
txXSLTEnvironmentFunctionCall::SYSTEM_PROPERTY,
|
||||
aState->mElementContext->mMappings);
|
||||
}
|
||||
else if (aName == txXSLTAtoms::elementAvailable) {
|
||||
else if (aName == nsGkAtoms::elementAvailable) {
|
||||
*aFunction = new txXSLTEnvironmentFunctionCall(
|
||||
txXSLTEnvironmentFunctionCall::ELEMENT_AVAILABLE,
|
||||
aState->mElementContext->mMappings);
|
||||
}
|
||||
else if (aName == txXSLTAtoms::functionAvailable) {
|
||||
else if (aName == nsGkAtoms::functionAvailable) {
|
||||
*aFunction = new txXSLTEnvironmentFunctionCall(
|
||||
txXSLTEnvironmentFunctionCall::FUNCTION_AVAILABLE,
|
||||
aState->mElementContext->mMappings);
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
#include "txExecutionState.h"
|
||||
#include "txStringUtils.h"
|
||||
#include "txStylesheet.h"
|
||||
#include "txAtoms.h"
|
||||
#include "nsGkAtoms.h"
|
||||
|
||||
txUnknownHandler::txUnknownHandler(txExecutionState* aEs)
|
||||
: mEs(aEs),
|
||||
|
@ -160,7 +160,7 @@ txUnknownHandler::startElement(nsIAtom* aPrefix, nsIAtom* aLocalName,
|
|||
}
|
||||
|
||||
PRBool htmlRoot = aNsID == kNameSpaceID_None && !aPrefix &&
|
||||
aLowercaseLocalName == txHTMLAtoms::html;
|
||||
aLowercaseLocalName == nsGkAtoms::html;
|
||||
|
||||
// Use aLocalName and not aLowercaseLocalName in case the output
|
||||
// handler cares about case. For eHTMLOutput the handler will hardcode
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "txIXPathContext.h"
|
||||
#include "txAtoms.h"
|
||||
#include "nsGkAtoms.h"
|
||||
#include "txError.h"
|
||||
#include "txXMLUtils.h"
|
||||
#include "txXSLTFunctions.h"
|
||||
|
@ -66,14 +66,14 @@ txXSLTEnvironmentFunctionCall::evaluate(txIEvalContext* aContext,
|
|||
case SYSTEM_PROPERTY:
|
||||
{
|
||||
if (qname.mNamespaceID == kNameSpaceID_XSLT) {
|
||||
if (qname.mLocalName == txXSLTAtoms::version) {
|
||||
if (qname.mLocalName == nsGkAtoms::version) {
|
||||
return aContext->recycler()->getNumberResult(1.0, aResult);
|
||||
}
|
||||
if (qname.mLocalName == txXSLTAtoms::vendor) {
|
||||
if (qname.mLocalName == nsGkAtoms::vendor) {
|
||||
return aContext->recycler()->getStringResult(
|
||||
NS_LITERAL_STRING("Transformiix"), aResult);
|
||||
}
|
||||
if (qname.mLocalName == txXSLTAtoms::vendorUrl) {
|
||||
if (qname.mLocalName == nsGkAtoms::vendorUrl) {
|
||||
return aContext->recycler()->getStringResult(
|
||||
NS_LITERAL_STRING("http://www.mozilla.org/projects/xslt/"),
|
||||
aResult);
|
||||
|
@ -85,41 +85,41 @@ txXSLTEnvironmentFunctionCall::evaluate(txIEvalContext* aContext,
|
|||
case ELEMENT_AVAILABLE:
|
||||
{
|
||||
PRBool val = qname.mNamespaceID == kNameSpaceID_XSLT &&
|
||||
(qname.mLocalName == txXSLTAtoms::applyImports ||
|
||||
qname.mLocalName == txXSLTAtoms::applyTemplates ||
|
||||
qname.mLocalName == txXSLTAtoms::attribute ||
|
||||
qname.mLocalName == txXSLTAtoms::attributeSet ||
|
||||
qname.mLocalName == txXSLTAtoms::callTemplate ||
|
||||
qname.mLocalName == txXSLTAtoms::choose ||
|
||||
qname.mLocalName == txXSLTAtoms::comment ||
|
||||
qname.mLocalName == txXSLTAtoms::copy ||
|
||||
qname.mLocalName == txXSLTAtoms::copyOf ||
|
||||
qname.mLocalName == txXSLTAtoms::decimalFormat ||
|
||||
qname.mLocalName == txXSLTAtoms::element ||
|
||||
qname.mLocalName == txXSLTAtoms::fallback ||
|
||||
qname.mLocalName == txXSLTAtoms::forEach ||
|
||||
qname.mLocalName == txXSLTAtoms::_if ||
|
||||
qname.mLocalName == txXSLTAtoms::import ||
|
||||
qname.mLocalName == txXSLTAtoms::include ||
|
||||
qname.mLocalName == txXSLTAtoms::key ||
|
||||
qname.mLocalName == txXSLTAtoms::message ||
|
||||
//qname.mLocalName == txXSLTAtoms::namespaceAlias ||
|
||||
qname.mLocalName == txXSLTAtoms::number ||
|
||||
qname.mLocalName == txXSLTAtoms::otherwise ||
|
||||
qname.mLocalName == txXSLTAtoms::output ||
|
||||
qname.mLocalName == txXSLTAtoms::param ||
|
||||
qname.mLocalName == txXSLTAtoms::preserveSpace ||
|
||||
qname.mLocalName == txXSLTAtoms::processingInstruction ||
|
||||
qname.mLocalName == txXSLTAtoms::sort ||
|
||||
qname.mLocalName == txXSLTAtoms::stripSpace ||
|
||||
qname.mLocalName == txXSLTAtoms::stylesheet ||
|
||||
qname.mLocalName == txXSLTAtoms::_template ||
|
||||
qname.mLocalName == txXSLTAtoms::text ||
|
||||
qname.mLocalName == txXSLTAtoms::transform ||
|
||||
qname.mLocalName == txXSLTAtoms::valueOf ||
|
||||
qname.mLocalName == txXSLTAtoms::variable ||
|
||||
qname.mLocalName == txXSLTAtoms::when ||
|
||||
qname.mLocalName == txXSLTAtoms::withParam);
|
||||
(qname.mLocalName == nsGkAtoms::applyImports ||
|
||||
qname.mLocalName == nsGkAtoms::applyTemplates ||
|
||||
qname.mLocalName == nsGkAtoms::attribute ||
|
||||
qname.mLocalName == nsGkAtoms::attributeSet ||
|
||||
qname.mLocalName == nsGkAtoms::callTemplate ||
|
||||
qname.mLocalName == nsGkAtoms::choose ||
|
||||
qname.mLocalName == nsGkAtoms::comment ||
|
||||
qname.mLocalName == nsGkAtoms::copy ||
|
||||
qname.mLocalName == nsGkAtoms::copyOf ||
|
||||
qname.mLocalName == nsGkAtoms::decimalFormat ||
|
||||
qname.mLocalName == nsGkAtoms::element ||
|
||||
qname.mLocalName == nsGkAtoms::fallback ||
|
||||
qname.mLocalName == nsGkAtoms::forEach ||
|
||||
qname.mLocalName == nsGkAtoms::_if ||
|
||||
qname.mLocalName == nsGkAtoms::import ||
|
||||
qname.mLocalName == nsGkAtoms::include ||
|
||||
qname.mLocalName == nsGkAtoms::key ||
|
||||
qname.mLocalName == nsGkAtoms::message ||
|
||||
//qname.mLocalName == nsGkAtoms::namespaceAlias ||
|
||||
qname.mLocalName == nsGkAtoms::number ||
|
||||
qname.mLocalName == nsGkAtoms::otherwise ||
|
||||
qname.mLocalName == nsGkAtoms::output ||
|
||||
qname.mLocalName == nsGkAtoms::param ||
|
||||
qname.mLocalName == nsGkAtoms::preserveSpace ||
|
||||
qname.mLocalName == nsGkAtoms::processingInstruction ||
|
||||
qname.mLocalName == nsGkAtoms::sort ||
|
||||
qname.mLocalName == nsGkAtoms::stripSpace ||
|
||||
qname.mLocalName == nsGkAtoms::stylesheet ||
|
||||
qname.mLocalName == nsGkAtoms::_template ||
|
||||
qname.mLocalName == nsGkAtoms::text ||
|
||||
qname.mLocalName == nsGkAtoms::transform ||
|
||||
qname.mLocalName == nsGkAtoms::valueOf ||
|
||||
qname.mLocalName == nsGkAtoms::variable ||
|
||||
qname.mLocalName == nsGkAtoms::when ||
|
||||
qname.mLocalName == nsGkAtoms::withParam);
|
||||
|
||||
aContext->recycler()->getBoolResult(val, aResult);
|
||||
break;
|
||||
|
@ -161,9 +161,9 @@ txXSLTEnvironmentFunctionCall::isSensitiveTo(ContextSensitivity aContext)
|
|||
nsresult
|
||||
txXSLTEnvironmentFunctionCall::getNameAtom(nsIAtom** aAtom)
|
||||
{
|
||||
*aAtom = mType == SYSTEM_PROPERTY ? txXSLTAtoms::systemProperty :
|
||||
mType == ELEMENT_AVAILABLE ? txXSLTAtoms::elementAvailable :
|
||||
txXSLTAtoms::functionAvailable;
|
||||
*aAtom = mType == SYSTEM_PROPERTY ? nsGkAtoms::systemProperty :
|
||||
mType == ELEMENT_AVAILABLE ? nsGkAtoms::elementAvailable :
|
||||
nsGkAtoms::functionAvailable;
|
||||
NS_ADDREF(*aAtom);
|
||||
|
||||
return NS_OK;
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "txXSLTNumber.h"
|
||||
#include "txAtoms.h"
|
||||
#include "nsGkAtoms.h"
|
||||
#include "txCore.h"
|
||||
#include <math.h>
|
||||
#include "txExpr.h"
|
||||
|
@ -184,7 +184,7 @@ txXSLTNumber::getValueList(Expr* aValueExpr, txPattern* aCountPattern,
|
|||
{
|
||||
// this won't match anything as we walk up the tree
|
||||
// but it's what the spec says to do
|
||||
nodeTest = new txNameTest(0, txXPathAtoms::_asterix, 0,
|
||||
nodeTest = new txNameTest(0, nsGkAtoms::_asterix, 0,
|
||||
nodeType);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
|
||||
#include "txXSLTProcessor.h"
|
||||
#include "txInstructions.h"
|
||||
#include "txAtoms.h"
|
||||
#include "nsGkAtoms.h"
|
||||
#include "txLog.h"
|
||||
#include "txStylesheetCompileHandlers.h"
|
||||
#include "txStylesheetCompiler.h"
|
||||
|
|
|
@ -2400,6 +2400,7 @@ nsDOMClassInfo::Init()
|
|||
|
||||
DOM_CLASSINFO_MAP_BEGIN(ProcessingInstruction, nsIDOMProcessingInstruction)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMProcessingInstruction)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMCharacterData)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget)
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
|
|
|
@ -274,6 +274,7 @@ static PRPackedBool gDragServiceDisabled = PR_FALSE;
|
|||
static FILE *gDumpFile = nsnull;
|
||||
static PRUint64 gNextWindowID = 0;
|
||||
static PRUint32 gSerialCounter = 0;
|
||||
static PRBool gDoNotTrackEnabled = PR_FALSE;
|
||||
|
||||
#ifdef DEBUG_jst
|
||||
PRInt32 gTimeoutCnt = 0;
|
||||
|
@ -962,6 +963,10 @@ nsGlobalWindow::Init()
|
|||
NS_ASSERTION(gEntropyCollector,
|
||||
"gEntropyCollector should have been initialized!");
|
||||
|
||||
mozilla::Preferences::AddBoolVarCache(&gDoNotTrackEnabled,
|
||||
"privacy.donottrackheader.enabled",
|
||||
PR_FALSE);
|
||||
|
||||
#ifdef PR_LOGGING
|
||||
gDOMLeakPRLog = PR_NewLogModule("DOMLeak");
|
||||
NS_ASSERTION(gDOMLeakPRLog, "gDOMLeakPRLog should have been initialized!");
|
||||
|
@ -11116,6 +11121,18 @@ nsNavigator::GetBuildID(nsAString& aBuildID)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNavigator::GetDoNotTrack(nsAString &aResult)
|
||||
{
|
||||
if (gDoNotTrackEnabled) {
|
||||
aResult.AssignLiteral("yes");
|
||||
}
|
||||
else {
|
||||
aResult.AssignLiteral("unspecified");
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNavigator::JavaEnabled(PRBool *aReturn)
|
||||
{
|
||||
|
|
|
@ -1558,7 +1558,7 @@ nsJSContext::CompileScript(const PRUnichar* aText,
|
|||
if (ok && ((JSVersion)aVersion) != JSVERSION_UNKNOWN) {
|
||||
JSAutoRequest ar(mContext);
|
||||
|
||||
JSObject* scriptObj =
|
||||
JSScript* script =
|
||||
::JS_CompileUCScriptForPrincipalsVersion(mContext,
|
||||
(JSObject *)aScopeObject,
|
||||
jsprin,
|
||||
|
@ -1567,10 +1567,10 @@ nsJSContext::CompileScript(const PRUnichar* aText,
|
|||
aURL,
|
||||
aLineNo,
|
||||
JSVersion(aVersion));
|
||||
if (scriptObj) {
|
||||
if (script) {
|
||||
NS_ASSERTION(aScriptObject.getScriptTypeID()==JAVASCRIPT,
|
||||
"Expecting JS script object holder");
|
||||
rv = aScriptObject.set(scriptObj);
|
||||
rv = aScriptObject.set(script);
|
||||
} else {
|
||||
rv = NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
@ -1620,10 +1620,12 @@ nsJSContext::ExecuteScript(void *aScriptObject,
|
|||
jsval val;
|
||||
JSBool ok;
|
||||
|
||||
JSObject *scriptObj = (JSObject*)aScriptObject;
|
||||
JSScript *script = static_cast<JSScript *>(aScriptObject);
|
||||
nsCOMPtr<nsIPrincipal> principal;
|
||||
|
||||
rv = sSecurityManager->GetObjectPrincipal(mContext, scriptObj, getter_AddRefs(principal));
|
||||
rv = sSecurityManager->GetObjectPrincipal(mContext,
|
||||
JS_GetObjectFromScript(script),
|
||||
getter_AddRefs(principal));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = sSecurityManager->PushContextPrincipal(mContext, nsnull, principal);
|
||||
|
@ -1632,7 +1634,7 @@ nsJSContext::ExecuteScript(void *aScriptObject,
|
|||
nsJSContext::TerminationFuncHolder holder(this);
|
||||
JSAutoRequest ar(mContext);
|
||||
++mExecuteDepth;
|
||||
ok = ::JS_ExecuteScript(mContext, (JSObject *)aScopeObject, scriptObj, &val);
|
||||
ok = ::JS_ExecuteScript(mContext, (JSObject *)aScopeObject, script, &val);
|
||||
|
||||
if (ok) {
|
||||
// If all went well, convert val to a string (XXXbe unless undefined?).
|
||||
|
@ -2010,8 +2012,8 @@ nsJSContext::BindCompiledEventHandler(nsISupports* aTarget, void *aScope,
|
|||
nsresult
|
||||
nsJSContext::Serialize(nsIObjectOutputStream* aStream, void *aScriptObject)
|
||||
{
|
||||
JSObject *mJSObject = (JSObject *)aScriptObject;
|
||||
if (!mJSObject)
|
||||
JSScript *script = static_cast<JSScript *>(aScriptObject);
|
||||
if (!script)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsresult rv;
|
||||
|
@ -2023,7 +2025,7 @@ nsJSContext::Serialize(nsIObjectOutputStream* aStream, void *aScriptObject)
|
|||
xdr->userdata = (void*) aStream;
|
||||
|
||||
JSAutoRequest ar(cx);
|
||||
if (! ::JS_XDRScriptObject(xdr, &mJSObject)) {
|
||||
if (! ::JS_XDRScript(xdr, &script)) {
|
||||
rv = NS_ERROR_FAILURE; // likely to be a principals serialization error
|
||||
} else {
|
||||
// Get the encoded JSXDRState data and write it. The JSXDRState owns
|
||||
|
@ -2060,7 +2062,7 @@ nsresult
|
|||
nsJSContext::Deserialize(nsIObjectInputStream* aStream,
|
||||
nsScriptObjectHolder &aResult)
|
||||
{
|
||||
JSObject *result = nsnull;
|
||||
JSScript *result = nsnull;
|
||||
nsresult rv;
|
||||
|
||||
NS_TIME_FUNCTION_MIN(1.0);
|
||||
|
@ -2083,7 +2085,7 @@ nsJSContext::Deserialize(nsIObjectInputStream* aStream,
|
|||
JSAutoRequest ar(cx);
|
||||
::JS_XDRMemSetData(xdr, data, size);
|
||||
|
||||
if (! ::JS_XDRScriptObject(xdr, &result)) {
|
||||
if (! ::JS_XDRScript(xdr, &result)) {
|
||||
rv = NS_ERROR_FAILURE; // principals deserialization error?
|
||||
}
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
|
||||
#include "domstubs.idl"
|
||||
|
||||
[scriptable, uuid(5dd9f1f5-3347-4945-a350-4eedeb97d24c)]
|
||||
[scriptable, uuid(B8EE0374-5F47-4ED0-B9B0-BDE3E6D81FF5)]
|
||||
interface nsIDOMNavigator : nsISupports
|
||||
{
|
||||
readonly attribute DOMString appCodeName;
|
||||
|
@ -58,6 +58,7 @@ interface nsIDOMNavigator : nsISupports
|
|||
readonly attribute boolean cookieEnabled;
|
||||
readonly attribute boolean onLine;
|
||||
readonly attribute DOMString buildID;
|
||||
readonly attribute DOMString doNotTrack;
|
||||
|
||||
boolean javaEnabled();
|
||||
};
|
||||
|
|
|
@ -44,6 +44,10 @@
|
|||
|
||||
#include "nsIDOMNode.idl"
|
||||
|
||||
%{ C++
|
||||
#include "jspubtd.h"
|
||||
%}
|
||||
|
||||
interface nsIDOMNodeIterator;
|
||||
interface nsIDOMNodeFilter;
|
||||
interface nsIDOMTreeWalker;
|
||||
|
@ -63,7 +67,7 @@ interface nsIDOMCaretPosition;
|
|||
* http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html
|
||||
*/
|
||||
|
||||
[scriptable, uuid(48ef69c6-844f-41ba-af66-17b338177a8b)]
|
||||
[scriptable, uuid(C54536AF-C238-4D8B-A339-54E2A0649FF5)]
|
||||
interface nsIDOMDocument : nsIDOMNode
|
||||
{
|
||||
readonly attribute nsIDOMDocumentType doctype;
|
||||
|
@ -395,4 +399,9 @@ interface nsIDOMDocument : nsIDOMNode
|
|||
* @see <https://wiki.mozilla.org/index.php?title=Gecko:FullScreenAPI>
|
||||
*/
|
||||
readonly attribute boolean mozFullScreen;
|
||||
|
||||
/**
|
||||
* Inline event handler for readystatechange events.
|
||||
*/
|
||||
[implicit_jscontext] attribute jsval onreadystatechange;
|
||||
};
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsIDOMNode.idl"
|
||||
#include "nsIDOMCharacterData.idl"
|
||||
|
||||
/**
|
||||
* The nsIDOMProcessingInstruction interface represents a
|
||||
|
@ -45,13 +45,12 @@
|
|||
* information in the text of the document.
|
||||
*
|
||||
* For more information on this interface please see
|
||||
* http://www.w3.org/TR/DOM-Level-2-Core/
|
||||
* http://www.w3.org/TR/DOM-Level-2-Core/ and
|
||||
* http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html
|
||||
*/
|
||||
|
||||
[scriptable, uuid(5964f639-1183-487d-a87d-4c93111eae85)]
|
||||
interface nsIDOMProcessingInstruction : nsIDOMNode
|
||||
[scriptable, uuid(d754433f-4637-4a5f-9034-0388173ea254)]
|
||||
interface nsIDOMProcessingInstruction : nsIDOMCharacterData
|
||||
{
|
||||
readonly attribute DOMString target;
|
||||
attribute DOMString data;
|
||||
// raises(DOMException) on setting
|
||||
};
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
|
||||
#include "nsIDOMDocument.idl"
|
||||
|
||||
[scriptable, uuid(e788e37b-9a89-4b3e-9593-c598e50695eb)]
|
||||
[scriptable, uuid(0457526E-1FA5-476C-9314-0F704617B9F4)]
|
||||
interface nsIDOMXMLDocument : nsIDOMDocument
|
||||
{
|
||||
// DOM Level 3 Load & Save, DocumentLS
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
#include "jspubtd.h"
|
||||
%}
|
||||
|
||||
[scriptable, uuid(790ad9f7-167a-4f5f-a5c1-8cfb3697104d)]
|
||||
[scriptable, uuid(1b065b41-6e00-450c-a44c-e0e44581c08a)]
|
||||
interface nsIInlineEventHandlers : nsISupports
|
||||
{
|
||||
[implicit_jscontext] attribute jsval onabort;
|
||||
|
@ -88,7 +88,6 @@ interface nsIInlineEventHandlers : nsISupports
|
|||
[implicit_jscontext] attribute jsval onplaying;
|
||||
[implicit_jscontext] attribute jsval onprogress;
|
||||
[implicit_jscontext] attribute jsval onratechange;
|
||||
[implicit_jscontext] attribute jsval onreadystatechange;
|
||||
[implicit_jscontext] attribute jsval onreset;
|
||||
[implicit_jscontext] attribute jsval onscroll;
|
||||
[implicit_jscontext] attribute jsval onseeked;
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
*/
|
||||
interface nsISelection;
|
||||
|
||||
[scriptable, uuid(7587ce39-e939-4b86-838d-a1d04e4e04c0)]
|
||||
[scriptable, uuid(DA6A8183-3C50-4F4A-9EFC-0E050B9A856A)]
|
||||
interface nsIDOMHTMLDocument : nsIDOMDocument
|
||||
{
|
||||
readonly attribute DOMString URL;
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
|
||||
interface nsIDOMSVGSVGElement;
|
||||
|
||||
[scriptable, uuid(4ac55dee-ce7f-465d-a27c-ecc293ae35db)]
|
||||
[scriptable, uuid(E055EF40-D6BA-443A-B4DB-C1CCFAA6EB31)]
|
||||
interface nsIDOMSVGDocument : nsIDOMDocument
|
||||
{
|
||||
readonly attribute DOMString domain;
|
||||
|
|
|
@ -113,18 +113,22 @@ nsDOMStorageDBWrapper::FlushAndDeleteTemporaryTables(bool force)
|
|||
return NS_FAILED(rv1) ? rv1 : rv2;
|
||||
}
|
||||
|
||||
#define IMPL_FORWARDER(_code) \
|
||||
PR_BEGIN_MACRO \
|
||||
if (aStorage->CanUseChromePersist()) \
|
||||
return mChromePersistentDB._code; \
|
||||
if (nsDOMStorageManager::gStorageManager->InPrivateBrowsingMode()) \
|
||||
return mPrivateBrowsingDB._code; \
|
||||
if (aStorage->SessionOnly()) \
|
||||
return mSessionOnlyDB._code; \
|
||||
return mPersistentDB._code; \
|
||||
PR_END_MACRO
|
||||
|
||||
nsresult
|
||||
nsDOMStorageDBWrapper::GetAllKeys(DOMStorageImpl* aStorage,
|
||||
nsTHashtable<nsSessionStorageEntry>* aKeys)
|
||||
{
|
||||
if (aStorage->CanUseChromePersist())
|
||||
return mChromePersistentDB.GetAllKeys(aStorage, aKeys);
|
||||
if (nsDOMStorageManager::gStorageManager->InPrivateBrowsingMode())
|
||||
return mPrivateBrowsingDB.GetAllKeys(aStorage, aKeys);
|
||||
if (aStorage->SessionOnly())
|
||||
return mSessionOnlyDB.GetAllKeys(aStorage, aKeys);
|
||||
|
||||
return mPersistentDB.GetAllKeys(aStorage, aKeys);
|
||||
IMPL_FORWARDER(GetAllKeys(aStorage, aKeys));
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
@ -133,14 +137,7 @@ nsDOMStorageDBWrapper::GetKeyValue(DOMStorageImpl* aStorage,
|
|||
nsAString& aValue,
|
||||
PRBool* aSecure)
|
||||
{
|
||||
if (aStorage->CanUseChromePersist())
|
||||
return mChromePersistentDB.GetKeyValue(aStorage, aKey, aValue, aSecure);
|
||||
if (nsDOMStorageManager::gStorageManager->InPrivateBrowsingMode())
|
||||
return mPrivateBrowsingDB.GetKeyValue(aStorage, aKey, aValue, aSecure);
|
||||
if (aStorage->SessionOnly())
|
||||
return mSessionOnlyDB.GetKeyValue(aStorage, aKey, aValue, aSecure);
|
||||
|
||||
return mPersistentDB.GetKeyValue(aStorage, aKey, aValue, aSecure);
|
||||
IMPL_FORWARDER(GetKeyValue(aStorage, aKey, aValue, aSecure));
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
@ -152,18 +149,8 @@ nsDOMStorageDBWrapper::SetKey(DOMStorageImpl* aStorage,
|
|||
PRBool aExcludeOfflineFromUsage,
|
||||
PRInt32 *aNewUsage)
|
||||
{
|
||||
if (aStorage->CanUseChromePersist())
|
||||
return mChromePersistentDB.SetKey(aStorage, aKey, aValue, aSecure,
|
||||
aQuota, aExcludeOfflineFromUsage, aNewUsage);
|
||||
if (nsDOMStorageManager::gStorageManager->InPrivateBrowsingMode())
|
||||
return mPrivateBrowsingDB.SetKey(aStorage, aKey, aValue, aSecure,
|
||||
aQuota, aExcludeOfflineFromUsage, aNewUsage);
|
||||
if (aStorage->SessionOnly())
|
||||
return mSessionOnlyDB.SetKey(aStorage, aKey, aValue, aSecure,
|
||||
aQuota, aExcludeOfflineFromUsage, aNewUsage);
|
||||
|
||||
return mPersistentDB.SetKey(aStorage, aKey, aValue, aSecure,
|
||||
aQuota, aExcludeOfflineFromUsage, aNewUsage);
|
||||
IMPL_FORWARDER(SetKey(aStorage, aKey, aValue, aSecure,
|
||||
aQuota, aExcludeOfflineFromUsage, aNewUsage));
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
@ -171,14 +158,7 @@ nsDOMStorageDBWrapper::SetSecure(DOMStorageImpl* aStorage,
|
|||
const nsAString& aKey,
|
||||
const PRBool aSecure)
|
||||
{
|
||||
if (aStorage->CanUseChromePersist())
|
||||
return mChromePersistentDB.SetSecure(aStorage, aKey, aSecure);
|
||||
if (nsDOMStorageManager::gStorageManager->InPrivateBrowsingMode())
|
||||
return mPrivateBrowsingDB.SetSecure(aStorage, aKey, aSecure);
|
||||
if (aStorage->SessionOnly())
|
||||
return mSessionOnlyDB.SetSecure(aStorage, aKey, aSecure);
|
||||
|
||||
return mPersistentDB.SetSecure(aStorage, aKey, aSecure);
|
||||
IMPL_FORWARDER(SetSecure(aStorage, aKey, aSecure));
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
@ -187,27 +167,13 @@ nsDOMStorageDBWrapper::RemoveKey(DOMStorageImpl* aStorage,
|
|||
PRBool aExcludeOfflineFromUsage,
|
||||
PRInt32 aKeyUsage)
|
||||
{
|
||||
if (aStorage->CanUseChromePersist())
|
||||
return mChromePersistentDB.RemoveKey(aStorage, aKey, aExcludeOfflineFromUsage, aKeyUsage);
|
||||
if (nsDOMStorageManager::gStorageManager->InPrivateBrowsingMode())
|
||||
return mPrivateBrowsingDB.RemoveKey(aStorage, aKey, aExcludeOfflineFromUsage, aKeyUsage);
|
||||
if (aStorage->SessionOnly())
|
||||
return mSessionOnlyDB.RemoveKey(aStorage, aKey, aExcludeOfflineFromUsage, aKeyUsage);
|
||||
|
||||
return mPersistentDB.RemoveKey(aStorage, aKey, aExcludeOfflineFromUsage, aKeyUsage);
|
||||
IMPL_FORWARDER(RemoveKey(aStorage, aKey, aExcludeOfflineFromUsage, aKeyUsage));
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsDOMStorageDBWrapper::ClearStorage(DOMStorageImpl* aStorage)
|
||||
{
|
||||
if (aStorage->CanUseChromePersist())
|
||||
return mChromePersistentDB.ClearStorage(aStorage);
|
||||
if (nsDOMStorageManager::gStorageManager->InPrivateBrowsingMode())
|
||||
return mPrivateBrowsingDB.ClearStorage(aStorage);
|
||||
if (aStorage->SessionOnly())
|
||||
return mSessionOnlyDB.ClearStorage(aStorage);
|
||||
|
||||
return mPersistentDB.ClearStorage(aStorage);
|
||||
IMPL_FORWARDER(ClearStorage(aStorage));
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
@ -289,14 +255,7 @@ nsresult
|
|||
nsDOMStorageDBWrapper::GetUsage(DOMStorageImpl* aStorage,
|
||||
PRBool aExcludeOfflineFromUsage, PRInt32 *aUsage)
|
||||
{
|
||||
if (aStorage->CanUseChromePersist())
|
||||
return mChromePersistentDB.GetUsage(aStorage, aExcludeOfflineFromUsage, aUsage);
|
||||
if (nsDOMStorageManager::gStorageManager->InPrivateBrowsingMode())
|
||||
return mPrivateBrowsingDB.GetUsage(aStorage, aExcludeOfflineFromUsage, aUsage);
|
||||
if (aStorage->SessionOnly())
|
||||
return mSessionOnlyDB.GetUsage(aStorage, aExcludeOfflineFromUsage, aUsage);
|
||||
|
||||
return mPersistentDB.GetUsage(aStorage, aExcludeOfflineFromUsage, aUsage);
|
||||
IMPL_FORWARDER(GetUsage(aStorage, aExcludeOfflineFromUsage, aUsage));
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
|
|
@ -55,6 +55,7 @@ _TEST_FILES = \
|
|||
file_bug628069.html \
|
||||
test_bug631440.html \
|
||||
test_bug653364.html \
|
||||
test_bug629535.html \
|
||||
test_consoleAPI.html \
|
||||
test_domWindowUtils.html \
|
||||
test_domWindowUtils_scrollXY.html \
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=629535
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 629535</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=629535">Mozilla Bug 629535</a>
|
||||
|
||||
<script type="application/javascript">
|
||||
|
||||
const dntPref = 'privacy.donottrackheader.enabled';
|
||||
const oldDNT = SpecialPowers.getBoolPref(dntPref);
|
||||
|
||||
is(SpecialPowers.getBoolPref(dntPref), false,
|
||||
'DNT should be disabled by default');
|
||||
is(navigator.doNotTrack, 'unspecified',
|
||||
'navigator.doNotTrack should initially be "unspecified".');
|
||||
|
||||
SpecialPowers.clearUserPref(dntPref);
|
||||
is(navigator.doNotTrack, "unspecified", 'after clearing pref');
|
||||
|
||||
SpecialPowers.setBoolPref(dntPref, true);
|
||||
is(navigator.doNotTrack, "yes", 'after setting pref to true');
|
||||
|
||||
SpecialPowers.setBoolPref(dntPref, false);
|
||||
is(navigator.doNotTrack, "unspecified", 'after setting pref to false');
|
||||
|
||||
SpecialPowers.setBoolPref(dntPref, oldDNT);
|
||||
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -649,7 +649,8 @@ class GeckoSurfaceView
|
|||
break;
|
||||
}
|
||||
|
||||
if (isPreIme && mIMEState != IME_STATE_DISABLED)
|
||||
if (isPreIme && mIMEState != IME_STATE_DISABLED &&
|
||||
(event.getMetaState() & KeyEvent.META_ALT_ON) == 0)
|
||||
// Let active IME process pre-IME key events
|
||||
return false;
|
||||
|
||||
|
@ -678,7 +679,8 @@ class GeckoSurfaceView
|
|||
break;
|
||||
}
|
||||
|
||||
if (isPreIme && mIMEState != IME_STATE_DISABLED)
|
||||
if (isPreIme && mIMEState != IME_STATE_DISABLED &&
|
||||
(event.getMetaState() & KeyEvent.META_ALT_ON) == 0)
|
||||
// Let active IME process pre-IME key events
|
||||
return false;
|
||||
|
||||
|
|
|
@ -311,7 +311,7 @@ Load(JSContext *cx,
|
|||
{
|
||||
uintN i;
|
||||
JSString *str;
|
||||
JSObject *scriptObj;
|
||||
JSScript *script;
|
||||
jsval result;
|
||||
FILE *file;
|
||||
|
||||
|
@ -333,14 +333,14 @@ Load(JSContext *cx,
|
|||
JS_ReportError(cx, "cannot open file '%s' for reading", filename.ptr());
|
||||
return JS_FALSE;
|
||||
}
|
||||
scriptObj = JS_CompileFileHandleForPrincipals(cx, obj, filename.ptr(), file,
|
||||
Environment(cx)->GetPrincipal());
|
||||
script = JS_CompileFileHandleForPrincipals(cx, obj, filename.ptr(), file,
|
||||
Environment(cx)->GetPrincipal());
|
||||
fclose(file);
|
||||
if (!scriptObj)
|
||||
if (!script)
|
||||
return JS_FALSE;
|
||||
|
||||
if (!Environment(cx)->ShouldCompileOnly() &&
|
||||
!JS_ExecuteScript(cx, obj, scriptObj, &result)) {
|
||||
!JS_ExecuteScript(cx, obj, script, &result)) {
|
||||
return JS_FALSE;
|
||||
}
|
||||
}
|
||||
|
@ -582,7 +582,7 @@ ProcessFile(JSContext *cx,
|
|||
XPCShellEnvironment* env = Environment(cx);
|
||||
XPCShellEnvironment::AutoContextPusher pusher(env);
|
||||
|
||||
JSObject *scriptObj;
|
||||
JSScript *script;
|
||||
jsval result;
|
||||
int lineno, startline;
|
||||
JSBool ok, hitEOF;
|
||||
|
@ -622,11 +622,11 @@ ProcessFile(JSContext *cx,
|
|||
return;
|
||||
}
|
||||
|
||||
JSObject* scriptObj =
|
||||
JSScript* script =
|
||||
JS_CompileFileHandleForPrincipals(cx, obj, filename, file,
|
||||
env->GetPrincipal());
|
||||
if (scriptObj && !env->ShouldCompileOnly())
|
||||
(void)JS_ExecuteScript(cx, obj, scriptObj, &result);
|
||||
if (script && !env->ShouldCompileOnly())
|
||||
(void)JS_ExecuteScript(cx, obj, script, &result);
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -664,14 +664,14 @@ ProcessFile(JSContext *cx,
|
|||
|
||||
/* Clear any pending exception from previous failed compiles. */
|
||||
JS_ClearPendingException(cx);
|
||||
scriptObj =
|
||||
script =
|
||||
JS_CompileScriptForPrincipals(cx, obj, env->GetPrincipal(), buffer,
|
||||
strlen(buffer), "typein", startline);
|
||||
if (scriptObj) {
|
||||
if (script) {
|
||||
JSErrorReporter older;
|
||||
|
||||
if (!env->ShouldCompileOnly()) {
|
||||
ok = JS_ExecuteScript(cx, obj, scriptObj, &result);
|
||||
ok = JS_ExecuteScript(cx, obj, script, &result);
|
||||
if (ok && result != JSVAL_VOID) {
|
||||
/* Suppress error reports from JS_ValueToString(). */
|
||||
older = JS_SetErrorReporter(cx, NULL);
|
||||
|
@ -1237,11 +1237,11 @@ XPCShellEnvironment::EvaluateString(const nsString& aString,
|
|||
return false;
|
||||
}
|
||||
|
||||
JSObject* scriptObj =
|
||||
JSScript* script =
|
||||
JS_CompileUCScriptForPrincipals(mCx, global, GetPrincipal(),
|
||||
aString.get(), aString.Length(),
|
||||
"typein", 0);
|
||||
if (!scriptObj) {
|
||||
if (!script) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1251,7 +1251,7 @@ XPCShellEnvironment::EvaluateString(const nsString& aString,
|
|||
}
|
||||
|
||||
jsval result;
|
||||
JSBool ok = JS_ExecuteScript(mCx, global, scriptObj, &result);
|
||||
JSBool ok = JS_ExecuteScript(mCx, global, script, &result);
|
||||
if (ok && result != JSVAL_VOID) {
|
||||
JSErrorReporter old = JS_SetErrorReporter(mCx, NULL);
|
||||
JSString* str = JS_ValueToString(mCx, result);
|
||||
|
|
|
@ -1042,7 +1042,6 @@ jsdScript::CreatePPLineMap()
|
|||
JSFunction *fun = JSD_GetJSFunction (mCx, mScript);
|
||||
JSScript *script; /* In JSD compartment */
|
||||
PRUint32 baseLine;
|
||||
JSObject *scriptObj = NULL;
|
||||
JSString *jsstr;
|
||||
size_t length;
|
||||
const jschar *chars;
|
||||
|
@ -1093,17 +1092,12 @@ jsdScript::CreatePPLineMap()
|
|||
}
|
||||
|
||||
JS::Anchor<JSString *> kungFuDeathGrip(jsstr);
|
||||
scriptObj = JS_CompileUCScript (cx, obj, chars, length, "x-jsd:ppbuffer?type=script", 1);
|
||||
if (!scriptObj)
|
||||
script = JS_CompileUCScript (cx, obj, chars, length, "x-jsd:ppbuffer?type=script", 1);
|
||||
if (!script)
|
||||
return nsnull;
|
||||
script = JS_GetScriptFromObject(scriptObj);
|
||||
baseLine = 1;
|
||||
}
|
||||
|
||||
/* Make sure that a non-function script is rooted via scriptObj until the
|
||||
* end of script usage. */
|
||||
JS::Anchor<JSObject *> scriptAnchor(scriptObj);
|
||||
|
||||
PRUint32 scriptExtent = JS_GetScriptLineExtent (cx, script);
|
||||
jsbytecode* firstPC = JS_LineNumberToPC (cx, script, 0);
|
||||
/* allocate worst case size of map (number of lines in script + 1
|
||||
|
|
|
@ -947,12 +947,10 @@ namespace JSC {
|
|||
return m_buffer.sizeOfConstantPool();
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
void allowPoolFlush(bool allowFlush)
|
||||
int flushCount()
|
||||
{
|
||||
m_buffer.allowPoolFlush(allowFlush);
|
||||
return m_buffer.flushCount();
|
||||
}
|
||||
#endif
|
||||
|
||||
JmpDst label()
|
||||
{
|
||||
|
@ -1456,7 +1454,12 @@ namespace JSC {
|
|||
// Encoded as bits [5,3:0].
|
||||
return ((reg << 5) & 0x20) | ((reg >> 1) & 0xf);
|
||||
}
|
||||
|
||||
ARMWord SN(int reg)
|
||||
{
|
||||
ASSERT(reg <= ARMRegisters::d31);
|
||||
// Encoded as bits [19:16,7].
|
||||
return ((reg << 15) & 0xf0000) | ((reg & 1) << 7);
|
||||
}
|
||||
static ARMWord getConditionalField(ARMWord i)
|
||||
{
|
||||
return i & 0xf0000000;
|
||||
|
@ -1600,7 +1603,6 @@ namespace JSC {
|
|||
emitVFPInst(static_cast<ARMWord>(cc) | VFP_DXFER | VFP_MOV |
|
||||
(fromFP ? DT_LOAD : 0) |
|
||||
(isDbl ? VFP_DBL : 0), RD(r1), RN(r2), isDbl ? DM(rFP) : SM(rFP));
|
||||
|
||||
}
|
||||
|
||||
void fcpyd_r(int dd, int dm, Condition cc = AL)
|
||||
|
@ -1610,7 +1612,7 @@ namespace JSC {
|
|||
nameFpRegD(dd), nameFpRegD(dm));
|
||||
// TODO: emitInst doesn't work for VFP instructions, though it
|
||||
// seems to work for current usage.
|
||||
emitInst(static_cast<ARMWord>(cc) | FCPYD, dd, dd, dm);
|
||||
emitVFPInst(static_cast<ARMWord>(cc) | FCPYD, DD(dd), DM(dm), 0);
|
||||
}
|
||||
|
||||
void faddd_r(int dd, int dn, int dm, Condition cc = AL)
|
||||
|
@ -1619,7 +1621,7 @@ namespace JSC {
|
|||
IPFX "%-15s %s, %s, %s\n", MAYBE_PAD, "vadd.f64", nameFpRegD(dd), nameFpRegD(dn), nameFpRegD(dm));
|
||||
// TODO: emitInst doesn't work for VFP instructions, though it
|
||||
// seems to work for current usage.
|
||||
emitInst(static_cast<ARMWord>(cc) | FADDD, dd, dn, dm);
|
||||
emitVFPInst(static_cast<ARMWord>(cc) | FADDD, DD(dd), DN(dn), DM(dm));
|
||||
}
|
||||
|
||||
void fnegd_r(int dd, int dm, Condition cc = AL)
|
||||
|
@ -1635,7 +1637,7 @@ namespace JSC {
|
|||
IPFX "%-15s %s, %s, %s\n", MAYBE_PAD, "vdiv.f64", nameFpRegD(dd), nameFpRegD(dn), nameFpRegD(dm));
|
||||
// TODO: emitInst doesn't work for VFP instructions, though it
|
||||
// seems to work for current usage.
|
||||
emitInst(static_cast<ARMWord>(cc) | FDIVD, dd, dn, dm);
|
||||
emitVFPInst(static_cast<ARMWord>(cc) | FDIVD, DD(dd), DN(dn), DM(dm));
|
||||
}
|
||||
|
||||
void fsubd_r(int dd, int dn, int dm, Condition cc = AL)
|
||||
|
@ -1644,7 +1646,7 @@ namespace JSC {
|
|||
IPFX "%-15s %s, %s, %s\n", MAYBE_PAD, "vsub.f64", nameFpRegD(dd), nameFpRegD(dn), nameFpRegD(dm));
|
||||
// TODO: emitInst doesn't work for VFP instructions, though it
|
||||
// seems to work for current usage.
|
||||
emitInst(static_cast<ARMWord>(cc) | FSUBD, dd, dn, dm);
|
||||
emitVFPInst(static_cast<ARMWord>(cc) | FSUBD, DD(dd), DN(dn), DM(dm));
|
||||
}
|
||||
|
||||
void fabsd_r(int dd, int dm, Condition cc = AL)
|
||||
|
@ -1660,7 +1662,7 @@ namespace JSC {
|
|||
IPFX "%-15s %s, %s, %s\n", MAYBE_PAD, "vmul.f64", nameFpRegD(dd), nameFpRegD(dn), nameFpRegD(dm));
|
||||
// TODO: emitInst doesn't work for VFP instructions, though it
|
||||
// seems to work for current usage.
|
||||
emitInst(static_cast<ARMWord>(cc) | FMULD, dd, dn, dm);
|
||||
emitVFPInst(static_cast<ARMWord>(cc) | FMULD, DD(dd), DN(dn), DM(dm));
|
||||
}
|
||||
|
||||
void fcmpd_r(int dd, int dm, Condition cc = AL)
|
||||
|
@ -1669,7 +1671,7 @@ namespace JSC {
|
|||
IPFX "%-15s %s, %s\n", MAYBE_PAD, "vcmp.f64", nameFpRegD(dd), nameFpRegD(dm));
|
||||
// TODO: emitInst doesn't work for VFP instructions, though it
|
||||
// seems to work for current usage.
|
||||
emitInst(static_cast<ARMWord>(cc) | FCMPD, dd, 0, dm);
|
||||
emitVFPInst(static_cast<ARMWord>(cc) | FCMPD, DD(dd), 0, DM(dm));
|
||||
}
|
||||
|
||||
void fsqrtd_r(int dd, int dm, Condition cc = AL)
|
||||
|
@ -1678,49 +1680,49 @@ namespace JSC {
|
|||
IPFX "%-15s %s, %s\n", MAYBE_PAD, "vsqrt.f64", nameFpRegD(dd), nameFpRegD(dm));
|
||||
// TODO: emitInst doesn't work for VFP instructions, though it
|
||||
// seems to work for current usage.
|
||||
emitInst(static_cast<ARMWord>(cc) | FSQRTD, dd, 0, dm);
|
||||
emitVFPInst(static_cast<ARMWord>(cc) | FSQRTD, DD(dd), 0, DM(dm));
|
||||
}
|
||||
|
||||
void fmsr_r(int dd, int rn, Condition cc = AL)
|
||||
{
|
||||
// TODO: emitInst doesn't work for VFP instructions, though it
|
||||
// seems to work for current usage.
|
||||
emitInst(static_cast<ARMWord>(cc) | FMSR, rn, dd, 0);
|
||||
emitVFPInst(static_cast<ARMWord>(cc) | FMSR, RD(rn), SN(dd), 0);
|
||||
}
|
||||
|
||||
void fmrs_r(int rd, int dn, Condition cc = AL)
|
||||
{
|
||||
// TODO: emitInst doesn't work for VFP instructions, though it
|
||||
// seems to work for current usage.
|
||||
emitInst(static_cast<ARMWord>(cc) | FMRS, rd, dn, 0);
|
||||
emitVFPInst(static_cast<ARMWord>(cc) | FMRS, RD(rd), SN(dn), 0);
|
||||
}
|
||||
|
||||
// dear god :(
|
||||
// integer registers ar encoded the same as single registers
|
||||
void fsitod_r(int dd, int dm, Condition cc = AL)
|
||||
{
|
||||
// TODO: emitInst doesn't work for VFP instructions, though it
|
||||
// seems to work for current usage.
|
||||
emitInst(static_cast<ARMWord>(cc) | FSITOD, dd, 0, dm);
|
||||
emitVFPInst(static_cast<ARMWord>(cc) | FSITOD, DD(dd), 0, SM(dm));
|
||||
}
|
||||
|
||||
void fuitod_r(int dd, int dm, Condition cc = AL)
|
||||
{
|
||||
// TODO: emitInst doesn't work for VFP instructions, though it
|
||||
// seems to work for current usage.
|
||||
emitInst(static_cast<ARMWord>(cc) | FUITOD, dd, 0, dm);
|
||||
emitVFPInst(static_cast<ARMWord>(cc) | FUITOD, DD(dd), 0, SM(dm));
|
||||
}
|
||||
|
||||
void ftosid_r(int fd, int dm, Condition cc = AL)
|
||||
{
|
||||
// TODO: emitInst doesn't work for VFP instructions, though it
|
||||
// seems to work for current usage.
|
||||
emitInst(static_cast<ARMWord>(cc) | FTOSID, fd, 0, dm);
|
||||
// TODO: I don't actually know what the encoding is i'm guessing SD and DM.
|
||||
emitVFPInst(static_cast<ARMWord>(cc) | FTOSID, SD(fd), 0, DM(dm));
|
||||
}
|
||||
|
||||
void ftosizd_r(int fd, int dm, Condition cc = AL)
|
||||
{
|
||||
// TODO: emitInst doesn't work for VFP instructions, though it
|
||||
// seems to work for current usage.
|
||||
emitInst(static_cast<ARMWord>(cc) | FTOSIZD, fd, 0, dm);
|
||||
// TODO: I don't actually know what the encoding is i'm guessing SD and DM.
|
||||
emitVFPInst(static_cast<ARMWord>(cc) | FTOSIZD, SD(fd), 0, DM(dm));
|
||||
}
|
||||
|
||||
void fmstat(Condition cc = AL)
|
||||
|
|
|
@ -106,9 +106,7 @@ public:
|
|||
, m_numConsts(0)
|
||||
, m_maxDistance(maxPoolSize)
|
||||
, m_lastConstDelta(0)
|
||||
#ifdef DEBUG
|
||||
, m_allowFlush(true)
|
||||
#endif
|
||||
, m_flushCount(0)
|
||||
{
|
||||
m_pool = static_cast<uint32_t*>(malloc(maxPoolSize));
|
||||
m_mask = static_cast<char*>(malloc(maxPoolSize / sizeof(uint32_t)));
|
||||
|
@ -241,19 +239,16 @@ public:
|
|||
return m_numConsts;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
// Guard constant pool flushes to ensure that they don't occur during
|
||||
// regions where offsets into the code have to be maintained (such as PICs).
|
||||
void allowPoolFlush(bool allowFlush)
|
||||
int flushCount()
|
||||
{
|
||||
m_allowFlush = allowFlush;
|
||||
return m_flushCount;
|
||||
}
|
||||
#endif
|
||||
|
||||
private:
|
||||
void correctDeltas(int insnSize)
|
||||
{
|
||||
m_maxDistance -= insnSize;
|
||||
ASSERT(m_maxDistance >= 0);
|
||||
m_lastConstDelta -= insnSize;
|
||||
if (m_lastConstDelta < 0)
|
||||
m_lastConstDelta = 0;
|
||||
|
@ -264,6 +259,7 @@ private:
|
|||
correctDeltas(insnSize);
|
||||
|
||||
m_maxDistance -= m_lastConstDelta;
|
||||
ASSERT(m_maxDistance >= 0);
|
||||
m_lastConstDelta = constSize;
|
||||
}
|
||||
|
||||
|
@ -271,9 +267,9 @@ private:
|
|||
{
|
||||
js::JaegerSpew(js::JSpew_Insns, " -- FLUSHING CONSTANT POOL WITH %d CONSTANTS --\n",
|
||||
m_numConsts);
|
||||
ASSERT(m_allowFlush);
|
||||
if (m_numConsts == 0)
|
||||
return;
|
||||
m_flushCount++;
|
||||
int alignPool = (AssemblerBuffer::size() + (useBarrier ? barrierSize : 0)) & (sizeof(uint64_t) - 1);
|
||||
|
||||
if (alignPool)
|
||||
|
@ -304,12 +300,16 @@ private:
|
|||
m_loadOffsets.clear();
|
||||
m_numConsts = 0;
|
||||
m_maxDistance = maxPoolSize;
|
||||
ASSERT(m_maxDistance >= 0);
|
||||
|
||||
}
|
||||
|
||||
void flushIfNoSpaceFor(int nextInsnSize)
|
||||
{
|
||||
if (m_numConsts == 0)
|
||||
if (m_numConsts == 0) {
|
||||
m_maxDistance = maxPoolSize;
|
||||
return;
|
||||
}
|
||||
int lastConstDelta = m_lastConstDelta > nextInsnSize ? m_lastConstDelta - nextInsnSize : 0;
|
||||
if ((m_maxDistance < nextInsnSize + lastConstDelta + barrierSize + (int)sizeof(uint32_t)))
|
||||
flushConstantPool();
|
||||
|
@ -317,8 +317,10 @@ private:
|
|||
|
||||
void flushIfNoSpaceFor(int nextInsnSize, int nextConstSize)
|
||||
{
|
||||
if (m_numConsts == 0)
|
||||
if (m_numConsts == 0) {
|
||||
m_maxDistance = maxPoolSize;
|
||||
return;
|
||||
}
|
||||
if ((m_maxDistance < nextInsnSize + m_lastConstDelta + nextConstSize + barrierSize + (int)sizeof(uint32_t)) ||
|
||||
(m_numConsts * sizeof(uint32_t) + nextConstSize >= maxPoolSize))
|
||||
flushConstantPool();
|
||||
|
@ -331,10 +333,7 @@ private:
|
|||
int m_numConsts;
|
||||
int m_maxDistance;
|
||||
int m_lastConstDelta;
|
||||
|
||||
#ifdef DEBUG
|
||||
bool m_allowFlush;
|
||||
#endif
|
||||
int m_flushCount;
|
||||
};
|
||||
|
||||
} // namespace JSC
|
||||
|
|
|
@ -1292,14 +1292,14 @@ public:
|
|||
|
||||
void convertInt32ToDouble(RegisterID src, FPRegisterID dest)
|
||||
{
|
||||
m_assembler.fmsr_r(dest, src);
|
||||
m_assembler.fsitod_r(dest, dest);
|
||||
m_assembler.fmsr_r(floatShadow(dest), src);
|
||||
m_assembler.fsitod_r(dest, floatShadow(dest));
|
||||
}
|
||||
|
||||
void convertUInt32ToDouble(RegisterID src, FPRegisterID dest)
|
||||
{
|
||||
m_assembler.fmsr_r(dest, src);
|
||||
m_assembler.fuitod_r(dest, dest);
|
||||
m_assembler.fmsr_r(floatShadow(dest), src);
|
||||
m_assembler.fuitod_r(dest, floatShadow(dest));
|
||||
}
|
||||
|
||||
void convertInt32ToDouble(Address src, FPRegisterID dest)
|
||||
|
@ -1337,11 +1337,11 @@ public:
|
|||
// May also branch for some values that are representable in 32 bits
|
||||
Jump branchTruncateDoubleToInt32(FPRegisterID src, RegisterID dest)
|
||||
{
|
||||
m_assembler.ftosizd_r(ARMRegisters::SD0, src);
|
||||
m_assembler.ftosizd_r(floatShadow(ARMRegisters::SD0), src);
|
||||
// If FTOSIZD (VCVT.S32.F64) can't fit the result into a 32-bit
|
||||
// integer, it saturates at INT_MAX or INT_MIN. Testing this is
|
||||
// probably quicker than testing FPSCR for exception.
|
||||
m_assembler.fmrs_r(dest, ARMRegisters::SD0);
|
||||
m_assembler.fmrs_r(dest, floatShadow(ARMRegisters::SD0));
|
||||
m_assembler.cmn_r(dest, ARMAssembler::getOp2(-0x7fffffff));
|
||||
m_assembler.cmp_r(dest, ARMAssembler::getOp2(0x80000000), ARMCondition(NonZero));
|
||||
return Jump(m_assembler.jmp(ARMCondition(Zero)));
|
||||
|
@ -1353,11 +1353,11 @@ public:
|
|||
// (specifically, in this case, 0).
|
||||
void branchConvertDoubleToInt32(FPRegisterID src, RegisterID dest, JumpList& failureCases, FPRegisterID fpTemp)
|
||||
{
|
||||
m_assembler.ftosid_r(ARMRegisters::SD0, src);
|
||||
m_assembler.fmrs_r(dest, ARMRegisters::SD0);
|
||||
m_assembler.ftosid_r(floatShadow(ARMRegisters::SD0), src);
|
||||
m_assembler.fmrs_r(dest, floatShadow(ARMRegisters::SD0));
|
||||
|
||||
// Convert the integer result back to float & compare to the original value - if not equal or unordered (NaN) then jump.
|
||||
m_assembler.fsitod_r(ARMRegisters::SD0, ARMRegisters::SD0);
|
||||
m_assembler.fsitod_r(ARMRegisters::SD0, floatShadow(ARMRegisters::SD0));
|
||||
failureCases.append(branchDouble(DoubleNotEqualOrUnordered, src, ARMRegisters::SD0));
|
||||
|
||||
// If the result is zero, it might have been -0.0, and 0.0 equals to -0.0
|
||||
|
@ -1380,12 +1380,10 @@ public:
|
|||
m_assembler.forceFlushConstantPool();
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
void allowPoolFlush(bool allowFlush)
|
||||
int flushCount()
|
||||
{
|
||||
m_assembler.allowPoolFlush(allowFlush);
|
||||
return m_assembler.flushCount();
|
||||
}
|
||||
#endif
|
||||
|
||||
protected:
|
||||
ARMAssembler::Condition ARMCondition(Condition cond)
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
|
||||
var g = newGlobal("same-compartment");
|
||||
g.eval("this.f = function(a) {" +
|
||||
"assertEq(a instanceof Array, false);" +
|
||||
"a = Array.prototype.slice.call(a);" +
|
||||
"assertEq(a instanceof Array, true); }");
|
||||
g.f([1, 2, 3]);
|
||||
|
||||
var g2 = newGlobal("new-compartment");
|
||||
g2.a = g2.Array(10);
|
||||
assertEq(g2.a instanceof Array, false);
|
||||
g2.a = Array.prototype.slice(g2.a);
|
||||
assertEq(g2.a instanceof Array, true);
|
|
@ -0,0 +1,11 @@
|
|||
|
||||
function foo() {
|
||||
function D(){}
|
||||
arr = [
|
||||
new (function D ( ) {
|
||||
D += '' + foo;
|
||||
}),
|
||||
new D
|
||||
];
|
||||
}
|
||||
foo();
|
|
@ -0,0 +1,16 @@
|
|||
|
||||
(function () {
|
||||
assertEquals = function assertEquals(expected, found, name_opt) { };
|
||||
})();
|
||||
function testOne(receiver, key, result) {
|
||||
for(var i = 0; i != 10; i++ ) {
|
||||
assertEquals(result, receiver[key]());
|
||||
}
|
||||
}
|
||||
function TypeOfThis() { return typeof this; }
|
||||
Number.prototype.type = TypeOfThis;
|
||||
String.prototype.type = TypeOfThis;
|
||||
Boolean.prototype.type = TypeOfThis;
|
||||
testOne(2.3, 'type', 'object');
|
||||
testOne('x', 'type', 'object');
|
||||
testOne(true, 'type', 'object');
|
|
@ -0,0 +1,8 @@
|
|||
function Function() {
|
||||
try {
|
||||
var g = this;
|
||||
g.c("evil", eval);
|
||||
} catch(b) {}
|
||||
}
|
||||
var o0 = Function.prototype;
|
||||
var f = new Function( (null ) );
|
|
@ -0,0 +1,7 @@
|
|||
|
||||
function X(n) {
|
||||
while ('' + (n--)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
X();
|
|
@ -0,0 +1,7 @@
|
|||
|
||||
function foo(x) {
|
||||
for (var i = 0; i < 100; i++) {
|
||||
x.f === i;
|
||||
}
|
||||
}
|
||||
foo({f:"three"});
|
|
@ -0,0 +1,13 @@
|
|||
|
||||
// TI does not account for GETELEM accessing strings, so the GETELEM PIC must
|
||||
// update type constraints according to generated stubs.
|
||||
function foo(a, b) {
|
||||
for (var j = 0; j < 5; j++)
|
||||
a[b[j]] + " what";
|
||||
}
|
||||
var a = {a:"zero", b:"one", c:"two", d:"three", e:"four"};
|
||||
var b = ["a", "b", "c", "d", "e"];
|
||||
foo(a, b);
|
||||
foo(a, b);
|
||||
a.e = 4;
|
||||
foo(a, b);
|
|
@ -0,0 +1,18 @@
|
|||
// GETPROP PIC with multiple stubs containing getter hooks.
|
||||
|
||||
function foo(arr) {
|
||||
for (var i = 0; i < 100; i++)
|
||||
arr[i].caller;
|
||||
}
|
||||
arr = Object.create(Object.prototype);
|
||||
first = Object.create({});
|
||||
first.caller = null;
|
||||
second = Object.create({});
|
||||
second.caller = null;
|
||||
for (var i = 0; i < 100; ) {
|
||||
arr[i++] = first;
|
||||
arr[i++] = foo;
|
||||
arr[i++] = second;
|
||||
}
|
||||
foo.caller;
|
||||
foo(arr);
|
|
@ -0,0 +1,19 @@
|
|||
// PIC on CALLPROP invoking getter hook.
|
||||
|
||||
function foo(arr) {
|
||||
for (var i = 0; i < 100; i++)
|
||||
arr[i].caller(false);
|
||||
}
|
||||
arr = Object.create(Object.prototype);
|
||||
first = Object.create({});
|
||||
first.caller = bar;
|
||||
second = Object.create({});
|
||||
second.caller = bar;
|
||||
for (var i = 0; i < 100; )
|
||||
arr[i++] = foo;
|
||||
foo.caller;
|
||||
function bar(x) {
|
||||
if (x)
|
||||
foo(arr);
|
||||
}
|
||||
bar(true);
|
|
@ -140,6 +140,14 @@ class Bytecode
|
|||
/* Call whose result should be monitored. */
|
||||
bool monitoredTypesReturn : 1;
|
||||
|
||||
/*
|
||||
* Dynamically observed state about the execution of this opcode. These are
|
||||
* hints about the script for use during compilation.
|
||||
*/
|
||||
bool arrayWriteHole: 1; /* SETELEM which has written to an array hole. */
|
||||
bool getStringElement:1; /* GETELEM which has accessed string properties. */
|
||||
bool accessGetter: 1; /* Property read on a shape with a getter hook. */
|
||||
|
||||
/* Stack depth before this opcode. */
|
||||
uint32 stackDepth;
|
||||
|
||||
|
@ -964,7 +972,6 @@ class ScriptAnalysis
|
|||
/* Accessors for bytecode information. */
|
||||
|
||||
Bytecode& getCode(uint32 offset) {
|
||||
JS_ASSERT(script->compartment()->activeAnalysis);
|
||||
JS_ASSERT(offset < script->length);
|
||||
JS_ASSERT(codeArray[offset]);
|
||||
return *codeArray[offset];
|
||||
|
@ -972,7 +979,6 @@ class ScriptAnalysis
|
|||
Bytecode& getCode(const jsbytecode *pc) { return getCode(pc - script->code); }
|
||||
|
||||
Bytecode* maybeCode(uint32 offset) {
|
||||
JS_ASSERT(script->compartment()->activeAnalysis);
|
||||
JS_ASSERT(offset < script->length);
|
||||
return codeArray[offset];
|
||||
}
|
||||
|
|
|
@ -34,12 +34,10 @@ BEGIN_TEST(testScriptInfo)
|
|||
{
|
||||
uintN startLine = 1000;
|
||||
|
||||
JSObject *scriptObj = JS_CompileScript(cx, global, code, strlen(code),
|
||||
__FILE__, startLine);
|
||||
JSScript *script = JS_CompileScript(cx, global, code, strlen(code), __FILE__, startLine);
|
||||
|
||||
CHECK(scriptObj);
|
||||
CHECK(script);
|
||||
|
||||
JSScript *script = JS_GetScriptFromObject(scriptObj);
|
||||
jsbytecode *start = JS_LineNumberToPC(cx, script, startLine);
|
||||
CHECK_EQUAL(JS_GetScriptBaseLineNumber(cx, script), startLine);
|
||||
CHECK_EQUAL(JS_PCToLineNumber(cx, script, start), startLine);
|
||||
|
|
|
@ -15,15 +15,15 @@ struct ScriptObjectFixture : public JSAPITest {
|
|||
uc_code[i] = code[i];
|
||||
}
|
||||
|
||||
bool tryScript(JSObject *scriptObj)
|
||||
bool tryScript(JSScript *script)
|
||||
{
|
||||
CHECK(scriptObj);
|
||||
CHECK(script);
|
||||
|
||||
JS_GC(cx);
|
||||
|
||||
/* After a garbage collection, the script should still work. */
|
||||
jsval result;
|
||||
CHECK(JS_ExecuteScript(cx, global, scriptObj, &result));
|
||||
CHECK(JS_ExecuteScript(cx, global, script, &result));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -87,9 +87,9 @@ BEGIN_FIXTURE_TEST(ScriptObjectFixture, bug438633_JS_CompileFile)
|
|||
FILE *script_stream = tempScript.open(script_filename);
|
||||
CHECK(fputs(code, script_stream) != EOF);
|
||||
tempScript.close();
|
||||
JSObject *scriptObj = JS_CompileFile(cx, global, script_filename);
|
||||
JSScript *script = JS_CompileFile(cx, global, script_filename);
|
||||
tempScript.remove();
|
||||
return tryScript(scriptObj);
|
||||
return tryScript(script);
|
||||
}
|
||||
END_FIXTURE_TEST(ScriptObjectFixture, bug438633_JS_CompileFile)
|
||||
|
||||
|
@ -99,9 +99,9 @@ BEGIN_FIXTURE_TEST(ScriptObjectFixture, bug438633_JS_CompileFile_empty)
|
|||
static const char script_filename[] = "temp-bug438633_JS_CompileFile_empty";
|
||||
tempScript.open(script_filename);
|
||||
tempScript.close();
|
||||
JSObject *scriptObj = JS_CompileFile(cx, global, script_filename);
|
||||
JSScript *script = JS_CompileFile(cx, global, script_filename);
|
||||
tempScript.remove();
|
||||
return tryScript(scriptObj);
|
||||
return tryScript(script);
|
||||
}
|
||||
END_FIXTURE_TEST(ScriptObjectFixture, bug438633_JS_CompileFile_empty)
|
||||
|
||||
|
|
|
@ -30,12 +30,12 @@ BEGIN_TEST(testTrap_gc)
|
|||
;
|
||||
|
||||
// compile
|
||||
JSObject *scriptObj = JS_CompileScript(cx, global, source, strlen(source), __FILE__, 1);
|
||||
CHECK(scriptObj);
|
||||
JSScript *script = JS_CompileScript(cx, global, source, strlen(source), __FILE__, 1);
|
||||
CHECK(script);
|
||||
|
||||
// execute
|
||||
jsvalRoot v2(cx);
|
||||
CHECK(JS_ExecuteScript(cx, global, scriptObj, v2.addr()));
|
||||
CHECK(JS_ExecuteScript(cx, global, script, v2.addr()));
|
||||
CHECK(JSVAL_IS_OBJECT(v2));
|
||||
CHECK_EQUAL(emptyTrapCallCount, 0);
|
||||
|
||||
|
@ -51,7 +51,6 @@ BEGIN_TEST(testTrap_gc)
|
|||
// JS_ExecuteScript. This way we avoid using Anchor.
|
||||
JSString *trapClosure;
|
||||
{
|
||||
JSScript *script = JS_GetScriptFromObject(scriptObj);
|
||||
jsbytecode *line2 = JS_LineNumberToPC(cx, script, 1);
|
||||
CHECK(line2);
|
||||
|
||||
|
@ -69,7 +68,7 @@ BEGIN_TEST(testTrap_gc)
|
|||
}
|
||||
|
||||
// execute
|
||||
CHECK(JS_ExecuteScript(cx, global, scriptObj, v2.addr()));
|
||||
CHECK(JS_ExecuteScript(cx, global, script, v2.addr()));
|
||||
CHECK_EQUAL(emptyTrapCallCount, 11);
|
||||
|
||||
JS_GC(cx);
|
||||
|
|
|
@ -42,7 +42,7 @@ struct VersionFixture : public JSAPITest
|
|||
EvalScriptVersion16, 0, 0);
|
||||
}
|
||||
|
||||
JSObject *fakeScript(const char *contents, size_t length) {
|
||||
JSScript *fakeScript(const char *contents, size_t length) {
|
||||
return JS_CompileScript(cx, global, contents, length, "<test>", 1);
|
||||
}
|
||||
|
||||
|
@ -75,9 +75,9 @@ struct VersionFixture : public JSAPITest
|
|||
|
||||
/* Check that script compilation results in a version without XML. */
|
||||
bool checkNewScriptNoXML() {
|
||||
JSObject *scriptObj = fakeScript("", 0);
|
||||
CHECK(scriptObj);
|
||||
CHECK(!hasXML(JS_GetScriptFromObject(scriptObj)->getVersion()));
|
||||
JSScript *script = fakeScript("", 0);
|
||||
CHECK(script);
|
||||
CHECK(!hasXML(script->getVersion()));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -196,9 +196,9 @@ BEGIN_FIXTURE_TEST(VersionFixture, testOptionsAreUsedForVersionFlags)
|
|||
"disableXMLOption();"
|
||||
"callSetVersion17();"
|
||||
"checkNewScriptNoXML();";
|
||||
JSObject *toActivate = fakeScript(toActivateChars, sizeof(toActivateChars) - 1);
|
||||
JSScript *toActivate = fakeScript(toActivateChars, sizeof(toActivateChars) - 1);
|
||||
CHECK(toActivate);
|
||||
CHECK(hasXML(JS_GetScriptFromObject(toActivate)));
|
||||
CHECK(hasXML(toActivate));
|
||||
|
||||
disableXML();
|
||||
|
||||
|
|
|
@ -16,13 +16,13 @@ BEGIN_TEST(testXDR_bug506491)
|
|||
"var f = makeClosure('0;', 'status', 'ok');\n";
|
||||
|
||||
// compile
|
||||
JSObject *scriptObj = JS_CompileScript(cx, global, s, strlen(s), __FILE__, __LINE__);
|
||||
CHECK(scriptObj);
|
||||
JSScript *script = JS_CompileScript(cx, global, s, strlen(s), __FILE__, __LINE__);
|
||||
CHECK(script);
|
||||
|
||||
// freeze
|
||||
JSXDRState *w = JS_XDRNewMem(cx, JSXDR_ENCODE);
|
||||
CHECK(w);
|
||||
CHECK(JS_XDRScriptObject(w, &scriptObj));
|
||||
CHECK(JS_XDRScript(w, &script));
|
||||
uint32 nbytes;
|
||||
void *p = JS_XDRMemGetData(w, &nbytes);
|
||||
CHECK(p);
|
||||
|
@ -32,15 +32,15 @@ BEGIN_TEST(testXDR_bug506491)
|
|||
JS_XDRDestroy(w);
|
||||
|
||||
// thaw
|
||||
scriptObj = NULL;
|
||||
script = NULL;
|
||||
JSXDRState *r = JS_XDRNewMem(cx, JSXDR_DECODE);
|
||||
JS_XDRMemSetData(r, frozen, nbytes);
|
||||
CHECK(JS_XDRScriptObject(r, &scriptObj));
|
||||
CHECK(JS_XDRScript(r, &script));
|
||||
JS_XDRDestroy(r); // this frees `frozen`
|
||||
|
||||
// execute
|
||||
jsvalRoot v2(cx);
|
||||
CHECK(JS_ExecuteScript(cx, global, scriptObj, v2.addr()));
|
||||
CHECK(JS_ExecuteScript(cx, global, script, v2.addr()));
|
||||
|
||||
// try to break the Block object that is the parent of f
|
||||
JS_GC(cx);
|
||||
|
@ -56,13 +56,13 @@ END_TEST(testXDR_bug506491)
|
|||
BEGIN_TEST(testXDR_bug516827)
|
||||
{
|
||||
// compile an empty script
|
||||
JSObject *scriptObj = JS_CompileScript(cx, global, "", 0, __FILE__, __LINE__);
|
||||
CHECK(scriptObj);
|
||||
JSScript *script = JS_CompileScript(cx, global, "", 0, __FILE__, __LINE__);
|
||||
CHECK(script);
|
||||
|
||||
// freeze
|
||||
JSXDRState *w = JS_XDRNewMem(cx, JSXDR_ENCODE);
|
||||
CHECK(w);
|
||||
CHECK(JS_XDRScriptObject(w, &scriptObj));
|
||||
CHECK(JS_XDRScript(w, &script));
|
||||
uint32 nbytes;
|
||||
void *p = JS_XDRMemGetData(w, &nbytes);
|
||||
CHECK(p);
|
||||
|
@ -72,14 +72,14 @@ BEGIN_TEST(testXDR_bug516827)
|
|||
JS_XDRDestroy(w);
|
||||
|
||||
// thaw
|
||||
scriptObj = NULL;
|
||||
script = NULL;
|
||||
JSXDRState *r = JS_XDRNewMem(cx, JSXDR_DECODE);
|
||||
JS_XDRMemSetData(r, frozen, nbytes);
|
||||
CHECK(JS_XDRScriptObject(r, &scriptObj));
|
||||
CHECK(JS_XDRScript(r, &script));
|
||||
JS_XDRDestroy(r); // this frees `frozen`
|
||||
|
||||
// execute with null result meaning no result wanted
|
||||
CHECK(JS_ExecuteScript(cx, global, scriptObj, NULL));
|
||||
CHECK(JS_ExecuteScript(cx, global, script, NULL));
|
||||
return true;
|
||||
}
|
||||
END_TEST(testXDR_bug516827)
|
||||
|
|
|
@ -1580,8 +1580,8 @@ StdNameToAtom(JSContext *cx, JSStdName *stdn)
|
|||
* If you add a "standard" class, remember to update this table.
|
||||
*/
|
||||
static JSStdName standard_class_atoms[] = {
|
||||
{js_InitFunctionAndObjectClasses, EAGER_ATOM_AND_CLASP(Function)},
|
||||
{js_InitFunctionAndObjectClasses, EAGER_ATOM_AND_CLASP(Object)},
|
||||
{js_InitFunctionClass, EAGER_ATOM_AND_CLASP(Function)},
|
||||
{js_InitObjectClass, EAGER_ATOM_AND_CLASP(Object)},
|
||||
{js_InitArrayClass, EAGER_ATOM_AND_CLASP(Array)},
|
||||
{js_InitBooleanClass, EAGER_ATOM_AND_CLASP(Boolean)},
|
||||
{js_InitDateClass, EAGER_ATOM_AND_CLASP(Date)},
|
||||
|
@ -2085,6 +2085,13 @@ JS_AddNamedObjectRoot(JSContext *cx, JSObject **rp, const char *name)
|
|||
return js_AddGCThingRoot(cx, (void **)rp, name);
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(JSBool)
|
||||
JS_AddNamedScriptRoot(JSContext *cx, JSScript **rp, const char *name)
|
||||
{
|
||||
CHECK_REQUEST(cx);
|
||||
return js_AddGCThingRoot(cx, (void **)rp, name);
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(JSBool)
|
||||
JS_AddNamedGCThingRoot(JSContext *cx, void **rp, const char *name)
|
||||
{
|
||||
|
@ -2113,6 +2120,13 @@ JS_RemoveObjectRoot(JSContext *cx, JSObject **rp)
|
|||
return js_RemoveRoot(cx->runtime, (void *)rp);
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(JSBool)
|
||||
JS_RemoveScriptRoot(JSContext *cx, JSScript **rp)
|
||||
{
|
||||
CHECK_REQUEST(cx);
|
||||
return js_RemoveRoot(cx->runtime, (void *)rp);
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(JSBool)
|
||||
JS_RemoveGCThingRoot(JSContext *cx, void **rp)
|
||||
{
|
||||
|
@ -4462,7 +4476,7 @@ JS_OPTIONS_TO_TCFLAGS(JSContext *cx)
|
|||
(cx->hasRunOption(JSOPTION_NO_SCRIPT_RVAL) ? TCF_NO_SCRIPT_RVAL : 0);
|
||||
}
|
||||
|
||||
static JSObject *
|
||||
static JSScript *
|
||||
CompileUCScriptForPrincipalsCommon(JSContext *cx, JSObject *obj, JSPrincipals *principals,
|
||||
const jschar *chars, size_t length,
|
||||
const char *filename, uintN lineno, JSVersion version)
|
||||
|
@ -4473,15 +4487,11 @@ CompileUCScriptForPrincipalsCommon(JSContext *cx, JSObject *obj, JSPrincipals *p
|
|||
AutoLastFrameCheck lfc(cx);
|
||||
|
||||
uint32 tcflags = JS_OPTIONS_TO_TCFLAGS(cx) | TCF_NEED_MUTABLE_SCRIPT | TCF_NEED_SCRIPT_OBJECT;
|
||||
JSScript *script = Compiler::compileScript(cx, obj, NULL, principals, tcflags,
|
||||
chars, length, filename, lineno, version);
|
||||
if (!script)
|
||||
return NULL;
|
||||
JS_ASSERT(script->u.object);
|
||||
return script->u.object;
|
||||
return Compiler::compileScript(cx, obj, NULL, principals, tcflags,
|
||||
chars, length, filename, lineno, version);
|
||||
}
|
||||
|
||||
extern JS_PUBLIC_API(JSObject *)
|
||||
extern JS_PUBLIC_API(JSScript *)
|
||||
JS_CompileUCScriptForPrincipalsVersion(JSContext *cx, JSObject *obj,
|
||||
JSPrincipals *principals,
|
||||
const jschar *chars, size_t length,
|
||||
|
@ -4493,7 +4503,7 @@ JS_CompileUCScriptForPrincipalsVersion(JSContext *cx, JSObject *obj,
|
|||
avi.version());
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(JSObject *)
|
||||
JS_PUBLIC_API(JSScript *)
|
||||
JS_CompileUCScriptForPrincipals(JSContext *cx, JSObject *obj, JSPrincipals *principals,
|
||||
const jschar *chars, size_t length,
|
||||
const char *filename, uintN lineno)
|
||||
|
@ -4502,7 +4512,7 @@ JS_CompileUCScriptForPrincipals(JSContext *cx, JSObject *obj, JSPrincipals *prin
|
|||
cx->findVersion());
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(JSObject *)
|
||||
JS_PUBLIC_API(JSScript *)
|
||||
JS_CompileUCScript(JSContext *cx, JSObject *obj, const jschar *chars, size_t length,
|
||||
const char *filename, uintN lineno)
|
||||
{
|
||||
|
@ -4510,7 +4520,7 @@ JS_CompileUCScript(JSContext *cx, JSObject *obj, const jschar *chars, size_t len
|
|||
return JS_CompileUCScriptForPrincipals(cx, obj, NULL, chars, length, filename, lineno);
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(JSObject *)
|
||||
JS_PUBLIC_API(JSScript *)
|
||||
JS_CompileScriptForPrincipalsVersion(JSContext *cx, JSObject *obj,
|
||||
JSPrincipals *principals,
|
||||
const char *bytes, size_t length,
|
||||
|
@ -4521,7 +4531,7 @@ JS_CompileScriptForPrincipalsVersion(JSContext *cx, JSObject *obj,
|
|||
return JS_CompileScriptForPrincipals(cx, obj, principals, bytes, length, filename, lineno);
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(JSObject *)
|
||||
JS_PUBLIC_API(JSScript *)
|
||||
JS_CompileScriptForPrincipals(JSContext *cx, JSObject *obj,
|
||||
JSPrincipals *principals,
|
||||
const char *bytes, size_t length,
|
||||
|
@ -4533,13 +4543,13 @@ JS_CompileScriptForPrincipals(JSContext *cx, JSObject *obj,
|
|||
jschar *chars = InflateString(cx, bytes, &length);
|
||||
if (!chars)
|
||||
return NULL;
|
||||
JSObject *scriptObj =
|
||||
JSScript *script =
|
||||
JS_CompileUCScriptForPrincipals(cx, obj, principals, chars, length, filename, lineno);
|
||||
cx->free_(chars);
|
||||
return scriptObj;
|
||||
return script;
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(JSObject *)
|
||||
JS_PUBLIC_API(JSScript *)
|
||||
JS_CompileScript(JSContext *cx, JSObject *obj, const char *bytes, size_t length,
|
||||
const char *filename, uintN lineno)
|
||||
{
|
||||
|
@ -4600,7 +4610,7 @@ JS_BufferIsCompilableUnit(JSContext *cx, JSBool bytes_are_utf8, JSObject *obj, c
|
|||
# define fast_getc getc
|
||||
#endif
|
||||
|
||||
static JSObject *
|
||||
static JSScript *
|
||||
CompileFileHelper(JSContext *cx, JSObject *obj, JSPrincipals *principals,
|
||||
const char* filename, FILE *fp)
|
||||
{
|
||||
|
@ -4657,13 +4667,10 @@ CompileFileHelper(JSContext *cx, JSObject *obj, JSPrincipals *principals,
|
|||
script = Compiler::compileScript(cx, obj, NULL, principals, tcflags, buf, len, filename, 1,
|
||||
cx->findVersion());
|
||||
cx->free_(buf);
|
||||
if (!script)
|
||||
return NULL;
|
||||
JS_ASSERT(script->u.object);
|
||||
return script->u.object;
|
||||
return script;
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(JSObject *)
|
||||
JS_PUBLIC_API(JSScript *)
|
||||
JS_CompileFile(JSContext *cx, JSObject *obj, const char *filename)
|
||||
{
|
||||
JS_THREADSAFE_ASSERT(cx->compartment != cx->runtime->atomsCompartment);
|
||||
|
@ -4683,13 +4690,13 @@ JS_CompileFile(JSContext *cx, JSObject *obj, const char *filename)
|
|||
}
|
||||
}
|
||||
|
||||
JSObject *scriptObj = CompileFileHelper(cx, obj, NULL, filename, fp);
|
||||
JSScript *script = CompileFileHelper(cx, obj, NULL, filename, fp);
|
||||
if (fp != stdin)
|
||||
fclose(fp);
|
||||
return scriptObj;
|
||||
return script;
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(JSObject *)
|
||||
JS_PUBLIC_API(JSScript *)
|
||||
JS_CompileFileHandleForPrincipals(JSContext *cx, JSObject *obj, const char *filename,
|
||||
FILE *file, JSPrincipals *principals)
|
||||
{
|
||||
|
@ -4701,7 +4708,7 @@ JS_CompileFileHandleForPrincipals(JSContext *cx, JSObject *obj, const char *file
|
|||
return CompileFileHelper(cx, obj, principals, filename, file);
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(JSObject *)
|
||||
JS_PUBLIC_API(JSScript *)
|
||||
JS_CompileFileHandleForPrincipalsVersion(JSContext *cx, JSObject *obj, const char *filename,
|
||||
FILE *file, JSPrincipals *principals, JSVersion version)
|
||||
{
|
||||
|
@ -4709,19 +4716,19 @@ JS_CompileFileHandleForPrincipalsVersion(JSContext *cx, JSObject *obj, const cha
|
|||
return JS_CompileFileHandleForPrincipals(cx, obj, filename, file, principals);
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(JSObject *)
|
||||
JS_PUBLIC_API(JSScript *)
|
||||
JS_CompileFileHandle(JSContext *cx, JSObject *obj, const char *filename, FILE *file)
|
||||
{
|
||||
JS_THREADSAFE_ASSERT(cx->compartment != cx->runtime->atomsCompartment);
|
||||
return JS_CompileFileHandleForPrincipals(cx, obj, filename, file, NULL);
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(JSScript *)
|
||||
JS_GetScriptFromObject(JSObject *scriptObj)
|
||||
JS_PUBLIC_API(JSObject *)
|
||||
JS_GetObjectFromScript(JSScript *script)
|
||||
{
|
||||
JS_ASSERT(scriptObj->isScript());
|
||||
JS_ASSERT(script->u.object);
|
||||
|
||||
return (JSScript *) scriptObj->getPrivate();
|
||||
return script->u.object;
|
||||
}
|
||||
|
||||
static JSFunction *
|
||||
|
@ -4861,12 +4868,6 @@ JS_DecompileScript(JSContext *cx, JSScript *script, const char *name, uintN inde
|
|||
return str;
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(JSString *)
|
||||
JS_DecompileScriptObject(JSContext *cx, JSObject *scriptObj, const char *name, uintN indent)
|
||||
{
|
||||
return JS_DecompileScript(cx, scriptObj->getScript(), name, indent);
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(JSString *)
|
||||
JS_DecompileFunction(JSContext *cx, JSFunction *fun, uintN indent)
|
||||
{
|
||||
|
@ -4892,22 +4893,22 @@ JS_DecompileFunctionBody(JSContext *cx, JSFunction *fun, uintN indent)
|
|||
}
|
||||
|
||||
JS_PUBLIC_API(JSBool)
|
||||
JS_ExecuteScript(JSContext *cx, JSObject *obj, JSObject *scriptObj, jsval *rval)
|
||||
JS_ExecuteScript(JSContext *cx, JSObject *obj, JSScript *script, jsval *rval)
|
||||
{
|
||||
JS_THREADSAFE_ASSERT(cx->compartment != cx->runtime->atomsCompartment);
|
||||
CHECK_REQUEST(cx);
|
||||
assertSameCompartment(cx, obj, scriptObj);
|
||||
assertSameCompartment(cx, obj, script);
|
||||
AutoLastFrameCheck lfc(cx);
|
||||
|
||||
return Execute(cx, scriptObj->getScript(), *obj, Valueify(rval));
|
||||
return Execute(cx, script, *obj, Valueify(rval));
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(JSBool)
|
||||
JS_ExecuteScriptVersion(JSContext *cx, JSObject *obj, JSObject *scriptObj, jsval *rval,
|
||||
JS_ExecuteScriptVersion(JSContext *cx, JSObject *obj, JSScript *script, jsval *rval,
|
||||
JSVersion version)
|
||||
{
|
||||
AutoVersionAPI ava(cx, version);
|
||||
return JS_ExecuteScript(cx, obj, scriptObj, rval);
|
||||
return JS_ExecuteScript(cx, obj, script, rval);
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
|
@ -1322,6 +1322,9 @@ JS_AddNamedStringRoot(JSContext *cx, JSString **rp, const char *name);
|
|||
extern JS_PUBLIC_API(JSBool)
|
||||
JS_AddNamedObjectRoot(JSContext *cx, JSObject **rp, const char *name);
|
||||
|
||||
extern JS_PUBLIC_API(JSBool)
|
||||
JS_AddNamedScriptRoot(JSContext *cx, JSScript **rp, const char *name);
|
||||
|
||||
extern JS_PUBLIC_API(JSBool)
|
||||
JS_AddNamedGCThingRoot(JSContext *cx, void **rp, const char *name);
|
||||
|
||||
|
@ -1334,6 +1337,9 @@ JS_RemoveStringRoot(JSContext *cx, JSString **rp);
|
|||
extern JS_PUBLIC_API(JSBool)
|
||||
JS_RemoveObjectRoot(JSContext *cx, JSObject **rp);
|
||||
|
||||
extern JS_PUBLIC_API(JSBool)
|
||||
JS_RemoveScriptRoot(JSContext *cx, JSScript **rp);
|
||||
|
||||
extern JS_PUBLIC_API(JSBool)
|
||||
JS_RemoveGCThingRoot(JSContext *cx, void **rp);
|
||||
|
||||
|
@ -1659,6 +1665,10 @@ JSVAL_TRACE_KIND(jsval v)
|
|||
* internal implementation-specific traversal kind. In the latter case the only
|
||||
* operations on thing that the callback can do is to call JS_TraceChildren or
|
||||
* DEBUG-only JS_PrintTraceThingInfo.
|
||||
*
|
||||
* If eagerlyTraceWeakMaps is true, when we trace a WeakMap visit all
|
||||
* of its mappings. This should be used in cases where the tracer
|
||||
* wants to use the existing liveness of entries.
|
||||
*/
|
||||
typedef void
|
||||
(* JSTraceCallback)(JSTracer *trc, void *thing, JSGCTraceKind kind);
|
||||
|
@ -1669,6 +1679,7 @@ struct JSTracer {
|
|||
JSTraceNamePrinter debugPrinter;
|
||||
const void *debugPrintArg;
|
||||
size_t debugPrintIndex;
|
||||
JSBool eagerlyTraceWeakMaps;
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -1768,6 +1779,7 @@ JS_CallTracer(JSTracer *trc, void *thing, JSGCTraceKind kind);
|
|||
(trc)->debugPrinter = NULL; \
|
||||
(trc)->debugPrintArg = NULL; \
|
||||
(trc)->debugPrintIndex = (size_t)-1; \
|
||||
(trc)->eagerlyTraceWeakMaps = JS_TRUE; \
|
||||
JS_END_MACRO
|
||||
|
||||
extern JS_PUBLIC_API(void)
|
||||
|
@ -2716,60 +2728,63 @@ extern JS_PUBLIC_API(JSBool)
|
|||
JS_BufferIsCompilableUnit(JSContext *cx, JSBool bytes_are_utf8,
|
||||
JSObject *obj, const char *bytes, size_t length);
|
||||
|
||||
extern JS_PUBLIC_API(JSObject *)
|
||||
extern JS_PUBLIC_API(JSScript *)
|
||||
JS_CompileScript(JSContext *cx, JSObject *obj,
|
||||
const char *bytes, size_t length,
|
||||
const char *filename, uintN lineno);
|
||||
|
||||
extern JS_PUBLIC_API(JSObject *)
|
||||
extern JS_PUBLIC_API(JSScript *)
|
||||
JS_CompileScriptForPrincipals(JSContext *cx, JSObject *obj,
|
||||
JSPrincipals *principals,
|
||||
const char *bytes, size_t length,
|
||||
const char *filename, uintN lineno);
|
||||
|
||||
extern JS_PUBLIC_API(JSObject *)
|
||||
extern JS_PUBLIC_API(JSScript *)
|
||||
JS_CompileScriptForPrincipalsVersion(JSContext *cx, JSObject *obj,
|
||||
JSPrincipals *principals,
|
||||
const char *bytes, size_t length,
|
||||
const char *filename, uintN lineno,
|
||||
JSVersion version);
|
||||
|
||||
extern JS_PUBLIC_API(JSObject *)
|
||||
extern JS_PUBLIC_API(JSScript *)
|
||||
JS_CompileUCScript(JSContext *cx, JSObject *obj,
|
||||
const jschar *chars, size_t length,
|
||||
const char *filename, uintN lineno);
|
||||
|
||||
extern JS_PUBLIC_API(JSObject *)
|
||||
extern JS_PUBLIC_API(JSScript *)
|
||||
JS_CompileUCScriptForPrincipals(JSContext *cx, JSObject *obj,
|
||||
JSPrincipals *principals,
|
||||
const jschar *chars, size_t length,
|
||||
const char *filename, uintN lineno);
|
||||
|
||||
extern JS_PUBLIC_API(JSObject *)
|
||||
extern JS_PUBLIC_API(JSScript *)
|
||||
JS_CompileUCScriptForPrincipalsVersion(JSContext *cx, JSObject *obj,
|
||||
JSPrincipals *principals,
|
||||
const jschar *chars, size_t length,
|
||||
const char *filename, uintN lineno,
|
||||
JSVersion version);
|
||||
|
||||
extern JS_PUBLIC_API(JSObject *)
|
||||
extern JS_PUBLIC_API(JSScript *)
|
||||
JS_CompileFile(JSContext *cx, JSObject *obj, const char *filename);
|
||||
|
||||
extern JS_PUBLIC_API(JSObject *)
|
||||
extern JS_PUBLIC_API(JSScript *)
|
||||
JS_CompileFileHandle(JSContext *cx, JSObject *obj, const char *filename,
|
||||
FILE *fh);
|
||||
|
||||
extern JS_PUBLIC_API(JSObject *)
|
||||
extern JS_PUBLIC_API(JSScript *)
|
||||
JS_CompileFileHandleForPrincipals(JSContext *cx, JSObject *obj,
|
||||
const char *filename, FILE *fh,
|
||||
JSPrincipals *principals);
|
||||
|
||||
extern JS_PUBLIC_API(JSObject *)
|
||||
extern JS_PUBLIC_API(JSScript *)
|
||||
JS_CompileFileHandleForPrincipalsVersion(JSContext *cx, JSObject *obj,
|
||||
const char *filename, FILE *fh,
|
||||
JSPrincipals *principals,
|
||||
JSVersion version);
|
||||
|
||||
extern JS_PUBLIC_API(JSObject *)
|
||||
JS_GetObjectFromScript(JSScript *script);
|
||||
|
||||
extern JS_PUBLIC_API(JSFunction *)
|
||||
JS_CompileFunction(JSContext *cx, JSObject *obj, const char *name,
|
||||
uintN nargs, const char **argnames,
|
||||
|
@ -2805,7 +2820,7 @@ JS_CompileUCFunctionForPrincipalsVersion(JSContext *cx, JSObject *obj,
|
|||
JSVersion version);
|
||||
|
||||
extern JS_PUBLIC_API(JSString *)
|
||||
JS_DecompileScriptObject(JSContext *cx, JSObject *scriptObj, const char *name, uintN indent);
|
||||
JS_DecompileScript(JSContext *cx, JSScript *script, const char *name, uintN indent);
|
||||
|
||||
/*
|
||||
* API extension: OR this into indent to avoid pretty-printing the decompiled
|
||||
|
@ -2855,10 +2870,10 @@ JS_DecompileFunctionBody(JSContext *cx, JSFunction *fun, uintN indent);
|
|||
* etc., entry points.
|
||||
*/
|
||||
extern JS_PUBLIC_API(JSBool)
|
||||
JS_ExecuteScript(JSContext *cx, JSObject *obj, JSObject *scriptObj, jsval *rval);
|
||||
JS_ExecuteScript(JSContext *cx, JSObject *obj, JSScript *script, jsval *rval);
|
||||
|
||||
extern JS_PUBLIC_API(JSBool)
|
||||
JS_ExecuteScriptVersion(JSContext *cx, JSObject *obj, JSObject *scriptObj, jsval *rval,
|
||||
JS_ExecuteScriptVersion(JSContext *cx, JSObject *obj, JSScript *script, jsval *rval,
|
||||
JSVersion version);
|
||||
|
||||
/*
|
||||
|
|
|
@ -2615,6 +2615,21 @@ array_unshift(JSContext *cx, uintN argc, Value *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
static inline void
|
||||
TryReuseArrayType(JSObject *obj, JSObject *nobj)
|
||||
{
|
||||
/*
|
||||
* Try to change the type of a newly created array nobj to the same type
|
||||
* as obj. This can only be performed if the original object is an array
|
||||
* and has the same prototype.
|
||||
*/
|
||||
JS_ASSERT(nobj->isDenseArray());
|
||||
JS_ASSERT(nobj->type() == nobj->getProto()->newType);
|
||||
|
||||
if (obj->isArray() && !obj->hasSingletonType() && obj->getProto() == nobj->getProto())
|
||||
nobj->setType(obj->type());
|
||||
}
|
||||
|
||||
static JSBool
|
||||
array_splice(JSContext *cx, uintN argc, Value *vp)
|
||||
{
|
||||
|
@ -2625,24 +2640,11 @@ array_splice(JSContext *cx, uintN argc, Value *vp)
|
|||
jsuint length, begin, end, count, delta, last;
|
||||
JSBool hole;
|
||||
|
||||
/*
|
||||
* Get the type of the result object: the original type when splicing an
|
||||
* array, a generic array type otherwise.
|
||||
*/
|
||||
TypeObject *type;
|
||||
if (obj->isArray() && !obj->hasSingletonType()) {
|
||||
type = obj->type();
|
||||
} else {
|
||||
type = GetTypeNewObject(cx, JSProto_Array);
|
||||
if (!type)
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Create a new array value to return. */
|
||||
JSObject *obj2 = NewDenseEmptyArray(cx);
|
||||
if (!obj2)
|
||||
return JS_FALSE;
|
||||
obj2->setType(type);
|
||||
TryReuseArrayType(obj, obj2);
|
||||
vp->setObject(*obj2);
|
||||
|
||||
/* Nothing to do if no args. Otherwise get length. */
|
||||
|
@ -2801,8 +2803,7 @@ array_concat(JSContext *cx, uintN argc, Value *vp)
|
|||
nobj = NewDenseCopiedArray(cx, initlen, vector);
|
||||
if (!nobj)
|
||||
return JS_FALSE;
|
||||
if (nobj->getProto() == aobj->getProto() && !aobj->hasSingletonType())
|
||||
nobj->setType(aobj->type());
|
||||
TryReuseArrayType(aobj, nobj);
|
||||
nobj->setArrayLength(cx, length);
|
||||
if (!aobj->isPackedDenseArray())
|
||||
nobj->markDenseArrayNotPacked(cx);
|
||||
|
@ -2905,22 +2906,12 @@ array_slice(JSContext *cx, uintN argc, Value *vp)
|
|||
if (begin > end)
|
||||
begin = end;
|
||||
|
||||
/* Get the type object for the returned array, as for array_splice. */
|
||||
TypeObject *type;
|
||||
if (obj->isArray() && !obj->hasSingletonType()) {
|
||||
type = obj->type();
|
||||
} else {
|
||||
type = GetTypeNewObject(cx, JSProto_Array);
|
||||
if (!type)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (obj->isDenseArray() && end <= obj->getDenseArrayInitializedLength() &&
|
||||
!js_PrototypeHasIndexedProperties(cx, obj)) {
|
||||
nobj = NewDenseCopiedArray(cx, end - begin, obj->getDenseArrayElements() + begin);
|
||||
if (!nobj)
|
||||
return JS_FALSE;
|
||||
nobj->setType(type);
|
||||
TryReuseArrayType(obj, nobj);
|
||||
if (!obj->isPackedDenseArray())
|
||||
nobj->markDenseArrayNotPacked(cx);
|
||||
vp->setObject(*nobj);
|
||||
|
@ -2931,7 +2922,7 @@ array_slice(JSContext *cx, uintN argc, Value *vp)
|
|||
nobj = NewDenseAllocatedArray(cx, end - begin);
|
||||
if (!nobj)
|
||||
return JS_FALSE;
|
||||
nobj->setType(type);
|
||||
TryReuseArrayType(obj, nobj);
|
||||
vp->setObject(*nobj);
|
||||
|
||||
AutoValueRooter tvr(cx);
|
||||
|
|
|
@ -2166,8 +2166,6 @@ JS_GetFunctionCallback(JSContext *cx)
|
|||
JS_PUBLIC_API(void)
|
||||
JS_DumpBytecode(JSContext *cx, JSScript *script)
|
||||
{
|
||||
JS_ASSERT(!cx->runtime->gcRunning);
|
||||
|
||||
#if defined(DEBUG)
|
||||
AutoArenaAllocator mark(&cx->tempPool);
|
||||
Sprinter sprinter;
|
||||
|
|
|
@ -90,9 +90,6 @@ class JS_PUBLIC_API(AutoEnterFrameCompartment) : public AutoEnterScriptCompartme
|
|||
JS_BEGIN_EXTERN_C
|
||||
#endif
|
||||
|
||||
extern JS_PUBLIC_API(JSScript *)
|
||||
JS_GetScriptFromObject(JSObject *scriptObject);
|
||||
|
||||
extern JS_PUBLIC_API(JSString *)
|
||||
JS_DecompileScript(JSContext *cx, JSScript *script, const char *name, uintN indent);
|
||||
|
||||
|
|
|
@ -93,6 +93,15 @@ JS_SplicePrototype(JSContext *cx, JSObject *obj, JSObject *proto)
|
|||
* does not nuke type information for the object.
|
||||
*/
|
||||
CHECK_REQUEST(cx);
|
||||
|
||||
if (!obj->hasSingletonType()) {
|
||||
/*
|
||||
* We can see non-singleton objects when trying to splice prototypes
|
||||
* due to mutable __proto__ (ugh).
|
||||
*/
|
||||
return JS_SetPrototype(cx, obj, proto);
|
||||
}
|
||||
|
||||
return obj->splicePrototype(cx, proto);
|
||||
}
|
||||
|
||||
|
|
|
@ -1266,7 +1266,7 @@ StackFrame::getValidCalleeObject(JSContext *cx, Value *vp)
|
|||
* track of the method, so we associate it with the first barriered
|
||||
* object found starting from thisp on the prototype chain.
|
||||
*/
|
||||
JSObject *newfunobj = CloneFunctionObject(cx, fun, fun->getParent(), true);
|
||||
JSObject *newfunobj = CloneFunctionObject(cx, fun);
|
||||
if (!newfunobj)
|
||||
return false;
|
||||
newfunobj->setMethodObj(*first_barriered_thisp);
|
||||
|
@ -2091,20 +2091,6 @@ fun_bind(JSContext *cx, uintN argc, Value *vp)
|
|||
return true;
|
||||
}
|
||||
|
||||
static JSFunctionSpec function_methods[] = {
|
||||
#if JS_HAS_TOSOURCE
|
||||
JS_FN(js_toSource_str, fun_toSource, 0,0),
|
||||
#endif
|
||||
JS_FN(js_toString_str, fun_toString, 0,0),
|
||||
JS_FN(js_apply_str, js_fun_apply, 2,0),
|
||||
JS_FN(js_call_str, js_fun_call, 1,0),
|
||||
JS_FN("bind", fun_bind, 1,0),
|
||||
#if JS_HAS_GENERATORS
|
||||
JS_FN("isGenerator", fun_isGenerator,0,0),
|
||||
#endif
|
||||
JS_FS_END
|
||||
};
|
||||
|
||||
/*
|
||||
* Report "malformed formal parameter" iff no illegal char or similar scanner
|
||||
* error was already reported.
|
||||
|
@ -2119,7 +2105,23 @@ OnBadFormal(JSContext *cx, TokenKind tt)
|
|||
return false;
|
||||
}
|
||||
|
||||
static JSBool
|
||||
namespace js {
|
||||
|
||||
JSFunctionSpec function_methods[] = {
|
||||
#if JS_HAS_TOSOURCE
|
||||
JS_FN(js_toSource_str, fun_toSource, 0,0),
|
||||
#endif
|
||||
JS_FN(js_toString_str, fun_toString, 0,0),
|
||||
JS_FN(js_apply_str, js_fun_apply, 2,0),
|
||||
JS_FN(js_call_str, js_fun_call, 1,0),
|
||||
JS_FN("bind", fun_bind, 1,0),
|
||||
#if JS_HAS_GENERATORS
|
||||
JS_FN("isGenerator", fun_isGenerator,0,0),
|
||||
#endif
|
||||
JS_FS_END
|
||||
};
|
||||
|
||||
JSBool
|
||||
Function(JSContext *cx, uintN argc, Value *vp)
|
||||
{
|
||||
CallArgs call = CallArgsFromVp(argc, vp);
|
||||
|
@ -2294,8 +2296,6 @@ Function(JSContext *cx, uintN argc, Value *vp)
|
|||
return ok;
|
||||
}
|
||||
|
||||
namespace js {
|
||||
|
||||
bool
|
||||
IsBuiltinFunctionConstructor(JSFunction *fun)
|
||||
{
|
||||
|
@ -2328,59 +2328,6 @@ LookupInterpretedFunctionPrototype(JSContext *cx, JSObject *funobj)
|
|||
|
||||
} /* namespace js */
|
||||
|
||||
static JSBool
|
||||
ThrowTypeError(JSContext *cx, uintN argc, Value *vp)
|
||||
{
|
||||
JS_ReportErrorFlagsAndNumber(cx, JSREPORT_ERROR, js_GetErrorMessage, NULL,
|
||||
JSMSG_THROW_TYPE_ERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
JSObject *
|
||||
js_InitFunctionClass(JSContext *cx, JSObject *obj)
|
||||
{
|
||||
JSObject *proto = js_InitClass(cx, obj, NULL, &FunctionClass, Function, 1,
|
||||
NULL, function_methods, NULL, NULL);
|
||||
if (!proto)
|
||||
return NULL;
|
||||
|
||||
/*
|
||||
* The default 'new' object for Function.prototype has unknown properties.
|
||||
* This will be used for generic scripted functions, e.g. from non-compileAndGo code.
|
||||
*/
|
||||
proto->getNewType(cx, NULL, /* markUnknown = */ true);
|
||||
|
||||
JSFunction *fun = js_NewFunction(cx, proto, NULL, 0, JSFUN_INTERPRETED, obj, NULL);
|
||||
if (!fun)
|
||||
return NULL;
|
||||
fun->flags |= JSFUN_PROTOTYPE;
|
||||
|
||||
JSScript *script = JSScript::NewScript(cx, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, JSVERSION_DEFAULT);
|
||||
if (!script)
|
||||
return NULL;
|
||||
script->noScriptRval = true;
|
||||
script->code[0] = JSOP_STOP;
|
||||
script->code[1] = SRC_NULL;
|
||||
fun->u.i.script = script;
|
||||
fun->getType(cx)->interpretedFunction = fun;
|
||||
script->hasFunction = true;
|
||||
script->setOwnerObject(fun);
|
||||
js_CallNewScriptHook(cx, script, fun);
|
||||
|
||||
if (obj->isGlobal()) {
|
||||
/* ES5 13.2.3: Construct the unique [[ThrowTypeError]] function object. */
|
||||
JSFunction *throwTypeError =
|
||||
js_NewFunction(cx, NULL, reinterpret_cast<Native>(ThrowTypeError), 0,
|
||||
0, obj, NULL);
|
||||
if (!throwTypeError)
|
||||
return NULL;
|
||||
|
||||
obj->asGlobal()->setThrowTypeError(throwTypeError);
|
||||
}
|
||||
|
||||
return proto;
|
||||
}
|
||||
|
||||
JSFunction *
|
||||
js_NewFunction(JSContext *cx, JSObject *funobj, Native native, uintN nargs,
|
||||
uintN flags, JSObject *parent, JSAtom *atom)
|
||||
|
|
|
@ -398,6 +398,11 @@ GetFunctionNameBytes(JSContext *cx, JSFunction *fun, JSAutoByteString *bytes)
|
|||
return js_anonymous_str;
|
||||
}
|
||||
|
||||
extern JSFunctionSpec function_methods[];
|
||||
|
||||
extern JSBool
|
||||
Function(JSContext *cx, uintN argc, Value *vp);
|
||||
|
||||
extern bool
|
||||
IsBuiltinFunctionConstructor(JSFunction *fun);
|
||||
|
||||
|
@ -425,12 +430,6 @@ extern JSFunction *
|
|||
js_NewFunction(JSContext *cx, JSObject *funobj, js::Native native, uintN nargs,
|
||||
uintN flags, JSObject *parent, JSAtom *atom);
|
||||
|
||||
extern JSObject *
|
||||
js_InitFunctionClass(JSContext *cx, JSObject *obj);
|
||||
|
||||
extern JSObject *
|
||||
js_InitArgumentsClass(JSContext *cx, JSObject *obj);
|
||||
|
||||
extern void
|
||||
js_FinalizeFunction(JSContext *cx, JSFunction *fun);
|
||||
|
||||
|
@ -463,6 +462,24 @@ CloneFunctionObject(JSContext *cx, JSFunction *fun, JSObject *parent,
|
|||
return js_CloneFunctionObject(cx, fun, parent, proto);
|
||||
}
|
||||
|
||||
inline JSObject *
|
||||
CloneFunctionObject(JSContext *cx, JSFunction *fun)
|
||||
{
|
||||
/*
|
||||
* Variant which makes an exact clone of fun, preserving parent and proto.
|
||||
* Calling the above version CloneFunctionObject(cx, fun, fun->getParent())
|
||||
* is not equivalent: API clients, including XPConnect, can reparent
|
||||
* objects so that fun->getGlobal() != fun->getProto()->getGlobal().
|
||||
* See ReparentWrapperIfFound.
|
||||
*/
|
||||
JS_ASSERT(fun->getParent() && fun->getProto());
|
||||
|
||||
if (fun->hasSingletonType())
|
||||
return fun;
|
||||
|
||||
return js_CloneFunctionObject(cx, fun, fun->getParent(), fun->getProto());
|
||||
}
|
||||
|
||||
extern JSObject * JS_FASTCALL
|
||||
js_AllocFlatClosure(JSContext *cx, JSFunction *fun, JSObject *scopeChain);
|
||||
|
||||
|
|
|
@ -227,7 +227,7 @@ Arena::finalize(JSContext *cx, AllocKind thingKind, size_t thingSize)
|
|||
JS_ASSERT(aheader.allocated());
|
||||
JS_ASSERT(thingKind == aheader.getAllocKind());
|
||||
JS_ASSERT(thingSize == aheader.getThingSize());
|
||||
JS_ASSERT(!aheader.getMarkingDelay()->link);
|
||||
JS_ASSERT(!aheader.hasDelayedMarking);
|
||||
|
||||
uintptr_t thing = thingsStart(thingKind);
|
||||
uintptr_t lastByte = thingsEnd() - 1;
|
||||
|
@ -387,32 +387,27 @@ FinalizeArenas(JSContext *cx, ArenaLists::ArenaList *al, AllocKind thingKind)
|
|||
} /* namespace js */
|
||||
|
||||
void
|
||||
Chunk::init(JSRuntime *rt)
|
||||
Chunk::init()
|
||||
{
|
||||
info.runtime = rt;
|
||||
info.age = 0;
|
||||
info.numFree = ArenasPerChunk;
|
||||
JS_POISON(this, JS_FREE_PATTERN, GC_CHUNK_SIZE);
|
||||
|
||||
/* Assemble all arenas into a linked list and mark them as not allocated. */
|
||||
ArenaHeader **prevp = &info.emptyArenaListHead;
|
||||
Arena *end = &arenas[JS_ARRAY_LENGTH(arenas)];
|
||||
for (Arena *a = &arenas[0]; a != end; ++a) {
|
||||
#ifdef DEBUG
|
||||
memset(a, ArenaSize, JS_FREE_PATTERN);
|
||||
#endif
|
||||
*prevp = &a->aheader;
|
||||
a->aheader.setAsNotAllocated();
|
||||
prevp = &a->aheader.next;
|
||||
}
|
||||
*prevp = NULL;
|
||||
|
||||
for (size_t i = 0; i != JS_ARRAY_LENGTH(markingDelay); ++i)
|
||||
markingDelay[i].init();
|
||||
|
||||
/* We clear the bitmap to guard against xpc_IsGrayGCThing being called on
|
||||
uninitialized data, which would happen before the first GC cycle. */
|
||||
bitmap.clear();
|
||||
|
||||
info.age = 0;
|
||||
info.numFree = ArenasPerChunk;
|
||||
|
||||
/* The rest of info fields are initialized in PickChunk. */
|
||||
}
|
||||
|
||||
|
@ -467,7 +462,7 @@ Chunk::allocateArena(JSContext *cx, AllocKind thingKind)
|
|||
if (!hasAvailableArenas())
|
||||
removeFromAvailableList();
|
||||
|
||||
JSRuntime *rt = info.runtime;
|
||||
JSRuntime *rt = comp->rt;
|
||||
Probes::resizeHeap(comp, rt->gcBytes, rt->gcBytes + ArenaSize);
|
||||
JS_ATOMIC_ADD(&rt->gcBytes, ArenaSize);
|
||||
JS_ATOMIC_ADD(&comp->gcBytes, ArenaSize);
|
||||
|
@ -481,13 +476,14 @@ void
|
|||
Chunk::releaseArena(ArenaHeader *aheader)
|
||||
{
|
||||
JS_ASSERT(aheader->allocated());
|
||||
JSRuntime *rt = info.runtime;
|
||||
JS_ASSERT(!aheader->hasDelayedMarking);
|
||||
JSCompartment *comp = aheader->compartment;
|
||||
JSRuntime *rt = comp->rt;
|
||||
#ifdef JS_THREADSAFE
|
||||
AutoLockGC maybeLock;
|
||||
if (rt->gcHelperThread.sweeping)
|
||||
maybeLock.lock(info.runtime);
|
||||
maybeLock.lock(rt);
|
||||
#endif
|
||||
JSCompartment *comp = aheader->compartment;
|
||||
|
||||
Probes::resizeHeap(comp, rt->gcBytes, rt->gcBytes - ArenaSize);
|
||||
JS_ASSERT(size_t(rt->gcBytes) >= ArenaSize);
|
||||
|
@ -576,7 +572,7 @@ PickChunk(JSContext *cx)
|
|||
if (!chunk)
|
||||
return NULL;
|
||||
|
||||
chunk->init(rt);
|
||||
chunk->init();
|
||||
rt->gcChunkAllocationSinceLastGC = true;
|
||||
}
|
||||
|
||||
|
@ -1546,7 +1542,7 @@ namespace js {
|
|||
|
||||
GCMarker::GCMarker(JSContext *cx)
|
||||
: color(0),
|
||||
unmarkedArenaStackTop(MarkingDelay::stackBottom()),
|
||||
unmarkedArenaStackTop(NULL),
|
||||
objStack(cx->runtime->gcMarkStackObjs, sizeof(cx->runtime->gcMarkStackObjs)),
|
||||
ropeStack(cx->runtime->gcMarkStackRopes, sizeof(cx->runtime->gcMarkStackRopes)),
|
||||
typeStack(cx->runtime->gcMarkStackTypes, sizeof(cx->runtime->gcMarkStackTypes)),
|
||||
|
@ -1559,6 +1555,12 @@ GCMarker::GCMarker(JSContext *cx)
|
|||
conservativeDumpFileName = getenv("JS_DUMP_CONSERVATIVE_GC_ROOTS");
|
||||
memset(&conservativeStats, 0, sizeof(conservativeStats));
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The GC is recomputing the liveness of WeakMap entries, so we
|
||||
* delay visting entries.
|
||||
*/
|
||||
eagerlyTraceWeakMaps = JS_FALSE;
|
||||
}
|
||||
|
||||
GCMarker::~GCMarker()
|
||||
|
@ -1573,24 +1575,23 @@ GCMarker::delayMarkingChildren(const void *thing)
|
|||
{
|
||||
const Cell *cell = reinterpret_cast<const Cell *>(thing);
|
||||
ArenaHeader *aheader = cell->arenaHeader();
|
||||
if (aheader->getMarkingDelay()->link) {
|
||||
if (aheader->hasDelayedMarking) {
|
||||
/* Arena already scheduled to be marked later */
|
||||
return;
|
||||
}
|
||||
aheader->getMarkingDelay()->link = unmarkedArenaStackTop;
|
||||
unmarkedArenaStackTop = aheader;
|
||||
aheader->setNextDelayedMarking(unmarkedArenaStackTop);
|
||||
unmarkedArenaStackTop = aheader->getArena();
|
||||
markLaterArenas++;
|
||||
}
|
||||
|
||||
static void
|
||||
MarkDelayedChildren(JSTracer *trc, ArenaHeader *aheader)
|
||||
MarkDelayedChildren(GCMarker *trc, Arena *a)
|
||||
{
|
||||
AllocKind thingKind = aheader->getAllocKind();
|
||||
JSGCTraceKind traceKind = MapAllocToTraceKind(thingKind);
|
||||
size_t thingSize = aheader->getThingSize();
|
||||
Arena *a = aheader->getArena();
|
||||
AllocKind allocKind = a->aheader.getAllocKind();
|
||||
JSGCTraceKind traceKind = MapAllocToTraceKind(allocKind);
|
||||
size_t thingSize = Arena::thingSize(allocKind);
|
||||
uintptr_t end = a->thingsEnd();
|
||||
for (uintptr_t thing = a->thingsStart(thingKind); thing != end; thing += thingSize) {
|
||||
for (uintptr_t thing = a->thingsStart(allocKind); thing != end; thing += thingSize) {
|
||||
Cell *t = reinterpret_cast<Cell *>(thing);
|
||||
if (t->isMarked())
|
||||
JS_TraceChildren(trc, t, traceKind);
|
||||
|
@ -1600,19 +1601,19 @@ MarkDelayedChildren(JSTracer *trc, ArenaHeader *aheader)
|
|||
void
|
||||
GCMarker::markDelayedChildren()
|
||||
{
|
||||
while (unmarkedArenaStackTop != MarkingDelay::stackBottom()) {
|
||||
while (unmarkedArenaStackTop) {
|
||||
/*
|
||||
* If marking gets delayed at the same arena again, we must repeat
|
||||
* marking of its things. For that we pop arena from the stack and
|
||||
* clear its nextDelayedMarking before we begin the marking.
|
||||
* clear its hasDelayedMarking flag before we begin the marking.
|
||||
*/
|
||||
ArenaHeader *aheader = unmarkedArenaStackTop;
|
||||
unmarkedArenaStackTop = aheader->getMarkingDelay()->link;
|
||||
JS_ASSERT(unmarkedArenaStackTop);
|
||||
aheader->getMarkingDelay()->link = NULL;
|
||||
Arena *a = unmarkedArenaStackTop;
|
||||
JS_ASSERT(a->aheader.hasDelayedMarking);
|
||||
JS_ASSERT(markLaterArenas);
|
||||
unmarkedArenaStackTop = a->aheader.getNextDelayedMarking();
|
||||
a->aheader.hasDelayedMarking = 0;
|
||||
markLaterArenas--;
|
||||
MarkDelayedChildren(this, aheader);
|
||||
MarkDelayedChildren(this, a);
|
||||
}
|
||||
JS_ASSERT(!markLaterArenas);
|
||||
}
|
||||
|
|
110
js/src/jsgc.h
110
js/src/jsgc.h
|
@ -78,7 +78,6 @@ struct Shape;
|
|||
namespace gc {
|
||||
|
||||
struct Arena;
|
||||
struct MarkingDelay;
|
||||
|
||||
/*
|
||||
* This must be an upper bound, but we do not need the least upper bound, so
|
||||
|
@ -357,6 +356,8 @@ struct FreeSpan {
|
|||
|
||||
/* Every arena has a header. */
|
||||
struct ArenaHeader {
|
||||
friend struct FreeLists;
|
||||
|
||||
JSCompartment *compartment;
|
||||
ArenaHeader *next;
|
||||
|
||||
|
@ -375,21 +376,48 @@ struct ArenaHeader {
|
|||
* during the conservative GC scanning without searching the arena in the
|
||||
* list.
|
||||
*/
|
||||
unsigned allocKind;
|
||||
|
||||
friend struct FreeLists;
|
||||
size_t allocKind : 8;
|
||||
|
||||
/*
|
||||
* When recursive marking uses too much stack the marking is delayed and
|
||||
* the corresponding arenas are put into a stack using the following field
|
||||
* as a linkage. To distinguish the bottom of the stack from the arenas
|
||||
* not present in the stack we use an extra flag to tag arenas on the
|
||||
* stack.
|
||||
*
|
||||
* To minimize the ArenaHeader size we record the next delayed marking
|
||||
* linkage as arenaAddress() >> ArenaShift and pack it with the allocKind
|
||||
* field and hasDelayedMarking flag. We use 8 bits for the allocKind, not
|
||||
* ArenaShift - 1, so the compiler can use byte-level memory instructions
|
||||
* to access it.
|
||||
*/
|
||||
public:
|
||||
size_t hasDelayedMarking : 1;
|
||||
size_t nextDelayedMarking : JS_BITS_PER_WORD - 8 - 1;
|
||||
|
||||
static void staticAsserts() {
|
||||
/* We must be able to fit the allockind into uint8. */
|
||||
JS_STATIC_ASSERT(FINALIZE_LIMIT <= 255);
|
||||
|
||||
/*
|
||||
* nextDelayedMarkingpacking assumes that ArenaShift has enough bits
|
||||
* to cover allocKind and hasDelayedMarking.
|
||||
*/
|
||||
JS_STATIC_ASSERT(ArenaShift >= 8 + 1);
|
||||
}
|
||||
|
||||
inline uintptr_t address() const;
|
||||
inline Chunk *chunk() const;
|
||||
|
||||
void setAsNotAllocated() {
|
||||
allocKind = FINALIZE_LIMIT;
|
||||
allocKind = size_t(FINALIZE_LIMIT);
|
||||
hasDelayedMarking = 0;
|
||||
nextDelayedMarking = 0;
|
||||
}
|
||||
|
||||
bool allocated() const {
|
||||
JS_ASSERT(allocKind <= FINALIZE_LIMIT);
|
||||
return allocKind < FINALIZE_LIMIT;
|
||||
JS_ASSERT(allocKind <= size_t(FINALIZE_LIMIT));
|
||||
return allocKind < size_t(FINALIZE_LIMIT);
|
||||
}
|
||||
|
||||
inline void init(JSCompartment *comp, AllocKind kind);
|
||||
|
@ -431,11 +459,12 @@ struct ArenaHeader {
|
|||
firstFreeSpanOffsets = span->encodeAsOffsets();
|
||||
}
|
||||
|
||||
inline MarkingDelay *getMarkingDelay() const;
|
||||
|
||||
#ifdef DEBUG
|
||||
void checkSynchronizedWithFreeList() const;
|
||||
#endif
|
||||
|
||||
inline Arena *getNextDelayedMarking() const;
|
||||
inline void setNextDelayedMarking(Arena *arena);
|
||||
};
|
||||
|
||||
struct Arena {
|
||||
|
@ -506,32 +535,8 @@ struct Arena {
|
|||
bool finalize(JSContext *cx, AllocKind thingKind, size_t thingSize);
|
||||
};
|
||||
|
||||
/*
|
||||
* When recursive marking uses too much stack the marking is delayed and
|
||||
* the corresponding arenas are put into a stack using a linked via the
|
||||
* following per arena structure.
|
||||
*/
|
||||
struct MarkingDelay {
|
||||
ArenaHeader *link;
|
||||
|
||||
void init() {
|
||||
link = NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* To separate arenas without things to mark later from the arena at the
|
||||
* marked delay stack bottom we use for the latter a special sentinel
|
||||
* value. We set it to the header for the second arena in the chunk
|
||||
* starting at the 0 address.
|
||||
*/
|
||||
static ArenaHeader *stackBottom() {
|
||||
return reinterpret_cast<ArenaHeader *>(ArenaSize);
|
||||
}
|
||||
};
|
||||
|
||||
/* The chunk header (located at the end of the chunk to preserve arena alignment). */
|
||||
struct ChunkInfo {
|
||||
JSRuntime *runtime;
|
||||
Chunk *next;
|
||||
Chunk **prevp;
|
||||
ArenaHeader *emptyArenaListHead;
|
||||
|
@ -539,7 +544,7 @@ struct ChunkInfo {
|
|||
size_t numFree;
|
||||
};
|
||||
|
||||
const size_t BytesPerArena = ArenaSize + ArenaBitmapBytes + sizeof(MarkingDelay);
|
||||
const size_t BytesPerArena = ArenaSize + ArenaBitmapBytes;
|
||||
const size_t ArenasPerChunk = (GC_CHUNK_SIZE - sizeof(ChunkInfo)) / BytesPerArena;
|
||||
|
||||
/* A chunk bitmap contains enough mark bits for all the cells in a chunk. */
|
||||
|
@ -613,7 +618,6 @@ JS_STATIC_ASSERT(ArenaBitmapBytes * ArenasPerChunk == sizeof(ChunkBitmap));
|
|||
struct Chunk {
|
||||
Arena arenas[ArenasPerChunk];
|
||||
ChunkBitmap bitmap;
|
||||
MarkingDelay markingDelay[ArenasPerChunk];
|
||||
ChunkInfo info;
|
||||
|
||||
static Chunk *fromAddress(uintptr_t addr) {
|
||||
|
@ -637,7 +641,7 @@ struct Chunk {
|
|||
return addr;
|
||||
}
|
||||
|
||||
void init(JSRuntime *rt);
|
||||
void init();
|
||||
|
||||
bool unused() const {
|
||||
return info.numFree == ArenasPerChunk;
|
||||
|
@ -702,9 +706,11 @@ inline void
|
|||
ArenaHeader::init(JSCompartment *comp, AllocKind kind)
|
||||
{
|
||||
JS_ASSERT(!allocated());
|
||||
JS_ASSERT(!getMarkingDelay()->link);
|
||||
JS_ASSERT(!hasDelayedMarking);
|
||||
compartment = comp;
|
||||
allocKind = kind;
|
||||
|
||||
JS_STATIC_ASSERT(FINALIZE_LIMIT <= 255);
|
||||
allocKind = size_t(kind);
|
||||
|
||||
/* See comments in FreeSpan::allocateFromNewArena. */
|
||||
firstFreeSpanOffsets = FreeSpan::FullArenaOffsets;
|
||||
|
@ -741,6 +747,20 @@ ArenaHeader::getThingSize() const
|
|||
return Arena::thingSize(getAllocKind());
|
||||
}
|
||||
|
||||
inline Arena *
|
||||
ArenaHeader::getNextDelayedMarking() const
|
||||
{
|
||||
return reinterpret_cast<Arena *>(nextDelayedMarking << ArenaShift);
|
||||
}
|
||||
|
||||
inline void
|
||||
ArenaHeader::setNextDelayedMarking(Arena *arena)
|
||||
{
|
||||
JS_ASSERT(!hasDelayedMarking);
|
||||
hasDelayedMarking = 1;
|
||||
nextDelayedMarking = arena->address() >> ArenaShift;
|
||||
}
|
||||
|
||||
JS_ALWAYS_INLINE void
|
||||
ChunkBitmap::getMarkWordAndMask(const Cell *cell, uint32 color,
|
||||
uintptr_t **wordp, uintptr_t *maskp)
|
||||
|
@ -752,12 +772,6 @@ ChunkBitmap::getMarkWordAndMask(const Cell *cell, uint32 color,
|
|||
*wordp = &bitmap[bit / JS_BITS_PER_WORD];
|
||||
}
|
||||
|
||||
inline MarkingDelay *
|
||||
ArenaHeader::getMarkingDelay() const
|
||||
{
|
||||
return &chunk()->markingDelay[Chunk::arenaIndex(address())];
|
||||
}
|
||||
|
||||
static void
|
||||
AssertValidColor(const void *thing, uint32 color)
|
||||
{
|
||||
|
@ -843,12 +857,6 @@ MapAllocToTraceKind(AllocKind thingKind)
|
|||
inline JSGCTraceKind
|
||||
GetGCThingTraceKind(const void *thing);
|
||||
|
||||
static inline JSRuntime *
|
||||
GetGCThingRuntime(void *thing)
|
||||
{
|
||||
return reinterpret_cast<Cell *>(thing)->chunk()->info.runtime;
|
||||
}
|
||||
|
||||
struct ArenaLists {
|
||||
|
||||
/*
|
||||
|
@ -1481,7 +1489,7 @@ struct GCMarker : public JSTracer {
|
|||
|
||||
public:
|
||||
/* Pointer to the top of the stack of arenas we are delaying marking on. */
|
||||
js::gc::ArenaHeader *unmarkedArenaStackTop;
|
||||
js::gc::Arena *unmarkedArenaStackTop;
|
||||
/* Count of arenas that are currently in the stack. */
|
||||
DebugOnly<size_t> markLaterArenas;
|
||||
|
||||
|
|
|
@ -608,7 +608,7 @@ class HashTable : private AllocPolicy
|
|||
memset(table, 0, sizeof(*table) * tableCapacity);
|
||||
} else {
|
||||
for (Entry *e = table, *end = table + tableCapacity; e != end; ++e)
|
||||
*e = Entry();
|
||||
*e = Move(Entry());
|
||||
}
|
||||
removedCount = 0;
|
||||
entryCount = 0;
|
||||
|
|
|
@ -691,16 +691,17 @@ public:
|
|||
JSScript *script;
|
||||
jsbytecode *callpc;
|
||||
Type type;
|
||||
TypeSet *types;
|
||||
|
||||
TypeConstraintPropagateThis(JSScript *script, jsbytecode *callpc, Type type)
|
||||
: TypeConstraint("propagatethis"), script(script), callpc(callpc), type(type)
|
||||
TypeConstraintPropagateThis(JSScript *script, jsbytecode *callpc, Type type, TypeSet *types)
|
||||
: TypeConstraint("propagatethis"), script(script), callpc(callpc), type(type), types(types)
|
||||
{}
|
||||
|
||||
void newType(JSContext *cx, TypeSet *source, Type type);
|
||||
};
|
||||
|
||||
void
|
||||
TypeSet::addPropagateThis(JSContext *cx, JSScript *script, jsbytecode *pc, Type type)
|
||||
TypeSet::addPropagateThis(JSContext *cx, JSScript *script, jsbytecode *pc, Type type, TypeSet *types)
|
||||
{
|
||||
/* Don't add constraints when the call will be 'new' (see addCallProperty). */
|
||||
jsbytecode *callpc = script->analysis()->getCallPC(pc);
|
||||
|
@ -708,7 +709,7 @@ TypeSet::addPropagateThis(JSContext *cx, JSScript *script, jsbytecode *pc, Type
|
|||
if (JSOp(*callpc) == JSOP_NEW)
|
||||
return;
|
||||
|
||||
add(cx, ArenaNew<TypeConstraintPropagateThis>(cx->compartment->pool, script, callpc, type));
|
||||
add(cx, ArenaNew<TypeConstraintPropagateThis>(cx->compartment->pool, script, callpc, type, types));
|
||||
}
|
||||
|
||||
/* Subset constraint which filters out primitive types. */
|
||||
|
@ -1063,10 +1064,10 @@ TypeConstraintCallProp::newType(JSContext *cx, TypeSet *source, Type type)
|
|||
UntrapOpcode untrap(cx, script, callpc);
|
||||
|
||||
/*
|
||||
* For CALLPROP and CALLELEM, we need to update not just the pushed types
|
||||
* but also the 'this' types of possible callees. If we can't figure out
|
||||
* that set of callees, monitor the call to make sure discovered callees
|
||||
* get their 'this' types updated.
|
||||
* For CALLPROP, we need to update not just the pushed types but also the
|
||||
* 'this' types of possible callees. If we can't figure out that set of
|
||||
* callees, monitor the call to make sure discovered callees get their
|
||||
* 'this' types updated.
|
||||
*/
|
||||
|
||||
if (UnknownPropertyAccess(script, type)) {
|
||||
|
@ -1086,7 +1087,8 @@ TypeConstraintCallProp::newType(JSContext *cx, TypeSet *source, Type type)
|
|||
object->getFromPrototypes(cx, id, types);
|
||||
/* Bypass addPropagateThis, we already have the callpc. */
|
||||
types->add(cx, ArenaNew<TypeConstraintPropagateThis>(cx->compartment->pool,
|
||||
script, callpc, type));
|
||||
script, callpc, type,
|
||||
(TypeSet *) NULL));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1230,8 +1232,8 @@ TypeConstraintPropagateThis::newType(JSContext *cx, TypeSet *source, Type type)
|
|||
/*
|
||||
* The callee is unknown, make sure the call is monitored so we pick up
|
||||
* possible this/callee correlations. This only comes into play for
|
||||
* CALLPROP and CALLELEM, for other calls we are past the type barrier
|
||||
* already and a TypeConstraintCall will also monitor the call.
|
||||
* CALLPROP, for other calls we are past the type barrier and a
|
||||
* TypeConstraintCall will also monitor the call.
|
||||
*/
|
||||
cx->compartment->types.monitorBytecode(cx, script, callpc - script->code);
|
||||
return;
|
||||
|
@ -1258,7 +1260,11 @@ TypeConstraintPropagateThis::newType(JSContext *cx, TypeSet *source, Type type)
|
|||
if (!callee->script()->ensureHasTypes(cx, callee))
|
||||
return;
|
||||
|
||||
TypeScript::ThisTypes(callee->script())->addType(cx, this->type);
|
||||
TypeSet *thisTypes = TypeScript::ThisTypes(callee->script());
|
||||
if (this->types)
|
||||
this->types->addSubset(cx, thisTypes);
|
||||
else
|
||||
thisTypes->addType(cx, this->type);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1891,10 +1897,8 @@ TypeCompartment::init(JSContext *cx)
|
|||
{
|
||||
PodZero(this);
|
||||
|
||||
#ifndef JS_CPU_ARM
|
||||
if (cx && cx->getRunOptions() & JSOPTION_TYPE_INFERENCE)
|
||||
inferenceEnabled = true;
|
||||
#endif
|
||||
}
|
||||
|
||||
TypeObject *
|
||||
|
@ -3221,6 +3225,14 @@ ScriptAnalysis::resolveNameAccess(JSContext *cx, jsid id, bool addDependency)
|
|||
return access;
|
||||
}
|
||||
|
||||
/*
|
||||
* The script's bindings do not contain a name for the function itself,
|
||||
* don't resolve name accesses on lambdas in DeclEnv objects on the
|
||||
* scope chain.
|
||||
*/
|
||||
if (atom == CallObjectLambdaName(script->function()))
|
||||
return access;
|
||||
|
||||
if (!script->nesting()->parent)
|
||||
return access;
|
||||
script = script->nesting()->parent;
|
||||
|
@ -3676,19 +3688,18 @@ ScriptAnalysis::analyzeTypesBytecode(JSContext *cx, unsigned offset,
|
|||
TypeSet *seen = script->analysis()->bytecodeTypes(pc);
|
||||
|
||||
poppedTypes(pc, 1)->addGetProperty(cx, script, pc, seen, JSID_VOID);
|
||||
if (op == JSOP_CALLELEM)
|
||||
poppedTypes(pc, 1)->addCallProperty(cx, script, pc, JSID_VOID);
|
||||
|
||||
seen->addSubset(cx, &pushed[0]);
|
||||
if (op == JSOP_CALLELEM)
|
||||
if (op == JSOP_CALLELEM) {
|
||||
poppedTypes(pc, 1)->addFilterPrimitives(cx, &pushed[1], TypeSet::FILTER_NULL_VOID);
|
||||
pushed[0].addPropagateThis(cx, script, pc, Type::UndefinedType(), &pushed[1]);
|
||||
}
|
||||
if (CheckNextTest(pc))
|
||||
pushed[0].addType(cx, Type::UndefinedType());
|
||||
break;
|
||||
}
|
||||
|
||||
case JSOP_SETELEM:
|
||||
case JSOP_SETHOLE:
|
||||
poppedTypes(pc, 1)->addSetElement(cx, script, pc, poppedTypes(pc, 2), poppedTypes(pc, 0));
|
||||
poppedTypes(pc, 0)->addSubset(cx, &pushed[0]);
|
||||
break;
|
||||
|
@ -6021,6 +6032,13 @@ TypeScript::Sweep(JSContext *cx, JSScript *script)
|
|||
#ifdef JS_METHODJIT
|
||||
mjit::ReleaseScriptCode(cx, script);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Use counts for scripts are reset on GC. After discarding code we need to
|
||||
* let it warm back up to get information like which opcodes are setting
|
||||
* array holes or accessing getter properties.
|
||||
*/
|
||||
script->resetUseCount();
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -452,7 +452,8 @@ class TypeSet
|
|||
void addCall(JSContext *cx, TypeCallsite *site);
|
||||
void addArith(JSContext *cx, TypeSet *target, TypeSet *other = NULL);
|
||||
void addTransformThis(JSContext *cx, JSScript *script, TypeSet *target);
|
||||
void addPropagateThis(JSContext *cx, JSScript *script, jsbytecode *pc, Type type);
|
||||
void addPropagateThis(JSContext *cx, JSScript *script, jsbytecode *pc,
|
||||
Type type, TypeSet *types = NULL);
|
||||
void addFilterPrimitives(JSContext *cx, TypeSet *target, FilterKind filter);
|
||||
void addSubsetBarrier(JSContext *cx, JSScript *script, jsbytecode *pc, TypeSet *target);
|
||||
void addLazyArguments(JSContext *cx, TypeSet *target);
|
||||
|
|
|
@ -3903,13 +3903,13 @@ BEGIN_CASE(JSOP_GETELEM)
|
|||
}
|
||||
}
|
||||
|
||||
if (JSID_IS_STRING(id) && script->hasAnalysis() && !regs.fp()->hasImacropc())
|
||||
script->analysis()->getCode(regs.pc).getStringElement = true;
|
||||
|
||||
if (!obj->getProperty(cx, id, &rval))
|
||||
goto error;
|
||||
copyFrom = &rval;
|
||||
|
||||
if (!JSID_IS_INT(id))
|
||||
TypeScript::MonitorUnknown(cx, script, regs.pc);
|
||||
|
||||
end_getelem:
|
||||
regs.sp--;
|
||||
regs.sp[-1] = *copyFrom;
|
||||
|
@ -3947,14 +3947,11 @@ BEGIN_CASE(JSOP_CALLELEM)
|
|||
regs.sp[-1] = thisv;
|
||||
}
|
||||
|
||||
if (!JSID_IS_INT(id))
|
||||
TypeScript::MonitorUnknown(cx, script, regs.pc);
|
||||
TypeScript::Monitor(cx, script, regs.pc, regs.sp[-2]);
|
||||
}
|
||||
END_CASE(JSOP_CALLELEM)
|
||||
|
||||
BEGIN_CASE(JSOP_SETELEM)
|
||||
BEGIN_CASE(JSOP_SETHOLE)
|
||||
{
|
||||
JSObject *obj;
|
||||
FETCH_OBJECT(cx, -3, obj);
|
||||
|
@ -3972,12 +3969,12 @@ BEGIN_CASE(JSOP_SETHOLE)
|
|||
break;
|
||||
if ((jsuint)i >= obj->getArrayLength())
|
||||
obj->setArrayLength(cx, i + 1);
|
||||
*regs.pc = JSOP_SETHOLE;
|
||||
}
|
||||
obj->setDenseArrayElementWithType(cx, i, regs.sp[-1]);
|
||||
goto end_setelem;
|
||||
} else {
|
||||
*regs.pc = JSOP_SETHOLE;
|
||||
if (script->hasAnalysis() && !regs.fp()->hasImacropc())
|
||||
script->analysis()->getCode(regs.pc).arrayWriteHole = true;
|
||||
}
|
||||
}
|
||||
} while (0);
|
||||
|
@ -4686,6 +4683,7 @@ BEGIN_CASE(JSOP_DEFFUN)
|
|||
obj = CloneFunctionObject(cx, fun, obj2, true);
|
||||
if (!obj)
|
||||
goto error;
|
||||
JS_ASSERT_IF(script->hasGlobal(), obj->getProto() == fun->getProto());
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -4819,6 +4817,8 @@ BEGIN_CASE(JSOP_DEFLOCALFUN)
|
|||
}
|
||||
}
|
||||
|
||||
JS_ASSERT_IF(script->hasGlobal(), obj->getProto() == fun->getProto());
|
||||
|
||||
uint32 slot = GET_SLOTNO(regs.pc);
|
||||
TRACE_2(DefLocalFunSetSlot, slot, obj);
|
||||
|
||||
|
@ -4937,6 +4937,8 @@ BEGIN_CASE(JSOP_LAMBDA)
|
|||
} while (0);
|
||||
|
||||
JS_ASSERT(obj->getProto());
|
||||
JS_ASSERT_IF(script->hasGlobal(), obj->getProto() == fun->getProto());
|
||||
|
||||
PUSH_OBJECT(*obj);
|
||||
}
|
||||
END_CASE(JSOP_LAMBDA)
|
||||
|
@ -4949,6 +4951,7 @@ BEGIN_CASE(JSOP_LAMBDA_FC)
|
|||
JSObject *obj = js_NewFlatClosure(cx, fun, JSOP_LAMBDA_FC, JSOP_LAMBDA_FC_LENGTH);
|
||||
if (!obj)
|
||||
goto error;
|
||||
JS_ASSERT_IF(script->hasGlobal(), obj->getProto() == fun->getProto());
|
||||
|
||||
PUSH_OBJECT(*obj);
|
||||
}
|
||||
|
|
|
@ -153,7 +153,7 @@ obj_getProto(JSContext *cx, JSObject *obj, jsid id, Value *vp);
|
|||
static JSBool
|
||||
obj_setProto(JSContext *cx, JSObject *obj, jsid id, JSBool strict, Value *vp);
|
||||
|
||||
static JSPropertySpec object_props[] = {
|
||||
JSPropertySpec object_props[] = {
|
||||
{js_proto_str, 0, JSPROP_PERMANENT|JSPROP_SHARED, Jsvalify(obj_getProto), Jsvalify(obj_setProto)},
|
||||
{0,0,0,0,0}
|
||||
};
|
||||
|
@ -1311,12 +1311,14 @@ WarnOnTooManyArgs(JSContext *cx, const CallArgs &call)
|
|||
return true;
|
||||
}
|
||||
|
||||
namespace js {
|
||||
|
||||
/*
|
||||
* ES5 15.1.2.1.
|
||||
*
|
||||
* NB: This method handles only indirect eval.
|
||||
*/
|
||||
static JSBool
|
||||
JSBool
|
||||
eval(JSContext *cx, uintN argc, Value *vp)
|
||||
{
|
||||
CallArgs call = CallArgsFromVp(argc, vp);
|
||||
|
@ -1324,8 +1326,6 @@ eval(JSContext *cx, uintN argc, Value *vp)
|
|||
EvalKernel(cx, call, INDIRECT_EVAL, NULL, *call.callee().getGlobal());
|
||||
}
|
||||
|
||||
namespace js {
|
||||
|
||||
bool
|
||||
DirectEval(JSContext *cx, const CallArgs &call)
|
||||
{
|
||||
|
@ -2867,7 +2867,7 @@ const char js_hasOwnProperty_str[] = "hasOwnProperty";
|
|||
const char js_isPrototypeOf_str[] = "isPrototypeOf";
|
||||
const char js_propertyIsEnumerable_str[] = "propertyIsEnumerable";
|
||||
|
||||
static JSFunctionSpec object_methods[] = {
|
||||
JSFunctionSpec object_methods[] = {
|
||||
#if JS_HAS_TOSOURCE
|
||||
JS_FN(js_toSource_str, obj_toSource, 0,0),
|
||||
#endif
|
||||
|
@ -2890,7 +2890,7 @@ static JSFunctionSpec object_methods[] = {
|
|||
JS_FS_END
|
||||
};
|
||||
|
||||
static JSFunctionSpec object_static_methods[] = {
|
||||
JSFunctionSpec object_static_methods[] = {
|
||||
JS_FN("getPrototypeOf", obj_getPrototypeOf, 1,0),
|
||||
JS_FN("getOwnPropertyDescriptor", obj_getOwnPropertyDescriptor,2,0),
|
||||
JS_FN("keys", obj_keys, 1,0),
|
||||
|
@ -4089,29 +4089,6 @@ Class js::BlockClass = {
|
|||
ConvertStub
|
||||
};
|
||||
|
||||
JSObject *
|
||||
js_InitObjectClass(JSContext *cx, JSObject *obj)
|
||||
{
|
||||
JSObject *proto = js_InitClass(cx, obj, NULL, &ObjectClass, js_Object, 1,
|
||||
object_props, object_methods, NULL, object_static_methods);
|
||||
if (!proto)
|
||||
return NULL;
|
||||
|
||||
/* The default 'new' object for Object.prototype has unknown properties. */
|
||||
proto->getNewType(cx, NULL, /* markUnknown = */ true);
|
||||
|
||||
/* ECMA (15.1.2.1) says 'eval' is a property of the global object. */
|
||||
jsid id = ATOM_TO_JSID(cx->runtime->atomState.evalAtom);
|
||||
|
||||
JSObject *evalobj = js_DefineFunction(cx, obj, id, eval, 1, JSFUN_STUB_GSOPS);
|
||||
if (!evalobj)
|
||||
return NULL;
|
||||
if (obj->isGlobal())
|
||||
obj->asGlobal()->setOriginalEval(evalobj);
|
||||
|
||||
return proto;
|
||||
}
|
||||
|
||||
static bool
|
||||
DefineStandardSlot(JSContext *cx, JSObject *obj, JSProtoKey key, JSAtom *atom,
|
||||
const Value &v, uint32 attrs, bool &named)
|
||||
|
@ -5688,6 +5665,8 @@ js_NativeGetInline(JSContext *cx, JSObject *receiver, JSObject *obj, JSObject *p
|
|||
if (slot != SHAPE_INVALID_SLOT) {
|
||||
*vp = pobj->nativeGetSlot(slot);
|
||||
JS_ASSERT(!vp->isMagic());
|
||||
JS_ASSERT_IF(!pobj->hasSingletonType() && shape->hasDefaultGetterOrIsMethod(),
|
||||
js::types::TypeHasProperty(cx, pobj->type(), shape->propid, *vp));
|
||||
} else {
|
||||
vp->setUndefined();
|
||||
}
|
||||
|
@ -5699,6 +5678,14 @@ js_NativeGetInline(JSContext *cx, JSObject *receiver, JSObject *obj, JSObject *p
|
|||
return true;
|
||||
}
|
||||
|
||||
jsbytecode *pc;
|
||||
JSScript *script = cx->stack.currentScript(&pc);
|
||||
if (script && script->hasAnalysis() && !cx->fp()->hasImacropc()) {
|
||||
analyze::Bytecode *code = script->analysis()->maybeCode(pc);
|
||||
if (code)
|
||||
code->accessGetter = true;
|
||||
}
|
||||
|
||||
sample = cx->runtime->propertyRemovals;
|
||||
if (!shape->get(cx, receiver, obj, pobj, vp))
|
||||
return false;
|
||||
|
@ -5711,9 +5698,6 @@ js_NativeGetInline(JSContext *cx, JSObject *receiver, JSObject *obj, JSObject *p
|
|||
pobj->nativeSetSlot(slot, *vp);
|
||||
}
|
||||
|
||||
/* Record values produced by shapes without a default getter. */
|
||||
AddTypePropertyId(cx, obj, shape->propid, *vp);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -6014,7 +5998,7 @@ CloneFunctionForSetMethod(JSContext *cx, Value *vp)
|
|||
* need to be cloned again.
|
||||
*/
|
||||
if (fun == funobj) {
|
||||
funobj = CloneFunctionObject(cx, fun, fun->parent, true);
|
||||
funobj = CloneFunctionObject(cx, fun);
|
||||
if (!funobj)
|
||||
return false;
|
||||
vp->setObject(*funobj);
|
||||
|
|
|
@ -1754,14 +1754,20 @@ js_HasOwnProperty(JSContext *cx, js::LookupPropOp lookup, JSObject *obj, jsid id
|
|||
extern JSBool
|
||||
js_PropertyIsEnumerable(JSContext *cx, JSObject *obj, jsid id, js::Value *vp);
|
||||
|
||||
#if JS_HAS_OBJ_PROTO_PROP
|
||||
extern JSPropertySpec object_props[];
|
||||
#else
|
||||
#define object_props NULL
|
||||
#endif
|
||||
|
||||
extern JSFunctionSpec object_methods[];
|
||||
extern JSFunctionSpec object_static_methods[];
|
||||
|
||||
#ifdef OLD_GETTER_SETTER_METHODS
|
||||
JS_FRIEND_API(JSBool) js_obj_defineGetter(JSContext *cx, uintN argc, js::Value *vp);
|
||||
JS_FRIEND_API(JSBool) js_obj_defineSetter(JSContext *cx, uintN argc, js::Value *vp);
|
||||
#endif
|
||||
|
||||
extern JSObject *
|
||||
js_InitObjectClass(JSContext *cx, JSObject *obj);
|
||||
|
||||
namespace js {
|
||||
|
||||
JSObject *
|
||||
|
@ -2174,6 +2180,9 @@ SetProto(JSContext *cx, JSObject *obj, JSObject *proto, bool checkForCycles);
|
|||
extern JSString *
|
||||
obj_toStringHelper(JSContext *cx, JSObject *obj);
|
||||
|
||||
extern JSBool
|
||||
eval(JSContext *cx, uintN argc, Value *vp);
|
||||
|
||||
/*
|
||||
* Performs a direct eval for the given arguments, which must correspond to the
|
||||
* currently-executing stack frame, which must be a script frame. On completion
|
||||
|
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче