Bug 574189 - Fix chrome tests to work from an extension for android and e10s support a=NPOTB r=ctalbert

This commit is contained in:
Joel Maher 2010-08-24 10:29:34 -07:00
Родитель a781965b6d
Коммит 8015553874
142 изменённых файлов: 695 добавлений и 221 удалений

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

@ -14,6 +14,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=415498
src="chrome://mochikit/content/MochiKit/packed.js"></script>
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript"
src="chrome://mochikit/content/chrome-harness.js"></script>
<body xmlns="http://www.w3.org/1999/xhtml">
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=415498">Mozilla Bug 415498</a>
@ -23,9 +25,11 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=415498
<script class="testbody" type="application/javascript"><![CDATA[
/** Test for Bug 415498 **/
const Cc = Components.classes;
const Ci = Components.interfaces;
const Cr = Components.results;
if (Cc === undefined) {
var Cc = Components.classes;
var Ci = Components.interfaces;
}
var Cr = Components.results;
SimpleTest.waitForExplicitFinish();
@ -72,7 +76,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=415498
}, false);
// 1) This document uses addEventListener to register a method throwing an exception
browser.loadURI("chrome://mochikit/content/chrome/content/events/test/bug415498-doc1.html");
var chromeDir = getRootDirectory(window.location.href);
browser.loadURI(chromeDir + "bug415498-doc1.html");
yield;
ok(verifyErrorReceived("NS_ERROR_DOM_HIERARCHY_REQUEST_ERR"),
@ -80,7 +85,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=415498
gMessages = [];
// 2) This document sets window.onload to register a method throwing an exception
browser.loadURI("chrome://mochikit/content/chrome/content/events/test/bug415498-doc2.html");
var chromeDir = getRootDirectory(window.location.href);
browser.loadURI(chromeDir + "bug415498-doc2.html");
yield;
ok(verifyErrorReceived("NS_ERROR_DOM_HIERARCHY_REQUEST_ERR"),

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

@ -1,7 +1,7 @@
<html>
<head>
<title>Tests for the dragstart event</title>
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css">
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
<script type="application/javascript" src="/MochiKit/packed.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>

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

@ -1,11 +1,11 @@
<html>
<head>
<title>Tests for the draggable property on HTML elements</title>
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css">
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
<script type="application/javascript"
src="chrome://mochikit/content/MochiKit/packed.js"></script>
src="/MochiKit/packed.js"></script>
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
src="/tests/SimpleTest/SimpleTest.js"></script>
<body>
<p id="display"></p>

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

@ -1,7 +1,7 @@
<html>
<head>
<title>Tests for the dragstart event</title>
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css">
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
<script type="application/javascript" src="/MochiKit/packed.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>

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

@ -5,7 +5,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=417760
-->
<head>
<title>cannot focus() img with tabindex="-1"</title>
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" />
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
<style type="text/css">
img {
border: 5px solid white;
@ -16,8 +16,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=417760
</style>
<script type="application/javascript" src="chrome://mochikit/content/MochiKit/packed.js"></script>
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="/MochiKit/packed.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript">
function checkFocus(aExpected, aTabIndex)

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

@ -8,7 +8,7 @@
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" />
</head>
<body style="height: 100%" onload="setTimeout(onBodyLoad, 0);">
<iframe id="test" src="chrome://mochikit/content/chrome/content/xul/content/test/398289-resource.xul" width="100%" height="100%">
<iframe id="test" src="398289-resource.xul" width="100%" height="100%">
</iframe>
<script class="testbody" type="text/javascript">

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

@ -435,3 +435,37 @@ function compareConsoleMessages()
is(messages[m].message, expectedConsoleMessages.shift(), "logged message " + (m + 1));
}
}
function copyToProfile(filename)
{
if (Cc === undefined) {
var Cc = Components.classes;
var Ci = Components.interfaces;
}
var loader = Cc["@mozilla.org/moz/jssubscript-loader;1"]
.getService(Ci.mozIJSSubScriptLoader);
loader.loadSubScript("chrome://mochikit/content/chrome-harness.js");
var file = Cc["@mozilla.org/file/directory_service;1"]
.getService(Ci.nsIProperties)
.get("ProfD", Ci.nsIFile);
file.append(filename);
var parentURI = getResolvedURI(getRootDirectory(window.location.href));
if (parentURI.JARFile) {
parentURI = extractJarToTmp(parentURI);
} else {
var fileHandler = Cc["@mozilla.org/network/protocol;1?name=file"].
getService(Ci.nsIFileProtocolHandler);
parentURI = fileHandler.getFileFromURLSpec(parentURI.spec);
}
parentURI = parentURI.QueryInterface(Ci.nsILocalFile);
parentURI.append(filename);
try {
var retVal = parentURI.copyToFollowingLinks(file.parent, filename);
} catch (ex) {
//ignore this error as the file could exist already
}
}

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

@ -35,6 +35,7 @@ Components.classes["@mozilla.org/consoleservice;1"]
.getService(Components.interfaces.nsIConsoleService)
.reset();
copyToProfile('animals.sqlite');
expectedConsoleMessages.push("Error parsing template: the given named parameter is unknown in the SQL query");
var changes = [];
@ -42,7 +43,7 @@ var changes = [];
</script>
<listbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root"
flex="1" datasources="animals.sqlite" ref="." querytype="storage">
flex="1" datasources="profile:animals.sqlite" ref="." querytype="storage">
<template>
<query>
SELECT * FROM animals WHERE species_id = ? ORDER BY name

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

@ -35,6 +35,8 @@ Components.classes["@mozilla.org/consoleservice;1"]
.getService(Components.interfaces.nsIConsoleService)
.reset();
copyToProfile('animals.sqlite');
expectedConsoleMessages.push("Error parsing template: the type of a query parameter is wrong");
var changes = [];
@ -42,7 +44,7 @@ var changes = [];
</script>
<listbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root"
flex="1" datasources="animals.sqlite" ref="." querytype="storage">
flex="1" datasources="profile:animals.sqlite" ref="." querytype="storage">
<template>
<query>
SELECT * FROM animals WHERE species_id = ? ORDER BY name

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

@ -35,6 +35,8 @@ Components.classes["@mozilla.org/consoleservice;1"]
.getService(Components.interfaces.nsIConsoleService)
.reset();
copyToProfile('animals.sqlite');
expectedConsoleMessages.push("Error parsing template: a query parameter cannot be bound to the SQL query");
var changes = [];
@ -42,7 +44,7 @@ var changes = [];
</script>
<listbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root"
flex="1" datasources="animals.sqlite" ref="." querytype="storage">
flex="1" datasources="profile:animals.sqlite" ref="." querytype="storage">
<template>
<query>
SELECT * FROM animals WHERE species_id = :spec ORDER BY name

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

@ -34,6 +34,8 @@ Components.classes["@mozilla.org/consoleservice;1"]
.getService(Components.interfaces.nsIConsoleService)
.reset();
copyToProfile('animals.sqlite');
expectedConsoleMessages.push("Error parsing template: syntax error in the SQL query");
@ -43,7 +45,7 @@ var changes = [];
<listbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root"
flex="1" rows="8"
datasources="animals.sqlite" ref="." querytype="storage">
datasources="profile:animals.sqlite" ref="." querytype="storage">
<template>
<query>
SELECT * FROM animalssssssss WHERE species_id = 2 ORDER BY

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

@ -22,6 +22,7 @@
<![CDATA[
SimpleTest.waitForExplicitFinish();
copyToProfile('animals.sqlite');
function test_storage_template()
{
@ -67,7 +68,7 @@ var changes = [];
</script>
<listbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root"
flex="1" datasources="animals.sqlite" ref="." querytype="storage">
flex="1" datasources="profile:animals.sqlite" ref="." querytype="storage">
<template>
<query>
SELECT * FROM animals WHERE species_id = :spec ORDER BY name

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

@ -22,6 +22,8 @@
<![CDATA[
SimpleTest.waitForExplicitFinish();
copyToProfile('animals.sqlite');
var testid ="storage simple listbox";
var queryType = "storage";
var isTreeBuilder = false;
@ -41,7 +43,7 @@ var changes = [];
<listbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root"
flex="1" rows="8"
datasources="animals.sqlite" ref="." querytype="storage">
datasources="profile:animals.sqlite" ref="." querytype="storage">
<template>
<query>
SELECT * FROM animals WHERE species_id = 2 ORDER BY name

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

@ -22,6 +22,8 @@
<![CDATA[
SimpleTest.waitForExplicitFinish();
copyToProfile('animals.sqlite');
var testid ="storage listbox with multiqueries";
var queryType = "storage";
var isTreeBuilder = false;
@ -48,7 +50,7 @@ var changes = [];
</script>
<listbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root"
flex="1" datasources="animals.sqlite" ref="." querytype="storage">
flex="1" datasources="profile:animals.sqlite" ref="." querytype="storage">
<template>
<queryset>
<query>SELECT * FROM animals WHERE species_id = 5 ORDER BY name</query>

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

@ -20,6 +20,8 @@
<script>
<![CDATA[
copyToProfile('animals.sqlite');
SimpleTest.waitForExplicitFinish();
@ -79,7 +81,7 @@ var changes = [];
</script>
<listbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root1"
flex="1" datasources="animals.sqlite" ref="." querytype="storage">
flex="1" datasources="profile:animals.sqlite" ref="." querytype="storage">
<template>
<query>
SELECT * FROM animals WHERE species_id = ? ORDER BY name
@ -93,7 +95,7 @@ var changes = [];
<listbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root2"
flex="1" datasources="animals.sqlite" ref="." querytype="storage">
flex="1" datasources="profile:animals.sqlite" ref="." querytype="storage">
<template>
<query>
SELECT * FROM animals WHERE species_id = ? ORDER BY name
@ -107,7 +109,7 @@ var changes = [];
<listbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root3"
flex="1" datasources="animals.sqlite" ref="." querytype="storage">
flex="1" datasources="profile:animals.sqlite" ref="." querytype="storage">
<template>
<query>
SELECT * FROM animals WHERE species_id = :spec AND name like ? ORDER BY name
@ -121,7 +123,7 @@ var changes = [];
</listbox>
<listbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root4"
flex="1" datasources="animals.sqlite" ref="." querytype="storage">
flex="1" datasources="profile:animals.sqlite" ref="." querytype="storage">
<template>
<query>
SELECT * FROM animals WHERE species_id = ?3 AND name like ?1 ORDER BY name
@ -135,7 +137,7 @@ var changes = [];
</listbox>
<listbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root5"
flex="1" datasources="animals.sqlite" ref="." querytype="storage">
flex="1" datasources="profile:animals.sqlite" ref="." querytype="storage">
<template>
<query>
SELECT * FROM animals WHERE species_id = ?3 AND name like :pattern ORDER BY name
@ -149,7 +151,7 @@ var changes = [];
</listbox>
<listbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root6"
flex="1" datasources="animals.sqlite" ref="." querytype="storage">
flex="1" datasources="profile:animals.sqlite" ref="." querytype="storage">
<template>
<query>
SELECT * FROM animals WHERE species_id = ? ORDER BY name

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

@ -20,7 +20,9 @@
<script>
<![CDATA[
SimpleTest.waitForExplicitFinish();
copyToProfile('animals.sqlite');
var testid ="storage listbox with rule";
var queryType = "storage";
@ -42,7 +44,7 @@ var changes = [];
<listbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root"
flex="1" rows="8"
datasources="animals.sqlite" ref="." querytype="storage">
datasources="profile:animals.sqlite" ref="." querytype="storage">
<template>
<query>
SELECT * FROM animals WHERE species_id = 5 ORDER BY name

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

@ -20,6 +20,7 @@
<script>
<![CDATA[
copyToProfile('animals.sqlite');
SimpleTest.waitForExplicitFinish();
var testid ="storage simple";
@ -40,7 +41,7 @@ var changes = [];
</script>
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root"
datasources="animals.sqlite" querytype="storage" ref=".">
datasources="profile:animals.sqlite" querytype="storage" ref=".">
<template>
<query>SELECT * FROM animals WHERE species_id = 2 ORDER BY name</query>
<action>

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

@ -22,6 +22,8 @@
<![CDATA[
SimpleTest.waitForExplicitFinish();
copyToProfile('animals.sqlite');
var testid ="storage sort integer asc";
var queryType = "storage";
var isTreeBuilder = false;
@ -57,7 +59,7 @@ var changes = [];
<column flex="1"/>
<column flex="3"/>
</columns>
<rows id="root" datasources="animals.sqlite" querytype="storage" ref="."
<rows id="root" datasources="profile:animals.sqlite" querytype="storage" ref="."
sort="?id" sortDirection="ascending">
<template>
<query>SELECT id, name FROM animals</query>

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

@ -22,6 +22,8 @@
<![CDATA[
SimpleTest.waitForExplicitFinish();
copyToProfile('animals.sqlite');
var testid ="storage sort integer desc";
var queryType = "storage";
var isTreeBuilder = false;
@ -57,7 +59,7 @@ var changes = [];
<column flex="1"/>
<column flex="3"/>
</columns>
<rows id="root" datasources="animals.sqlite" querytype="storage" ref="."
<rows id="root" datasources="profile:animals.sqlite" querytype="storage" ref="."
sort="?id" sortDirection="descending">
<template>
<query>SELECT id, name FROM animals</query>

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

@ -22,6 +22,8 @@
<![CDATA[
SimpleTest.waitForExplicitFinish();
copyToProfile('animals.sqlite');
var testid ="storage sort string asc";
var queryType = "storage";
var isTreeBuilder = false;
@ -57,7 +59,7 @@ var changes = [];
<column flex="1"/>
<column flex="3"/>
</columns>
<rows id="root" datasources="animals.sqlite" querytype="storage" ref="."
<rows id="root" datasources="profile:animals.sqlite" querytype="storage" ref="."
sort="?name" sortDirection="ascending">
<template>
<query>SELECT id, name FROM animals</query>

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

@ -22,6 +22,8 @@
<![CDATA[
SimpleTest.waitForExplicitFinish();
copyToProfile('animals.sqlite');
var testid ="storage sort string desc";
var queryType = "storage";
var isTreeBuilder = false;
@ -57,7 +59,7 @@ var changes = [];
<column flex="1"/>
<column flex="3"/>
</columns>
<rows id="root" datasources="animals.sqlite" querytype="storage" ref="."
<rows id="root" datasources="profile:animals.sqlite" querytype="storage" ref="."
sort="?name" sortDirection="descending">
<template>
<query>SELECT id, name FROM animals</query>

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

@ -22,6 +22,8 @@
<![CDATA[
SimpleTest.waitForExplicitFinish();
copyToProfile('animals.sqlite');
var testid ="storage tree";
var queryType = "storage";
var isTreeBuilder = true;
@ -93,7 +95,7 @@ var changes = [];
</script>
<tree xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root"
flex="1" datasources="animals.sqlite" ref="*" querytype="storage" flags="dont-build-content">
flex="1" datasources="profile:animals.sqlite" ref="*" querytype="storage" flags="dont-build-content">
<treecols>
<treecol id="species" primary="true" label="Species" flex="2"/>
<treecol id="name" label="Common name" flex="2"/>

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

@ -1,6 +1,6 @@
<?xml version="1.0" ?>
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
<?xml-stylesheet href="/tests/SimpleTest/test.css" type="text/css"?>
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<tree flex="20" id="t" ref="urn:data:row" datasources="rdf:null" seltype="single">

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

@ -1,6 +1,6 @@
<?xml version="1.0" ?>
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
<?xml-stylesheet href="/tests/SimpleTest/test.css" type="text/css"?>
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">

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

@ -10,7 +10,7 @@
<script type="application/javascript"
src=
"chrome://mochikit/content/chrome/docshell/test/chrome/docshell_helpers.js">
"docshell_helpers.js">
</script>
<script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/WindowSnapshot.js"></script>

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

@ -10,7 +10,7 @@
<script type="application/javascript"
src=
"chrome://mochikit/content/chrome/docshell/test/chrome/docshell_helpers.js">
"docshell_helpers.js">
</script>
<script type="application/javascript"><![CDATA[

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

@ -10,7 +10,7 @@
<script type="application/javascript"
src=
"chrome://mochikit/content/chrome/docshell/test/chrome/docshell_helpers.js">
"docshell_helpers.js">
</script>
<script type="application/javascript"><![CDATA[

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

@ -10,7 +10,7 @@
<script type="application/javascript"
src=
"chrome://mochikit/content/chrome/docshell/test/chrome/docshell_helpers.js">
"docshell_helpers.js">
</script>
<script type="application/javascript"><![CDATA[

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

@ -9,7 +9,7 @@
title="bug 303267 test">
<script type="application/javascript"
src="chrome://mochikit/content/chrome/docshell/test/chrome/docshell_helpers.js">
src="docshell_helpers.js">
</script>
<script type="application/javascript"><![CDATA[

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

@ -10,7 +10,7 @@
<script type="application/javascript"
src=
"chrome://mochikit/content/chrome/docshell/test/chrome/docshell_helpers.js">
"docshell_helpers.js">
</script>
<script type="application/javascript"><![CDATA[

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

@ -10,7 +10,7 @@
<script type="application/javascript"
src=
"chrome://mochikit/content/chrome/docshell/test/chrome/docshell_helpers.js">
"docshell_helpers.js">
</script>
<script type="application/javascript"><![CDATA[

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

@ -10,7 +10,7 @@
<script type="application/javascript"
src=
"chrome://mochikit/content/chrome/docshell/test/chrome/docshell_helpers.js">
"docshell_helpers.js">
</script>
<script type="application/javascript"><![CDATA[

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

@ -9,7 +9,7 @@
title="bug {BUGNUMBER} test">
<script type="application/javascript"
src="chrome://mochikit/content/chrome/docshell/test/chrome/docshell_helpers.js">
src="docshell_helpers.js">
</script>
<script type="application/javascript"><![CDATA[

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

@ -2,9 +2,9 @@
<html>
<head>
<title>Test bug 529119</title>
<script type="text/javascript" src="chrome://mochikit/content/MochiKit/packed.js"></script>
<script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" />
<script type="text/javascript" src="/MochiKit/packed.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
<script class="testbody" type="text/javascript">

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

@ -2,9 +2,9 @@
<html>
<head>
<title>Test bug 529119</title>
<script type="text/javascript" src="chrome://mochikit/content/MochiKit/packed.js"></script>
<script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" />
<script type="text/javascript" src="/MochiKit/packed.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
<script class="testbody" type="text/javascript">

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

@ -4,13 +4,13 @@
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script type="application/javascript"
src="chrome://mochikit/content/MochiKit/packed.js"></script>
src="/MochiKit/packed.js"></script>
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
src="/tests/SimpleTest/EventUtils.js"></script>
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/WindowSnapshot.js"></script>
src="/tests/SimpleTest/WindowSnapshot.js"></script>
<html:style xmlns:html="http://www.w3.org/1999/xhtml" type="text/css">
* { outline: none; }

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

@ -7,13 +7,10 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=postMessage
<title>postMessage chrome tests</title>
<script type="application/javascript" src="chrome://mochikit/content/MochiKit/packed.js"></script>
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="chrome://mochikit/content/chrome-harness.js"></script>
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" />
</head>
<body>
<!--
This test runs at the following URL:
chrome://mochikit/content/chrome/dom/tests/mochitest/whatwg/test_postMessage_chrome.html
-->
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=postMessage">Mozilla Bug 387706</a>
<p id="display"></p>
@ -70,8 +67,10 @@ function messageReceiver(evt)
function checkSelf(evt)
{
var prepath = getChromePrePath(window.location.href);
is(evt.isTrusted, true, "should have sent a trusted event");
is(evt.origin, "chrome://mochikit", "wrong origin for chrome: URL");
is(evt.origin, prepath, "wrong origin for chrome: URL");
is(evt.source, null, "chrome posters get a null source, for security");
window.frames.contentDomain.postMessage("post-to-content",

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

@ -2,11 +2,11 @@
<head>
<title>Test for contenteditable focus</title>
<script type="text/javascript"
src="chrome://mochikit/content/MochiKit/packed.js"></script>
src="/MochiKit/packed.js"></script>
<script type="text/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css"
href="chrome://mochikit/content/tests/SimpleTest/test.css" />
href="/tests/SimpleTest/test.css" />
</head>
<body>
<div id="display">

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

@ -2,13 +2,13 @@
<head>
<title>Test for text input event handling on contenteditable editor</title>
<script type="text/javascript"
src="chrome://mochikit/content/MochiKit/packed.js"></script>
src="/MochiKit/packed.js"></script>
<script type="text/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript"
src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
src="/tests/SimpleTest/EventUtils.js"></script>
<link rel="stylesheet" type="text/css"
href="chrome://mochikit/content/tests/SimpleTest/test.css" />
href="/tests/SimpleTest/test.css" />
</head>
<body>
<div id="display">

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

@ -2,13 +2,13 @@
<head>
<title>Test for key event handler of HTML editor</title>
<script type="text/javascript"
src="chrome://mochikit/content/MochiKit/packed.js"></script>
src="/MochiKit/packed.js"></script>
<script type="text/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript"
src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
src="/tests/SimpleTest/EventUtils.js"></script>
<link rel="stylesheet" type="text/css"
href="chrome://mochikit/content/tests/SimpleTest/test.css" />
href="/tests/SimpleTest/test.css" />
</head>
<body>
<div id="display">

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

@ -2,13 +2,13 @@
<head>
<title>Test for root element replacement</title>
<script type="text/javascript"
src="chrome://mochikit/content/MochiKit/packed.js"></script>
src="/MochiKit/packed.js"></script>
<script type="text/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript"
src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
src="/tests/SimpleTest/EventUtils.js"></script>
<link rel="stylesheet" type="text/css"
href="chrome://mochikit/content/tests/SimpleTest/test.css" />
href="/tests/SimpleTest/test.css" />
</head>
<body>
<p id="display">

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

@ -2,11 +2,11 @@
<head>
<title>Test select all in HTML editor without body element</title>
<script type="text/javascript"
src="chrome://mochikit/content/MochiKit/packed.js"></script>
src="/MochiKit/packed.js"></script>
<script type="text/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css"
href="chrome://mochikit/content/tests/SimpleTest/test.css" />
href="/tests/SimpleTest/test.css" />
</head>
<body>
<p id="display">

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

@ -2,13 +2,13 @@
<head>
<title>Test for key event handler of text editor</title>
<script type="text/javascript"
src="chrome://mochikit/content/MochiKit/packed.js"></script>
src="/MochiKit/packed.js"></script>
<script type="text/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript"
src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
src="/tests/SimpleTest/EventUtils.js"></script>
<link rel="stylesheet" type="text/css"
href="chrome://mochikit/content/tests/SimpleTest/test.css" />
href="/tests/SimpleTest/test.css" />
</head>
<body>
<div id="display">

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

@ -16,8 +16,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=503926
<a href="https://bugzilla.mozilla.org/show_bug.cgi?id=503926"
target="_blank">Mozilla Bug 503926</a>
<iframe id="ifr" type="content" onload="iframe_loaded()"
src="chrome://mochikit/content/chrome/js/src/xpconnect/tests/chrome/bug503926.xul#iframe"/>
<iframe id="ifr" type="content" onload="iframe_loaded()" src="bug503926.xul#iframe"/>
</body>
<!-- test code goes here -->
@ -33,8 +32,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=503926
try { gWindowUtils.dispatchDOMEventViaPresShell(obj, obj, false); } catch (e) {}
ok(passed, "trusted QIs should be called");
openDialog("chrome://mochikit/content/chrome/js/src/xpconnect/tests/chrome/bug503926.xul",
"chromeDialog", "modal");
openDialog("bug503926.xul", "chromeDialog", "modal");
SimpleTest.finish();
}

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

@ -7,6 +7,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=386153
<title>Test for Bug 386153</title>
<script type="application/javascript" src="chrome://mochikit/content/MochiKit/packed.js"></script>
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="chrome://mochikit/content/chrome-harness.js"></script>
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
</head>
<body>
@ -25,15 +26,17 @@ const Ci = Components.interfaces;
// Opens a zip file from the test directory.
function openZip(path) {
var ios = Cc["@mozilla.org/network/io-service;1"].
getService(Ci.nsIIOService);
var chromeURI = ios.newURI("chrome://mochikit/content/chrome/modules/libjar/test/chrome/" + path,
null, null);
var resolved = Cc["@mozilla.org/chrome/chrome-registry;1"].
getService(Ci.nsIChromeRegistry).
convertChromeURL(chromeURI).
QueryInterface(Ci.nsIFileURL).
file;
var location = window.location.href;
location = getRootDirectory(location);
var jar = getJar(location);
if (jar != null) {
var resolved = extractJarToTmp(jar);
} else {
var resolvedURI = getResolvedURI(window.location.href);
var resolved = getChromeDir(resolvedURI);
}
resolved.append(path);
var zip = Cc["@mozilla.org/libjar/zip-reader;1"].
createInstance(Ci.nsIZipReader);

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

@ -3,9 +3,9 @@
532208</title>
<script type="application/javascript"
src="chrome://mochikit/content/MochiKit/packed.js"></script>
src="/MochiKit/packed.js"></script>
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
src="/tests/SimpleTest/SimpleTest.js"></script>
<body onload="setTimeout(runTests, 2000)">
<embed id="plugin1" type="application/x-test" width="400"

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

@ -1,8 +1,8 @@
<html>
<head>
<title>NPCocoaEventFocusChanged Tests</title>
<script type="application/javascript" src="chrome://mochikit/content/MochiKit/packed.js"></script>
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="/MochiKit/packed.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
</head>
<body onload="runTests()">

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

@ -1,8 +1,8 @@
<html>
<head>
<title>NPCocoaEventWindowFocusChanged Tests</title>
<script type="application/javascript" src="chrome://mochikit/content/MochiKit/packed.js"></script>
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="/MochiKit/packed.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
</head>
<body onload="runTests()">

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

@ -1,8 +1,8 @@
<html>
<head>
<title>NPAPI Cookie Tests</title>
<script type="application/javascript" src="chrome://mochikit/content/MochiKit/packed.js"></script>
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="/MochiKit/packed.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
</head>
<body onload="runTests()">

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

@ -1,7 +1,7 @@
<head>
<title>Plugin crashing in nested loop</title>
<script type="application/javascript" src="chrome://mochikit/content/MochiKit/packed.js"></script>
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="/MochiKit/packed.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<body>
<iframe id="iframe1" src="crashing_subpage.html" width="600" height="600"></iframe>

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

@ -1,7 +1,7 @@
<head>
<title>Plugin crashing</title>
<script type="application/javascript" src="chrome://mochikit/content/MochiKit/packed.js"></script>
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="/MochiKit/packed.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<body>
<iframe id="iframe1" src="crashing_subpage.html" width="600" height="600"></iframe>

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

@ -1,7 +1,7 @@
<head>
<title>Plugin crashing</title>
<script type="application/javascript" src="chrome://mochikit/content/MochiKit/packed.js"></script>
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="/MochiKit/packed.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<body onload="mainLoaded()">
<iframe id="iframe1" src="about:blank" width="600" height="600"></iframe>

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

@ -1,8 +1,8 @@
<html>
<head>
<title>NPAPI Cookie Tests</title>
<script type="application/javascript" src="chrome://mochikit/content/MochiKit/packed.js"></script>
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="/MochiKit/packed.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css"
href="/tests/SimpleTest/test.css" />

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

@ -1,7 +1,7 @@
<head>
<title>Plugin hanging</title>
<script type="application/javascript" src="chrome://mochikit/content/MochiKit/packed.js"></script>
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="/MochiKit/packed.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<body>
<iframe id="iframe1" src="crashing_subpage.html" width="600" height="600"></iframe>

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

@ -1,7 +1,7 @@
<head>
<title>Plugin instantiation</title>
<script type="application/javascript" src="chrome://mochikit/content/MochiKit/packed.js"></script>
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="/MochiKit/packed.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<body onload="mainLoaded()">
<iframe id="iframe1" src="about:blank" width="600" height="600"></iframe>

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

@ -1,7 +1,7 @@
<head>
<title>NPNV*NPObject accessibility tests</title>
<script type="application/javascript" src="chrome://mochikit/content/MochiKit/packed.js"></script>
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="/MochiKit/packed.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<body onload="runTests()">
<embed id="plugin1" type="application/x-test" width="400" height="400"></embed>

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

@ -1,7 +1,7 @@
<head>
<title>NPN_GetURL called from NPP_Destroy</title>
<script type="application/javascript" src="chrome://mochikit/content/MochiKit/packed.js"></script>
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="/MochiKit/packed.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css"
href="/tests/SimpleTest/test.css">

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

@ -1,7 +1,7 @@
<head>
<title>NPNV*NPObject accessibility tests</title>
<script type="application/javascript" src="chrome://mochikit/content/MochiKit/packed.js"></script>
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="/MochiKit/packed.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<body onload="runTests()">
<embed id="plugin1" type="application/x-test" width="400" height="400"></embed>

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

@ -1,7 +1,7 @@
<head>
<title>NPN_Get/PostURLNotify tests</title>
<script type="application/javascript" src="chrome://mochikit/content/MochiKit/packed.js"></script>
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="/MochiKit/packed.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<body onload="runTests()">
<embed id="plugin1" type="application/x-test" width="400" height="400"></embed>

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

@ -1,9 +1,10 @@
<html>
<head>
<title>Test bug 483437 and bug 480509</title>
<script type="text/javascript" src="chrome://mochikit/content/MochiKit/packed.js"></script>
<script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" />
<script type="text/javascript" src="/MochiKit/packed.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body onload="onWindowLoad()">

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

@ -1,9 +1,9 @@
<html>
<head>
<title>Test bug 483437 and bug 480509</title>
<script type="text/javascript" src="chrome://mochikit/content/MochiKit/packed.js"></script>
<script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" />
<script type="text/javascript" src="/MochiKit/packed.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>

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

@ -1,9 +1,9 @@
<html>
<head>
<title>Test bug 484111</title>
<script type="text/javascript" src="chrome://mochikit/content/MochiKit/packed.js"></script>
<script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" />
<script type="text/javascript" src="/MochiKit/packed.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body onload="onWindowLoad()">

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

@ -74,6 +74,7 @@ _SERV_FILES = \
harness.xul \
browser-test-overlay.xul \
browser-test.js \
chrome-harness.js \
ipc-overlay.xul \
ipc.js \
browser-harness.xul \

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

@ -45,6 +45,7 @@ function Tester(aTests, aDumper, aCallback) {
var simpleTestScope = {};
this._scriptLoader.loadSubScript("chrome://mochikit/content/MochiKit/packed.js", simpleTestScope);
this._scriptLoader.loadSubScript("chrome://mochikit/content/tests/SimpleTest/SimpleTest.js", simpleTestScope);
this._scriptLoader.loadSubScript("chrome://mochikit/content/chrome-harness.js", simpleTestScope);
this.SimpleTest = simpleTestScope.SimpleTest;
}
Tester.prototype = {

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

@ -0,0 +1,342 @@
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:set ts=2 sw=2 sts=2 et: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mochitest code.
*
* The Initial Developer of the Original Code is
* Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Joel Maher <joel.maher@gmail.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
/*
* getChromeURI converts a URL to a URI
*
* url: string of a URL (http://mochi.test/test.html)
* returns: a nsiURI object representing the given URL
*
*/
function getChromeURI(url) {
var ios = Components.classes["@mozilla.org/network/io-service;1"].
getService(Components.interfaces.nsIIOService);
return ios.newURI(url, null, null);
}
/*
* Convert a URL (string) into a nsIURI or NSIJARURI
* This is intended for URL's that are on a file system
* or in packaged up in an extension .jar file
*
* url: a string of a url on the local system(http://localhost/blah.html)
*/
function getResolvedURI(url) {
var chromeURI = getChromeURI(url);
var resolvedURI = Components.classes["@mozilla.org/chrome/chrome-registry;1"].
getService(Components.interfaces.nsIChromeRegistry).
convertChromeURL(chromeURI);
try {
resolvedURI = resolvedURI.QueryInterface(Components.interfaces.nsIJARURI);
} catch (ex) {} //not a jar file
return resolvedURI;
}
/**
* getChromeDir is intended to be called after getResolvedURI and convert
* the input URI into a nsILocalFile (actually the directory containing the
* file). This can be used for copying or referencing the file or extra files
* required by the test. Usually we need to load a secondary html file or library
* and this will give us file system access to that.
*
* resolvedURI: nsIURI (from getResolvedURI) that points to a file:/// url
*/
function getChromeDir(resolvedURI) {
var fileHandler = Components.classes["@mozilla.org/network/protocol;1?name=file"].
getService(Components.interfaces.nsIFileProtocolHandler);
var chromeDir = fileHandler.getFileFromURLSpec(resolvedURI.spec);
return chromeDir.parent.QueryInterface(Components.interfaces.nsILocalFile);
}
/*
* given a .jar file, we get all test files located inside the archive
*
* basePath: base URL to determine chrome location and search for tests
* testPath: passed in testPath value from command line such as: dom/tests/mochitest
* dir: the test dir to append to the baseURL after getting a directory interface
*
* As a note, this is hardcoded to the .jar structure we use for mochitest.
* Please don't assume this works for all jar files.
*/
function getMochitestJarListing(basePath, testPath, dir)
{
var zReader = Components.classes["@mozilla.org/libjar/zip-reader;1"].
createInstance(Components.interfaces.nsIZipReader);
var fileHandler = Components.classes["@mozilla.org/network/protocol;1?name=file"].
getService(Components.interfaces.nsIFileProtocolHandler);
var fileName = fileHandler.getFileFromURLSpec(getResolvedURI(basePath).JARFile.spec);
zReader.open(fileName);
//hardcoded 'content' as that is the root dir in the mochikit.jar file
var base = "content/" + dir + "/";
var singleTestPath;
if (testPath) {
var extraPath = testPath;
var pathToCheck = base + testPath;
if (zReader.hasEntry(pathToCheck)) {
var pathEntry = zReader.getEntry(pathToCheck);
if (pathEntry.isDirectory) {
base = pathToCheck;
} else {
singleTestPath = '/' + base + testPath;
var singleObject = {};
singleObject[singleTestPath] = true;
return [singleObject, singleTestPath];
}
}
else if (zReader.hasEntry(pathToCheck + "/")) {
base = pathToCheck + "/";
}
}
var [links, count] = zList(base, zReader, true);
return [links, null];
}
/*
* Replicate the server.js list() function with a .jar file
*
* base: string value of base directory we are testing
* zReader: handle to opened nsIZipReader object
* recurse: true|false if we do subdirs
*
* returns:
* [json object of {dir:{subdir:{file:true, file:true, ...}}}, count of tests]
*/
function zList(base, zReader, recurse) {
var dirs = zReader.findEntries(base + "*");
var links = {};
var count = 0;
var fileArray = [];
while(dirs.hasMore()) {
var entryName = dirs.getNext();
if (entryName.substr(-1) == '/' && entryName.split('/').length == (base.split('/').length + 1) ||
(entryName.substr(-1) != '/' && entryName.split('/').length == (base.split('/').length))) {
fileArray.push(entryName);
}
}
fileArray.sort();
count = fileArray.length;
for (var i=0; i < fileArray.length; i++) {
var myFile = fileArray[i];
if (myFile.substr(-1) === '/' && recurse) {
var childCount = 0;
[links[myFile], childCount] = zList(myFile, zReader, recurse);
count += childCount;
} else {
if (myFile.indexOf("SimpleTest") == -1) {
//we add the '/' so we don't try to run content/content/chrome
links['/' + myFile] = true;
}
}
}
return [links, count];
}
/**
* basePath: the URL base path to search from such as chrome://mochikit/content/a11y
* testPath: the optional testPath passed into the test such as dom/tests/mochitest
* dir: the test dir to append to the uri after getting a directory interface
* srvScope: loaded javascript to server.js so we have aComponents.classesess to the list() function
*
* return value:
* single test: [json object, path to test]
* list of tests: [json object, null] <- directory [heirarchy]
*/
function getFileListing(basePath, testPath, dir, srvScope)
{
var uri = getResolvedURI(basePath);
var chromeDir = getChromeDir(uri);
chromeDir.appendRelativePath(dir);
basePath += '/' + dir;
var ioSvc = Components.classes["@mozilla.org/network/io-service;1"].
getService(Components.interfaces.nsIIOService);
var testsDirURI = ioSvc.newFileURI(chromeDir);
var testsDir = ioSvc.newURI(testPath, null, testsDirURI)
.QueryInterface(Components.interfaces.nsIFileURL).file;
var singleTestPath;
if (testPath != undefined) {
var extraPath = testPath;
var fileNameRegexp = /(browser|test)_.+\.(xul|html|js)$/;
// Invalid testPath...
if (!testsDir.exists())
return [];
// If we were passed a speComponents.interfacesfic file, run only that test.
if (testsDir.isFile()) {
if (fileNameRegexp.test(testsDir.leafName))
var singlePath = basePath + '/' + testPath;
var links = {};
links[singlePath] = true;
return [links, singlePath];
// We were passed a file that's not a test...
return [];
}
// otherwise, we were passed a directory of tests
basePath += "/" + testPath;
}
var [links, count] = srvScope.list(basePath, testsDir, true);
return [links, null];
}
//used by tests to determine their directory based off window.location.path
function getRootDirectory(path, chromeURI) {
if (chromeURI === undefined)
{
chromeURI = getChromeURI(path);
}
var myURL = chromeURI.QueryInterface(Components.interfaces.nsIURL);
return chromeURI.prePath + myURL.directory;
}
//used by tests to determine their directory based off window.location.path
function getChromePrePath(path, chromeURI) {
if (chromeURI === undefined) {
chromeURI = getChromeURI(path);
}
return chromeURI.prePath;
}
/*
* Given a URI, return nsIJARURI or null
*/
function getJar(uri) {
var resolvedURI = getResolvedURI(uri);
var jar = null;
try {
if (resolvedURI.JARFile) {
jar = resolvedURI;
}
} catch (ex) {}
return jar;
}
/*
* input:
* jar: a nsIJARURI object with the jarfile and jarentry (path in jar file)
*
* output;
* all files and subdirectories inside jarentry will be extracted to TmpD/mochikit.tmp
* we will return the location of /TmpD/mochikit.tmp* so you can reference the files locally
*/
function extractJarToTmp(jar) {
var tmpdir = Components.classes["@mozilla.org/file/directory_service;1"]
.getService(Components.interfaces.nsIProperties)
.get("ProfD", Components.interfaces.nsILocalFile);
tmpdir.append("mochikit.tmp");
tmpdir.createUnique(Components.interfaces.nsIFile.DIRECTORY_TYPE, 0777);
var zReader = Components.classes["@mozilla.org/libjar/zip-reader;1"].
createInstance(Components.interfaces.nsIZipReader);
var fileHandler = Components.classes["@mozilla.org/network/protocol;1?name=file"].
getService(Components.interfaces.nsIFileProtocolHandler);
var fileName = fileHandler.getFileFromURLSpec(jar.JARFile.spec);
zReader.open(fileName);
//filepath represents the path in the jar file without the filename
var filepath = "";
var parts = jar.JAREntry.split('/');
for (var i =0; i < parts.length - 1; i++) {
if (parts[i] != '') {
filepath += parts[i] + '/';
}
}
/* Create dir structure first, no guarantee about ordering of directories and
* files returned from findEntries.
*/
var dirs = zReader.findEntries(filepath + '*/');
while (dirs.hasMore()) {
var targetDir = buildRelativePath(dirs.getNext(), tmpdir, filepath);
targetDir.create(Components.interfaces.nsIFile.DIRECTORY_TYPE, 0777);
}
//now do the files
var files = zReader.findEntries(filepath + "*");
while (files.hasMore()) {
var fname = files.getNext();
if (fname.substr(-1) != '/') {
var targetFile = buildRelativePath(fname, tmpdir, filepath);
zReader.extract(fname, targetFile);
}
}
return tmpdir;
}
/*
* Simple utility function to take the directory structure in jarentryname and
* translate that to a path of a nsILocalFile.
*/
function buildRelativePath(jarentryname, destdir, basepath)
{
var baseParts = basepath.split('/');
if (baseParts[baseParts.length-1] == '') {
baseParts.pop();
}
var parts = jarentryname.split('/');
var targetFile = Components.classes["@mozilla.org/file/local;1"]
.createInstance(Components.interfaces.nsILocalFile);
targetFile.initWithFile(destdir);
for (var i = baseParts.length; i < parts.length; i++) {
targetFile.append(parts[i]);
}
return targetFile;
}

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

@ -65,7 +65,8 @@ check if nsIFile can be determined
/** Test for Bug 462172 synthesizeDragStart**/
var testFile = Components.classes["@mozilla.org/file/directory_service;1"].
getService(Ci.nsIProperties).get("CurWorkD", Ci.nsIFile);
getService(Components.interfaces.nsIProperties).
get("CurWorkD", Components.interfaces.nsIFile);
var regularDtForDrag1 = null;
function doOnDragStart(aEvent)

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

@ -51,8 +51,6 @@ _tests\testing\mochitest\chrome\testing\mochitest\tests\SimpleTest\tests\test_sy
src="chrome://mochikit/content/MochiKit/packed.js"/>
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
<script type="application/javascript"
src="chrome://mochikit/content/chrome/toolkit/mozapps/downloads/tests/chrome/utils.js"/>
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
<script type="application/javascript">

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

@ -46,10 +46,41 @@
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
<script type="application/javascript"
src="chrome://mochikit/content/chrome-harness.js"/>
<script type="application/javascript">
<![CDATA[
/*
* input: string of the url where we are running from
* return: nsILocalFile
*/
function getCurrentDir(path) {
var rootDir = getRootDirectory(window.location.href);
var jar = getJar(rootDir);
if (jar) {
return extractJarToTmp(jar);
} else {
return getLocalDir(path);
}
}
function getLocalDir(path) {
let dir = Components.classes["@mozilla.org/file/directory_service;1"]
.getService(Components.interfaces.nsIProperties)
.get("CurWorkD", Components.interfaces.nsILocalFile);
let path = location.pathname;
path = path.slice("content/".length,
-1 * "/test_ctypes.xul".length);
let components = path.split("/");
for (let part in components) {
dir.append(components[part]);
}
return dir;
}
function test()
{
SimpleTest.waitForExplicitFinish();
@ -65,15 +96,7 @@
SimpleTest.finish();
}
let dir = Components.classes["@mozilla.org/file/directory_service;1"]
.getService(Components.interfaces.nsIProperties)
.get("CurWorkD", Components.interfaces.nsILocalFile);
let path = location.pathname.slice("content/".length,
-1 * "/test_ctypes.xul".length);
let components = path.split("/");
for (let part in components) {
dir.append(components[part]);
}
var dir = getCurrentDir(location.path);
ok(dir.exists() && dir.isDirectory(), "Chrome test dir doesn't exist?!");
worker.postMessage(dir.path);
}

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

@ -84,8 +84,8 @@ var observer =
},
onBeforeItemRemoved: function(){},
onItemRemoved: function() {},
onItemChanged: function() {}
onItemVisited: function() {}
onItemChanged: function() {},
onItemVisited: function() {},
onItemMoved: function() {}
};
bmsvc.addObserver(observer, false);

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

@ -37,6 +37,16 @@ function convertChromeURI(chromeURI)
function chromeURIToFile(chromeURI)
{
var jar = getJar(chromeURI);
if (jar) {
var tmpDir = extractJarToTmp(jar);
let parts = chromeURI.split('/');
if (parts[parts.length - 1] != '') {
tmpDir.append(parts[parts.length - 1]);
}
return tmpDir;
}
return convertChromeURI(chromeURI).
QueryInterface(Ci.nsIFileURL).file;
}

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

@ -1,3 +1,10 @@
content rtlchrome /content
# Override intl.css with our own CSS file
override chrome://global/locale/intl.css chrome://rtlchrome/rtl.css
override chrome://global/locale/global.dtd chrome://rtlchrome/rtl.dtd
# Override intl.css with our own CSS file
override chrome://global/locale/intl.css chrome://mochikit/content/chrome/toolkit/content/tests/chrome/rtlchrome/rtl.css
override chrome://global/locale/global.dtd chrome://mochikit/content/chrome/toolkit/content/tests/chrome/rtlchrome/rtl.dtd

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

@ -16,6 +16,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=348233
src="chrome://mochikit/content/MochiKit/packed.js"></script>
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript"
src="chrome://mochikit/content/chrome-harness.js"></script>
<script type="application/javascript"
src="RegisterUnregisterChrome.js"></script>
@ -49,11 +51,15 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=348233
frame.setAttribute("src", "about:plugins");
frame.addEventListener("load", function () {
frame.removeEventListener("load", arguments.callee, false);
is(frame.contentDocument.dir, "rtl", "about:plugins should be RTL in RTL locales");
let gDirSvc = Components.classes["@mozilla.org/file/directory_service;1"].
getService(Components.interfaces.nsIDirectoryService).
QueryInterface(Components.interfaces.nsIProperties);
let tmpd = gDirSvc.get("ProfD", Components.interfaces.nsIFile);
frame = document.createElement("iframe");
frame.setAttribute("src", convertChromeURI("chrome://mochikit/content/chrome/toolkit/content/tests/chrome/rtlchrome/").spec); // a file:// URI, bug 348233
frame.setAttribute("src", "file://" + tmpd.path); // a file:// URI, bug 348233
frame.addEventListener("load", function () {
frame.removeEventListener("load", arguments.callee, false);

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

@ -12,6 +12,8 @@
src="chrome://mochikit/content/MochiKit/packed.js"></script>
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript"
src="chrome://mochikit/content/chrome-harness.js"></script>
<script type="application/javascript"
src="RegisterUnregisterChrome.js"></script>

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

@ -1,6 +1,6 @@
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
<?xml-stylesheet href="/tests/SimpleTest/test.css" type="text/css"?>
<!--
XUL Widget Test for button
-->

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

@ -1,6 +1,6 @@
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
<?xml-stylesheet href="/tests/SimpleTest/test.css" type="text/css"?>
<!--
XUL Widget Test for deck
-->

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

@ -1,6 +1,6 @@
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
<?xml-stylesheet href="/tests/SimpleTest/test.css" type="text/css"?>
<!--
XUL Widget Test for basic properties - this test checks that the basic
properties defined in general.xml and inherited by a number of elements

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

@ -1,6 +1,6 @@
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
<?xml-stylesheet href="/tests/SimpleTest/test.css" type="text/css"?>
<!--
XUL Widget Test for listbox direction
-->

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

@ -1,6 +1,6 @@
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
<?xml-stylesheet href="/tests/SimpleTest/test.css" type="text/css"?>
<!--
XUL Widget Test for statusbar
-->

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

@ -54,7 +54,7 @@
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
<script type="application/javascript"
src="chrome://mochikit/content/chrome/toolkit/mozapps/downloads/tests/chrome/utils.js"/>
src="utils.js"/>
<script type="application/javascript">
<![CDATA[

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

@ -53,7 +53,7 @@
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
<script type="application/javascript"
src="chrome://mochikit/content/chrome/toolkit/mozapps/downloads/tests/chrome/utils.js"/>
src="utils.js"/>
<script type="application/javascript">
<![CDATA[

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

@ -54,7 +54,7 @@
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
<script type="application/javascript"
src="chrome://mochikit/content/chrome/toolkit/mozapps/downloads/tests/chrome/utils.js"/>
src="utils.js"/>
<script type="application/javascript">
<![CDATA[

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

@ -54,7 +54,7 @@
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
<script type="application/javascript"
src="chrome://mochikit/content/chrome/toolkit/mozapps/downloads/tests/chrome/utils.js"/>
src="utils.js"/>
<script type="application/javascript">
<![CDATA[

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

@ -62,7 +62,7 @@ close window
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
<script type="application/javascript"
src="chrome://mochikit/content/chrome/toolkit/mozapps/downloads/tests/chrome/utils.js"/>
src="utils.js"/>
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
<script type="application/javascript">

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

@ -54,7 +54,7 @@
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
<script type="application/javascript"
src="chrome://mochikit/content/chrome/toolkit/mozapps/downloads/tests/chrome/utils.js"/>
src="utils.js"/>
<script type="application/javascript">
<![CDATA[

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

@ -56,7 +56,7 @@
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
<script type="application/javascript"
src="chrome://mochikit/content/chrome/toolkit/mozapps/downloads/tests/chrome/utils.js"/>
src="utils.js"/>
<script type="application/javascript">

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

@ -55,7 +55,7 @@
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
<script type="application/javascript"
src="chrome://mochikit/content/chrome/toolkit/mozapps/downloads/tests/chrome/utils.js"/>
src="utils.js"/>
<script type="application/javascript">

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

@ -20,7 +20,7 @@
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
<script type="application/javascript"
src="chrome://mochikit/content/chrome/toolkit/mozapps/downloads/tests/chrome/utils.js"/>
src="utils.js"/>
<script type="application/javascript">
<![CDATA[

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

@ -59,7 +59,7 @@
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
<script type="application/javascript"
src="chrome://mochikit/content/chrome/toolkit/mozapps/downloads/tests/chrome/utils.js"/>
src="utils.js"/>
<script type="application/javascript">
<![CDATA[

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

@ -53,7 +53,7 @@
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
<script type="application/javascript"
src="chrome://mochikit/content/chrome/toolkit/mozapps/downloads/tests/chrome/utils.js"/>
src="utils.js"/>
<script type="application/javascript">
<![CDATA[

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

@ -54,7 +54,7 @@
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
<script type="application/javascript"
src="chrome://mochikit/content/chrome/toolkit/mozapps/downloads/tests/chrome/utils.js"/>
src="utils.js"/>
<script type="application/javascript">
<![CDATA[

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

@ -52,7 +52,7 @@
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
<script type="application/javascript"
src="chrome://mochikit/content/chrome/toolkit/mozapps/downloads/tests/chrome/utils.js"/>
src="utils.js"/>
<script type="application/javascript">
<![CDATA[

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

@ -52,7 +52,7 @@
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
<script type="application/javascript"
src="chrome://mochikit/content/chrome/toolkit/mozapps/downloads/tests/chrome/utils.js"/>
src="utils.js"/>
<script type="application/javascript">
<![CDATA[

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

@ -53,7 +53,7 @@
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
<script type="application/javascript"
src="chrome://mochikit/content/chrome/toolkit/mozapps/downloads/tests/chrome/utils.js"/>
src="utils.js"/>
<script type="application/javascript">
<![CDATA[

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

@ -51,7 +51,7 @@
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
<script type="application/javascript"
src="chrome://mochikit/content/chrome/toolkit/mozapps/downloads/tests/chrome/utils.js"/>
src="utils.js"/>
<script type="application/javascript">
<![CDATA[

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

@ -54,7 +54,7 @@
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
<script type="application/javascript"
src="chrome://mochikit/content/chrome/toolkit/mozapps/downloads/tests/chrome/utils.js"/>
src="utils.js"/>
<script type="application/javascript">
<![CDATA[

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

@ -51,7 +51,7 @@
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
<script type="application/javascript"
src="chrome://mochikit/content/chrome/toolkit/mozapps/downloads/tests/chrome/utils.js"/>
src="utils.js"/>
<script type="application/javascript">
<![CDATA[

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

@ -55,7 +55,7 @@
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
<script type="application/javascript"
src="chrome://mochikit/content/chrome/toolkit/mozapps/downloads/tests/chrome/utils.js"/>
src="utils.js"/>
<script type="application/javascript">
<![CDATA[

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

@ -53,7 +53,7 @@
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
<script type="application/javascript"
src="chrome://mochikit/content/chrome/toolkit/mozapps/downloads/tests/chrome/utils.js"/>
src="utils.js"/>
<script type="application/javascript">
<![CDATA[

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

@ -54,7 +54,7 @@
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
<script type="application/javascript"
src="chrome://mochikit/content/chrome/toolkit/mozapps/downloads/tests/chrome/utils.js"/>
src="utils.js"/>
<script type="application/javascript">
<![CDATA[

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

@ -54,7 +54,7 @@
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
<script type="application/javascript"
src="chrome://mochikit/content/chrome/toolkit/mozapps/downloads/tests/chrome/utils.js"/>
src="utils.js"/>
<script type="application/javascript">
<![CDATA[

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше