mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Merge mozilla-central and inbound
This commit is contained in:
commit
ca7d53fbb2
@ -23,12 +23,18 @@
|
||||
#include "nsIObserverService.h"
|
||||
#include "nsXULAppAPI.h"
|
||||
|
||||
// Used to check if external protocol schemes are usable
|
||||
#include "nsCExternalHandlerService.h"
|
||||
#include "nsIExternalProtocolService.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
/* Implementation file */
|
||||
NS_IMPL_ISUPPORTS(nsDefaultURIFixup, nsIURIFixup)
|
||||
|
||||
static bool sInitializedPrefCaches = false;
|
||||
static bool sFixTypos = true;
|
||||
static bool sFixupKeywords = true;
|
||||
|
||||
nsDefaultURIFixup::nsDefaultURIFixup()
|
||||
{
|
||||
@ -203,12 +209,19 @@ nsDefaultURIFixup::CreateFixupURI(const nsACString& aStringURI, uint32_t aFixupF
|
||||
#endif
|
||||
}
|
||||
|
||||
// Check if we want to fix up common scheme typos.
|
||||
rv = Preferences::AddBoolVarCache(&sFixTypos,
|
||||
"browser.fixup.typo.scheme",
|
||||
sFixTypos);
|
||||
MOZ_ASSERT(NS_SUCCEEDED(rv),
|
||||
"Failed to observe \"browser.fixup.typo.scheme\"");
|
||||
if (!sInitializedPrefCaches) {
|
||||
// Check if we want to fix up common scheme typos.
|
||||
rv = Preferences::AddBoolVarCache(&sFixTypos,
|
||||
"browser.fixup.typo.scheme",
|
||||
sFixTypos);
|
||||
MOZ_ASSERT(NS_SUCCEEDED(rv),
|
||||
"Failed to observe \"browser.fixup.typo.scheme\"");
|
||||
|
||||
rv = Preferences::AddBoolVarCache(&sFixupKeywords, "keyword.enabled",
|
||||
sFixupKeywords);
|
||||
MOZ_ASSERT(NS_SUCCEEDED(rv), "Failed to observe \"keyword.enabled\"");
|
||||
sInitializedPrefCaches = true;
|
||||
}
|
||||
|
||||
// Fix up common scheme typos.
|
||||
if (sFixTypos && (aFixupFlags & FIXUP_FLAG_FIX_SCHEME_TYPOS)) {
|
||||
@ -262,6 +275,27 @@ nsDefaultURIFixup::CreateFixupURI(const nsACString& aStringURI, uint32_t aFixupF
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
|
||||
if (*aURI && ourHandler == extHandler && sFixupKeywords &&
|
||||
(aFixupFlags & FIXUP_FLAG_FIX_SCHEME_TYPOS)) {
|
||||
nsCOMPtr<nsIExternalProtocolService> extProtService =
|
||||
do_GetService(NS_EXTERNALPROTOCOLSERVICE_CONTRACTID);
|
||||
if (extProtService) {
|
||||
bool handlerExists = false;
|
||||
rv = extProtService->ExternalProtocolHandlerExists(scheme.get(), &handlerExists);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
// This basically means we're dealing with a theoretically valid
|
||||
// URI... but we have no idea how to load it. (e.g. "christmas:humbug")
|
||||
// It's more likely the user wants to search, and so we
|
||||
// chuck this over to their preferred search provider instead:
|
||||
if (!handlerExists) {
|
||||
NS_RELEASE(*aURI);
|
||||
KeywordToURI(uriString, aPostData, aURI);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (*aURI) {
|
||||
if (aFixupFlags & FIXUP_FLAGS_MAKE_ALTERNATE_URI)
|
||||
@ -271,16 +305,10 @@ nsDefaultURIFixup::CreateFixupURI(const nsACString& aStringURI, uint32_t aFixupF
|
||||
|
||||
// See if it is a keyword
|
||||
// Test whether keywords need to be fixed up
|
||||
bool fixupKeywords = false;
|
||||
if (aFixupFlags & FIXUP_FLAG_ALLOW_KEYWORD_LOOKUP) {
|
||||
nsresult rv = Preferences::GetBool("keyword.enabled", &fixupKeywords);
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_FAILURE);
|
||||
if (fixupKeywords)
|
||||
{
|
||||
KeywordURIFixup(uriString, aPostData, aURI);
|
||||
if(*aURI)
|
||||
return NS_OK;
|
||||
}
|
||||
if (sFixupKeywords && (aFixupFlags & FIXUP_FLAG_ALLOW_KEYWORD_LOOKUP)) {
|
||||
KeywordURIFixup(uriString, aPostData, aURI);
|
||||
if(*aURI)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Prune duff protocol schemes
|
||||
@ -337,7 +365,7 @@ nsDefaultURIFixup::CreateFixupURI(const nsACString& aStringURI, uint32_t aFixupF
|
||||
|
||||
// If we still haven't been able to construct a valid URI, try to force a
|
||||
// keyword match. This catches search strings with '.' or ':' in them.
|
||||
if (!*aURI && fixupKeywords)
|
||||
if (!*aURI && sFixupKeywords)
|
||||
{
|
||||
KeywordToURI(aStringURI, aPostData, aURI);
|
||||
if(*aURI)
|
||||
@ -397,21 +425,21 @@ NS_IMETHODIMP nsDefaultURIFixup::KeywordToURI(const nsACString& aKeyword,
|
||||
searchSvc->GetDefaultEngine(getter_AddRefs(defaultEngine));
|
||||
if (defaultEngine) {
|
||||
nsCOMPtr<nsISearchSubmission> submission;
|
||||
nsAutoString responseType;
|
||||
// We allow default search plugins to specify alternate
|
||||
// parameters that are specific to keyword searches.
|
||||
NS_NAMED_LITERAL_STRING(mozKeywordSearch, "application/x-moz-keywordsearch");
|
||||
bool supportsResponseType = false;
|
||||
defaultEngine->SupportsResponseType(mozKeywordSearch, &supportsResponseType);
|
||||
if (supportsResponseType)
|
||||
defaultEngine->GetSubmission(NS_ConvertUTF8toUTF16(keyword),
|
||||
mozKeywordSearch,
|
||||
NS_LITERAL_STRING("keyword"),
|
||||
getter_AddRefs(submission));
|
||||
else
|
||||
defaultEngine->GetSubmission(NS_ConvertUTF8toUTF16(keyword),
|
||||
EmptyString(),
|
||||
NS_LITERAL_STRING("keyword"),
|
||||
getter_AddRefs(submission));
|
||||
if (supportsResponseType) {
|
||||
responseType.Assign(mozKeywordSearch);
|
||||
}
|
||||
|
||||
defaultEngine->GetSubmission(NS_ConvertUTF8toUTF16(keyword),
|
||||
responseType,
|
||||
NS_LITERAL_STRING("keyword"),
|
||||
getter_AddRefs(submission));
|
||||
|
||||
if (submission) {
|
||||
nsCOMPtr<nsIInputStream> postData;
|
||||
submission->GetPostData(getter_AddRefs(postData));
|
||||
|
@ -1571,9 +1571,6 @@ nsDocShell::LoadURI(nsIURI * aURI,
|
||||
if (aLoadFlags & LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP)
|
||||
flags |= INTERNAL_LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP;
|
||||
|
||||
if (aLoadFlags & LOAD_FLAGS_FIXUP_SCHEME_TYPOS)
|
||||
flags |= INTERNAL_LOAD_FLAGS_FIXUP_SCHEME_TYPOS;
|
||||
|
||||
if (aLoadFlags & LOAD_FLAGS_FIRST_LOAD)
|
||||
flags |= INTERNAL_LOAD_FLAGS_FIRST_LOAD;
|
||||
|
||||
|
@ -46,7 +46,7 @@ interface nsITabParent;
|
||||
|
||||
typedef unsigned long nsLoadFlags;
|
||||
|
||||
[scriptable, builtinclass, uuid(2a099e83-44df-415a-be76-c145966074e7)]
|
||||
[scriptable, builtinclass, uuid(e5fe5c76-e511-4da3-9709-f8294b8dc5ce)]
|
||||
interface nsIDocShell : nsIDocShellTreeItem
|
||||
{
|
||||
/**
|
||||
@ -113,9 +113,10 @@ interface nsIDocShell : nsIDocShellTreeItem
|
||||
// Whether the load should be treated as srcdoc load, rather than a URI one.
|
||||
const long INTERNAL_LOAD_FLAGS_IS_SRCDOC = 0x40;
|
||||
|
||||
const long INTERNAL_LOAD_FLAGS_FIXUP_SCHEME_TYPOS = 0x80;
|
||||
const long INTERNAL_LOAD_FLAGS_NO_OPENER = 0x100;
|
||||
|
||||
// NB: 0x80 is available.
|
||||
|
||||
/**
|
||||
* Loads the given URI. This method is identical to loadURI(...) except
|
||||
* that its parameter list is broken out instead of being packaged inside
|
||||
|
@ -88,6 +88,8 @@ skip-if = e10s # Bug ?????? - event handler checks event.target is the content d
|
||||
skip-if = e10s # Bug ?????? - BrowserSetForcedCharacterSet() in browser.js references docShell
|
||||
[browser_bug941562.js]
|
||||
skip-if = e10s # Bug ?????? - event handler checks event.target is the content document and test e10s-utils doesn't do that.
|
||||
[browser_uriFixupIntegration.js]
|
||||
skip-if = e10s
|
||||
[browser_loadDisallowInherit.js]
|
||||
[browser_loadURI.js]
|
||||
skip-if = e10s # Bug ?????? - event handler checks event.target is the content document and test e10s-utils doesn't do that.
|
||||
|
81
docshell/test/browser/browser_uriFixupIntegration.js
Normal file
81
docshell/test/browser/browser_uriFixupIntegration.js
Normal file
@ -0,0 +1,81 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
const Cc = Components.classes;
|
||||
const Ci = Components.interfaces;
|
||||
|
||||
const kSearchEngineID = "browser_urifixup_search_engine";
|
||||
const kTest
|
||||
const kSearchEngineURL = "http://example.com/?search={searchTerms}";
|
||||
Services.search.addEngineWithDetails(kSearchEngineID, "", "", "", "get",
|
||||
kSearchEngineURL);
|
||||
|
||||
let oldDefaultEngine = Services.search.defaultEngine;
|
||||
Services.search.defaultEngine = Services.search.getEngineByName(kSearchEngineID);
|
||||
|
||||
let tab;
|
||||
let searchParams;
|
||||
|
||||
function checkURL() {
|
||||
let escapedParams = encodeURIComponent(searchParams).replace("%20", "+");
|
||||
let expectedURL = kSearchEngineURL.replace("{searchTerms}", escapedParams);
|
||||
is(tab.linkedBrowser.currentURI.spec, expectedURL,
|
||||
"New tab should have loaded with expected url.");
|
||||
}
|
||||
|
||||
function addPageShowListener(aFunc) {
|
||||
gBrowser.selectedBrowser.addEventListener("pageshow", function loadListener() {
|
||||
gBrowser.selectedBrowser.removeEventListener("pageshow", loadListener, false);
|
||||
aFunc();
|
||||
});
|
||||
}
|
||||
|
||||
function locationBarEnter(aCallback) {
|
||||
executeSoon(function() {
|
||||
gURLBar.focus();
|
||||
EventUtils.synthesizeKey("VK_RETURN", {});
|
||||
addPageShowListener(aCallback);
|
||||
});
|
||||
}
|
||||
|
||||
let urlbarInput = [
|
||||
"foo bar",
|
||||
"brokenprotocol:somethingelse"
|
||||
];
|
||||
function test() {
|
||||
waitForExplicitFinish();
|
||||
|
||||
nextTest();
|
||||
}
|
||||
|
||||
function nextTest() {
|
||||
searchParams = urlbarInput.pop();
|
||||
tab = gBrowser.selectedTab = gBrowser.addTab();
|
||||
|
||||
gURLBar.value = searchParams;
|
||||
locationBarEnter(function() {
|
||||
checkURL();
|
||||
gBrowser.removeTab(tab);
|
||||
tab = null;
|
||||
if (urlbarInput.length) {
|
||||
nextTest();
|
||||
} else {
|
||||
finish();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
registerCleanupFunction(function () {
|
||||
if (tab) {
|
||||
gBrowser.removeTab(tab);
|
||||
}
|
||||
|
||||
if (oldDefaultEngine) {
|
||||
Services.search.defaultEngine = oldDefaultEngine;
|
||||
}
|
||||
let engine = Services.search.getEngineByName(kSearchEngineID);
|
||||
if (engine) {
|
||||
Services.search.removeEngine(engine);
|
||||
}
|
||||
});
|
||||
|
57
docshell/test/unit/test_nsDefaultURIFixup_search.js
Normal file
57
docshell/test/unit/test_nsDefaultURIFixup_search.js
Normal file
@ -0,0 +1,57 @@
|
||||
let urifixup = Cc["@mozilla.org/docshell/urifixup;1"].
|
||||
getService(Ci.nsIURIFixup);
|
||||
Components.utils.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
Services.prefs.setBoolPref("keyword.enabled", true);
|
||||
|
||||
const kSearchEngineID = "test_urifixup_search_engine";
|
||||
const kSearchEngineURL = "http://www.example.org/?search={searchTerms}";
|
||||
Services.search.addEngineWithDetails(kSearchEngineID, "", "", "", "get",
|
||||
kSearchEngineURL);
|
||||
|
||||
let oldDefaultEngine = Services.search.defaultEngine;
|
||||
Services.search.defaultEngine = Services.search.getEngineByName(kSearchEngineID);
|
||||
|
||||
let selectedName = Services.search.defaultEngine.name;
|
||||
do_check_eq(selectedName, kSearchEngineID);
|
||||
|
||||
do_register_cleanup(function() {
|
||||
if (oldDefaultEngine) {
|
||||
Services.search.defaultEngine = oldDefaultEngine;
|
||||
}
|
||||
let engine = Services.search.getEngineByName(kSearchEngineID);
|
||||
if (engine) {
|
||||
Services.search.removeEngine(engine);
|
||||
}
|
||||
Services.prefs.clearUserPref("keyword.enabled");
|
||||
});
|
||||
|
||||
let data = [
|
||||
{
|
||||
// Valid should not be changed.
|
||||
wrong: 'https://example.com/this/is/a/test.html',
|
||||
fixed: 'https://example.com/this/is/a/test.html',
|
||||
},
|
||||
{
|
||||
// Unrecognized protocols should be changed.
|
||||
wrong: 'whatever://this/is/a/test.html',
|
||||
fixed: kSearchEngineURL.replace("{searchTerms}", encodeURIComponent('whatever://this/is/a/test.html')),
|
||||
},
|
||||
];
|
||||
|
||||
|
||||
function run_test() {
|
||||
run_next_test();
|
||||
}
|
||||
|
||||
let len = data.length;
|
||||
// Make sure we fix what needs fixing
|
||||
add_task(function test_fix_unknown_schemes() {
|
||||
for (let i = 0; i < len; ++i) {
|
||||
let item = data[i];
|
||||
let result =
|
||||
urifixup.createFixupURI(item.wrong,
|
||||
urifixup.FIXUP_FLAG_FIX_SCHEME_TYPOS).spec;
|
||||
do_check_eq(result, item.fixed);
|
||||
}
|
||||
});
|
@ -5,6 +5,8 @@ tail =
|
||||
[test_bug414201_jfif.js]
|
||||
[test_bug442584.js]
|
||||
[test_nsDefaultURIFixup.js]
|
||||
[test_nsDefaultURIFixup_search.js]
|
||||
skip-if = os == 'android'
|
||||
[test_nsIDownloadHistory.js]
|
||||
[test_pb_notification.js]
|
||||
# Bug 751575: unrelated JS changes cause timeouts on random platforms
|
||||
|
@ -579,6 +579,7 @@ GLContext::InitWithPrefix(const char *prefix, bool trygl)
|
||||
const char *rendererMatchStrings[size_t(GLRenderer::Other)] = {
|
||||
"Adreno 200",
|
||||
"Adreno 205",
|
||||
"Adreno (TM) 200",
|
||||
"Adreno (TM) 205",
|
||||
"Adreno (TM) 320",
|
||||
"PowerVR SGX 530",
|
||||
|
@ -138,6 +138,7 @@ MOZ_END_ENUM_CLASS(GLVendor)
|
||||
MOZ_BEGIN_ENUM_CLASS(GLRenderer)
|
||||
Adreno200,
|
||||
Adreno205,
|
||||
AdrenoTM200,
|
||||
AdrenoTM205,
|
||||
AdrenoTM320,
|
||||
SGX530,
|
||||
|
@ -169,10 +169,19 @@ SharedSurface_Gralloc::Fence()
|
||||
mSync = 0;
|
||||
}
|
||||
|
||||
bool disableSyncFence = false;
|
||||
// Disable sync fence on AdrenoTM200.
|
||||
// AdrenoTM200's sync fence does not work correctly. See Bug 1022205.
|
||||
if (mGL->Renderer() == GLRenderer::AdrenoTM200) {
|
||||
disableSyncFence = true;
|
||||
}
|
||||
|
||||
// When Android native fences are available, try
|
||||
// them first since they're more likely to work.
|
||||
// Android native fences are also likely to perform better.
|
||||
if (mEGL->IsExtensionSupported(GLLibraryEGL::ANDROID_native_fence_sync)) {
|
||||
if (!disableSyncFence &&
|
||||
mEGL->IsExtensionSupported(GLLibraryEGL::ANDROID_native_fence_sync))
|
||||
{
|
||||
mGL->MakeCurrent();
|
||||
EGLSync sync = mEGL->fCreateSync(mEGL->Display(),
|
||||
LOCAL_EGL_SYNC_NATIVE_FENCE_ANDROID,
|
||||
@ -196,7 +205,9 @@ SharedSurface_Gralloc::Fence()
|
||||
}
|
||||
}
|
||||
|
||||
if (mEGL->IsExtensionSupported(GLLibraryEGL::KHR_fence_sync)) {
|
||||
if (!disableSyncFence &&
|
||||
mEGL->IsExtensionSupported(GLLibraryEGL::KHR_fence_sync))
|
||||
{
|
||||
mGL->MakeCurrent();
|
||||
mSync = mEGL->fCreateSync(mEGL->Display(),
|
||||
LOCAL_EGL_SYNC_FENCE,
|
||||
|
@ -1432,7 +1432,7 @@ intl_FormatNumber(JSContext *cx, UNumberFormat *nf, double x, MutableHandleValue
|
||||
return false;
|
||||
}
|
||||
|
||||
JSString *str = js_NewStringCopyN<CanGC>(cx, chars.begin(), size);
|
||||
JSString *str = NewStringCopyN<CanGC>(cx, chars.begin(), size);
|
||||
if (!str)
|
||||
return false;
|
||||
|
||||
@ -1932,7 +1932,7 @@ intl_FormatDateTime(JSContext *cx, UDateFormat *df, double x, MutableHandleValue
|
||||
return false;
|
||||
}
|
||||
|
||||
JSString *str = js_NewStringCopyN<CanGC>(cx, chars.begin(), size);
|
||||
JSString *str = NewStringCopyN<CanGC>(cx, chars.begin(), size);
|
||||
if (!str)
|
||||
return false;
|
||||
|
||||
|
@ -155,7 +155,7 @@ js::ObjectToSource(JSContext *cx, HandleObject obj)
|
||||
if (!detector.init())
|
||||
return nullptr;
|
||||
if (detector.foundCycle())
|
||||
return js_NewStringCopyZ<CanGC>(cx, "{}");
|
||||
return NewStringCopyZ<CanGC>(cx, "{}");
|
||||
|
||||
StringBuffer buf(cx);
|
||||
if (outermost && !buf.append('('))
|
||||
|
@ -58,7 +58,7 @@ js::CreateRegExpMatchResult(JSContext *cx, HandleString input, const MatchPairs
|
||||
arr->setDenseInitializedLength(i + 1);
|
||||
arr->initDenseElement(i, UndefinedValue());
|
||||
} else {
|
||||
JSLinearString *str = js_NewDependentString(cx, input, pair.start, pair.length());
|
||||
JSLinearString *str = NewDependentString(cx, input, pair.start, pair.length());
|
||||
if (!str)
|
||||
return false;
|
||||
arr->setDenseInitializedLength(i + 1);
|
||||
|
@ -1853,7 +1853,7 @@ FindPath(JSContext *cx, unsigned argc, jsval *vp)
|
||||
JSPROP_ENUMERATE, nullptr, nullptr))
|
||||
return false;
|
||||
|
||||
RootedString edge(cx, js_NewString<CanGC>(cx, edges[i].get(), js_strlen(edges[i])));
|
||||
RootedString edge(cx, NewString<CanGC>(cx, edges[i].get(), js_strlen(edges[i])));
|
||||
if (!edge)
|
||||
return false;
|
||||
edges[i].forget();
|
||||
|
@ -475,7 +475,7 @@ StringFromCharCode(JSContext *cx, int32_t code)
|
||||
if (StaticStrings::hasUnit(c))
|
||||
return cx->staticStrings().getUnit(c);
|
||||
|
||||
return js_NewStringCopyN<CanGC>(cx, &c, 1);
|
||||
return NewStringCopyN<CanGC>(cx, &c, 1);
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -111,7 +111,7 @@ BEGIN_TEST(testStringToPropertyName)
|
||||
template<size_t N> static JSFlatString *
|
||||
NewString(JSContext *cx, const jschar (&chars)[N])
|
||||
{
|
||||
return js_NewStringCopyN<js::CanGC>(cx, chars, N);
|
||||
return js::NewStringCopyN<js::CanGC>(cx, chars, N);
|
||||
}
|
||||
|
||||
END_TEST(testStringToPropertyName)
|
||||
|
@ -72,7 +72,7 @@ BEGIN_TEST(testParseJSON_success)
|
||||
JS::Rooted<JSFlatString*> str(cx);
|
||||
|
||||
const jschar emptystr[] = { '\0' };
|
||||
str = js_NewStringCopyN<CanGC>(cx, emptystr, 0);
|
||||
str = js::NewStringCopyN<CanGC>(cx, emptystr, 0);
|
||||
CHECK(str);
|
||||
expected = STRING_TO_JSVAL(str);
|
||||
CHECK(TryParse(cx, "\"\"", expected));
|
||||
@ -138,7 +138,7 @@ BEGIN_TEST(testParseJSON_success)
|
||||
template<size_t N> static JSFlatString *
|
||||
NewString(JSContext *cx, const jschar (&chars)[N])
|
||||
{
|
||||
return js_NewStringCopyN<CanGC>(cx, chars, N);
|
||||
return js::NewStringCopyN<CanGC>(cx, chars, N);
|
||||
}
|
||||
|
||||
template<size_t N> inline bool
|
||||
|
@ -4810,7 +4810,7 @@ JS_DecompileScript(JSContext *cx, HandleScript script, const char *name, unsigne
|
||||
bool haveSource = script->scriptSource()->hasSourceData();
|
||||
if (!haveSource && !JSScript::loadSource(cx, script->scriptSource(), &haveSource))
|
||||
return nullptr;
|
||||
return haveSource ? script->sourceData(cx) : js_NewStringCopyZ<CanGC>(cx, "[no source]");
|
||||
return haveSource ? script->sourceData(cx) : NewStringCopyZ<CanGC>(cx, "[no source]");
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(JSString *)
|
||||
@ -5228,28 +5228,17 @@ JS_NewStringCopyN(JSContext *cx, const char *s, size_t n)
|
||||
CHECK_REQUEST(cx);
|
||||
if (!n)
|
||||
return cx->names().empty;
|
||||
return js_NewStringCopyN<CanGC>(cx, s, n);
|
||||
return NewStringCopyN<CanGC>(cx, s, n);
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(JSString *)
|
||||
JS_NewStringCopyZ(JSContext *cx, const char *s)
|
||||
{
|
||||
size_t n;
|
||||
jschar *js;
|
||||
JSString *str;
|
||||
|
||||
AssertHeapIsIdle(cx);
|
||||
CHECK_REQUEST(cx);
|
||||
if (!s || !*s)
|
||||
return cx->runtime()->emptyString;
|
||||
n = strlen(s);
|
||||
js = InflateString(cx, s, &n);
|
||||
if (!js)
|
||||
return nullptr;
|
||||
str = js_NewString<CanGC>(cx, js, n);
|
||||
if (!str)
|
||||
js_free(js);
|
||||
return str;
|
||||
return NewStringCopyZ<CanGC>(cx, s);
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(bool)
|
||||
@ -5304,7 +5293,7 @@ JS_NewUCString(JSContext *cx, jschar *chars, size_t length)
|
||||
{
|
||||
AssertHeapIsIdle(cx);
|
||||
CHECK_REQUEST(cx);
|
||||
return js_NewString<CanGC>(cx, chars, length);
|
||||
return NewString<CanGC>(cx, chars, length);
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(JSString *)
|
||||
@ -5314,7 +5303,7 @@ JS_NewUCStringCopyN(JSContext *cx, const jschar *s, size_t n)
|
||||
CHECK_REQUEST(cx);
|
||||
if (!n)
|
||||
return cx->names().empty;
|
||||
return js_NewStringCopyN<CanGC>(cx, s, n);
|
||||
return NewStringCopyN<CanGC>(cx, s, n);
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(JSString *)
|
||||
@ -5324,7 +5313,7 @@ JS_NewUCStringCopyZ(JSContext *cx, const jschar *s)
|
||||
CHECK_REQUEST(cx);
|
||||
if (!s)
|
||||
return cx->runtime()->emptyString;
|
||||
return js_NewStringCopyZ<CanGC>(cx, s);
|
||||
return NewStringCopyZ<CanGC>(cx, s);
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(JSString *)
|
||||
@ -5483,7 +5472,7 @@ JS_NewDependentString(JSContext *cx, HandleString str, size_t start, size_t leng
|
||||
{
|
||||
AssertHeapIsIdle(cx);
|
||||
CHECK_REQUEST(cx);
|
||||
return js_NewDependentString(cx, str, start, length);
|
||||
return NewDependentString(cx, str, start, length);
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(JSString *)
|
||||
@ -5922,7 +5911,7 @@ JS_ExecuteRegExp(JSContext *cx, HandleObject obj, HandleObject reobj, jschar *ch
|
||||
if (!res)
|
||||
return false;
|
||||
|
||||
RootedLinearString input(cx, js_NewStringCopyN<CanGC>(cx, chars, length));
|
||||
RootedLinearString input(cx, NewStringCopyN<CanGC>(cx, chars, length));
|
||||
if (!input)
|
||||
return false;
|
||||
|
||||
@ -5959,7 +5948,7 @@ JS_ExecuteRegExpNoStatics(JSContext *cx, HandleObject obj, jschar *chars, size_t
|
||||
AssertHeapIsIdle(cx);
|
||||
CHECK_REQUEST(cx);
|
||||
|
||||
RootedLinearString input(cx, js_NewStringCopyN<CanGC>(cx, chars, length));
|
||||
RootedLinearString input(cx, NewStringCopyN<CanGC>(cx, chars, length));
|
||||
if (!input)
|
||||
return false;
|
||||
|
||||
|
@ -347,7 +347,7 @@ AtomizeAndtake(ExclusiveContext *cx, jschar *tbchars, size_t length, InternBehav
|
||||
AutoLockForExclusiveAccess lock(cx);
|
||||
|
||||
/*
|
||||
* If a GC occurs at js_NewStringCopy then |p| will still have the correct
|
||||
* If a GC occurs at NewStringCopy then |p| will still have the correct
|
||||
* hash, allowing us to avoid rehashing it. Even though the hash is
|
||||
* unchanged, we need to re-lookup the table position because a last-ditch
|
||||
* GC will potentially free some table entries.
|
||||
@ -363,7 +363,7 @@ AtomizeAndtake(ExclusiveContext *cx, jschar *tbchars, size_t length, InternBehav
|
||||
|
||||
AutoCompartment ac(cx, cx->atomsCompartment());
|
||||
|
||||
JSFlatString *flat = js_NewString<NoGC>(cx, tbchars, length);
|
||||
JSFlatString *flat = NewString<NoGC>(cx, tbchars, length);
|
||||
if (!flat) {
|
||||
js_free(tbchars);
|
||||
js_ReportOutOfMemory(cx);
|
||||
@ -407,7 +407,7 @@ AtomizeAndCopyChars(ExclusiveContext *cx, const CharT *tbchars, size_t length, I
|
||||
|
||||
AutoCompartment ac(cx, cx->atomsCompartment());
|
||||
|
||||
JSFlatString *flat = js_NewStringCopyN<NoGC>(cx, tbchars, length);
|
||||
JSFlatString *flat = NewStringCopyN<NoGC>(cx, tbchars, length);
|
||||
if (!flat) {
|
||||
// Grudgingly forgo last-ditch GC. The alternative would be to release
|
||||
// the lock, manually GC here, and retry from the top. If you fix this,
|
||||
|
@ -279,10 +279,10 @@ CopyStringPure(JSContext *cx, JSString *str)
|
||||
/* Only use AutoStableStringChars if the NoGC allocation fails. */
|
||||
if (str->hasLatin1Chars()) {
|
||||
JS::AutoCheckCannotGC nogc;
|
||||
copy = js_NewStringCopyN<NoGC>(cx, str->asLinear().latin1Chars(nogc), len);
|
||||
copy = NewStringCopyN<NoGC>(cx, str->asLinear().latin1Chars(nogc), len);
|
||||
} else {
|
||||
JS::AutoCheckCannotGC nogc;
|
||||
copy = js_NewStringCopyN<NoGC>(cx, str->asLinear().twoByteChars(nogc), len);
|
||||
copy = NewStringCopyN<NoGC>(cx, str->asLinear().twoByteChars(nogc), len);
|
||||
}
|
||||
if (copy)
|
||||
return copy;
|
||||
@ -292,8 +292,8 @@ CopyStringPure(JSContext *cx, JSString *str)
|
||||
return nullptr;
|
||||
|
||||
return chars.isLatin1()
|
||||
? js_NewStringCopyN<CanGC>(cx, chars.latin1Range().start().get(), len)
|
||||
: js_NewStringCopyN<CanGC>(cx, chars.twoByteRange().start().get(), len);
|
||||
? NewStringCopyN<CanGC>(cx, chars.latin1Range().start().get(), len)
|
||||
: NewStringCopyN<CanGC>(cx, chars.twoByteRange().start().get(), len);
|
||||
}
|
||||
|
||||
if (str->hasLatin1Chars()) {
|
||||
@ -301,14 +301,14 @@ CopyStringPure(JSContext *cx, JSString *str)
|
||||
if (!str->asRope().copyLatin1CharsZ(cx, copiedChars))
|
||||
return nullptr;
|
||||
|
||||
return js_NewString<CanGC>(cx, copiedChars.forget(), len);
|
||||
return NewString<CanGC>(cx, copiedChars.forget(), len);
|
||||
}
|
||||
|
||||
ScopedJSFreePtr<jschar> copiedChars;
|
||||
if (!str->asRope().copyTwoByteCharsZ(cx, copiedChars))
|
||||
return nullptr;
|
||||
|
||||
return js_NewString<CanGC>(cx, copiedChars.forget(), len);
|
||||
return NewString<CanGC>(cx, copiedChars.forget(), len);
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -755,28 +755,28 @@ NewTypeObject(js::ThreadSafeContext *cx)
|
||||
return gc::AllocateNonObject<types::TypeObject, js::CanGC>(cx);
|
||||
}
|
||||
|
||||
} /* namespace js */
|
||||
|
||||
template <js::AllowGC allowGC>
|
||||
inline JSString *
|
||||
js_NewGCString(js::ThreadSafeContext *cx)
|
||||
NewGCString(js::ThreadSafeContext *cx)
|
||||
{
|
||||
return js::gc::AllocateNonObject<JSString, allowGC>(cx);
|
||||
}
|
||||
|
||||
template <js::AllowGC allowGC>
|
||||
inline JSFatInlineString *
|
||||
js_NewGCFatInlineString(js::ThreadSafeContext *cx)
|
||||
NewGCFatInlineString(js::ThreadSafeContext *cx)
|
||||
{
|
||||
return js::gc::AllocateNonObject<JSFatInlineString, allowGC>(cx);
|
||||
}
|
||||
|
||||
inline JSExternalString *
|
||||
js_NewGCExternalString(js::ThreadSafeContext *cx)
|
||||
NewGCExternalString(js::ThreadSafeContext *cx)
|
||||
{
|
||||
return js::gc::AllocateNonObject<JSExternalString, js::CanGC>(cx);
|
||||
}
|
||||
|
||||
} /* namespace js */
|
||||
|
||||
inline JSScript *
|
||||
js_NewGCScript(js::ThreadSafeContext *cx)
|
||||
{
|
||||
|
@ -648,7 +648,7 @@ js::Int32ToString(ThreadSafeContext *cx, int32_t si)
|
||||
if (JSFlatString *str = LookupInt32ToString(cx, si))
|
||||
return str;
|
||||
|
||||
JSFatInlineString *str = js_NewGCFatInlineString<allowGC>(cx);
|
||||
JSFatInlineString *str = NewGCFatInlineString<allowGC>(cx);
|
||||
if (!str)
|
||||
return nullptr;
|
||||
|
||||
@ -883,7 +883,7 @@ num_toLocaleString_impl(JSContext *cx, CallArgs args)
|
||||
return ok;
|
||||
}
|
||||
|
||||
str = js_NewStringCopyN<CanGC>(cx, buf, buflen);
|
||||
str = NewStringCopyN<CanGC>(cx, buf, buflen);
|
||||
js_free(buf);
|
||||
if (!str)
|
||||
return false;
|
||||
@ -944,7 +944,7 @@ DToStrResult(JSContext *cx, double d, JSDToStrMode mode, int precision, CallArgs
|
||||
JS_ReportOutOfMemory(cx);
|
||||
return false;
|
||||
}
|
||||
JSString *str = js_NewStringCopyZ<CanGC>(cx, numStr);
|
||||
JSString *str = NewStringCopyZ<CanGC>(cx, numStr);
|
||||
if (!str)
|
||||
return false;
|
||||
args.rval().setString(str);
|
||||
@ -1362,7 +1362,7 @@ js_NumberToStringWithBase(ThreadSafeContext *cx, double d, int base)
|
||||
cbuf.dbuf && cbuf.dbuf == numStr);
|
||||
}
|
||||
|
||||
JSFlatString *s = js_NewStringCopyZ<allowGC>(cx, numStr);
|
||||
JSFlatString *s = NewStringCopyZ<allowGC>(cx, numStr);
|
||||
|
||||
if (comp)
|
||||
comp->dtoaCache.cache(base, d, s);
|
||||
@ -1429,7 +1429,7 @@ js::IndexToString(JSContext *cx, uint32_t index)
|
||||
if (JSFlatString *str = c->dtoaCache.lookup(10, index))
|
||||
return str;
|
||||
|
||||
JSFatInlineString *str = js_NewGCFatInlineString<CanGC>(cx);
|
||||
JSFatInlineString *str = NewGCFatInlineString<CanGC>(cx);
|
||||
if (!str)
|
||||
return nullptr;
|
||||
|
||||
|
@ -135,7 +135,7 @@ JSONParser<CharT>::readString()
|
||||
current++;
|
||||
JSFlatString *str = (ST == JSONParser::PropertyName)
|
||||
? AtomizeChars(cx, start.get(), length)
|
||||
: js_NewStringCopyN<CanGC>(cx, start.get(), length);
|
||||
: NewStringCopyN<CanGC>(cx, start.get(), length);
|
||||
if (!str)
|
||||
return token(OOM);
|
||||
return stringToken(str);
|
||||
|
@ -1380,7 +1380,7 @@ js_QuoteString(ExclusiveContext *cx, JSString *str, jschar quote)
|
||||
char *bytes = QuoteString(&sprinter, str, quote);
|
||||
if (!bytes)
|
||||
return nullptr;
|
||||
return js_NewStringCopyZ<CanGC>(cx, bytes);
|
||||
return NewStringCopyZ<CanGC>(cx, bytes);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
|
@ -1548,7 +1548,7 @@ ScriptSource::substring(JSContext *cx, uint32_t start, uint32_t stop)
|
||||
const jschar *chars = this->chars(cx, holder);
|
||||
if (!chars)
|
||||
return nullptr;
|
||||
return js_NewStringCopyN<CanGC>(cx, chars + start, stop - start);
|
||||
return NewStringCopyN<CanGC>(cx, chars + start, stop - start);
|
||||
}
|
||||
|
||||
void
|
||||
|
141
js/src/jsstr.cpp
141
js/src/jsstr.cpp
@ -203,7 +203,7 @@ str_escape(JSContext *cx, unsigned argc, Value *vp)
|
||||
if (!newChars)
|
||||
return false;
|
||||
|
||||
JSString *res = js_NewString<CanGC>(cx, newChars.get(), newLength);
|
||||
JSString *res = NewString<CanGC>(cx, newChars.get(), newLength);
|
||||
if (!res)
|
||||
return false;
|
||||
|
||||
@ -394,7 +394,7 @@ str_enumerate(JSContext *cx, HandleObject obj)
|
||||
RootedString str(cx, obj->as<StringObject>().unbox());
|
||||
RootedValue value(cx);
|
||||
for (size_t i = 0, length = str->length(); i < length; i++) {
|
||||
JSString *str1 = js_NewDependentString(cx, str, i, 1);
|
||||
JSString *str1 = NewDependentString(cx, str, i, 1);
|
||||
if (!str1)
|
||||
return false;
|
||||
value.setString(str1);
|
||||
@ -603,14 +603,14 @@ DoSubstr(JSContext *cx, JSString *str, size_t begin, size_t len)
|
||||
/* Substring is totally in leftChild of rope. */
|
||||
if (begin + len <= rope->leftChild()->length()) {
|
||||
str = rope->leftChild();
|
||||
return js_NewDependentString(cx, str, begin, len);
|
||||
return NewDependentString(cx, str, begin, len);
|
||||
}
|
||||
|
||||
/* Substring is totally in rightChild of rope. */
|
||||
if (begin >= rope->leftChild()->length()) {
|
||||
str = rope->rightChild();
|
||||
begin -= rope->leftChild()->length();
|
||||
return js_NewDependentString(cx, str, begin, len);
|
||||
return NewDependentString(cx, str, begin, len);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -624,19 +624,18 @@ DoSubstr(JSContext *cx, JSString *str, size_t begin, size_t len)
|
||||
size_t rhsLength = begin + len - rope->leftChild()->length();
|
||||
|
||||
Rooted<JSRope *> ropeRoot(cx, rope);
|
||||
RootedString lhs(cx, js_NewDependentString(cx, ropeRoot->leftChild(),
|
||||
begin, lhsLength));
|
||||
RootedString lhs(cx, NewDependentString(cx, ropeRoot->leftChild(), begin, lhsLength));
|
||||
if (!lhs)
|
||||
return nullptr;
|
||||
|
||||
RootedString rhs(cx, js_NewDependentString(cx, ropeRoot->rightChild(), 0, rhsLength));
|
||||
RootedString rhs(cx, NewDependentString(cx, ropeRoot->rightChild(), 0, rhsLength));
|
||||
if (!rhs)
|
||||
return nullptr;
|
||||
|
||||
return JSRope::new_<CanGC>(cx, lhs, rhs, len);
|
||||
}
|
||||
|
||||
return js_NewDependentString(cx, str, begin, len);
|
||||
return NewDependentString(cx, str, begin, len);
|
||||
}
|
||||
|
||||
static bool
|
||||
@ -720,7 +719,7 @@ ToLowerCase(JSContext *cx, JSLinearString *str)
|
||||
newChars[length] = 0;
|
||||
}
|
||||
|
||||
JSString *res = js_NewString<CanGC>(cx, newChars.get(), length);
|
||||
JSString *res = NewString<CanGC>(cx, newChars.get(), length);
|
||||
if (!res)
|
||||
return nullptr;
|
||||
|
||||
@ -800,7 +799,7 @@ ToUpperCase(JSContext *cx, JSLinearString *str)
|
||||
newChars[length] = 0;
|
||||
}
|
||||
|
||||
JSString *res = js_NewString<CanGC>(cx, newChars.get(), length);
|
||||
JSString *res = NewString<CanGC>(cx, newChars.get(), length);
|
||||
if (!res)
|
||||
return nullptr;
|
||||
|
||||
@ -962,7 +961,7 @@ str_normalize(JSContext *cx, unsigned argc, Value *vp)
|
||||
if (U_FAILURE(status))
|
||||
return false;
|
||||
|
||||
JSString *ns = js_NewStringCopyN<CanGC>(cx, chars.begin(), size);
|
||||
JSString *ns = NewStringCopyN<CanGC>(cx, chars.begin(), size);
|
||||
if (!ns)
|
||||
return false;
|
||||
|
||||
@ -1908,7 +1907,7 @@ TrimString(JSContext *cx, Value *vp, bool trimLeft, bool trimRight)
|
||||
TrimString(linear->twoByteChars(nogc), trimLeft, trimRight, length, &begin, &end);
|
||||
}
|
||||
|
||||
str = js_NewDependentString(cx, str, begin, end - begin);
|
||||
str = NewDependentString(cx, str, begin, end - begin);
|
||||
if (!str)
|
||||
return false;
|
||||
|
||||
@ -2299,7 +2298,7 @@ DoMatchGlobal(JSContext *cx, CallArgs args, RegExpStatics *res, HandleLinearStri
|
||||
searchIndex = match.isEmpty() ? nextSearchIndex + 1 : nextSearchIndex;
|
||||
|
||||
// Step 8f(iii)(4-5).
|
||||
JSLinearString *str = js_NewDependentString(cx, input, match.start, match.length());
|
||||
JSLinearString *str = NewDependentString(cx, input, match.start, match.length());
|
||||
if (!str)
|
||||
return false;
|
||||
if (!elements.append(StringValue(str)))
|
||||
@ -2888,7 +2887,7 @@ BuildFlatReplacement(JSContext *cx, HandleString textstr, HandleString repstr,
|
||||
* the first character in the pattern, so we include the
|
||||
* replacement string here.
|
||||
*/
|
||||
RootedString leftSide(cx, js_NewDependentString(cx, str, 0, match - pos));
|
||||
RootedString leftSide(cx, NewDependentString(cx, str, 0, match - pos));
|
||||
if (!leftSide ||
|
||||
!builder.append(leftSide) ||
|
||||
!builder.append(repstr)) {
|
||||
@ -2901,8 +2900,8 @@ BuildFlatReplacement(JSContext *cx, HandleString textstr, HandleString repstr,
|
||||
* last part of str.
|
||||
*/
|
||||
if (strEnd > matchEnd) {
|
||||
RootedString rightSide(cx, js_NewDependentString(cx, str, matchEnd - pos,
|
||||
strEnd - matchEnd));
|
||||
RootedString rightSide(cx, NewDependentString(cx, str, matchEnd - pos,
|
||||
strEnd - matchEnd));
|
||||
if (!rightSide || !builder.append(rightSide))
|
||||
return false;
|
||||
}
|
||||
@ -2915,12 +2914,12 @@ BuildFlatReplacement(JSContext *cx, HandleString textstr, HandleString repstr,
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
RootedString leftSide(cx, js_NewDependentString(cx, textstr, 0, match));
|
||||
RootedString leftSide(cx, NewDependentString(cx, textstr, 0, match));
|
||||
if (!leftSide)
|
||||
return false;
|
||||
RootedString rightSide(cx);
|
||||
rightSide = js_NewDependentString(cx, textstr, match + fm.patternLength(),
|
||||
textstr->length() - match - fm.patternLength());
|
||||
rightSide = NewDependentString(cx, textstr, match + fm.patternLength(),
|
||||
textstr->length() - match - fm.patternLength());
|
||||
if (!rightSide ||
|
||||
!builder.append(leftSide) ||
|
||||
!builder.append(repstr) ||
|
||||
@ -3028,7 +3027,7 @@ BuildDollarReplacement(JSContext *cx, JSString *textstrArg, JSLinearString *reps
|
||||
if (!res)
|
||||
return false;
|
||||
|
||||
RootedString leftSide(cx, js_NewDependentString(cx, textstr, 0, matchStart));
|
||||
RootedString leftSide(cx, NewDependentString(cx, textstr, 0, matchStart));
|
||||
if (!leftSide)
|
||||
return false;
|
||||
|
||||
@ -3037,8 +3036,8 @@ BuildDollarReplacement(JSContext *cx, JSString *textstrArg, JSLinearString *reps
|
||||
return false;
|
||||
|
||||
JS_ASSERT(textstr->length() >= matchLimit);
|
||||
RootedString rightSide(cx, js_NewDependentString(cx, textstr, matchLimit,
|
||||
textstr->length() - matchLimit));
|
||||
RootedString rightSide(cx, NewDependentString(cx, textstr, matchLimit,
|
||||
textstr->length() - matchLimit));
|
||||
if (!rightSide)
|
||||
return false;
|
||||
|
||||
@ -3080,7 +3079,7 @@ static inline JSFatInlineString *
|
||||
FlattenSubstrings(JSContext *cx, Handle<JSFlatString*> flatStr, const StringRange *ranges,
|
||||
size_t rangesLen, size_t outputLen)
|
||||
{
|
||||
JSFatInlineString *str = js_NewGCFatInlineString<CanGC>(cx);
|
||||
JSFatInlineString *str = NewGCFatInlineString<CanGC>(cx);
|
||||
if (!str)
|
||||
return nullptr;
|
||||
|
||||
@ -3100,7 +3099,7 @@ AppendSubstrings(JSContext *cx, Handle<JSFlatString*> flatStr,
|
||||
|
||||
/* For single substrings, construct a dependent string. */
|
||||
if (rangesLen == 1)
|
||||
return js_NewDependentString(cx, flatStr, ranges[0].start, ranges[0].length);
|
||||
return NewDependentString(cx, flatStr, ranges[0].start, ranges[0].length);
|
||||
|
||||
bool isLatin1 = flatStr->hasLatin1Chars();
|
||||
uint32_t fatInlineMaxLength = isLatin1
|
||||
@ -3125,7 +3124,7 @@ AppendSubstrings(JSContext *cx, Handle<JSFlatString*> flatStr,
|
||||
if (i == end) {
|
||||
/* Not even one range fits JSFatInlineString, use DependentString */
|
||||
const StringRange &sr = ranges[i++];
|
||||
part = js_NewDependentString(cx, flatStr, sr.start, sr.length);
|
||||
part = NewDependentString(cx, flatStr, sr.start, sr.length);
|
||||
} else {
|
||||
/* Copy the ranges (linearly) into a JSFatInlineString */
|
||||
part = FlattenSubstrings(cx, flatStr, ranges + i, end - i, substrLen);
|
||||
@ -3366,7 +3365,7 @@ js::str_replace_string_raw(JSContext *cx, HandleString string, HandleString patt
|
||||
static inline bool
|
||||
str_replace_flat_lambda(JSContext *cx, CallArgs outerArgs, ReplaceData &rdata, const FlatMatch &fm)
|
||||
{
|
||||
RootedString matchStr(cx, js_NewDependentString(cx, rdata.str, fm.match(), fm.patternLength()));
|
||||
RootedString matchStr(cx, NewDependentString(cx, rdata.str, fm.match(), fm.patternLength()));
|
||||
if (!matchStr)
|
||||
return false;
|
||||
|
||||
@ -3391,13 +3390,13 @@ str_replace_flat_lambda(JSContext *cx, CallArgs outerArgs, ReplaceData &rdata, c
|
||||
if (!repstr)
|
||||
return false;
|
||||
|
||||
RootedString leftSide(cx, js_NewDependentString(cx, rdata.str, 0, fm.match()));
|
||||
RootedString leftSide(cx, NewDependentString(cx, rdata.str, 0, fm.match()));
|
||||
if (!leftSide)
|
||||
return false;
|
||||
|
||||
size_t matchLimit = fm.match() + fm.patternLength();
|
||||
RootedString rightSide(cx, js_NewDependentString(cx, rdata.str, matchLimit,
|
||||
rdata.str->length() - matchLimit));
|
||||
RootedString rightSide(cx, NewDependentString(cx, rdata.str, matchLimit,
|
||||
rdata.str->length() - matchLimit));
|
||||
if (!rightSide)
|
||||
return false;
|
||||
|
||||
@ -3642,7 +3641,7 @@ SplitHelper(JSContext *cx, HandleLinearString str, uint32_t limit, const Matcher
|
||||
|
||||
/* Steps 13(c)(iii)(1-3). */
|
||||
size_t subLength = size_t(endIndex - sepLength - lastEndIndex);
|
||||
JSString *sub = js_NewDependentString(cx, str, lastEndIndex, subLength);
|
||||
JSString *sub = NewDependentString(cx, str, lastEndIndex, subLength);
|
||||
if (!sub || !splits.append(StringValue(sub)))
|
||||
return nullptr;
|
||||
|
||||
@ -3665,7 +3664,7 @@ SplitHelper(JSContext *cx, HandleLinearString str, uint32_t limit, const Matcher
|
||||
if (!matches[i + 1].isUndefined()) {
|
||||
JSSubString parsub;
|
||||
res->getParen(i + 1, &parsub);
|
||||
sub = js_NewDependentString(cx, parsub.base, parsub.offset, parsub.length);
|
||||
sub = NewDependentString(cx, parsub.base, parsub.offset, parsub.length);
|
||||
if (!sub || !splits.append(StringValue(sub)))
|
||||
return nullptr;
|
||||
} else {
|
||||
@ -3686,7 +3685,7 @@ SplitHelper(JSContext *cx, HandleLinearString str, uint32_t limit, const Matcher
|
||||
}
|
||||
|
||||
/* Steps 14-15. */
|
||||
JSString *sub = js_NewDependentString(cx, str, lastEndIndex, strLength - lastEndIndex);
|
||||
JSString *sub = NewDependentString(cx, str, lastEndIndex, strLength - lastEndIndex);
|
||||
if (!sub || !splits.append(StringValue(sub)))
|
||||
return nullptr;
|
||||
|
||||
@ -4007,7 +4006,7 @@ str_slice(JSContext *cx, unsigned argc, Value *vp)
|
||||
} else {
|
||||
str = (length == 1)
|
||||
? cx->staticStrings().getUnitStringForElement(cx, str, begin)
|
||||
: js_NewDependentString(cx, str, begin, length);
|
||||
: NewDependentString(cx, str, begin, length);
|
||||
if (!str)
|
||||
return false;
|
||||
}
|
||||
@ -4050,9 +4049,7 @@ str_slice(JSContext *cx, unsigned argc, Value *vp)
|
||||
end = length;
|
||||
}
|
||||
|
||||
str = js_NewDependentString(cx, str,
|
||||
(size_t)begin,
|
||||
(size_t)(end - begin));
|
||||
str = NewDependentString(cx, str, size_t(begin), size_t(end - begin));
|
||||
if (!str)
|
||||
return false;
|
||||
}
|
||||
@ -4172,7 +4169,7 @@ js::str_fromCharCode(JSContext *cx, unsigned argc, Value *vp)
|
||||
chars[i] = jschar(code);
|
||||
}
|
||||
chars[args.length()] = 0;
|
||||
JSString *str = js_NewString<CanGC>(cx, chars, args.length());
|
||||
JSString *str = NewString<CanGC>(cx, chars, args.length());
|
||||
if (!str) {
|
||||
js_free(chars);
|
||||
return false;
|
||||
@ -4200,7 +4197,7 @@ js::str_fromCharCode_one_arg(JSContext *cx, HandleValue code, MutableHandleValue
|
||||
return false;
|
||||
chars[0] = jschar(ucode);
|
||||
chars[1] = 0;
|
||||
JSString *str = js_NewString<CanGC>(cx, chars, 1);
|
||||
JSString *str = NewString<CanGC>(cx, chars, 1);
|
||||
if (!str) {
|
||||
js_free(chars);
|
||||
return false;
|
||||
@ -4273,7 +4270,7 @@ js_InitStringClass(JSContext *cx, HandleObject obj)
|
||||
|
||||
template <AllowGC allowGC, typename CharT>
|
||||
JSFlatString *
|
||||
js_NewString(ThreadSafeContext *cx, CharT *chars, size_t length)
|
||||
js::NewString(ThreadSafeContext *cx, CharT *chars, size_t length)
|
||||
{
|
||||
if (length == 1) {
|
||||
jschar c = chars[0];
|
||||
@ -4289,19 +4286,19 @@ js_NewString(ThreadSafeContext *cx, CharT *chars, size_t length)
|
||||
}
|
||||
|
||||
template JSFlatString *
|
||||
js_NewString<CanGC>(ThreadSafeContext *cx, jschar *chars, size_t length);
|
||||
js::NewString<CanGC>(ThreadSafeContext *cx, jschar *chars, size_t length);
|
||||
|
||||
template JSFlatString *
|
||||
js_NewString<NoGC>(ThreadSafeContext *cx, jschar *chars, size_t length);
|
||||
js::NewString<NoGC>(ThreadSafeContext *cx, jschar *chars, size_t length);
|
||||
|
||||
template JSFlatString *
|
||||
js_NewString<CanGC>(ThreadSafeContext *cx, Latin1Char *chars, size_t length);
|
||||
js::NewString<CanGC>(ThreadSafeContext *cx, Latin1Char *chars, size_t length);
|
||||
|
||||
template JSFlatString *
|
||||
js_NewString<NoGC>(ThreadSafeContext *cx, Latin1Char *chars, size_t length);
|
||||
js::NewString<NoGC>(ThreadSafeContext *cx, Latin1Char *chars, size_t length);
|
||||
|
||||
JSLinearString *
|
||||
js_NewDependentString(JSContext *cx, JSString *baseArg, size_t start, size_t length)
|
||||
js::NewDependentString(JSContext *cx, JSString *baseArg, size_t start, size_t length)
|
||||
{
|
||||
if (length == 0)
|
||||
return cx->emptyString();
|
||||
@ -4346,9 +4343,11 @@ CopyCharsMaybeInflate(jschar *dest, const Latin1Char *src, size_t len)
|
||||
CopyAndInflateChars(dest, src, len);
|
||||
}
|
||||
|
||||
namespace js {
|
||||
|
||||
template <AllowGC allowGC, typename CharT>
|
||||
JSFlatString *
|
||||
js_NewStringCopyN(ThreadSafeContext *cx, const CharT *s, size_t n)
|
||||
NewStringCopyN(ThreadSafeContext *cx, const CharT *s, size_t n)
|
||||
{
|
||||
if (EnableLatin1Strings) {
|
||||
if (JSFatInlineString::lengthFits<CharT>(n))
|
||||
@ -4361,7 +4360,7 @@ js_NewStringCopyN(ThreadSafeContext *cx, const CharT *s, size_t n)
|
||||
PodCopy(news.get(), s, n);
|
||||
news[n] = 0;
|
||||
|
||||
JSFlatString *str = js_NewString<allowGC>(cx, news.get(), n);
|
||||
JSFlatString *str = NewString<allowGC>(cx, news.get(), n);
|
||||
if (!str)
|
||||
return nullptr;
|
||||
|
||||
@ -4379,7 +4378,7 @@ js_NewStringCopyN(ThreadSafeContext *cx, const CharT *s, size_t n)
|
||||
CopyCharsMaybeInflate(news.get(), s, n);
|
||||
news[n] = 0;
|
||||
|
||||
JSFlatString *str = js_NewString<allowGC>(cx, news.get(), n);
|
||||
JSFlatString *str = NewString<allowGC>(cx, news.get(), n);
|
||||
if (!str)
|
||||
return nullptr;
|
||||
|
||||
@ -4388,68 +4387,58 @@ js_NewStringCopyN(ThreadSafeContext *cx, const CharT *s, size_t n)
|
||||
}
|
||||
|
||||
template JSFlatString *
|
||||
js_NewStringCopyN<CanGC>(ThreadSafeContext *cx, const jschar *s, size_t n);
|
||||
NewStringCopyN<CanGC>(ThreadSafeContext *cx, const jschar *s, size_t n);
|
||||
|
||||
template JSFlatString *
|
||||
js_NewStringCopyN<NoGC>(ThreadSafeContext *cx, const jschar *s, size_t n);
|
||||
NewStringCopyN<NoGC>(ThreadSafeContext *cx, const jschar *s, size_t n);
|
||||
|
||||
template JSFlatString *
|
||||
js_NewStringCopyN<CanGC>(ThreadSafeContext *cx, const Latin1Char *s, size_t n);
|
||||
NewStringCopyN<CanGC>(ThreadSafeContext *cx, const Latin1Char *s, size_t n);
|
||||
|
||||
template JSFlatString *
|
||||
js_NewStringCopyN<NoGC>(ThreadSafeContext *cx, const Latin1Char *s, size_t n);
|
||||
NewStringCopyN<NoGC>(ThreadSafeContext *cx, const Latin1Char *s, size_t n);
|
||||
|
||||
template <>
|
||||
JSFlatString *
|
||||
js_NewStringCopyN<CanGC>(ThreadSafeContext *cx, const char *s, size_t n)
|
||||
NewStringCopyN<CanGC>(ThreadSafeContext *cx, const char *s, size_t n)
|
||||
{
|
||||
return js_NewStringCopyN<CanGC>(cx, reinterpret_cast<const Latin1Char *>(s), n);
|
||||
return NewStringCopyN<CanGC>(cx, reinterpret_cast<const Latin1Char *>(s), n);
|
||||
}
|
||||
|
||||
template <>
|
||||
JSFlatString *
|
||||
js_NewStringCopyN<NoGC>(ThreadSafeContext *cx, const char *s, size_t n)
|
||||
NewStringCopyN<NoGC>(ThreadSafeContext *cx, const char *s, size_t n)
|
||||
{
|
||||
return js_NewStringCopyN<NoGC>(cx, reinterpret_cast<const Latin1Char *>(s), n);
|
||||
return NewStringCopyN<NoGC>(cx, reinterpret_cast<const Latin1Char *>(s), n);
|
||||
}
|
||||
|
||||
} /* namespace js */
|
||||
|
||||
template <AllowGC allowGC>
|
||||
JSFlatString *
|
||||
js_NewStringCopyZ(ExclusiveContext *cx, const jschar *s)
|
||||
js::NewStringCopyZ(ExclusiveContext *cx, const jschar *s)
|
||||
{
|
||||
size_t n = js_strlen(s);
|
||||
if (JSFatInlineString::twoByteLengthFits(n))
|
||||
return NewFatInlineString<allowGC>(cx, Range<const jschar>(s, n));
|
||||
|
||||
size_t m = (n + 1) * sizeof(jschar);
|
||||
jschar *news = (jschar *) cx->malloc_(m);
|
||||
if (!news)
|
||||
return nullptr;
|
||||
js_memcpy(news, s, m);
|
||||
JSFlatString *str = js_NewString<allowGC>(cx, news, n);
|
||||
if (!str)
|
||||
js_free(news);
|
||||
return str;
|
||||
return NewStringCopyN<allowGC>(cx, s, js_strlen(s));
|
||||
}
|
||||
|
||||
template JSFlatString *
|
||||
js_NewStringCopyZ<CanGC>(ExclusiveContext *cx, const jschar *s);
|
||||
js::NewStringCopyZ<CanGC>(ExclusiveContext *cx, const jschar *s);
|
||||
|
||||
template JSFlatString *
|
||||
js_NewStringCopyZ<NoGC>(ExclusiveContext *cx, const jschar *s);
|
||||
js::NewStringCopyZ<NoGC>(ExclusiveContext *cx, const jschar *s);
|
||||
|
||||
template <AllowGC allowGC>
|
||||
JSFlatString *
|
||||
js_NewStringCopyZ(ThreadSafeContext *cx, const char *s)
|
||||
js::NewStringCopyZ(ThreadSafeContext *cx, const char *s)
|
||||
{
|
||||
return js_NewStringCopyN<allowGC>(cx, s, strlen(s));
|
||||
return NewStringCopyN<allowGC>(cx, s, strlen(s));
|
||||
}
|
||||
|
||||
template JSFlatString *
|
||||
js_NewStringCopyZ<CanGC>(ThreadSafeContext *cx, const char *s);
|
||||
js::NewStringCopyZ<CanGC>(ThreadSafeContext *cx, const char *s);
|
||||
|
||||
template JSFlatString *
|
||||
js_NewStringCopyZ<NoGC>(ThreadSafeContext *cx, const char *s);
|
||||
js::NewStringCopyZ<NoGC>(ThreadSafeContext *cx, const char *s);
|
||||
|
||||
const char *
|
||||
js_ValueToPrintable(JSContext *cx, const Value &vArg, JSAutoByteString *bytes, bool asSource)
|
||||
@ -4563,7 +4552,7 @@ js::ValueToSource(JSContext *cx, HandleValue v)
|
||||
/* NB: _ucNstr rather than _ucstr to indicate non-terminated. */
|
||||
static const jschar js_negzero_ucNstr[] = {'-', '0'};
|
||||
|
||||
return js_NewStringCopyN<CanGC>(cx, js_negzero_ucNstr, 2);
|
||||
return NewStringCopyN<CanGC>(cx, js_negzero_ucNstr, 2);
|
||||
}
|
||||
return ToString<CanGC>(cx, v);
|
||||
}
|
||||
|
@ -98,36 +98,6 @@ struct JSSubString {
|
||||
extern JSObject *
|
||||
js_InitStringClass(JSContext *cx, js::HandleObject obj);
|
||||
|
||||
extern const char js_escape_str[];
|
||||
extern const char js_unescape_str[];
|
||||
extern const char js_uneval_str[];
|
||||
extern const char js_decodeURI_str[];
|
||||
extern const char js_encodeURI_str[];
|
||||
extern const char js_decodeURIComponent_str[];
|
||||
extern const char js_encodeURIComponent_str[];
|
||||
|
||||
/* GC-allocate a string descriptor for the given malloc-allocated chars. */
|
||||
template <js::AllowGC allowGC, typename CharT>
|
||||
extern JSFlatString *
|
||||
js_NewString(js::ThreadSafeContext *cx, CharT *chars, size_t length);
|
||||
|
||||
extern JSLinearString *
|
||||
js_NewDependentString(JSContext *cx, JSString *base, size_t start, size_t length);
|
||||
|
||||
/* Copy a counted string and GC-allocate a descriptor for it. */
|
||||
template <js::AllowGC allowGC, typename CharT>
|
||||
extern JSFlatString *
|
||||
js_NewStringCopyN(js::ThreadSafeContext *cx, const CharT *s, size_t n);
|
||||
|
||||
/* Copy a C string and GC-allocate a descriptor for it. */
|
||||
template <js::AllowGC allowGC>
|
||||
extern JSFlatString *
|
||||
js_NewStringCopyZ(js::ExclusiveContext *cx, const jschar *s);
|
||||
|
||||
template <js::AllowGC allowGC>
|
||||
extern JSFlatString *
|
||||
js_NewStringCopyZ(js::ThreadSafeContext *cx, const char *s);
|
||||
|
||||
/*
|
||||
* Convert a value to a printable C string.
|
||||
*/
|
||||
@ -137,6 +107,28 @@ js_ValueToPrintable(JSContext *cx, const js::Value &,
|
||||
|
||||
namespace js {
|
||||
|
||||
/* GC-allocate a string descriptor for the given malloc-allocated chars. */
|
||||
template <js::AllowGC allowGC, typename CharT>
|
||||
extern JSFlatString *
|
||||
NewString(js::ThreadSafeContext *cx, CharT *chars, size_t length);
|
||||
|
||||
extern JSLinearString *
|
||||
NewDependentString(JSContext *cx, JSString *base, size_t start, size_t length);
|
||||
|
||||
/* Copy a counted string and GC-allocate a descriptor for it. */
|
||||
template <js::AllowGC allowGC, typename CharT>
|
||||
extern JSFlatString *
|
||||
NewStringCopyN(js::ThreadSafeContext *cx, const CharT *s, size_t n);
|
||||
|
||||
/* Copy a C string and GC-allocate a descriptor for it. */
|
||||
template <js::AllowGC allowGC>
|
||||
extern JSFlatString *
|
||||
NewStringCopyZ(js::ExclusiveContext *cx, const jschar *s);
|
||||
|
||||
template <js::AllowGC allowGC>
|
||||
extern JSFlatString *
|
||||
NewStringCopyZ(js::ThreadSafeContext *cx, const char *s);
|
||||
|
||||
/*
|
||||
* Convert a non-string value to a string, returning null after reporting an
|
||||
* error, otherwise returning a new string reference.
|
||||
|
@ -3081,9 +3081,9 @@ DebuggerScript_getUrl(JSContext *cx, unsigned argc, Value *vp)
|
||||
if (script->filename()) {
|
||||
JSString *str;
|
||||
if (script->scriptSource()->introducerFilename())
|
||||
str = js_NewStringCopyZ<CanGC>(cx, script->scriptSource()->introducerFilename());
|
||||
str = NewStringCopyZ<CanGC>(cx, script->scriptSource()->introducerFilename());
|
||||
else
|
||||
str = js_NewStringCopyZ<CanGC>(cx, script->filename());
|
||||
str = NewStringCopyZ<CanGC>(cx, script->filename());
|
||||
if (!str)
|
||||
return false;
|
||||
args.rval().setString(str);
|
||||
@ -4042,7 +4042,7 @@ DebuggerSource_getText(JSContext *cx, unsigned argc, Value *vp)
|
||||
return false;
|
||||
|
||||
JSString *str = hasSourceData ? ss->substring(cx, 0, ss->length())
|
||||
: js_NewStringCopyZ<CanGC>(cx, "[no source]");
|
||||
: NewStringCopyZ<CanGC>(cx, "[no source]");
|
||||
if (!str)
|
||||
return false;
|
||||
|
||||
@ -4057,7 +4057,7 @@ DebuggerSource_getUrl(JSContext *cx, unsigned argc, Value *vp)
|
||||
|
||||
ScriptSource *ss = sourceObject->source();
|
||||
if (ss->filename()) {
|
||||
JSString *str = js_NewStringCopyZ<CanGC>(cx, ss->filename());
|
||||
JSString *str = NewStringCopyZ<CanGC>(cx, ss->filename());
|
||||
if (!str)
|
||||
return false;
|
||||
args.rval().setString(str);
|
||||
@ -4150,7 +4150,7 @@ DebuggerSource_getIntroductionType(JSContext *cx, unsigned argc, Value *vp)
|
||||
|
||||
ScriptSource *ss = sourceObject->source();
|
||||
if (ss->hasIntroductionType()) {
|
||||
JSString *str = js_NewStringCopyZ<CanGC>(cx, ss->introductionType());
|
||||
JSString *str = NewStringCopyZ<CanGC>(cx, ss->introductionType());
|
||||
if (!str)
|
||||
return false;
|
||||
args.rval().setString(str);
|
||||
|
@ -224,7 +224,7 @@ RegExpStatics::createDependent(JSContext *cx, size_t start, size_t end, MutableH
|
||||
|
||||
JS_ASSERT(start <= end);
|
||||
JS_ASSERT(end <= matchesInput->length());
|
||||
JSString *str = js_NewDependentString(cx, matchesInput, start, end - start);
|
||||
JSString *str = NewDependentString(cx, matchesInput, start, end - start);
|
||||
if (!str)
|
||||
return false;
|
||||
out.setString(str);
|
||||
|
@ -1128,8 +1128,8 @@ CloneString(JSContext *cx, JSFlatString *selfHostedString)
|
||||
{
|
||||
JS::AutoCheckCannotGC nogc;
|
||||
JSString *clone = selfHostedString->hasLatin1Chars()
|
||||
? js_NewStringCopyN<NoGC>(cx, selfHostedString->latin1Chars(nogc), len)
|
||||
: js_NewStringCopyN<NoGC>(cx, selfHostedString->twoByteChars(nogc), len);
|
||||
? NewStringCopyN<NoGC>(cx, selfHostedString->latin1Chars(nogc), len)
|
||||
: NewStringCopyN<NoGC>(cx, selfHostedString->twoByteChars(nogc), len);
|
||||
if (clone)
|
||||
return clone;
|
||||
}
|
||||
@ -1139,8 +1139,8 @@ CloneString(JSContext *cx, JSFlatString *selfHostedString)
|
||||
return nullptr;
|
||||
|
||||
return chars.isLatin1()
|
||||
? js_NewStringCopyN<CanGC>(cx, chars.latin1Range().start().get(), len)
|
||||
: js_NewStringCopyN<CanGC>(cx, chars.twoByteRange().start().get(), len);
|
||||
? NewStringCopyN<CanGC>(cx, chars.latin1Range().start().get(), len)
|
||||
: NewStringCopyN<CanGC>(cx, chars.twoByteRange().start().get(), len);
|
||||
}
|
||||
|
||||
static JSObject *
|
||||
|
@ -151,7 +151,7 @@ JSRope::new_(js::ThreadSafeContext *cx,
|
||||
{
|
||||
if (!validateLength(cx, length))
|
||||
return nullptr;
|
||||
JSRope *str = (JSRope *) js_NewGCString<allowGC>(cx);
|
||||
JSRope *str = (JSRope *)js::NewGCString<allowGC>(cx);
|
||||
if (!str)
|
||||
return nullptr;
|
||||
str->init(cx, left, right, length);
|
||||
@ -212,7 +212,7 @@ JSDependentString::new_(js::ExclusiveContext *cx, JSLinearString *baseArg, size_
|
||||
return js::NewFatInlineString<jschar>(cx, base, start, length);
|
||||
}
|
||||
|
||||
JSDependentString *str = (JSDependentString *)js_NewGCString<js::NoGC>(cx);
|
||||
JSDependentString *str = (JSDependentString *)js::NewGCString<js::NoGC>(cx);
|
||||
if (str) {
|
||||
str->init(cx, baseArg, start, length);
|
||||
return str;
|
||||
@ -220,7 +220,7 @@ JSDependentString::new_(js::ExclusiveContext *cx, JSLinearString *baseArg, size_
|
||||
|
||||
js::RootedLinearString base(cx, baseArg);
|
||||
|
||||
str = (JSDependentString *)js_NewGCString<js::CanGC>(cx);
|
||||
str = (JSDependentString *)js::NewGCString<js::CanGC>(cx);
|
||||
if (!str)
|
||||
return nullptr;
|
||||
str->init(cx, base, start, length);
|
||||
@ -259,7 +259,7 @@ JSFlatString::new_(js::ThreadSafeContext *cx, const CharT *chars, size_t length)
|
||||
if (!validateLength(cx, length))
|
||||
return nullptr;
|
||||
|
||||
JSFlatString *str = (JSFlatString *)js_NewGCString<allowGC>(cx);
|
||||
JSFlatString *str = (JSFlatString *)js::NewGCString<allowGC>(cx);
|
||||
if (!str)
|
||||
return nullptr;
|
||||
|
||||
@ -286,7 +286,7 @@ template <js::AllowGC allowGC>
|
||||
MOZ_ALWAYS_INLINE JSInlineString *
|
||||
JSInlineString::new_(js::ThreadSafeContext *cx)
|
||||
{
|
||||
return (JSInlineString *)js_NewGCString<allowGC>(cx);
|
||||
return (JSInlineString *)js::NewGCString<allowGC>(cx);
|
||||
}
|
||||
|
||||
MOZ_ALWAYS_INLINE jschar *
|
||||
@ -357,7 +357,7 @@ template <js::AllowGC allowGC>
|
||||
MOZ_ALWAYS_INLINE JSFatInlineString *
|
||||
JSFatInlineString::new_(js::ThreadSafeContext *cx)
|
||||
{
|
||||
return js_NewGCFatInlineString<allowGC>(cx);
|
||||
return js::NewGCFatInlineString<allowGC>(cx);
|
||||
}
|
||||
|
||||
MOZ_ALWAYS_INLINE void
|
||||
@ -379,7 +379,7 @@ JSExternalString::new_(JSContext *cx, const jschar *chars, size_t length,
|
||||
|
||||
if (!validateLength(cx, length))
|
||||
return nullptr;
|
||||
JSExternalString *str = js_NewGCExternalString(cx);
|
||||
JSExternalString *str = js::NewGCExternalString(cx);
|
||||
if (!str)
|
||||
return nullptr;
|
||||
str->init(chars, length, fin);
|
||||
@ -397,7 +397,7 @@ js::StaticStrings::getUnitStringForElement(JSContext *cx, JSString *str, size_t
|
||||
return nullptr;
|
||||
if (c < UNIT_STATIC_LIMIT)
|
||||
return getUnit(c);
|
||||
return js_NewDependentString(cx, str, index, 1);
|
||||
return NewDependentString(cx, str, index, 1);
|
||||
}
|
||||
|
||||
inline JSAtom *
|
||||
|
@ -493,7 +493,7 @@ js::ConcatStrings(ThreadSafeContext *cx,
|
||||
? JSFatInlineString::latin1LengthFits(wholeLength)
|
||||
: JSFatInlineString::twoByteLengthFits(wholeLength);
|
||||
if (canUseFatInline && cx->isJSContext()) {
|
||||
JSFatInlineString *str = js_NewGCFatInlineString<allowGC>(cx);
|
||||
JSFatInlineString *str = NewGCFatInlineString<allowGC>(cx);
|
||||
if (!str)
|
||||
return nullptr;
|
||||
|
||||
@ -720,7 +720,7 @@ StaticStrings::init(JSContext *cx)
|
||||
|
||||
for (uint32_t i = 0; i < UNIT_STATIC_LIMIT; i++) {
|
||||
jschar buffer[] = { jschar(i), '\0' };
|
||||
JSFlatString *s = js_NewStringCopyN<NoGC>(cx, buffer, 1);
|
||||
JSFlatString *s = NewStringCopyN<NoGC>(cx, buffer, 1);
|
||||
if (!s)
|
||||
return false;
|
||||
unitStaticTable[i] = s->morphAtomizedStringIntoPermanentAtom();
|
||||
@ -728,7 +728,7 @@ StaticStrings::init(JSContext *cx)
|
||||
|
||||
for (uint32_t i = 0; i < NUM_SMALL_CHARS * NUM_SMALL_CHARS; i++) {
|
||||
jschar buffer[] = { FROM_SMALL_CHAR(i >> 6), FROM_SMALL_CHAR(i & 0x3F), '\0' };
|
||||
JSFlatString *s = js_NewStringCopyN<NoGC>(cx, buffer, 2);
|
||||
JSFlatString *s = NewStringCopyN<NoGC>(cx, buffer, 2);
|
||||
if (!s)
|
||||
return false;
|
||||
length2StaticTable[i] = s->morphAtomizedStringIntoPermanentAtom();
|
||||
@ -746,7 +746,7 @@ StaticStrings::init(JSContext *cx)
|
||||
jschar('0' + ((i / 10) % 10)),
|
||||
jschar('0' + (i % 10)),
|
||||
'\0' };
|
||||
JSFlatString *s = js_NewStringCopyN<NoGC>(cx, buffer, 3);
|
||||
JSFlatString *s = NewStringCopyN<NoGC>(cx, buffer, 3);
|
||||
if (!s)
|
||||
return false;
|
||||
intStaticTable[i] = s->morphAtomizedStringIntoPermanentAtom();
|
||||
|
@ -77,7 +77,7 @@ FinishStringFlat(ExclusiveContext *cx, StringBuffer &sb, Buffer &cb)
|
||||
if (!buf)
|
||||
return nullptr;
|
||||
|
||||
JSFlatString *str = js_NewString<CanGC>(cx, buf.get(), len);
|
||||
JSFlatString *str = NewString<CanGC>(cx, buf.get(), len);
|
||||
if (!str)
|
||||
return nullptr;
|
||||
|
||||
|
@ -1168,7 +1168,7 @@ JSStructuredCloneReader::readString(uint32_t nchars)
|
||||
Chars chars(context());
|
||||
if (!chars.allocate(nchars) || !in.readChars(chars.get(), nchars))
|
||||
return nullptr;
|
||||
JSString *str = js_NewString<CanGC>(context(), chars.get(), nchars);
|
||||
JSString *str = NewString<CanGC>(context(), chars.get(), nchars);
|
||||
if (str)
|
||||
chars.forget();
|
||||
return str;
|
||||
|
@ -17,10 +17,12 @@
|
||||
|
||||
package org.mozilla.gecko.sqlite;
|
||||
|
||||
import org.mozilla.gecko.AppConstants;
|
||||
import org.mozilla.gecko.mozglue.generatorannotations.WrapElementForJNI;
|
||||
|
||||
import android.database.AbstractCursor;
|
||||
import android.database.CursorIndexOutOfBoundsException;
|
||||
import android.util.Log;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.ArrayList;
|
||||
@ -44,6 +46,7 @@ public class MatrixBlobCursor extends AbstractCursor {
|
||||
private Object[] data;
|
||||
private int rowCount = 0;
|
||||
private final int columnCount;
|
||||
private static final String LOGTAG = "MatrixBlobCursor";
|
||||
|
||||
/**
|
||||
* Constructs a new cursor with the given initial capacity.
|
||||
@ -324,4 +327,15 @@ public class MatrixBlobCursor extends AbstractCursor {
|
||||
public boolean isNull(int column) {
|
||||
return get(column) == null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void finalize() {
|
||||
if (AppConstants.DEBUG_BUILD) {
|
||||
if (!isClosed()) {
|
||||
Log.e(LOGTAG, "Cursor finalized without being closed");
|
||||
}
|
||||
}
|
||||
|
||||
super.finalize();
|
||||
}
|
||||
}
|
||||
|
@ -84,6 +84,13 @@ NS_IMETHODIMP AppCacheStorage::AsyncOpenURI(nsIURI *aURI,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP AppCacheStorage::Exists(nsIURI *aURI, const nsACString & aIdExtension,
|
||||
bool *aResult)
|
||||
{
|
||||
*aResult = false;
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP AppCacheStorage::AsyncDoomURI(nsIURI *aURI, const nsACString & aIdExtension,
|
||||
nsICacheEntryDoomCallback* aCallback)
|
||||
{
|
||||
|
@ -676,7 +676,7 @@ bool CacheEntry::InvokeCallback(Callback & aCallback)
|
||||
// If we don't have data and the callback wants a complete entry,
|
||||
// don't invoke now.
|
||||
bool bypass = !mHasData;
|
||||
if (!bypass) {
|
||||
if (!bypass && NS_SUCCEEDED(mFileStatus)) {
|
||||
int64_t _unused;
|
||||
bypass = !mFile->DataSize(&_unused);
|
||||
}
|
||||
@ -1549,7 +1549,10 @@ void CacheEntry::StoreFrecency()
|
||||
// No need for thread safety over mFrecency, it will be rewriten
|
||||
// correctly on following invocation if broken by concurrency.
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
mFile->SetFrecency(FRECENCY2INT(mFrecency));
|
||||
|
||||
if (NS_SUCCEEDED(mFileStatus)) {
|
||||
mFile->SetFrecency(FRECENCY2INT(mFrecency));
|
||||
}
|
||||
}
|
||||
|
||||
// CacheOutputCloseListener
|
||||
|
@ -104,6 +104,26 @@ NS_IMETHODIMP CacheStorage::AsyncOpenURI(nsIURI *aURI,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP CacheStorage::Exists(nsIURI *aURI, const nsACString & aIdExtension,
|
||||
bool *aResult)
|
||||
{
|
||||
NS_ENSURE_ARG(aURI);
|
||||
NS_ENSURE_ARG(aResult);
|
||||
|
||||
if (!CacheStorageService::Self())
|
||||
return NS_ERROR_NOT_INITIALIZED;
|
||||
|
||||
nsresult rv;
|
||||
|
||||
nsCOMPtr<nsIURI> noRefURI;
|
||||
rv = aURI->CloneIgnoringRef(getter_AddRefs(noRefURI));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
return CacheStorageService::Self()->CheckStorageEntry(
|
||||
this, noRefURI, aIdExtension, aResult);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP CacheStorage::AsyncDoomURI(nsIURI *aURI, const nsACString & aIdExtension,
|
||||
nsICacheEntryDoomCallback* aCallback)
|
||||
{
|
||||
|
@ -1341,6 +1341,67 @@ CacheStorageService::AddStorageEntry(nsCSubstring const& aContextKey,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
CacheStorageService::CheckStorageEntry(CacheStorage const* aStorage,
|
||||
nsIURI* aURI,
|
||||
const nsACString & aIdExtension,
|
||||
bool* aResult)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
nsAutoCString contextKey;
|
||||
CacheFileUtils::AppendKeyPrefix(aStorage->LoadInfo(), contextKey);
|
||||
|
||||
if (!aStorage->WriteToDisk()) {
|
||||
AppendMemoryStorageID(contextKey);
|
||||
}
|
||||
|
||||
#ifdef PR_LOGGING
|
||||
nsAutoCString uriSpec;
|
||||
aURI->GetAsciiSpec(uriSpec);
|
||||
LOG(("CacheStorageService::CheckStorageEntry [uri=%s, eid=%s, contextKey=%s]",
|
||||
uriSpec.get(), aIdExtension.BeginReading(), contextKey.get()));
|
||||
#endif
|
||||
|
||||
{
|
||||
mozilla::MutexAutoLock lock(mLock);
|
||||
|
||||
NS_ENSURE_FALSE(mShutdown, NS_ERROR_NOT_INITIALIZED);
|
||||
|
||||
nsAutoCString entryKey;
|
||||
rv = CacheEntry::HashingKey(EmptyCString(), aIdExtension, aURI, entryKey);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
CacheEntryTable* entries;
|
||||
if ((*aResult = sGlobalEntryTables->Get(contextKey, &entries)) &&
|
||||
entries->GetWeak(entryKey, aResult)) {
|
||||
LOG((" found in hash tables"));
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
if (!aStorage->WriteToDisk()) {
|
||||
// Memory entry, nothing more to do.
|
||||
LOG((" not found in hash tables"));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Disk entry, not found in the hashtable, check the index.
|
||||
nsAutoCString fileKey;
|
||||
rv = CacheEntry::HashingKey(contextKey, aIdExtension, aURI, fileKey);
|
||||
|
||||
CacheIndex::EntryStatus status;
|
||||
rv = CacheIndex::HasEntry(fileKey, &status);
|
||||
if (NS_FAILED(rv) || status == CacheIndex::DO_NOT_KNOW) {
|
||||
LOG((" index doesn't know, rv=0x%08x", rv));
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
*aResult = status == CacheIndex::EXISTS;
|
||||
LOG((" %sfound in index", *aResult ? "" : "not "));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
namespace { // anon
|
||||
|
||||
class CacheEntryDoomByKeyCallback : public CacheFileIOListener
|
||||
|
@ -159,6 +159,15 @@ private:
|
||||
bool aReplace,
|
||||
CacheEntryHandle** aResult);
|
||||
|
||||
/**
|
||||
* Check existance of an entry. This may throw NS_ERROR_NOT_AVAILABLE
|
||||
* when the information cannot be obtained synchronously w/o blocking.
|
||||
*/
|
||||
nsresult CheckStorageEntry(CacheStorage const* aStorage,
|
||||
nsIURI* aURI,
|
||||
const nsACString & aIdExtension,
|
||||
bool* aResult);
|
||||
|
||||
/**
|
||||
* Removes the entry from the related entry hash table, if still present
|
||||
* and returns it.
|
||||
|
@ -943,6 +943,12 @@ NS_IMETHODIMP _OldStorage::AsyncOpenURI(nsIURI *aURI,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP _OldStorage::Exists(nsIURI *aURI, const nsACString & aIdExtension,
|
||||
bool *aResult)
|
||||
{
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP _OldStorage::AsyncDoomURI(nsIURI *aURI, const nsACString & aIdExtension,
|
||||
nsICacheEntryDoomCallback* aCallback)
|
||||
{
|
||||
|
@ -14,7 +14,7 @@ interface nsICacheStorageVisitor;
|
||||
* in-mem+on-disk, in-mem+on-disk+app-cache or just a specific
|
||||
* app-cache storage.
|
||||
*/
|
||||
[scriptable, uuid(d983ba0c-433f-4017-abc1-93af737c82e4)]
|
||||
[scriptable, uuid(d9006881-a536-4ce3-bc48-e7f94b40a690)]
|
||||
interface nsICacheStorage : nsISupports
|
||||
{
|
||||
/**
|
||||
@ -77,6 +77,15 @@ interface nsICacheStorage : nsISupports
|
||||
in uint32_t aFlags,
|
||||
in nsICacheEntryOpenCallback aCallback);
|
||||
|
||||
/**
|
||||
* Synchronously check on existance of an entry. In case of disk entries
|
||||
* this uses information from the cache index. When the index data are not
|
||||
* up to date or index is still building, NS_ERROR_NOT_AVAILABLE is thrown.
|
||||
* The same error may throw any storage implementation that cannot determine
|
||||
* entry state without blocking the caller.
|
||||
*/
|
||||
boolean exists(in nsIURI aURI, in ACString aIdExtension);
|
||||
|
||||
/**
|
||||
* Asynchronously removes an entry belonging to the URI from the cache.
|
||||
*/
|
||||
|
@ -1159,9 +1159,25 @@ Http2Session::ResponseHeadersComplete()
|
||||
LOG3(("Http2Session::ResponseHeadersComplete %p for 0x%X fin=%d",
|
||||
this, mInputFrameDataStream->StreamID(), mInputFrameFinal));
|
||||
|
||||
// only do this once, afterwards ignore trailers
|
||||
if (mInputFrameDataStream->AllHeadersReceived())
|
||||
// only interpret headers once, afterwards ignore trailers
|
||||
if (mInputFrameDataStream->AllHeadersReceived()) {
|
||||
LOG3(("Http2Session::ResponseHeadersComplete extra headers"));
|
||||
nsresult rv = UncompressAndDiscard();
|
||||
if (NS_FAILED(rv)) {
|
||||
LOG3(("Http2Session::ResponseHeadersComplete extra uncompress failed\n"));
|
||||
return rv;
|
||||
}
|
||||
mFlatHTTPResponseHeadersOut = 0;
|
||||
mFlatHTTPResponseHeaders.Truncate();
|
||||
if (mInputFrameFinal) {
|
||||
// need to process the fin
|
||||
ChangeDownstreamState(PROCESSING_COMPLETE_HEADERS);
|
||||
} else {
|
||||
ResetDownstreamState();
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
mInputFrameDataStream->SetAllHeadersReceived();
|
||||
|
||||
// The stream needs to see flattened http headers
|
||||
|
@ -200,15 +200,19 @@ TLSFilterTransaction::OnReadSegment(const char *aData,
|
||||
|
||||
uint32_t amt = 0;
|
||||
if (mEncryptedTextUsed) {
|
||||
// If we are tunneled on spdy CommitToSegmentSize will prevent partial
|
||||
// writes that could interfere with multiplexing. H1 is fine with
|
||||
// partial writes.
|
||||
rv = mSegmentReader->CommitToSegmentSize(mEncryptedTextUsed, mForce);
|
||||
if (rv != NS_BASE_STREAM_WOULD_BLOCK) {
|
||||
rv = mSegmentReader->OnReadSegment(mEncryptedText, mEncryptedTextUsed, &amt);
|
||||
}
|
||||
|
||||
if (rv == NS_BASE_STREAM_WOULD_BLOCK) {
|
||||
// return OK because all the data was consumed and stored in this buffer
|
||||
Connection()->TransactionHasDataToWrite(this);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
rv = mSegmentReader->OnReadSegment(mEncryptedText, mEncryptedTextUsed, &amt);
|
||||
if (NS_FAILED(rv)) {
|
||||
} else if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
@ -220,7 +224,6 @@ TLSFilterTransaction::OnReadSegment(const char *aData,
|
||||
} else {
|
||||
memmove(mEncryptedText, mEncryptedText + amt, mEncryptedTextUsed - amt);
|
||||
mEncryptedTextUsed -= amt;
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
@ -261,8 +264,9 @@ TLSFilterTransaction::OnWriteSegment(char *aData,
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
// this will call through to FilterRead to get data from the higher
|
||||
// this will call through to FilterInput to get data from the higher
|
||||
// level connection before removing the local TLS layer
|
||||
mFilterReadCode = NS_OK;
|
||||
int32_t bytesRead = PR_Read(mFD, aData, aCount);
|
||||
if (bytesRead == -1) {
|
||||
if (PR_GetError() == PR_WOULD_BLOCK_ERROR) {
|
||||
@ -271,6 +275,13 @@ TLSFilterTransaction::OnWriteSegment(char *aData,
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
*outCountRead = bytesRead;
|
||||
|
||||
if (NS_SUCCEEDED(mFilterReadCode) && !bytesRead) {
|
||||
LOG(("TLSFilterTransaction::OnWriteSegment %p "
|
||||
"Second layer of TLS stripping results in STREAM_CLOSED\n", this));
|
||||
mFilterReadCode = NS_BASE_STREAM_CLOSED;
|
||||
}
|
||||
|
||||
LOG(("TLSFilterTransaction::OnWriteSegment %p rv=%x didread=%d "
|
||||
"2 layers of ssl stripped to plaintext\n", this, mFilterReadCode, bytesRead));
|
||||
return mFilterReadCode;
|
||||
@ -286,7 +297,7 @@ TLSFilterTransaction::FilterInput(char *aBuf, int32_t aAmount)
|
||||
uint32_t outCountRead = 0;
|
||||
mFilterReadCode = mSegmentWriter->OnWriteSegment(aBuf, aAmount, &outCountRead);
|
||||
if (NS_SUCCEEDED(mFilterReadCode) && outCountRead) {
|
||||
LOG(("TLSFilterTransaction::FilterRead rv=%x read=%d input from net "
|
||||
LOG(("TLSFilterTransaction::FilterInput rv=%x read=%d input from net "
|
||||
"1 layer stripped, 1 still on\n", mFilterReadCode, outCountRead));
|
||||
if (mReadSegmentBlocked) {
|
||||
mNudgeCounter = 0;
|
||||
@ -338,6 +349,10 @@ TLSFilterTransaction::WriteSegments(nsAHttpSegmentWriter *aWriter,
|
||||
|
||||
mSegmentWriter = aWriter;
|
||||
nsresult rv = mTransaction->WriteSegments(this, aCount, outCountWritten);
|
||||
if (NS_SUCCEEDED(rv) && NS_FAILED(mFilterReadCode) && !(*outCountWritten)) {
|
||||
// nsPipe turns failures into silent OK.. undo that!
|
||||
rv = mFilterReadCode;
|
||||
}
|
||||
LOG(("TLSFilterTransaction %p called trans->WriteSegments rv=%x %d\n",
|
||||
this, rv, *outCountWritten));
|
||||
return rv;
|
||||
@ -902,6 +917,13 @@ SpdyConnectTransaction::Flush(uint32_t count, uint32_t *countRead)
|
||||
if (!(*countRead)) {
|
||||
return NS_BASE_STREAM_WOULD_BLOCK;
|
||||
}
|
||||
|
||||
if (mOutputDataUsed != mOutputDataOffset) {
|
||||
LOG(("SpdyConnectTransaction::Flush %p Incomplete %d\n",
|
||||
this, mOutputDataUsed - mOutputDataOffset));
|
||||
mSession->TransactionHasDataToWrite(this);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
33
netwerk/test/unit/test_cache2-24-exists.js
Normal file
33
netwerk/test/unit/test_cache2-24-exists.js
Normal file
@ -0,0 +1,33 @@
|
||||
Components.utils.import('resource://gre/modules/LoadContextInfo.jsm');
|
||||
|
||||
function run_test()
|
||||
{
|
||||
do_get_profile();
|
||||
|
||||
var mc = new MultipleCallbacks(2, function() {
|
||||
var mem = getCacheStorage("memory");
|
||||
var disk = getCacheStorage("disk");
|
||||
|
||||
do_check_true(disk.exists(createURI("http://m1/"), ""));
|
||||
do_check_true(mem.exists(createURI("http://m1/"), ""));
|
||||
do_check_false(mem.exists(createURI("http://m2/"), ""));
|
||||
do_check_true(disk.exists(createURI("http://d1/"), ""));
|
||||
do_check_throws_nsIException(() => disk.exists(createURI("http://d2/"), ""), 'NS_ERROR_NOT_AVAILABLE');
|
||||
|
||||
finish_cache2_test();
|
||||
});
|
||||
|
||||
asyncOpenCacheEntry("http://d1/", "disk", Ci.nsICacheStorage.OPEN_NORMALLY, LoadContextInfo.default,
|
||||
new OpenCallback(NEW | WAITFORWRITE, "meta", "data", function(entry) {
|
||||
mc.fired();
|
||||
})
|
||||
);
|
||||
|
||||
asyncOpenCacheEntry("http://m1/", "memory", Ci.nsICacheStorage.OPEN_NORMALLY, LoadContextInfo.default,
|
||||
new OpenCallback(NEW | WAITFORWRITE, "meta", "data", function(entry) {
|
||||
mc.fired();
|
||||
})
|
||||
);
|
||||
|
||||
do_test_pending();
|
||||
}
|
@ -292,6 +292,14 @@ function test_http2_push4() {
|
||||
chan.asyncOpen(listener, chan);
|
||||
}
|
||||
|
||||
// this is a basic test where the server sends a simple document with 2 header
|
||||
// blocks. bug 1027364
|
||||
function test_http2_doubleheader() {
|
||||
var chan = makeChan("https://localhost:6944/doubleheader");
|
||||
var listener = new Http2CheckListener();
|
||||
chan.asyncOpen(listener, null);
|
||||
}
|
||||
|
||||
// Make sure we handle GETs that cover more than 2 frames properly
|
||||
function test_http2_big() {
|
||||
var chan = makeChan("https://localhost:6944/big");
|
||||
@ -338,6 +346,7 @@ var tests = [ test_http2_post_big
|
||||
, test_http2_push2
|
||||
, test_http2_push3
|
||||
, test_http2_push4
|
||||
, test_http2_doubleheader
|
||||
, test_http2_xhr
|
||||
, test_http2_header
|
||||
, test_http2_cookie_crumbling
|
||||
|
@ -58,6 +58,9 @@ skip-if = os == "android"
|
||||
[test_cache2-21-anon-storage.js]
|
||||
[test_cache2-22-anon-visit.js]
|
||||
[test_cache2-23-read-over-chunk.js]
|
||||
[test_cache2-24-exists.js]
|
||||
# Bug 675039, comment 6: "The difference is that the memory cache is disabled in Armv6 builds."
|
||||
skip-if = os == "android"
|
||||
[test_304_responses.js]
|
||||
# Bug 675039: test hangs on Android-armv6
|
||||
skip-if = os == "android"
|
||||
|
@ -465,9 +465,6 @@ class MochitestOptions(optparse.OptionParser):
|
||||
else:
|
||||
self.error("could not find xre directory, --xre-path must be specified")
|
||||
|
||||
if options.profilePath is None:
|
||||
options.profilePath = tempfile.mkdtemp()
|
||||
|
||||
# allow relative paths
|
||||
options.xrePath = mochitest.getFullPath(options.xrePath)
|
||||
if options.profilePath:
|
||||
|
@ -1,11 +1,11 @@
|
||||
{
|
||||
"talos.zip": {
|
||||
"url": "http://talos-bundles.pvt.build.mozilla.org/zips/talos.b4907f0b27d3.zip",
|
||||
"url": "http://talos-bundles.pvt.build.mozilla.org/zips/talos.3a6a28b96228.zip",
|
||||
"path": ""
|
||||
},
|
||||
"global": {
|
||||
"talos_repo": "https://hg.mozilla.org/build/talos",
|
||||
"talos_revision": "35ba19c5f0e1"
|
||||
"talos_revision": "3a6a28b96228"
|
||||
},
|
||||
"suites": {
|
||||
"chromez": {
|
||||
@ -24,12 +24,15 @@
|
||||
"other": {
|
||||
"tests": ["a11yr", "ts_paint", "tpaint", "sessionrestore", "sessionrestore_no_auto_restore"]
|
||||
},
|
||||
"other_nolinux64": {
|
||||
"other_nol64": {
|
||||
"tests": ["a11yr", "ts_paint", "tpaint", "sessionrestore", "sessionrestore_no_auto_restore"]
|
||||
},
|
||||
"other_linux64": {
|
||||
"other_l64": {
|
||||
"tests": ["a11yr", "ts_paint", "tpaint", "sessionrestore", "sessionrestore_no_auto_restore", "media_tests"]
|
||||
},
|
||||
"g1": {
|
||||
"tests": ["tp5o_scroll"]
|
||||
},
|
||||
"svgr": {
|
||||
"tests": ["tsvgx", "tsvgr_opacity", "tart", "tscrollx", "cart"]
|
||||
},
|
||||
|
@ -114,6 +114,15 @@ function handleRequest(req, res) {
|
||||
}
|
||||
}
|
||||
|
||||
else if (u.pathname === "/doubleheader") {
|
||||
res.setHeader('Content-Type', 'text/html');
|
||||
res.writeHead(200);
|
||||
res.write(content);
|
||||
res.writeHead(200);
|
||||
res.end();
|
||||
return;
|
||||
}
|
||||
|
||||
else if (u.pathname === "/cookie_crumbling") {
|
||||
res.setHeader("X-Received-Header-Pairs", JSON.stringify(decompressedPairs));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user