Backout 453c74176a35 & 19ae28cad1da (bug 763694) for native Android test_browserElement_*_SecurityChange.html failures

This commit is contained in:
Ed Morley
2012-06-20 10:28:33 +01:00
parent 87c49860c8
commit a7b5979fc3
8 changed files with 2 additions and 131 deletions

View File

@@ -66,14 +66,8 @@ BrowserElementChild.prototype = {
docShell.QueryInterface(Ci.nsIWebProgress)
.addProgressListener(this._progressListener,
Ci.nsIWebProgress.NOTIFY_LOCATION |
Ci.nsIWebProgress.NOTIFY_SECURITY |
Ci.nsIWebProgress.NOTIFY_STATE_WINDOW);
// This is necessary to get security web progress notifications.
var securityUI = Cc['@mozilla.org/secure_browser_ui;1']
.createInstance(Ci.nsISecureBrowserUI);
securityUI.init(content);
// A mozbrowser iframe contained inside a mozapp iframe should return false
// for nsWindowUtils::IsPartOfApp (unless the mozbrowser iframe is itself
// also mozapp). That is, mozapp is transitive down to its children, but
@@ -378,35 +372,10 @@ BrowserElementChild.prototype = {
}
},
onSecurityChange: function(webProgress, request, state) {
if (webProgress != docShell) {
return;
}
var stateDesc;
if (state & Ci.nsIWebProgressListener.STATE_IS_SECURE) {
stateDesc = 'secure';
}
else if (state & Ci.nsIWebProgressListener.STATE_IS_BROKEN) {
stateDesc = 'broken';
}
else if (state & Ci.nsIWebProgressListener.STATE_IS_INSECURE) {
stateDesc = 'insecure';
}
else {
debug("Unexpected securitychange state!");
stateDesc = '???';
}
// XXX Until bug 764496 is fixed, this will always return false.
var isEV = !!(state & Ci.nsIWebProgressListener.STATE_IDENTITY_EV_TOPLEVEL);
sendAsyncMsg('securitychange', {state: stateDesc, extendedValidation: isEV});
},
onStatusChange: function(webProgress, request, status, message) {},
onProgressChange: function(webProgress, request, curSelfProgress,
maxSelfProgress, curTotalProgress, maxTotalProgress) {},
onSecurityChange: function(webProgress, request, aState) {}
},
};

View File

@@ -146,7 +146,6 @@ function BrowserElementParent(frameLoader) {
addMessageListener("titlechange", this._fireEventFromMsg);
addMessageListener("iconchange", this._fireEventFromMsg);
addMessageListener("close", this._fireEventFromMsg);
addMessageListener("securitychange", this._fireEventFromMsg);
addMessageListener("get-mozapp-manifest-url", this._sendMozAppManifestURL);
addMessageListener("keyevent", this._fireKeyEvent);
addMessageListener("showmodalprompt", this._handleShowModalPrompt);
@@ -160,7 +159,7 @@ function BrowserElementParent(frameLoader) {
defineMethod('getScreenshot', this._getScreenshot);
defineMethod('setVisible', this._setVisible);
this._mm.loadFrameScript("chrome://global/content/BrowserElementChild.js",
self._mm.loadFrameScript("chrome://global/content/BrowserElementChild.js",
/* allowDelayedLoad = */ true);
}

View File

@@ -17,7 +17,6 @@ include $(topsrcdir)/config/rules.mk
# process. Default is OOP.
_TEST_FILES = \
file_empty_script.js \
file_empty.html \
file_focus.html \
browserElementTestHelpers.js \
@@ -55,9 +54,6 @@ _TEST_FILES = \
browserElement_OpenWindowRejected.js \
test_browserElement_inproc_OpenWindowRejected.html \
file_browserElement_OpenWindowRejected.html \
browserElement_SecurityChange.js \
test_browserElement_inproc_SecurityChange.html \
file_browserElement_SecurityChange.html \
$(NULL)
# OOP tests don't work on Windows (bug 763081).
@@ -77,7 +73,6 @@ _TEST_FILES += \
test_browserElement_oop_Close.html \
test_browserElement_oop_OpenWindow.html \
test_browserElement_oop_OpenWindowRejected.html \
test_browserElement_oop_SecurityChange.html \
$(NULL)
endif

View File

@@ -1,50 +0,0 @@
/* Any copyright is dedicated to the public domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
// Bug 763694 - Test that <iframe mozbrowser> delivers proper
// mozbrowsersecuritychange events.
"use strict";
SimpleTest.waitForExplicitFinish();
function runTest() {
browserElementTestHelpers.setEnabledPref(true);
browserElementTestHelpers.addToWhitelist();
var iframe = document.createElement('iframe');
iframe.mozbrowser = true;
var lastSecurityState;
iframe.addEventListener('mozbrowsersecuritychange', function(e) {
lastSecurityState = e.detail;
});
var filepath = 'tests/dom/browser-element/mochitest/file_browserElement_SecurityChange.html';
var count = 0;
iframe.addEventListener('mozbrowserloadend', function(e) {
count++;
var nextURL;
switch (count) {
case 1:
is(lastSecurityState.state, 'secure');
is(lastSecurityState.extendedValidation, false);
iframe.src = "http://example.com/" + filepath;
break;
case 2:
is(lastSecurityState.state, 'insecure');
is(lastSecurityState.extendedValidation, false);
iframe.src = 'https://example.com:443/' + filepath + '?broken';
break;
case 3:
is(lastSecurityState.state, 'broken');
is(lastSecurityState.extendedValidation, false);
SimpleTest.finish();
}
});
iframe.src = "https://example.com/" + filepath;
document.body.appendChild(iframe);
}
runTest();

View File

@@ -1,16 +0,0 @@
<html>
<head>
<script>
if (location.search == '?broken') {
// Load something non-https.
var s = document.createElement('script');
s.src = 'http://example.com/dom/browser-element/mochitest/file_empty_script.js';
document.head.appendChild(s);
}
</script>
</head>
<body>
file_browserElement_SecurityChange.html.
</body>
</html>

View File

@@ -1,13 +0,0 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Test of browser element.</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.7" src="browserElement_SecurityChange.js">
</script>
</body>
</html>

View File

@@ -1,13 +0,0 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Test of browser element.</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.7" src="browserElement_SecurityChange.js">
</script>
</body>
</html>