mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Backed out changeset b1a6ecfca674 (bug 1044736)
This commit is contained in:
parent
7afae461b0
commit
b65c8ddcbc
@ -1,7 +1,6 @@
|
||||
var gWidgetManifestURL = 'http://test/tests/dom/apps/tests/file_app.sjs?apptype=widget&getmanifest=true';
|
||||
var gInvalidWidgetManifestURL = 'http://test/tests/dom/apps/tests/file_app.sjs?apptype=invalidWidget&getmanifest=true';
|
||||
var gApp;
|
||||
var gHasBrowserPermission;
|
||||
|
||||
function onError() {
|
||||
ok(false, "Error callback invoked");
|
||||
@ -83,34 +82,21 @@ function testApp(isValidWidget) {
|
||||
|
||||
function testLimitedBrowserAPI(ifr) {
|
||||
var securitySensitiveCalls = [
|
||||
{ api: 'sendMouseEvent' , args: ['mousedown', 0, 0, 0, 0, 0] },
|
||||
{ api: 'sendTouchEvent' , args: ['touchstart', [0], [0], [0], [1], [1], [0], [1], 1, 0] },
|
||||
{ api: 'goBack' , args: [] },
|
||||
{ api: 'goForward' , args: [] },
|
||||
{ api: 'reload' , args: [] },
|
||||
{ api: 'stop' , args: [] },
|
||||
{ api: 'download' , args: ['http://example.org'] },
|
||||
{ api: 'purgeHistory' , args: [] },
|
||||
{ api: 'getScreenshot' , args: [0, 0] },
|
||||
{ api: 'zoom' , args: [0.1] },
|
||||
{ api: 'getCanGoBack' , args: [] },
|
||||
{ api: 'getCanGoForward' , args: [] },
|
||||
{ api: 'getContentDimensions', args: [] }
|
||||
'sendMouseEvent',
|
||||
'sendTouchEvent',
|
||||
'goBack',
|
||||
'goForward',
|
||||
'reload',
|
||||
'stop',
|
||||
'download',
|
||||
'purgeHistory',
|
||||
'getScreenshot',
|
||||
'zoom',
|
||||
'getCanGoBack',
|
||||
'getCanGoForward'
|
||||
];
|
||||
securitySensitiveCalls.forEach( function(call) {
|
||||
if (gHasBrowserPermission) {
|
||||
isnot(typeof ifr[call.api], "undefined", call.api + " should be defined");
|
||||
var didThrow;
|
||||
try {
|
||||
ifr[call.api].apply(ifr, call.args);
|
||||
} catch (e) {
|
||||
ok(e instanceof DOMException, "throw right exception type");
|
||||
didThrow = e.code;
|
||||
}
|
||||
is(didThrow, DOMException.INVALID_NODE_TYPE_ERR, "call " + call.api + " should throw exception");
|
||||
} else {
|
||||
is(typeof ifr[call.api], "undefined", call.api + " should be hidden for widget");
|
||||
}
|
||||
is(typeof ifr[call], "undefined", call + " should be hidden for widget");
|
||||
});
|
||||
}
|
||||
|
||||
@ -168,7 +154,7 @@ var tests = [
|
||||
// Permissions
|
||||
function() {
|
||||
SpecialPowers.pushPermissions(
|
||||
[{ "type": "browser", "allow": gHasBrowserPermission ? 1 : 0, "context": document },
|
||||
[{ "type": "browser", "allow": 1, "context": document },
|
||||
{ "type": "embed-widgets", "allow": 1, "context": document },
|
||||
{ "type": "webapps-manage", "allow": 1, "context": document }], runTest);
|
||||
},
|
||||
|
@ -45,5 +45,3 @@ skip-if = (toolkit == 'android' && processor == 'x86') #x86 only
|
||||
[test_web_app_install.html]
|
||||
[test_widget.html]
|
||||
skip-if = os == "android" || toolkit == "gonk" # embed-apps doesn't work in mochitest app
|
||||
[test_widget_browser.html]
|
||||
skip-if = os == "android" || toolkit == "gonk" # embed-apps doesn't work in mochitest app
|
||||
|
@ -11,7 +11,6 @@
|
||||
<div id="container"></div>
|
||||
<script type="application/javascript;version=1.7">
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
gHasBrowserPermission = false;
|
||||
runTest();
|
||||
</script>
|
||||
</body>
|
||||
|
@ -1,18 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Test for DataStore - basic operation on a readonly db</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="application/javascript" src="file_test_widget.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<div id="container"></div>
|
||||
<script type="application/javascript;version=1.7">
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
gHasBrowserPermission = true;
|
||||
runTest();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -114,16 +114,6 @@ nsBrowserElement::IsBrowserElementOrThrow(ErrorResult& aRv)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
nsBrowserElement::IsNotWidgetOrThrow(ErrorResult& aRv)
|
||||
{
|
||||
if (!mOwnerIsWidget) {
|
||||
return true;
|
||||
}
|
||||
aRv.Throw(NS_ERROR_DOM_INVALID_NODE_TYPE_ERR);
|
||||
return false;
|
||||
}
|
||||
|
||||
void
|
||||
nsBrowserElement::InitBrowserElementAPI()
|
||||
{
|
||||
@ -132,8 +122,6 @@ nsBrowserElement::InitBrowserElementAPI()
|
||||
NS_ENSURE_TRUE_VOID(frameLoader);
|
||||
nsresult rv = frameLoader->GetOwnerIsBrowserOrAppFrame(&isBrowserOrApp);
|
||||
NS_ENSURE_SUCCESS_VOID(rv);
|
||||
rv = frameLoader->GetOwnerIsWidget(&mOwnerIsWidget);
|
||||
NS_ENSURE_SUCCESS_VOID(rv);
|
||||
|
||||
if (!isBrowserOrApp) {
|
||||
return;
|
||||
@ -146,7 +134,6 @@ nsBrowserElement::InitBrowserElementAPI()
|
||||
}
|
||||
|
||||
nsBrowserElement::nsBrowserElement()
|
||||
: mOwnerIsWidget(false)
|
||||
{
|
||||
mObserver = new BrowserShownObserver(this);
|
||||
mObserver->AddObserver();
|
||||
@ -223,7 +210,6 @@ nsBrowserElement::SendMouseEvent(const nsAString& aType,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
NS_ENSURE_TRUE_VOID(IsBrowserElementOrThrow(aRv));
|
||||
NS_ENSURE_TRUE_VOID(IsNotWidgetOrThrow(aRv));
|
||||
|
||||
nsresult rv = mBrowserElementAPI->SendMouseEvent(aType,
|
||||
aX,
|
||||
@ -251,7 +237,6 @@ nsBrowserElement::SendTouchEvent(const nsAString& aType,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
NS_ENSURE_TRUE_VOID(IsBrowserElementOrThrow(aRv));
|
||||
NS_ENSURE_TRUE_VOID(IsNotWidgetOrThrow(aRv));
|
||||
|
||||
if (aIdentifiers.Length() != aCount ||
|
||||
aXs.Length() != aCount ||
|
||||
@ -284,7 +269,6 @@ void
|
||||
nsBrowserElement::GoBack(ErrorResult& aRv)
|
||||
{
|
||||
NS_ENSURE_TRUE_VOID(IsBrowserElementOrThrow(aRv));
|
||||
NS_ENSURE_TRUE_VOID(IsNotWidgetOrThrow(aRv));
|
||||
|
||||
nsresult rv = mBrowserElementAPI->GoBack();
|
||||
|
||||
@ -297,7 +281,6 @@ void
|
||||
nsBrowserElement::GoForward(ErrorResult& aRv)
|
||||
{
|
||||
NS_ENSURE_TRUE_VOID(IsBrowserElementOrThrow(aRv));
|
||||
NS_ENSURE_TRUE_VOID(IsNotWidgetOrThrow(aRv));
|
||||
|
||||
nsresult rv = mBrowserElementAPI->GoForward();
|
||||
|
||||
@ -310,7 +293,6 @@ void
|
||||
nsBrowserElement::Reload(bool aHardReload, ErrorResult& aRv)
|
||||
{
|
||||
NS_ENSURE_TRUE_VOID(IsBrowserElementOrThrow(aRv));
|
||||
NS_ENSURE_TRUE_VOID(IsNotWidgetOrThrow(aRv));
|
||||
|
||||
nsresult rv = mBrowserElementAPI->Reload(aHardReload);
|
||||
|
||||
@ -323,7 +305,6 @@ void
|
||||
nsBrowserElement::Stop(ErrorResult& aRv)
|
||||
{
|
||||
NS_ENSURE_TRUE_VOID(IsBrowserElementOrThrow(aRv));
|
||||
NS_ENSURE_TRUE_VOID(IsNotWidgetOrThrow(aRv));
|
||||
|
||||
nsresult rv = mBrowserElementAPI->Stop();
|
||||
|
||||
@ -338,7 +319,6 @@ nsBrowserElement::Download(const nsAString& aUrl,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
NS_ENSURE_TRUE(IsBrowserElementOrThrow(aRv), nullptr);
|
||||
NS_ENSURE_TRUE(IsNotWidgetOrThrow(aRv), nullptr);
|
||||
|
||||
nsCOMPtr<nsIDOMDOMRequest> req;
|
||||
AutoJSAPI jsapi;
|
||||
@ -362,7 +342,6 @@ already_AddRefed<DOMRequest>
|
||||
nsBrowserElement::PurgeHistory(ErrorResult& aRv)
|
||||
{
|
||||
NS_ENSURE_TRUE(IsBrowserElementOrThrow(aRv), nullptr);
|
||||
NS_ENSURE_TRUE(IsNotWidgetOrThrow(aRv), nullptr);
|
||||
|
||||
nsCOMPtr<nsIDOMDOMRequest> req;
|
||||
nsresult rv = mBrowserElementAPI->PurgeHistory(getter_AddRefs(req));
|
||||
@ -382,7 +361,6 @@ nsBrowserElement::GetScreenshot(uint32_t aWidth,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
NS_ENSURE_TRUE(IsBrowserElementOrThrow(aRv), nullptr);
|
||||
NS_ENSURE_TRUE(IsNotWidgetOrThrow(aRv), nullptr);
|
||||
|
||||
nsCOMPtr<nsIDOMDOMRequest> req;
|
||||
nsresult rv = mBrowserElementAPI->GetScreenshot(aWidth, aHeight, aMimeType,
|
||||
@ -404,8 +382,6 @@ void
|
||||
nsBrowserElement::Zoom(float aZoom, ErrorResult& aRv)
|
||||
{
|
||||
NS_ENSURE_TRUE_VOID(IsBrowserElementOrThrow(aRv));
|
||||
NS_ENSURE_TRUE_VOID(IsNotWidgetOrThrow(aRv));
|
||||
|
||||
nsresult rv = mBrowserElementAPI->Zoom(aZoom);
|
||||
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
@ -417,7 +393,6 @@ already_AddRefed<DOMRequest>
|
||||
nsBrowserElement::GetCanGoBack(ErrorResult& aRv)
|
||||
{
|
||||
NS_ENSURE_TRUE(IsBrowserElementOrThrow(aRv), nullptr);
|
||||
NS_ENSURE_TRUE(IsNotWidgetOrThrow(aRv), nullptr);
|
||||
|
||||
nsCOMPtr<nsIDOMDOMRequest> req;
|
||||
nsresult rv = mBrowserElementAPI->GetCanGoBack(getter_AddRefs(req));
|
||||
@ -434,7 +409,6 @@ already_AddRefed<DOMRequest>
|
||||
nsBrowserElement::GetCanGoForward(ErrorResult& aRv)
|
||||
{
|
||||
NS_ENSURE_TRUE(IsBrowserElementOrThrow(aRv), nullptr);
|
||||
NS_ENSURE_TRUE(IsNotWidgetOrThrow(aRv), nullptr);
|
||||
|
||||
nsCOMPtr<nsIDOMDOMRequest> req;
|
||||
nsresult rv = mBrowserElementAPI->GetCanGoForward(getter_AddRefs(req));
|
||||
@ -451,7 +425,6 @@ already_AddRefed<DOMRequest>
|
||||
nsBrowserElement::GetContentDimensions(ErrorResult& aRv)
|
||||
{
|
||||
NS_ENSURE_TRUE(IsBrowserElementOrThrow(aRv), nullptr);
|
||||
NS_ENSURE_TRUE(IsNotWidgetOrThrow(aRv), nullptr);
|
||||
|
||||
nsCOMPtr<nsIDOMDOMRequest> req;
|
||||
nsresult rv = mBrowserElementAPI->GetContentDimensions(getter_AddRefs(req));
|
||||
|
@ -96,8 +96,6 @@ protected:
|
||||
private:
|
||||
void InitBrowserElementAPI();
|
||||
bool IsBrowserElementOrThrow(ErrorResult& aRv);
|
||||
bool IsNotWidgetOrThrow(ErrorResult& aRv);
|
||||
bool mOwnerIsWidget;
|
||||
|
||||
class BrowserShownObserver;
|
||||
friend class BrowserShownObserver;
|
||||
|
@ -307,10 +307,6 @@ nsGenericHTMLFrameElement::GetReallyIsBrowserOrApp(bool *aOut)
|
||||
uint32_t permission = nsIPermissionManager::DENY_ACTION;
|
||||
nsresult rv = permMgr->TestPermissionFromPrincipal(principal, "browser", &permission);
|
||||
NS_ENSURE_SUCCESS(rv, NS_OK);
|
||||
if (permission != nsIPermissionManager::ALLOW_ACTION) {
|
||||
rv = permMgr->TestPermissionFromPrincipal(principal, "embed-widgets", &permission);
|
||||
NS_ENSURE_SUCCESS(rv, NS_OK);
|
||||
}
|
||||
*aOut = permission == nsIPermissionManager::ALLOW_ACTION;
|
||||
return NS_OK;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user