Backed out 2 changesets (bug 1169633, bug 1163254) for linux Mn-e10s test bustage on a CLOSED TREE

Backed out changeset 47ccf6689101 (bug 1169633)
Backed out changeset 503eab197a2d (bug 1163254)
This commit is contained in:
Carsten "Tomcat" Book 2015-09-17 16:01:25 +02:00
parent 1963477975
commit a4ed3b54c3
25 changed files with 13 additions and 314 deletions

View File

@ -62,10 +62,6 @@ OriginAttributes::CreateSuffix(nsACString& aStr) const
params->Set(NS_LITERAL_STRING("userContextId"), value);
}
if (!mSignedPkg.IsEmpty()) {
params->Set(NS_LITERAL_STRING("signedPkg"), mSignedPkg);
}
aStr.Truncate();
params->Serialize(value);
@ -136,12 +132,6 @@ public:
return true;
}
if (aName.EqualsLiteral("signedPkg")) {
MOZ_RELEASE_ASSERT(mOriginAttributes->mSignedPkg.IsEmpty());
mOriginAttributes->mSignedPkg.Assign(aValue);
return true;
}
// No other attributes are supported.
return false;
}

View File

@ -36,8 +36,7 @@ public:
return mAppId == aOther.mAppId &&
mInBrowser == aOther.mInBrowser &&
mAddonId == aOther.mAddonId &&
mUserContextId == aOther.mUserContextId &&
mSignedPkg == aOther.mSignedPkg;
mUserContextId == aOther.mUserContextId;
}
bool operator!=(const OriginAttributes& aOther) const
{
@ -89,10 +88,6 @@ public:
return false;
}
if (mSignedPkg.WasPassed() && mSignedPkg.Value() != aAttrs.mSignedPkg) {
return false;
}
return true;
}
};

View File

@ -122,19 +122,6 @@ function run_test() {
checkOriginAttributes(nullPrin_userContextApp, {appId: 24, userContextId: 42}, '^appId=24&userContextId=42');
do_check_eq(exampleOrg_userContextApp.origin, 'http://example.org^appId=24&userContextId=42');
// Just signedPkg
var exampleOrg_signedPkg = ssm.createCodebasePrincipal(makeURI('http://example.org'), {signedPkg: 'whatever'});
checkOriginAttributes(exampleOrg_signedPkg, { signedPkg: 'id' }, '^signedPkg=whatever');
do_check_eq(exampleOrg_signedPkg.origin, 'http://example.org^signedPkg=whatever');
// signedPkg and browser
var exampleOrg_signedPkg_browser = ssm.createCodebasePrincipal(makeURI('http://example.org'), {signedPkg: 'whatever', inBrowser: true});
checkOriginAttributes(exampleOrg_signedPkg_browser, { signedPkg: 'whatever', inBrowser: true }, '^inBrowser=1&signedPkg=whatever');
do_check_eq(exampleOrg_signedPkg_browser.origin, 'http://example.org^inBrowser=1&signedPkg=whatever');
// Just signedPkg (but different value from 'exampleOrg_signedPkg_app')
var exampleOrg_signedPkg_another = ssm.createCodebasePrincipal(makeURI('http://example.org'), {signedPkg: 'whatup'});
// Check that all of the above are cross-origin.
checkCrossOrigin(exampleOrg_app, exampleOrg);
checkCrossOrigin(exampleOrg_app, nullPrin_app);
@ -148,7 +135,4 @@ function run_test() {
checkCrossOrigin(exampleOrg_userContextAddon, exampleOrg);
checkCrossOrigin(exampleOrg_userContext, exampleOrg_userContextAddon);
checkCrossOrigin(exampleOrg_userContext, exampleOrg_userContextApp);
checkCrossOrigin(exampleOrg_signedPkg, exampleOrg);
checkCrossOrigin(exampleOrg_signedPkg, exampleOrg_signedPkg_browser);
checkCrossOrigin(exampleOrg_signedPkg, exampleOrg_signedPkg_another);
}

View File

@ -432,25 +432,14 @@ StructuredCloneHelper::ReadFullySerializableObjects(JSContext* aCx,
return nullptr;
}
uint32_t signedPkgLength, dummy;
if (!JS_ReadUint32Pair(aReader, &signedPkgLength, &dummy)) {
return nullptr;
}
nsAutoCString spec;
spec.SetLength(specLength);
if (!JS_ReadBytes(aReader, spec.BeginWriting(), specLength)) {
return nullptr;
}
nsAutoCString signedPkg;
spec.SetLength(signedPkgLength);
if (!JS_ReadBytes(aReader, signedPkg.BeginWriting(), signedPkgLength)) {
return nullptr;
}
info = mozilla::ipc::ContentPrincipalInfo(appId, isInBrowserElement,
spec, signedPkg);
spec);
}
nsresult rv;
@ -581,9 +570,7 @@ StructuredCloneHelper::WriteFullySerializableObjects(JSContext* aCx,
cInfo.appId()) &&
JS_WriteUint32Pair(aWriter, cInfo.isInBrowserElement(),
cInfo.spec().Length()) &&
JS_WriteUint32Pair(aWriter, cInfo.signedPkg().Length(), 0) &&
JS_WriteBytes(aWriter, cInfo.spec().get(), cInfo.spec().Length()) &&
JS_WriteBytes(aWriter, cInfo.signedPkg().get(), cInfo.signedPkg().Length());
JS_WriteBytes(aWriter, cInfo.spec().get(), cInfo.spec().Length());
}
}

View File

@ -12,15 +12,10 @@ var { classes: Cc, interfaces: Ci, results: Cr, utils: Cu } = Components;
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/BrowserElementPromptService.jsm");
Cu.import("resource://gre/modules/Task.jsm");
XPCOMUtils.defineLazyServiceGetter(this, "acs",
"@mozilla.org/audiochannel/service;1",
"nsIAudioChannelService");
XPCOMUtils.defineLazyModuleGetter(this, "ManifestFinder",
"resource://gre/modules/ManifestFinder.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "ManifestObtainer",
"resource://gre/modules/ManifestObtainer.jsm");
var kLongestReturnedString = 128;
@ -256,8 +251,7 @@ BrowserElementChild.prototype = {
"set-audio-channel-volume": this._recvSetAudioChannelVolume,
"get-audio-channel-muted": this._recvGetAudioChannelMuted,
"set-audio-channel-muted": this._recvSetAudioChannelMuted,
"get-is-audio-channel-active": this._recvIsAudioChannelActive,
"get-web-manifest": this._recvGetWebManifest,
"get-is-audio-channel-active": this._recvIsAudioChannelActive
}
addMessageListener("browser-element-api:call", function(aMessage) {
@ -1484,27 +1478,6 @@ BrowserElementChild.prototype = {
});
},
_recvGetWebManifest: Task.async(function* (data) {
debug(`Received GetWebManifest message: (${data.json.id})`);
let manifest = null;
let hasManifest = ManifestFinder.contentHasManifestLink(content);
if (hasManifest) {
try {
manifest = yield ManifestObtainer.contentObtainManifest(content);
} catch (e) {
sendAsyncMsg('got-web-manifest', {
id: data.json.id,
errorMsg: `Error fetching web manifest: ${e}.`,
});
return;
}
}
sendAsyncMsg('got-web-manifest', {
id: data.json.id,
successRv: manifest
});
}),
_initFinder: function() {
if (!this._finder) {
try {

View File

@ -210,8 +210,7 @@ BrowserElementParent.prototype = {
"got-set-audio-channel-volume": this._gotDOMRequestResult,
"got-audio-channel-muted": this._gotDOMRequestResult,
"got-set-audio-channel-muted": this._gotDOMRequestResult,
"got-is-audio-channel-active": this._gotDOMRequestResult,
"got-web-manifest": this._gotDOMRequestResult,
"got-is-audio-channel-active": this._gotDOMRequestResult
};
let mmSecuritySensitiveCalls = {
@ -1034,8 +1033,6 @@ BrowserElementParent.prototype = {
{audioChannel: aAudioChannel});
},
getWebManifest: defineDOMRequestMethod('get-web-manifest'),
/**
* Called when the visibility of the window which owns this iframe changes.
*/

View File

@ -1,78 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
/*
* This is an approximate implementation of ES7's async-await pattern.
* see: https://github.com/tc39/ecmascript-asyncawait
*
* It allows for simple creation of async function and "tasks".
*
* For example:
*
* var myThinger = {
* doAsynThing: async(function*(url){
* var result = yield fetch(url);
* return process(result);
* });
* }
*
* And Task-like things can be created as follows:
*
* var myTask = async(function*{
* var result = yield fetch(url);
* return result;
* });
* //returns a promise
*
* myTask().then(doSomethingElse);
*
*/
(function(exports) {
"use strict";
function async(func, self) {
return function asyncFunction() {
const functionArgs = Array.from(arguments);
return new Promise(function(resolve, reject) {
var gen;
if (typeof func !== "function") {
reject(new TypeError("Expected a Function."));
}
//not a generator, wrap it.
if (func.constructor.name !== "GeneratorFunction") {
gen = (function*() {
return func.apply(self, functionArgs);
}());
} else {
gen = func.apply(self, functionArgs);
}
try {
step(gen.next(undefined));
} catch (err) {
reject(err);
}
function step({value, done}) {
if (done) {
return resolve(value);
}
if (value instanceof Promise) {
return value.then(
result => step(gen.next(result)),
error => {
try {
step(gen.throw(error));
} catch (err) {
throw err;
}
}
).catch(err => reject(err));
}
step(gen.next(value));
}
});
};
}
exports.async = async;
}(this || self));

View File

@ -1,63 +0,0 @@
/* Any copyright is dedicated to the public domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/*globals async, ok, is, SimpleTest, browserElementTestHelpers*/
// Bug 1169633 - getWebManifest tests
'use strict';
SimpleTest.waitForExplicitFinish();
browserElementTestHelpers.setEnabledPref(true);
browserElementTestHelpers.addPermission();
// request to load a manifest from a page that doesn't have a manifest.
// The expected result to be null.
var test1 = async(function* () {
var manifest = yield requestManifest('file_empty.html');
is(manifest, null, 'it should be null.');
});
// request to load a manifest from a page that has a manifest.
// The expected manifest to have a property name whose value is 'pass'.
var test2 = async(function* () {
var manifest = yield requestManifest('file_web_manifest.html');
is(manifest && manifest.name, 'pass', 'it should return a manifest with name pass.');
});
// Cause an exception by attempting to fetch a file URL,
// expect onerror to be called.
var test3 = async(function* () {
var gotError = false;
try {
yield requestManifest('file_illegal_web_manifest.html');
} catch (err) {
gotError = true;
}
ok(gotError, 'onerror was called on the DOMRequest.');
});
// Run the tests
Promise
.all([test1(), test2(), test3()])
.then(SimpleTest.finish);
function requestManifest(url) {
var iframe = document.createElement('iframe');
iframe.setAttribute('mozbrowser', 'true');
iframe.src = url;
document.body.appendChild(iframe);
return new Promise((resolve, reject) => {
iframe.addEventListener('mozbrowserloadend', function loadend() {
iframe.removeEventListener('mozbrowserloadend', loadend);
SimpleTest.executeSoon(() => {
var req = iframe.getWebManifest();
req.onsuccess = () => {
document.body.removeChild(iframe);
resolve(req.result);
};
req.onerror = () => {
document.body.removeChild(iframe);
reject(new Error(req.error));
};
});
});
});
}

View File

@ -1,6 +0,0 @@
<!doctype html>
<meta charset=utf-8>
<head>
<link rel="manifest" href="file://this_is_not_allowed!">
</head>
<h1>Support Page for Web Manifest Tests</h1>

View File

@ -1,6 +0,0 @@
<!doctype html>
<meta charset=utf-8>
<head>
<link rel="manifest" href="file_web_manifest.json">
</head>
<h1>Support Page for Web Manifest Tests</h1>

View File

@ -1 +0,0 @@
{"name": "pass"}

View File

@ -114,4 +114,3 @@ disabled = bug 924771
[test_browserElement_oop_GetContentDimensions.html]
[test_browserElement_oop_AudioChannel.html]
[test_browserElement_oop_SetNFCFocus.html]
[test_browserElement_oop_getWebManifest.html]

View File

@ -3,7 +3,6 @@ skip-if = buildapp == 'mulet' || (buildapp == 'b2g' && (toolkit != 'gonk' || deb
support-files =
../../../browser/base/content/test/general/audio.ogg
../../../dom/media/test/short-video.ogv
async.js
browserElementTestHelpers.js
browserElement_Alert.js
browserElement_AlertInFrame.js
@ -38,7 +37,6 @@ support-files =
browserElement_FrameWrongURI.js
browserElement_GetScreenshot.js
browserElement_GetScreenshotDppx.js
browserElement_getWebManifest.js
browserElement_Iconchange.js
browserElement_LoadEvents.js
browserElement_Manifestchange.js
@ -130,14 +128,10 @@ support-files =
file_wyciwyg.html
file_audio.html
iframe_file_audio.html
file_web_manifest.html
file_web_manifest.json
file_illegal_web_manifest.html
# Note: browserElementTestHelpers.js looks at the test's filename to determine
# whether the test should be OOP. "_oop_" signals OOP, "_inproc_" signals in
# process. Default is OOP.
[test_browserElement_inproc_getWebManifest.html]
[test_browserElement_NoAttr.html]
[test_browserElement_NoPref.html]
[test_browserElement_NoPermission.html]

View File

@ -1,17 +0,0 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Test for Bug 1169633</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="browserElementTestHelpers.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<script type="application/javascript;version=1.8"
src="async.js">
</script>
<script type="application/javascript;version=1.8"
src="browserElement_getWebManifest.js">
</script>
</body>
</html>

View File

@ -1,16 +0,0 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Test for Bug 1169633</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="browserElementTestHelpers.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<script type="application/javascript;version=1.8"
src="async.js"></script>
<script type="application/javascript;version=1.8"
src="browserElement_getWebManifest.js">
</script>
</body>
</html>

View File

@ -9,7 +9,7 @@
interface nsIDOMDOMRequest;
interface nsIFrameLoader;
[scriptable, function, uuid(00d0e19d-bd67-491f-8e85-b9905224d3bb)]
[scriptable, function, uuid(c0c2dd9b-41ef-42dd-a4c1-e456619c1941)]
interface nsIBrowserElementNextPaintListener : nsISupports
{
void recvNextPaint();
@ -26,7 +26,7 @@ interface nsIBrowserElementNextPaintListener : nsISupports
* Interface to the BrowserElementParent implementation. All methods
* but setFrameLoader throw when the remote process is dead.
*/
[scriptable, uuid(1e098c3a-7d65-452d-a2b2-9ffd1b6e04bb)]
[scriptable, uuid(56bd3e12-4a8b-422a-89fc-6dc25aa30aa2)]
interface nsIBrowserElementAPI : nsISupports
{
const long FIND_CASE_SENSITIVE = 0;
@ -100,6 +100,4 @@ interface nsIBrowserElementAPI : nsISupports
void setNFCFocus(in boolean isFocus);
nsIDOMDOMRequest executeScript(in DOMString script, in jsval options);
nsIDOMDOMRequest getWebManifest();
};

View File

@ -1908,9 +1908,8 @@ ReadResponse(mozIStorageConnection* aConn, EntryId aEntryId,
return NS_ERROR_FAILURE;
}
nsCString signedPkg = NS_ConvertUTF16toUTF8(attrs.mSignedPkg);
aSavedResponseOut->mValue.principalInfo() =
mozilla::ipc::ContentPrincipalInfo(attrs.mAppId, attrs.mInBrowser, originNoSuffix, signedPkg);
mozilla::ipc::ContentPrincipalInfo(attrs.mAppId, attrs.mInBrowser, originNoSuffix);
}
int32_t redirected;

View File

@ -747,21 +747,4 @@ nsBrowserElement::ExecuteScript(const nsAString& aScript,
return req.forget().downcast<DOMRequest>();
}
already_AddRefed<DOMRequest>
nsBrowserElement::GetWebManifest(ErrorResult& aRv)
{
NS_ENSURE_TRUE(IsBrowserElementOrThrow(aRv), nullptr);
nsCOMPtr<nsIDOMDOMRequest> req;
nsresult rv = mBrowserElementAPI->GetWebManifest(getter_AddRefs(req));
if (NS_WARN_IF(NS_FAILED(rv))) {
aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
return nullptr;
}
return req.forget().downcast<DOMRequest>();
}
} // namespace mozilla

View File

@ -112,8 +112,6 @@ public:
const dom::BrowserElementExecuteScriptOptions& aOptions,
ErrorResult& aRv);
already_AddRefed<dom::DOMRequest> GetWebManifest(ErrorResult& aRv);
void SetNFCFocus(bool isFocus,
ErrorResult& aRv);

View File

@ -174,9 +174,5 @@ interface BrowserElementPrivileged {
CheckAllPermissions="browser browser:universalxss"]
DOMRequest executeScript(DOMString script,
optional BrowserElementExecuteScriptOptions options);
[Throws,
Pref="dom.mozBrowserFramesEnabled",
CheckAllPermissions="browser"]
DOMRequest getWebManifest();
};

View File

@ -41,18 +41,18 @@ interface ChromeUtils : ThreadSafeChromeUtils {
* (2) Update the methods on mozilla::OriginAttributes, including equality,
* serialization, and deserialization.
* (3) Update the methods on mozilla::OriginAttributesPattern, including matching.
* (4) Bump the CIDs (_not_ IIDs) of all the principal implementations that
* use OriginAttributes in their nsISerializable implementations.
*/
dictionary OriginAttributesDictionary {
unsigned long appId = 0;
unsigned long userContextId = 0;
boolean inBrowser = false;
DOMString addonId = "";
DOMString signedPkg = "";
};
dictionary OriginAttributesPatternDictionary {
unsigned long appId;
unsigned long userContextId;
boolean inBrowser;
DOMString addonId;
DOMString signedPkg;
};

View File

@ -332,9 +332,8 @@ ServiceWorkerRegistrar::ReadData()
}
GET_LINE(line);
nsCString signedPkg = NS_ConvertUTF16toUTF8(attrs.mSignedPkg);
entry->principal() =
mozilla::ipc::ContentPrincipalInfo(attrs.mAppId, attrs.mInBrowser, line, signedPkg);
mozilla::ipc::ContentPrincipalInfo(attrs.mAppId, attrs.mInBrowser, line);
GET_LINE(entry->scope());
GET_LINE(entry->scriptSpec());

View File

@ -221,7 +221,7 @@ TEST(ServiceWorkerRegistrar, TestWriteData)
nsAutoCString spec;
spec.AppendPrintf("spec write %d", i);
d->principal() = mozilla::ipc::ContentPrincipalInfo(i, i % 2, spec, EmptyCString());
d->principal() = mozilla::ipc::ContentPrincipalInfo(i, i % 2, spec);
d->scope().AppendPrintf("scope write %d", i);
d->scriptSpec().AppendPrintf("scriptSpec write %d", i);
d->currentWorkerURL().AppendPrintf("currentWorkerURL write %d", i);

View File

@ -82,7 +82,6 @@ PrincipalInfoToPrincipal(const PrincipalInfo& aPrincipalInfo,
} else {
// TODO: Bug 1167100 - User nsIPrincipal.originAttribute in ContentPrincipalInfo
OriginAttributes attrs(info.appId(), info.isInBrowserElement());
attrs.mSignedPkg = NS_ConvertUTF8toUTF16(info.signedPkg());
principal = BasePrincipal::CreateCodebasePrincipal(uri, attrs);
rv = principal ? NS_OK : NS_ERROR_FAILURE;
}
@ -203,10 +202,6 @@ PrincipalToPrincipalInfo(nsIPrincipal* aPrincipal,
return rv;
}
const mozilla::OriginAttributes& attr =
mozilla::BasePrincipal::Cast(aPrincipal)->OriginAttributesRef();
nsCString signedPkg = NS_ConvertUTF16toUTF8(attr.mSignedPkg);
bool isUnknownAppId;
rv = aPrincipal->GetUnknownAppId(&isUnknownAppId);
if (NS_WARN_IF(NS_FAILED(rv))) {
@ -229,7 +224,7 @@ PrincipalToPrincipalInfo(nsIPrincipal* aPrincipal,
return rv;
}
*aPrincipalInfo = ContentPrincipalInfo(appId, isInBrowserElement, spec, signedPkg);
*aPrincipalInfo = ContentPrincipalInfo(appId, isInBrowserElement, spec);
return NS_OK;
}

View File

@ -12,7 +12,6 @@ struct ContentPrincipalInfo
uint32_t appId;
bool isInBrowserElement;
nsCString spec;
nsCString signedPkg;
};
struct SystemPrincipalInfo