зеркало из https://github.com/mozilla/gecko-dev.git
Bug 813906 - Mochitest for unified base URI usage. r=bsmedberg
This commit is contained in:
Родитель
ea13e54cd5
Коммит
0c07b574dc
|
@ -65,6 +65,7 @@ MOCHITEST_FILES = \
|
|||
file_bug771202.html \
|
||||
test_bug777098.html \
|
||||
test_bug751809.html \
|
||||
test_bug813906.html \
|
||||
test_enumerate.html \
|
||||
test_npruntime_construct.html \
|
||||
307-xo-redirect.sjs \
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Test for Bug 813906</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8">
|
||||
<base href="chrome://browser/content/">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<script type="application/javascript">
|
||||
function f() {
|
||||
document.getElementsByTagName("base")[0].href = "http://www.safe.com/";
|
||||
}
|
||||
</script>
|
||||
|
||||
<svg>
|
||||
<symbol id="a">
|
||||
<foreignObject>
|
||||
<object bugmode="813906" frame="frame1"></object>
|
||||
</foreignObject>
|
||||
</symbol>
|
||||
<use />
|
||||
</svg>
|
||||
|
||||
<script type="application/javascript">
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var frameLoadCount = 0;
|
||||
function frameLoaded() {
|
||||
frameLoadCount++;
|
||||
if (frameLoadCount == 1) {
|
||||
document.getElementsByTagName("object")[0].type = "application/x-test";
|
||||
document.getElementsByTagName("use")[0].setAttributeNS("http://www.w3.org/1999/xlink", "href", location.href + "#a");
|
||||
} else if (frameLoadCount == 2) {
|
||||
isnot(SpecialPowers.wrap(window.frame1).location.href.indexOf('chrome://'),
|
||||
0, 'plugin shouldnt be able to cause navigation to chrome URLs');
|
||||
SimpleTest.finish();
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<iframe name="frame1" onload="frameLoaded()"></iframe>
|
||||
</body>
|
||||
</html>
|
|
@ -583,6 +583,34 @@ drawAsyncBitmapColor(InstanceData* instanceData)
|
|||
instanceData->backBuffer = oldFront;
|
||||
}
|
||||
|
||||
static bool bug813906(NPP npp, const char* const function, const char* const url, const char* const frame)
|
||||
{
|
||||
InstanceData* id = static_cast<InstanceData*>(npp->pdata);
|
||||
|
||||
NPObject *windowObj = nullptr;
|
||||
NPError err = NPN_GetValue(npp, NPNVWindowNPObject, &windowObj);
|
||||
if (err != NPERR_NO_ERROR) {
|
||||
return false;
|
||||
}
|
||||
|
||||
NPVariant result;
|
||||
bool res = NPN_Invoke(npp, windowObj, NPN_GetStringIdentifier(function), nullptr, 0, &result);
|
||||
NPN_ReleaseObject(windowObj);
|
||||
if (!res) {
|
||||
return false;
|
||||
}
|
||||
|
||||
NPN_ReleaseVariantValue(&result);
|
||||
|
||||
err = NPN_GetURL(npp, url, frame);
|
||||
if (err != NPERR_NO_ERROR) {
|
||||
err = NPN_GetURL(npp, "about:blank", frame);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//
|
||||
// function signatures
|
||||
//
|
||||
|
@ -794,6 +822,7 @@ NPP_New(NPMIMEType pluginType, NPP instance, uint16_t mode, int16_t argc, char*
|
|||
instanceData->frontBuffer = NULL;
|
||||
instanceData->backBuffer = NULL;
|
||||
instanceData->mouseUpEventCount = 0;
|
||||
instanceData->bugMode = -1;
|
||||
instance->pdata = instanceData;
|
||||
|
||||
TestNPObject* scriptableObject = (TestNPObject*)NPN_CreateObject(instance, &sNPClass);
|
||||
|
@ -924,6 +953,9 @@ NPP_New(NPMIMEType pluginType, NPP instance, uint16_t mode, int16_t argc, char*
|
|||
if (!strcmp(argn[i], "closestream")) {
|
||||
instanceData->closeStream = true;
|
||||
}
|
||||
if (strcmp(argn[i], "bugmode") == 0) {
|
||||
instanceData->bugMode = atoi(argv[i]);
|
||||
}
|
||||
}
|
||||
|
||||
if (!browserSupportsWindowless || !pluginSupportsWindowlessMode()) {
|
||||
|
@ -1016,6 +1048,10 @@ NPP_New(NPMIMEType pluginType, NPP instance, uint16_t mode, int16_t argc, char*
|
|||
}
|
||||
}
|
||||
|
||||
if ((instanceData->bugMode == 813906) && instanceData->frame.length()) {
|
||||
bug813906(instance, "f", "browser.xul", instanceData->frame.c_str());
|
||||
}
|
||||
|
||||
return NPERR_NO_ERROR;
|
||||
}
|
||||
|
||||
|
|
|
@ -151,6 +151,7 @@ typedef struct InstanceData {
|
|||
NPAsyncSurface *frontBuffer;
|
||||
NPAsyncSurface *backBuffer;
|
||||
int32_t mouseUpEventCount;
|
||||
int32_t bugMode;
|
||||
} InstanceData;
|
||||
|
||||
void notifyDidPaint(InstanceData* instanceData);
|
||||
|
|
Загрузка…
Ссылка в новой задаче