Bug 1307694 - Mochitests for plugin parameter ordering; r=bsmedberg

MozReview-Commit-ID: 2fc1c3nbsN8
This commit is contained in:
Kyle Machulis 2016-10-17 22:02:36 -07:00
Родитель 37074751dc
Коммит 710cd95c09
3 изменённых файлов: 58 добавлений и 1 удалений

Просмотреть файл

@ -47,6 +47,7 @@ skip-if = buildapp == 'mulet' || buildapp == 'b2g' || toolkit == 'android' # nee
[test_bug1165981.html]
skip-if = !(os == "win" && processor == "x86_64")
[test_bug1245545.html]
[test_bug1307694.html]
[test_cocoa_focus.html]
skip-if = toolkit != "cocoa" || e10s # Bug 1194534
support-files = cocoa_focus.html

Просмотреть файл

@ -0,0 +1,41 @@
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="plugin-utils.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body onLoad="addPluginElement()">
<script type="text/javascript">
SimpleTest.waitForExplicitFinish();
SpecialPowers.setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED);
function addPluginElement() {
var p = document.createElement('embed');
p.setAttribute('id', 'plugin2');
p.setAttribute('type', 'application/x-shockwave-flash-test');
p.setAttribute('scale', 'noscale');
p.setAttribute('salign', 'lt');
document.body.appendChild(p);
SimpleTest.executeSoon(function() {
runTests();
});
}
function runTests() {
p = document.getElementById('plugin1');
ok(p.setColor != undefined, "Static plugin parameter (salign/scale) ordering were correct");
p2 = document.getElementById('plugin2');
ok(p2.setColor != undefined, "Dynamic plugin parameter (salign/scale) ordering were correct");
SimpleTest.finish();
}
</script>
<p id="display"></p>
<div id="div1">
<embed id="plugin1" type="application/x-shockwave-flash-test" width="200" height="200" scale="noscale" salign="lt"></embed>
</div>
</body>
</html>

Просмотреть файл

@ -886,6 +886,7 @@ NPP_New(NPMIMEType pluginType, NPP instance, uint16_t mode, int16_t argc, char*
AsyncDrawing requestAsyncDrawing = AD_NONE;
bool requestWindow = false;
bool alreadyHasSalign = false;
// handle extra params
for (int i = 0; i < argc; i++) {
if (strcmp(argn[i], "drawmode") == 0) {
@ -1001,7 +1002,21 @@ NPP_New(NPMIMEType pluginType, NPP instance, uint16_t mode, int16_t argc, char*
if (strcasecmp(argn[i], "codebase") == 0) {
instanceData->javaCodebase = argv[i];
}
}
// Bug 1307694 - There are two flash parameters that are order dependent for
// scaling/sizing the plugin. If they ever change from what is expected, it
// breaks flash on the web. In a test, if the scale tag ever happens
// with an salign before it, fail the plugin creation.
if (strcmp(argn[i], "scale") == 0) {
if (alreadyHasSalign) {
// If salign came before this parameter, error out now.
return NPERR_GENERIC_ERROR;
}
}
if (strcmp(argn[i], "salign") == 0) {
alreadyHasSalign = true;
}
}
if (!browserSupportsWindowless || !pluginSupportsWindowlessMode()) {
requestWindow = true;