mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Backout 4bb90f8c6909 (bug 756645) due to Android opt M3 orange on a CLOSED TREE.
This commit is contained in:
parent
e880c79745
commit
0ee3bd7919
@ -208,6 +208,11 @@ IDBFactory::Create(ContentParent* aContentParent,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
nsCString origin;
|
||||||
|
nsresult rv =
|
||||||
|
IndexedDatabaseManager::GetASCIIOriginFromWindow(nullptr, origin);
|
||||||
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
nsCOMPtr<nsIPrincipal> principal =
|
nsCOMPtr<nsIPrincipal> principal =
|
||||||
do_CreateInstance("@mozilla.org/nullprincipal;1");
|
do_CreateInstance("@mozilla.org/nullprincipal;1");
|
||||||
NS_ENSURE_TRUE(principal, NS_ERROR_FAILURE);
|
NS_ENSURE_TRUE(principal, NS_ERROR_FAILURE);
|
||||||
@ -227,7 +232,7 @@ IDBFactory::Create(ContentParent* aContentParent,
|
|||||||
NS_ASSERTION(xpc, "This should never be null!");
|
NS_ASSERTION(xpc, "This should never be null!");
|
||||||
|
|
||||||
nsCOMPtr<nsIXPConnectJSObjectHolder> globalHolder;
|
nsCOMPtr<nsIXPConnectJSObjectHolder> globalHolder;
|
||||||
nsresult rv = xpc->CreateSandbox(cx, principal, getter_AddRefs(globalHolder));
|
rv = xpc->CreateSandbox(cx, principal, getter_AddRefs(globalHolder));
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
JSObject* global;
|
JSObject* global;
|
||||||
@ -630,4 +635,4 @@ IDBFactory::Cmp(const jsval& aFirst,
|
|||||||
|
|
||||||
*_retval = Key::CompareKeys(first, second);
|
*_retval = Key::CompareKeys(first, second);
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
@ -1018,7 +1018,7 @@ IndexedDatabaseManager::GetASCIIOriginFromWindow(nsPIDOMWindow* aWindow,
|
|||||||
aASCIIOrigin.AssignLiteral("chrome");
|
aASCIIOrigin.AssignLiteral("chrome");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
nsresult rv = principal->GetExtendedOrigin(aASCIIOrigin);
|
nsresult rv = nsContentUtils::GetASCIIOrigin(principal, aASCIIOrigin);
|
||||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||||
|
|
||||||
if (aASCIIOrigin.EqualsLiteral("null")) {
|
if (aASCIIOrigin.EqualsLiteral("null")) {
|
||||||
|
@ -101,10 +101,6 @@ MOCHITEST_FILES = \
|
|||||||
test_unique_index_update.html \
|
test_unique_index_update.html \
|
||||||
third_party_iframe1.html \
|
third_party_iframe1.html \
|
||||||
third_party_iframe2.html \
|
third_party_iframe2.html \
|
||||||
test_app_isolation_inproc.html \
|
|
||||||
test_app_isolation_oop.html \
|
|
||||||
file_app_isolation.html \
|
|
||||||
file_app_isolation.js \
|
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
# test_writer_starvation.html disabled for infinite loops, bug 595368
|
# test_writer_starvation.html disabled for infinite loops, bug 595368
|
||||||
|
@ -1,88 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<body>
|
|
||||||
foobar!
|
|
||||||
</body>
|
|
||||||
<script>
|
|
||||||
var data = [
|
|
||||||
{ id: "0", name: "foo" },
|
|
||||||
];
|
|
||||||
|
|
||||||
var action = window.location.search.substring(1);
|
|
||||||
var finished = false;
|
|
||||||
var created = false; // We use that for 'read-no' action.
|
|
||||||
|
|
||||||
function finish(value) {
|
|
||||||
value ? alert('success') : alert('failure');
|
|
||||||
finished = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
var request = window.indexedDB.open('AppIsolationTest');
|
|
||||||
|
|
||||||
request.onupgradeneeded = function(event) {
|
|
||||||
if (finished) {
|
|
||||||
finish(false);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (action) {
|
|
||||||
case 'read-no':
|
|
||||||
created = true;
|
|
||||||
break;
|
|
||||||
case 'read-yes':
|
|
||||||
finish(false);
|
|
||||||
break;
|
|
||||||
case 'write':
|
|
||||||
created = true;
|
|
||||||
|
|
||||||
var db = event.target.result;
|
|
||||||
|
|
||||||
var objectStore = db.createObjectStore("test", { keyPath: "id" });
|
|
||||||
for (var i in data) {
|
|
||||||
objectStore.add(data[i]);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
request.onsuccess = function(event) {
|
|
||||||
if (finished) {
|
|
||||||
finish(false);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var db = event.target.result;
|
|
||||||
|
|
||||||
// Think about close the db!
|
|
||||||
switch (action) {
|
|
||||||
case 'read-no':
|
|
||||||
db.close();
|
|
||||||
|
|
||||||
if (created) { // That means we have created it.
|
|
||||||
indexedDB.deleteDatabase('AppIsolationTest').onsuccess = function() {
|
|
||||||
finish(true);
|
|
||||||
};
|
|
||||||
} else {
|
|
||||||
finish(false);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 'read-yes':
|
|
||||||
db.transaction("test").objectStore("test").get("0").onsuccess = function(event) {
|
|
||||||
var name = event.target.result.name;
|
|
||||||
db.close();
|
|
||||||
|
|
||||||
indexedDB.deleteDatabase('AppIsolationTest').onsuccess = function() {
|
|
||||||
finish(name == 'foo');
|
|
||||||
};
|
|
||||||
};
|
|
||||||
break;
|
|
||||||
case 'write':
|
|
||||||
db.close();
|
|
||||||
|
|
||||||
// Success only if the db was actually created.
|
|
||||||
finish(created);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
</script>
|
|
||||||
</html>
|
|
@ -1,169 +0,0 @@
|
|||||||
SimpleTest.waitForExplicitFinish();
|
|
||||||
|
|
||||||
var fileTestOnCurrentOrigin = (location.protocol + '//' + location.host + location.pathname)
|
|
||||||
.replace('test_', 'file_')
|
|
||||||
.replace('_inproc', '').replace('_oop', '');
|
|
||||||
|
|
||||||
var previousPrefs = {
|
|
||||||
mozBrowserFramesEnabled: undefined,
|
|
||||||
mozBrowserFramesWhitelist: undefined,
|
|
||||||
oop_by_default: undefined,
|
|
||||||
};
|
|
||||||
|
|
||||||
try {
|
|
||||||
previousPrefs.mozBrowserFramesEnabled = SpecialPowers.getBoolPref('dom.mozBrowserFramesEnabled');
|
|
||||||
} catch(e)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
previousPrefs.mozBrowserFramesWhitelist = SpecialPowers.getCharPref('dom.mozBrowserFramesWhitelist');
|
|
||||||
} catch(e) {
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
previousPrefs.oop_by_default = SpecialPowers.getBoolPref('dom.ipc.browser_frames.oop_by_default');
|
|
||||||
} catch(e) {
|
|
||||||
}
|
|
||||||
|
|
||||||
SpecialPowers.setBoolPref('dom.mozBrowserFramesEnabled', true);
|
|
||||||
SpecialPowers.setCharPref('dom.mozBrowserFramesWhitelist', location.protocol + "//" + location.host);
|
|
||||||
SpecialPowers.setBoolPref("dom.ipc.browser_frames.oop_by_default", location.pathname.indexOf('_inproc') == -1);
|
|
||||||
|
|
||||||
var gData = [
|
|
||||||
// APP 1
|
|
||||||
{
|
|
||||||
app: 'http://example.org/manifest.webapp',
|
|
||||||
action: 'read-no',
|
|
||||||
src: fileTestOnCurrentOrigin,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
app: 'http://example.org/manifest.webapp',
|
|
||||||
action: 'write',
|
|
||||||
src: fileTestOnCurrentOrigin,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
app: 'http://example.org/manifest.webapp',
|
|
||||||
action: 'read-yes',
|
|
||||||
src: fileTestOnCurrentOrigin,
|
|
||||||
},
|
|
||||||
// APP 2
|
|
||||||
{
|
|
||||||
app: 'https://example.com/manifest.webapp',
|
|
||||||
action: 'read-no',
|
|
||||||
src: fileTestOnCurrentOrigin,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
app: 'https://example.com/manifest.webapp',
|
|
||||||
action: 'write',
|
|
||||||
src: fileTestOnCurrentOrigin,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
app: 'https://example.com/manifest.webapp',
|
|
||||||
action: 'read-yes',
|
|
||||||
src: fileTestOnCurrentOrigin,
|
|
||||||
},
|
|
||||||
// Browser
|
|
||||||
{
|
|
||||||
browser: true,
|
|
||||||
action: 'read-no',
|
|
||||||
src: fileTestOnCurrentOrigin,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
browser: true,
|
|
||||||
action: 'write',
|
|
||||||
src: fileTestOnCurrentOrigin,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
browser: true,
|
|
||||||
action: 'read-yes',
|
|
||||||
src: fileTestOnCurrentOrigin,
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|
||||||
function runTest() {
|
|
||||||
for (var i in gData) {
|
|
||||||
var iframe = document.createElement('iframe');
|
|
||||||
var data = gData[i];
|
|
||||||
|
|
||||||
if (data.app) {
|
|
||||||
iframe.setAttribute('mozbrowser', '');
|
|
||||||
iframe.setAttribute('mozapp', data.app);
|
|
||||||
} else if (data.browser) {
|
|
||||||
iframe.setAttribute('mozbrowser', '');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (data.app || data.browser) {
|
|
||||||
iframe.addEventListener('mozbrowsershowmodalprompt', function(e) {
|
|
||||||
is(e.detail.message, 'success', 'test number ' + i);
|
|
||||||
|
|
||||||
// document.getElementById('content').removeChild(iframe);
|
|
||||||
|
|
||||||
i++;
|
|
||||||
if (i >= gData.length) {
|
|
||||||
if (previousPrefs.mozBrowserFramesEnabled !== undefined) {
|
|
||||||
SpecialPowers.setBoolPref('dom.mozBrowserFramesEnabled', previousPrefs.mozBrowserFramesEnabled);
|
|
||||||
}
|
|
||||||
if (previousPrefs.mozBrowserFramesWhitelist !== undefined) {
|
|
||||||
SpecialPowers.setCharPref('dom.mozBrowserFramesWhitelist', previousPrefs.mozBrowserFramesWhitelist);
|
|
||||||
}
|
|
||||||
if (previousPrefs.oop_by_default !== undefined) {
|
|
||||||
SpecialPowers.setBoolPref("dom.ipc.browser_frames.oop_by_default", previousPrefs.oop_by_default);
|
|
||||||
}
|
|
||||||
|
|
||||||
indexedDB.deleteDatabase('AppIsolationTest').onsuccess = function() {
|
|
||||||
SimpleTest.finish();
|
|
||||||
};
|
|
||||||
} else {
|
|
||||||
gTestRunner.next();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
iframe.src = data.src + '?' + data.action;
|
|
||||||
|
|
||||||
document.getElementById('content').appendChild(iframe);
|
|
||||||
|
|
||||||
yield;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var gTestRunner = runTest();
|
|
||||||
|
|
||||||
function startTest() {
|
|
||||||
var request = window.indexedDB.open('AppIsolationTest');
|
|
||||||
var created = false;
|
|
||||||
|
|
||||||
request.onupgradeneeded = function(event) {
|
|
||||||
created = true;
|
|
||||||
var db = event.target.result;
|
|
||||||
var data = [
|
|
||||||
{ id: "0", name: "foo" },
|
|
||||||
];
|
|
||||||
var objectStore = db.createObjectStore("test", { keyPath: "id" });
|
|
||||||
for (var i in data) {
|
|
||||||
objectStore.add(data[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
request.onsuccess = function(event) {
|
|
||||||
var db = event.target.result;
|
|
||||||
is(created, true, "we should have created the db");
|
|
||||||
|
|
||||||
db.transaction("test").objectStore("test").get("0").onsuccess = function(event) {
|
|
||||||
is(event.target.result.name, 'foo', 'data have been written');
|
|
||||||
db.close();
|
|
||||||
|
|
||||||
gTestRunner.next();
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// test_ipc.html executes all the tests in this directory in content process.
|
|
||||||
// It will fail on this one for the moment.
|
|
||||||
if (!SpecialPowers.isMainProcess()) {
|
|
||||||
todo(false, "We should make this work on content process");
|
|
||||||
SimpleTest.finish();
|
|
||||||
} else {
|
|
||||||
startTest();
|
|
||||||
}
|
|
@ -1,21 +0,0 @@
|
|||||||
<!DOCTYPE HTML>
|
|
||||||
<html>
|
|
||||||
<!--
|
|
||||||
https://bugzilla.mozilla.org/show_bug.cgi?id=756645
|
|
||||||
-->
|
|
||||||
<head>
|
|
||||||
<title>Test for IndexedDB app isolation (unique process)</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=756645">Mozilla Bug 756645</a>
|
|
||||||
<div id="content" style="display: none">
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<pre id="test">
|
|
||||||
<script type="application/javascript;version=1.7" src="file_app_isolation.js">
|
|
||||||
</script>
|
|
||||||
</pre>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,21 +0,0 @@
|
|||||||
<!DOCTYPE HTML>
|
|
||||||
<html>
|
|
||||||
<!--
|
|
||||||
https://bugzilla.mozilla.org/show_bug.cgi?id=756645
|
|
||||||
-->
|
|
||||||
<head>
|
|
||||||
<title>Test for IndexedDB app isolation (unique process)</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=756645">Mozilla Bug 756645</a>
|
|
||||||
<div id="content" style="display: none">
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<pre id="test">
|
|
||||||
<script type="application/javascript;version=1.7" src="file_app_isolation.js">
|
|
||||||
</script>
|
|
||||||
</pre>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
Loading…
Reference in New Issue
Block a user