mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 03:15:11 +00:00
Merge m-c to b2g-inbound
This commit is contained in:
commit
1af5b8eca0
@ -1,8 +0,0 @@
|
||||
#
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
MOCHITEST_A11Y_FILES += \
|
||||
$(topsrcdir)/content/media/test/bug461281.ogg \
|
||||
$(NULL)
|
@ -1,5 +1,6 @@
|
||||
[DEFAULT]
|
||||
support-files =
|
||||
../../../content/media/test/bug461281.ogg
|
||||
dumbfile.xpi
|
||||
formimage.png
|
||||
letters.gif
|
||||
|
@ -10,13 +10,16 @@ xul|window xul|scrollbar {
|
||||
display: none;
|
||||
}
|
||||
|
||||
html xul|scrollbar[root="true"] {
|
||||
position: relative;
|
||||
z-index: 2147483647;
|
||||
}
|
||||
|
||||
html xul|scrollbar {
|
||||
-moz-appearance: none !important;
|
||||
position: relative;
|
||||
background-color: transparent !important;
|
||||
background-image: none !important;
|
||||
border: 0px solid transparent !important;
|
||||
z-index: 2147483647;
|
||||
pointer-events: none;
|
||||
opacity: 1;
|
||||
}
|
||||
|
@ -33,14 +33,9 @@ var gPluginHandler = {
|
||||
let fallbackType = null;
|
||||
let blocklistState = null;
|
||||
|
||||
if (pluginElement instanceof HTMLAppletElement) {
|
||||
tagMimetype = "application/x-java-vm";
|
||||
} else {
|
||||
tagMimetype = pluginElement.actualType;
|
||||
|
||||
if (tagMimetype == "") {
|
||||
tagMimetype = pluginElement.type;
|
||||
}
|
||||
tagMimetype = pluginElement.actualType;
|
||||
if (tagMimetype == "") {
|
||||
tagMimetype = pluginElement.type;
|
||||
}
|
||||
|
||||
if (gPluginHandler.isKnownPlugin(pluginElement)) {
|
||||
@ -389,6 +384,14 @@ var gPluginHandler = {
|
||||
}
|
||||
}
|
||||
|
||||
let closeIcon = this.getPluginUI(plugin, "closeIcon");
|
||||
if (closeIcon) {
|
||||
closeIcon.addEventListener("click", function(aEvent) {
|
||||
if (aEvent.button == 0 && aEvent.isTrusted)
|
||||
gPluginHandler.hideClickToPlayOverlay(plugin);
|
||||
}, true);
|
||||
}
|
||||
|
||||
if (shouldShowNotification) {
|
||||
this._showClickToPlayNotification(browser, plugin, false);
|
||||
}
|
||||
@ -595,11 +598,6 @@ var gPluginHandler = {
|
||||
|
||||
if (overlay) {
|
||||
overlay.addEventListener("click", gPluginHandler._overlayClickListener, true);
|
||||
let closeIcon = this.getPluginUI(aPlugin, "closeIcon");
|
||||
closeIcon.addEventListener("click", function(aEvent) {
|
||||
if (aEvent.button == 0 && aEvent.isTrusted)
|
||||
gPluginHandler.hideClickToPlayOverlay(aPlugin);
|
||||
}, true);
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -592,6 +592,9 @@
|
||||
cui-areatype="toolbar"
|
||||
tooltiptext="&closeTab.label;"/>
|
||||
|
||||
#ifdef XP_WIN
|
||||
<hbox id="private-browsing-indicator" skipintoolbarset="true" ordinal="1000"/>
|
||||
#endif
|
||||
#ifdef CAN_DRAW_IN_TITLEBAR
|
||||
<hbox class="titlebar-placeholder" type="caption-buttons"
|
||||
id="titlebar-placeholder-on-TabsToolbar-for-captions-buttons" persist="width"
|
||||
|
@ -116,6 +116,7 @@ skip-if = toolkit == "gtk2" || toolkit == "gtk3" # browser_CTP_context_menu.js
|
||||
run-if = crashreporter
|
||||
[browser_CTP_data_urls.js]
|
||||
[browser_CTP_drag_drop.js]
|
||||
[browser_CTP_hide_overlay.js]
|
||||
[browser_CTP_multi_allow.js]
|
||||
[browser_CTP_nonplugins.js]
|
||||
[browser_CTP_notificationBar.js]
|
||||
|
@ -0,0 +1,76 @@
|
||||
var rootDir = getRootDirectory(gTestPath);
|
||||
const gTestRoot = rootDir;
|
||||
const gHttpTestRoot = rootDir.replace("chrome://mochitests/content/", "http://127.0.0.1:8888/");
|
||||
|
||||
var gTestBrowser = null;
|
||||
var gNextTest = null;
|
||||
var gPluginHost = Components.classes["@mozilla.org/plugin/host;1"].getService(Components.interfaces.nsIPluginHost);
|
||||
|
||||
Components.utils.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
function test() {
|
||||
waitForExplicitFinish();
|
||||
registerCleanupFunction(function() {
|
||||
clearAllPluginPermissions();
|
||||
Services.prefs.clearUserPref("extensions.blocklist.suppressUI");
|
||||
});
|
||||
Services.prefs.setBoolPref("extensions.blocklist.suppressUI", true);
|
||||
|
||||
let newTab = gBrowser.addTab();
|
||||
gBrowser.selectedTab = newTab;
|
||||
gTestBrowser = gBrowser.selectedBrowser;
|
||||
gTestBrowser.addEventListener("load", pageLoad, true);
|
||||
|
||||
Services.prefs.setBoolPref("plugins.click_to_play", true);
|
||||
setTestPluginEnabledState(Ci.nsIPluginTag.STATE_DISABLED);
|
||||
|
||||
prepareTest(runAfterPluginBindingAttached(test1), gHttpTestRoot + "plugin_test.html");
|
||||
}
|
||||
|
||||
function finishTest() {
|
||||
clearAllPluginPermissions();
|
||||
gTestBrowser.removeEventListener("load", pageLoad, true);
|
||||
gBrowser.removeCurrentTab();
|
||||
window.focus();
|
||||
finish();
|
||||
}
|
||||
|
||||
function pageLoad() {
|
||||
// The plugin events are async dispatched and can come after the load event
|
||||
// This just allows the events to fire before we then go on to test the states
|
||||
executeSoon(gNextTest);
|
||||
}
|
||||
|
||||
function prepareTest(nextTest, url) {
|
||||
gNextTest = nextTest;
|
||||
gTestBrowser.contentWindow.location = url;
|
||||
}
|
||||
|
||||
// Due to layout being async, "PluginBindAttached" may trigger later.
|
||||
// This wraps a function to force a layout flush, thus triggering it,
|
||||
// and schedules the function execution so they're definitely executed
|
||||
// afterwards.
|
||||
function runAfterPluginBindingAttached(func) {
|
||||
return function() {
|
||||
let doc = gTestBrowser.contentDocument;
|
||||
let elems = doc.getElementsByTagName('embed');
|
||||
if (elems.length < 1) {
|
||||
elems = doc.getElementsByTagName('object');
|
||||
}
|
||||
elems[0].clientTop;
|
||||
executeSoon(func);
|
||||
};
|
||||
}
|
||||
|
||||
// Tests that the overlay can be hidded for disabled plugins using the close icon.
|
||||
function test1() {
|
||||
var doc = gTestBrowser.contentDocument;
|
||||
var plugin = doc.getElementById("test");
|
||||
ok(plugin, "Test 1, Found plugin in page");
|
||||
var overlay = doc.getAnonymousElementByAttribute(plugin, "anonid", "main");
|
||||
ok(overlay.classList.contains("visible"), "Test 1, Plugin overlay should exist, not be hidden");
|
||||
var closeIcon = doc.getAnonymousElementByAttribute(plugin, "anonid", "closeIcon")
|
||||
EventUtils.synthesizeMouseAtCenter(closeIcon, {}, gTestBrowser.contentWindow);
|
||||
var condition = function() !overlay.classList.contains("visible");
|
||||
waitForCondition(condition, finishTest, "Test 1, Waited too long for the overlay to become invisible.");
|
||||
}
|
@ -191,6 +191,19 @@ const CustomizableWidgets = [{
|
||||
}
|
||||
recentlyClosedWindows.appendChild(windowsFragment);
|
||||
},
|
||||
onCreated: function(aNode) {
|
||||
// Middle clicking recently closed items won't close the panel - cope:
|
||||
let onRecentlyClosedClick = function(aEvent) {
|
||||
if (aEvent.button == 1) {
|
||||
CustomizableUI.hidePanelForNode(this);
|
||||
}
|
||||
};
|
||||
let doc = aNode.ownerDocument;
|
||||
let recentlyClosedTabs = doc.getElementById("PanelUI-recentlyClosedTabs");
|
||||
let recentlyClosedWindows = doc.getElementById("PanelUI-recentlyClosedWindows");
|
||||
recentlyClosedTabs.addEventListener("click", onRecentlyClosedClick);
|
||||
recentlyClosedWindows.addEventListener("click", onRecentlyClosedClick);
|
||||
},
|
||||
onViewHiding: function(aEvent) {
|
||||
LOG("History view is being hidden!");
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ support-files =
|
||||
[browser_bug731866.js]
|
||||
[browser_connection.js]
|
||||
[browser_healthreport.js]
|
||||
skip-if = (!healthreport) || (os == 'linux' && debug)
|
||||
skip-if = !healthreport || (os == 'linux' && debug)
|
||||
[browser_privacypane_1.js]
|
||||
[browser_privacypane_3.js]
|
||||
[browser_privacypane_5.js]
|
||||
|
@ -8,7 +8,7 @@ support-files =
|
||||
[browser_bug705422.js]
|
||||
[browser_chunk_permissions.js]
|
||||
[browser_healthreport.js]
|
||||
skip-if = (!healthreport) || (os == 'linux' && debug)
|
||||
skip-if = !healthreport || (os == 'linux' && debug)
|
||||
[browser_permissions.js]
|
||||
[browser_privacypane_1.js]
|
||||
[browser_privacypane_3.js]
|
||||
|
@ -107,6 +107,8 @@ support-files =
|
||||
test-bug_923281_test2.js
|
||||
test-bug_939783_console_trace_duplicates.html
|
||||
test-bug-952277-highlight-nodes-in-vview.html
|
||||
test-bug-609872-cd-iframe-parent.html
|
||||
test-bug-609872-cd-iframe-child.html
|
||||
|
||||
[browser_bug664688_sandbox_update_after_navigation.js]
|
||||
[browser_bug_638949_copy_link_location.js]
|
||||
@ -267,3 +269,4 @@ run-if = os == "mac"
|
||||
[browser_webconsole_output_events.js]
|
||||
[browser_console_variables_view_highlighter.js]
|
||||
[browser_webconsole_console_trace_duplicates.js]
|
||||
[browser_webconsole_cd_iframe.js]
|
||||
|
110
browser/devtools/webconsole/test/browser_webconsole_cd_iframe.js
Normal file
110
browser/devtools/webconsole/test/browser_webconsole_cd_iframe.js
Normal file
@ -0,0 +1,110 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
// Test that the cd() jsterm helper function works as expected. See bug 609872.
|
||||
|
||||
function test() {
|
||||
let hud;
|
||||
|
||||
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-bug-609872-cd-iframe-parent.html";
|
||||
|
||||
const parentMessages = [{
|
||||
name: "document.title in parent iframe",
|
||||
text: "bug 609872 - iframe parent",
|
||||
category: CATEGORY_OUTPUT,
|
||||
}, {
|
||||
name: "paragraph content",
|
||||
text: "p: test for bug 609872 - iframe parent",
|
||||
category: CATEGORY_OUTPUT,
|
||||
}, {
|
||||
name: "object content",
|
||||
text: "obj: parent!",
|
||||
category: CATEGORY_OUTPUT,
|
||||
}];
|
||||
|
||||
const childMessages = [{
|
||||
name: "document.title in child iframe",
|
||||
text: "bug 609872 - iframe child",
|
||||
category: CATEGORY_OUTPUT,
|
||||
}, {
|
||||
name: "paragraph content",
|
||||
text: "p: test for bug 609872 - iframe child",
|
||||
category: CATEGORY_OUTPUT,
|
||||
}, {
|
||||
name: "object content",
|
||||
text: "obj: child!",
|
||||
category: CATEGORY_OUTPUT,
|
||||
}];
|
||||
|
||||
Task.spawn(runner).then(finishTest);
|
||||
|
||||
function* runner() {
|
||||
const {tab} = yield loadTab(TEST_URI);
|
||||
hud = yield openConsole(tab);
|
||||
|
||||
executeWindowTest();
|
||||
|
||||
yield waitForMessages({ webconsole: hud, messages: parentMessages });
|
||||
|
||||
info("cd() into the iframe using a selector");
|
||||
hud.jsterm.clearOutput();
|
||||
hud.jsterm.execute("cd('iframe')");
|
||||
executeWindowTest();
|
||||
|
||||
yield waitForMessages({ webconsole: hud, messages: childMessages });
|
||||
|
||||
info("cd() out of the iframe, reset to default window");
|
||||
hud.jsterm.clearOutput();
|
||||
hud.jsterm.execute("cd()");
|
||||
executeWindowTest();
|
||||
|
||||
yield waitForMessages({ webconsole: hud, messages: parentMessages });
|
||||
|
||||
info("call cd() with unexpected arguments");
|
||||
hud.jsterm.clearOutput();
|
||||
hud.jsterm.execute("cd(document)");
|
||||
|
||||
yield waitForMessages({
|
||||
webconsole: hud,
|
||||
messages: [{
|
||||
text: "Cannot cd()",
|
||||
category: CATEGORY_OUTPUT,
|
||||
severity: SEVERITY_ERROR,
|
||||
}],
|
||||
});
|
||||
|
||||
hud.jsterm.clearOutput();
|
||||
hud.jsterm.execute("cd('p')");
|
||||
|
||||
yield waitForMessages({
|
||||
webconsole: hud,
|
||||
messages: [{
|
||||
text: "Cannot cd()",
|
||||
category: CATEGORY_OUTPUT,
|
||||
severity: SEVERITY_ERROR,
|
||||
}],
|
||||
});
|
||||
|
||||
info("cd() into the iframe using an iframe DOM element");
|
||||
hud.jsterm.clearOutput();
|
||||
hud.jsterm.execute("cd($('iframe'))");
|
||||
executeWindowTest();
|
||||
|
||||
yield waitForMessages({ webconsole: hud, messages: childMessages });
|
||||
|
||||
info("cd(window.parent)");
|
||||
hud.jsterm.clearOutput();
|
||||
hud.jsterm.execute("cd(window.parent)");
|
||||
executeWindowTest();
|
||||
|
||||
yield waitForMessages({ webconsole: hud, messages: parentMessages });
|
||||
|
||||
yield closeConsole(tab);
|
||||
}
|
||||
|
||||
function executeWindowTest() {
|
||||
hud.jsterm.execute("document.title");
|
||||
hud.jsterm.execute("'p: ' + document.querySelector('p').textContent");
|
||||
hud.jsterm.execute("'obj: ' + window.foobarBug609872");
|
||||
}
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>test for bug 609872 - iframe child</title>
|
||||
<!-- Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ -->
|
||||
</head>
|
||||
<body>
|
||||
<p>test for bug 609872 - iframe child</p>
|
||||
<script>window.foobarBug609872 = 'child!';</script>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,14 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>test for bug 609872 - iframe parent</title>
|
||||
<!-- Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ -->
|
||||
</head>
|
||||
<body>
|
||||
<p>test for bug 609872 - iframe parent</p>
|
||||
<script>window.foobarBug609872 = 'parent!';</script>
|
||||
<iframe src="test-bug-609872-cd-iframe-child.html"></iframe>
|
||||
</body>
|
||||
</html>
|
@ -213,3 +213,7 @@ emptyPropertiesList=No properties to display
|
||||
# #1 number of message repeats
|
||||
# example: 3 repeats
|
||||
messageRepeats.tooltip2=#1 repeat;#1 repeats
|
||||
|
||||
# LOCALIZATION NOTE (cdFunctionInvalidArgument): the text that is displayed when
|
||||
# cd() is invoked with an invalid argument.
|
||||
cdFunctionInvalidArgument=Cannot cd() to the given window. Invalid argument.
|
||||
|
@ -64,6 +64,7 @@ var Browser = {
|
||||
messageManager.loadFrameScript("chrome://browser/content/contenthandlers/SelectionHandler.js", true);
|
||||
messageManager.loadFrameScript("chrome://browser/content/contenthandlers/ContextMenuHandler.js", true);
|
||||
messageManager.loadFrameScript("chrome://browser/content/contenthandlers/ConsoleAPIObserver.js", true);
|
||||
messageManager.loadFrameScript("chrome://browser/content/contenthandlers/PluginHelper.js", true);
|
||||
} catch (e) {
|
||||
// XXX whatever is calling startup needs to dump errors!
|
||||
dump("###########" + e + "\n");
|
||||
|
@ -1120,6 +1120,9 @@ Desktop browser's sync prefs.
|
||||
<setting pref="signon.rememberSignons"
|
||||
title="&optionsHeader.privacy.passwords.label;"
|
||||
type="bool"/>
|
||||
<setting pref="browser.display.overlaynavbuttons"
|
||||
title="&optionsHeader.displayOverlayButtons.label;"
|
||||
type="bool"/>
|
||||
<settings id="prefs-reporting"
|
||||
label="&optionsHeader.reporting.title;">
|
||||
<setting pref="app.crashreporter.autosubmit"
|
||||
|
95
browser/metro/base/content/contenthandlers/PluginHelper.js
Normal file
95
browser/metro/base/content/contenthandlers/PluginHelper.js
Normal file
@ -0,0 +1,95 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
"use strict";
|
||||
|
||||
dump("### PluginHelper.js loaded\n");
|
||||
|
||||
/**
|
||||
* Handle events generated by plugin click-to-play code.
|
||||
*
|
||||
* This "PluginBindingAttached" fires when a "pluginProblem" XBL binding is
|
||||
* created. This binding overlays plugin content when the plugin is missing,
|
||||
* blocked, click-to-play, or replaced by a "preview" extension plugin like
|
||||
* Shumway or PDF.js.
|
||||
*/
|
||||
var PluginHelper = {
|
||||
init: function () {
|
||||
addEventListener("PluginBindingAttached", this, true, true);
|
||||
},
|
||||
|
||||
handleEvent: function handleEvent(aEvent) {
|
||||
switch (aEvent.type) {
|
||||
case "PluginBindingAttached":
|
||||
this.handlePluginBindingAttached(aEvent);
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
getPluginMimeType: function (plugin) {
|
||||
var tagMimetype = plugin.actualType;
|
||||
|
||||
if (tagMimetype == "") {
|
||||
tagMimetype = plugin.type;
|
||||
}
|
||||
return tagMimetype;
|
||||
},
|
||||
|
||||
handlePluginBindingAttached: function (aEvent) {
|
||||
let plugin = aEvent.target;
|
||||
let doc = plugin.ownerDocument;
|
||||
let overlay = doc.getAnonymousElementByAttribute(plugin, "anonid", "main");
|
||||
if (!overlay || overlay._bindingHandled) {
|
||||
return;
|
||||
}
|
||||
overlay._bindingHandled = true;
|
||||
|
||||
let eventType = PluginHelper._getBindingType(plugin);
|
||||
if (!eventType) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch (eventType) {
|
||||
case "PluginPlayPreview": {
|
||||
// Load the "preview" handler (an extension plugin like Shumway or PDF.js).
|
||||
let previewContent = doc.getAnonymousElementByAttribute(plugin, "class", "previewPluginContent");
|
||||
let pluginHost = Cc["@mozilla.org/plugin/host;1"].getService(Ci.nsIPluginHost);
|
||||
let mimeType = PluginHelper.getPluginMimeType(plugin);
|
||||
let playPreviewInfo = pluginHost.getPlayPreviewInfo(mimeType);
|
||||
|
||||
let iframe = previewContent.getElementsByClassName("previewPluginContentFrame")[0];
|
||||
if (!iframe) {
|
||||
// lazy initialization of the iframe
|
||||
iframe = doc.createElementNS("http://www.w3.org/1999/xhtml", "iframe");
|
||||
iframe.className = "previewPluginContentFrame";
|
||||
previewContent.appendChild(iframe);
|
||||
}
|
||||
iframe.src = playPreviewInfo.redirectURL;
|
||||
break;
|
||||
}
|
||||
|
||||
case "PluginNotFound": {
|
||||
// TODO: Display a message about missing plugins (bug 936907)
|
||||
break;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
// Helper to get the binding handler type from a plugin object
|
||||
_getBindingType: function(plugin) {
|
||||
if (!(plugin instanceof Ci.nsIObjectLoadingContent))
|
||||
return null;
|
||||
|
||||
switch (plugin.pluginFallbackType) {
|
||||
case Ci.nsIObjectLoadingContent.PLUGIN_UNSUPPORTED:
|
||||
return "PluginNotFound";
|
||||
case Ci.nsIObjectLoadingContent.PLUGIN_PLAY_PREVIEW:
|
||||
return "PluginPlayPreview";
|
||||
default:
|
||||
// Metro Firefox does not yet support other fallback types.
|
||||
return null;
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
PluginHelper.init();
|
@ -59,6 +59,7 @@ chrome.jar:
|
||||
content/contenthandlers/FormHelper.js (content/contenthandlers/FormHelper.js)
|
||||
content/contenthandlers/ConsoleAPIObserver.js (content/contenthandlers/ConsoleAPIObserver.js)
|
||||
content/contenthandlers/Content.js (content/contenthandlers/Content.js)
|
||||
content/contenthandlers/PluginHelper.js (content/contenthandlers/PluginHelper.js)
|
||||
|
||||
content/library/SelectionPrototype.js (content/library/SelectionPrototype.js)
|
||||
|
||||
|
@ -27,6 +27,7 @@
|
||||
<!ENTITY clearPrivateData.logins "Active logins">
|
||||
|
||||
<!ENTITY optionsHeader.privacy.passwords.label "Remember Passwords">
|
||||
<!ENTITY optionsHeader.displayOverlayButtons.label "Show Navigation Buttons">
|
||||
<!ENTITY doNotTrack.title "Do Not Track">
|
||||
<!ENTITY doNotTrack.options.doNotTrack "Tell websites that I do not want to be tracked">
|
||||
<!ENTITY doNotTrack.options.doTrack "Tell websites that I want to be tracked">
|
||||
|
@ -573,7 +573,12 @@ pref("pdfjs.previousHandler.alwaysAskBeforeHandling", false);
|
||||
#endif
|
||||
|
||||
#ifdef NIGHTLY_BUILD
|
||||
// Shumay is currently experimental. Toggle this pref to enable Shumway for
|
||||
// testing and development.
|
||||
pref("shumway.disabled", true);
|
||||
// When Shumway is enabled, use it all the time, not only when Flash is set to
|
||||
// click-to-play (because Metro doesn't even load the native Flash plugin).
|
||||
pref("shumway.ignoreCTP", true);
|
||||
#endif
|
||||
|
||||
// The maximum amount of decoded image data we'll willingly keep around (we
|
||||
|
@ -2509,9 +2509,7 @@ chatbox {
|
||||
|
||||
/* End customization mode */
|
||||
|
||||
#main-window[privatebrowsingmode=temporary] #TabsToolbar::after {
|
||||
content: "";
|
||||
display: -moz-box;
|
||||
#main-window[privatebrowsingmode=temporary] #private-browsing-indicator {
|
||||
width: 40px;
|
||||
background: url("chrome://browser/skin/privatebrowsing-indicator.png") no-repeat center center;
|
||||
}
|
||||
|
@ -395,9 +395,9 @@ nsScriptSecurityManager::ContentSecurityPolicyPermitsJSAction(JSContext *cx)
|
||||
unsigned lineNum = 0;
|
||||
NS_NAMED_LITERAL_STRING(scriptSample, "call to eval() or related function blocked by CSP");
|
||||
|
||||
JS::RootedScript script(cx);
|
||||
if (JS_DescribeScriptedCaller(cx, &script, &lineNum)) {
|
||||
if (const char *file = JS_GetScriptFilename(cx, script)) {
|
||||
JS::AutoFilename scriptFilename;
|
||||
if (JS::DescribeScriptedCaller(cx, &scriptFilename, &lineNum)) {
|
||||
if (const char *file = scriptFilename.get()) {
|
||||
CopyUTF8toUTF16(nsDependentCString(file), fileName);
|
||||
}
|
||||
}
|
||||
|
5
config/external/moz.build
vendored
5
config/external/moz.build
vendored
@ -33,15 +33,14 @@ if CONFIG['MOZ_WEBM_ENCODER']:
|
||||
if CONFIG['MOZ_VPX'] and not CONFIG['MOZ_NATIVE_LIBVPX']:
|
||||
external_dirs += ['media/libvpx']
|
||||
|
||||
if CONFIG['MOZ_OGG']:
|
||||
external_dirs += ['media/libogg', 'media/libtheora']
|
||||
|
||||
if not CONFIG['MOZ_NATIVE_PNG']:
|
||||
external_dirs += ['media/libpng']
|
||||
|
||||
external_dirs += [
|
||||
'media/kiss_fft',
|
||||
'media/libcubeb',
|
||||
'media/libogg',
|
||||
'media/libtheora',
|
||||
'media/libspeex_resampler',
|
||||
'media/libsoundtouch',
|
||||
]
|
||||
|
@ -230,6 +230,7 @@ cairo-xlib.h
|
||||
cairo-xlib-xrender.h
|
||||
cairo-directfb.h
|
||||
cairo-qpainter.h
|
||||
cairo-qt.h
|
||||
#endif
|
||||
dfiff.h
|
||||
exception
|
||||
|
63
configure.in
63
configure.in
@ -3867,7 +3867,6 @@ MOZ_FEEDS=1
|
||||
MOZ_WEBAPP_RUNTIME=
|
||||
MOZ_JSDEBUGGER=1
|
||||
MOZ_AUTH_EXTENSION=1
|
||||
MOZ_OGG=1
|
||||
MOZ_RAW=
|
||||
MOZ_VORBIS=
|
||||
MOZ_TREMOR=
|
||||
@ -5109,37 +5108,25 @@ fi
|
||||
|
||||
AC_SUBST(MOZ_RAW)
|
||||
|
||||
dnl ========================================================
|
||||
dnl = Disable Ogg Codecs
|
||||
dnl ========================================================
|
||||
MOZ_ARG_DISABLE_BOOL(ogg,
|
||||
[ --disable-ogg Disable support for OGG media (Theora video and Vorbis audio)],
|
||||
MOZ_OGG=,
|
||||
MOZ_OGG=1)
|
||||
|
||||
if test -n "$MOZ_OGG"; then
|
||||
AC_DEFINE(MOZ_OGG)
|
||||
|
||||
dnl Checks for __attribute__(aligned()) directive
|
||||
AC_CACHE_CHECK([__attribute__ ((aligned ())) support],
|
||||
[ac_cv_c_attribute_aligned],
|
||||
[ac_cv_c_attribute_aligned=0
|
||||
CFLAGS_save="${CFLAGS}"
|
||||
CFLAGS="${CFLAGS} -Werror"
|
||||
for ac_cv_c_attr_align_try in 64 32 16 8; do
|
||||
echo "trying $ac_cv_c_attr_align_try"
|
||||
AC_TRY_COMPILE([],
|
||||
[static char c __attribute__ ((aligned(${ac_cv_c_attr_align_try}))) = 0; return c;],
|
||||
[ac_cv_c_attribute_aligned="${ac_cv_c_attr_align_try}"])
|
||||
if test "$ac_cv_c_attribute_aligned" != 0; then
|
||||
break;
|
||||
fi
|
||||
done
|
||||
CFLAGS="${CFLAGS_save}"])
|
||||
if test "${ac_cv_c_attribute_aligned}" != "0"; then
|
||||
AC_DEFINE_UNQUOTED([ATTRIBUTE_ALIGNED_MAX],
|
||||
[${ac_cv_c_attribute_aligned}],[Maximum supported data alignment])
|
||||
fi
|
||||
dnl Checks for __attribute__(aligned()) directive need by libogg
|
||||
AC_CACHE_CHECK([__attribute__ ((aligned ())) support],
|
||||
[ac_cv_c_attribute_aligned],
|
||||
[ac_cv_c_attribute_aligned=0
|
||||
CFLAGS_save="${CFLAGS}"
|
||||
CFLAGS="${CFLAGS} -Werror"
|
||||
for ac_cv_c_attr_align_try in 64 32 16 8; do
|
||||
echo "trying $ac_cv_c_attr_align_try"
|
||||
AC_TRY_COMPILE([],
|
||||
[static char c __attribute__ ((aligned(${ac_cv_c_attr_align_try}))) = 0; return c;],
|
||||
[ac_cv_c_attribute_aligned="${ac_cv_c_attr_align_try}"])
|
||||
if test "$ac_cv_c_attribute_aligned" != 0; then
|
||||
break;
|
||||
fi
|
||||
done
|
||||
CFLAGS="${CFLAGS_save}"])
|
||||
if test "${ac_cv_c_attribute_aligned}" != "0"; then
|
||||
AC_DEFINE_UNQUOTED([ATTRIBUTE_ALIGNED_MAX],
|
||||
[${ac_cv_c_attribute_aligned}],[Maximum supported data alignment])
|
||||
fi
|
||||
|
||||
dnl ========================================================
|
||||
@ -5323,7 +5310,7 @@ AC_SUBST(MOZ_NATIVE_LIBVPX)
|
||||
AC_SUBST(MOZ_LIBVPX_CFLAGS)
|
||||
AC_SUBST(MOZ_LIBVPX_LIBS)
|
||||
|
||||
if test "$MOZ_WEBM" -o "$MOZ_OGG"; then
|
||||
if test "$MOZ_WEBM"; then
|
||||
if test "$MOZ_SAMPLE_TYPE_FLOAT32"; then
|
||||
MOZ_VORBIS=1
|
||||
else
|
||||
@ -5430,15 +5417,6 @@ dnl ========================================================
|
||||
dnl = Handle dependent MEDIA defines
|
||||
dnl ========================================================
|
||||
|
||||
if test -n "$MOZ_OPUS" -a -z "$MOZ_OGG"; then
|
||||
AC_MSG_ERROR([MOZ_OPUS requires MOZ_OGG which is disabled.])
|
||||
fi
|
||||
|
||||
if test -n "$MOZ_VORBIS" -a -z "$MOZ_OGG"; then
|
||||
AC_MSG_ERROR([MOZ_VORBIS requires MOZ_OGG which is disabled.
|
||||
Note that you need vorbis support for WebM playback.])
|
||||
fi
|
||||
|
||||
if test -n "$MOZ_VORBIS" -a -n "$MOZ_TREMOR"; then
|
||||
AC_MSG_ERROR([MOZ_VORBIS and MOZ_TREMOR are mutually exclusive! The build system should not allow them both to be set, but they are. Please file a bug at https://bugzilla.mozilla.org/])
|
||||
fi
|
||||
@ -8619,7 +8597,6 @@ AC_SUBST(MOZ_APPLEMEDIA)
|
||||
AC_SUBST(MOZ_OMX_PLUGIN)
|
||||
AC_SUBST(MOZ_VPX_ERROR_CONCEALMENT)
|
||||
AC_SUBST(MOZ_VPX)
|
||||
AC_SUBST(MOZ_OGG)
|
||||
AC_SUBST(VPX_AS)
|
||||
AC_SUBST(VPX_ASFLAGS)
|
||||
AC_SUBST(VPX_DASH_C_FLAG)
|
||||
|
@ -667,9 +667,9 @@ WebSocket::Init(JSContext* aCx,
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
unsigned lineno;
|
||||
JS::Rooted<JSScript*> script(aCx);
|
||||
if (JS_DescribeScriptedCaller(aCx, &script, &lineno)) {
|
||||
mScriptFile = JS_GetScriptFilename(aCx, script);
|
||||
JS::AutoFilename file;
|
||||
if (JS::DescribeScriptedCaller(aCx, &file, &lineno)) {
|
||||
mScriptFile = file.get();
|
||||
mScriptLine = lineno;
|
||||
}
|
||||
|
||||
|
@ -92,6 +92,8 @@
|
||||
|
||||
static NS_DEFINE_CID(kAppShellCID, NS_APPSHELL_CID);
|
||||
|
||||
static const char *kPrefJavaMIME = "plugin.java.mime";
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
|
||||
@ -902,6 +904,8 @@ nsObjectLoadingContent::InstantiatePluginInstance(bool aIsLoading)
|
||||
void
|
||||
nsObjectLoadingContent::NotifyOwnerDocumentActivityChanged()
|
||||
{
|
||||
// XXX(johns): We cannot touch plugins or run arbitrary script from this call,
|
||||
// as nsDocument is in a non-reentrant state.
|
||||
|
||||
// If we have a plugin we want to queue an event to stop it unless we are
|
||||
// moved into an active document before returning to the event loop.
|
||||
@ -1410,8 +1414,12 @@ nsObjectLoadingContent::UpdateObjectParameters(bool aJavaURI)
|
||||
///
|
||||
/// Initial MIME Type
|
||||
///
|
||||
|
||||
if (aJavaURI || thisContent->NodeInfo()->Equals(nsGkAtoms::applet)) {
|
||||
newMime.AssignLiteral("application/x-java-vm");
|
||||
nsAdoptingCString javaMIME = Preferences::GetCString(kPrefJavaMIME);
|
||||
newMime = javaMIME;
|
||||
NS_ASSERTION(nsPluginHost::IsJavaMIMEType(newMime.get()),
|
||||
"plugin.mime.java should be recognized by IsJavaMIMEType");
|
||||
isJava = true;
|
||||
} else {
|
||||
nsAutoString rawTypeAttr;
|
||||
@ -1432,9 +1440,12 @@ nsObjectLoadingContent::UpdateObjectParameters(bool aJavaURI)
|
||||
thisContent->GetAttr(kNameSpaceID_None, nsGkAtoms::classid, classIDAttr);
|
||||
if (!classIDAttr.IsEmpty()) {
|
||||
// Our classid support is limited to 'java:' ids
|
||||
nsAdoptingCString javaMIME = Preferences::GetCString(kPrefJavaMIME);
|
||||
NS_ASSERTION(nsPluginHost::IsJavaMIMEType(javaMIME.get()),
|
||||
"plugin.mime.java should be recognized by IsJavaMIMEType");
|
||||
if (StringBeginsWith(classIDAttr, NS_LITERAL_STRING("java:")) &&
|
||||
PluginExistsForType("application/x-java-vm")) {
|
||||
newMime.Assign("application/x-java-vm");
|
||||
PluginExistsForType(javaMIME)) {
|
||||
newMime = javaMIME;
|
||||
isJava = true;
|
||||
} else {
|
||||
// XXX(johns): Our de-facto behavior since forever was to refuse to load
|
||||
|
@ -615,13 +615,14 @@ CanvasRenderingContext2D::ParseColor(const nsAString& aString,
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifdef ACCESSIBILITY
|
||||
PLDHashOperator
|
||||
CanvasRenderingContext2D::RemoveHitRegionProperty(RegionInfo* aEntry, void*)
|
||||
{
|
||||
aEntry->mElement->DeleteProperty(nsGkAtoms::hitregion);
|
||||
return PL_DHASH_NEXT;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
nsresult
|
||||
CanvasRenderingContext2D::Reset()
|
||||
@ -639,7 +640,9 @@ CanvasRenderingContext2D::Reset()
|
||||
mTarget = nullptr;
|
||||
|
||||
// reset hit regions
|
||||
#ifdef ACCESSIBILITY
|
||||
mHitRegionsOptions.EnumerateEntries(RemoveHitRegionProperty, nullptr);
|
||||
#endif
|
||||
mHitRegionsOptions.Clear();
|
||||
|
||||
// Since the target changes the backing texture will change, and this will
|
||||
@ -2367,6 +2370,7 @@ CanvasRenderingContext2D::MeasureText(const nsAString& rawText,
|
||||
return new TextMetrics(width);
|
||||
}
|
||||
|
||||
#ifdef ACCESSIBILITY
|
||||
// Callback function, for freeing hit regions bounds values stored in property table
|
||||
static void
|
||||
ReleaseBBoxPropertyValue(void* aObject, /* unused */
|
||||
@ -2378,6 +2382,7 @@ ReleaseBBoxPropertyValue(void* aObject, /* unused */
|
||||
static_cast<nsRect*>(aPropertyValue);
|
||||
delete valPtr;
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
CanvasRenderingContext2D::AddHitRegion(const HitRegionOptions& options, ErrorResult& error)
|
||||
@ -2413,6 +2418,7 @@ CanvasRenderingContext2D::AddHitRegion(const HitRegionOptions& options, ErrorRes
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef ACCESSIBILITY
|
||||
if (isDescendant) {
|
||||
nsRect* nsBounds = new nsRect();
|
||||
gfxRect rect(bounds.x, bounds.y, bounds.width, bounds.height);
|
||||
@ -2421,6 +2427,7 @@ CanvasRenderingContext2D::AddHitRegion(const HitRegionOptions& options, ErrorRes
|
||||
options.mControl->SetProperty(nsGkAtoms::hitregion, nsBounds,
|
||||
ReleaseBBoxPropertyValue);
|
||||
}
|
||||
#endif
|
||||
|
||||
// finally, add the region to the list if it has an ID
|
||||
if (options.mId.Length() != 0) {
|
||||
@ -2436,7 +2443,9 @@ CanvasRenderingContext2D::RemoveHitRegion(const nsAString& id)
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef ACCESSIBILITY
|
||||
info->mElement->DeleteProperty(nsGkAtoms::hitregion);
|
||||
#endif
|
||||
mHitRegionsOptions.RemoveEntry(id);
|
||||
}
|
||||
|
||||
|
@ -702,7 +702,9 @@ protected:
|
||||
nsRefPtr<Element> mElement;
|
||||
};
|
||||
|
||||
#ifdef ACCESSIBILITY
|
||||
static PLDHashOperator RemoveHitRegionProperty(RegionInfo* aEntry, void* aData);
|
||||
#endif
|
||||
nsTHashtable<RegionInfo> mHitRegionsOptions;
|
||||
|
||||
/**
|
||||
|
@ -1,12 +0,0 @@
|
||||
#
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
libs::
|
||||
$(TAR) -cf - -C $(srcdir) \
|
||||
resources \
|
||||
conformance \
|
||||
| $(TAR) -xf - -C $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
|
@ -13,7 +13,8 @@ upstream and should not be modified without corresponding upstream fixes and/or
|
||||
patch file in this directory. The exceptions (the Mozilla-specific files) are:
|
||||
* README.mozilla (this file)
|
||||
* failing_tests_*.txt
|
||||
* Makefile.in
|
||||
* moz.build
|
||||
* writemanifest.py
|
||||
* *.patch files, if any
|
||||
|
||||
How to do an update:
|
||||
@ -25,4 +26,5 @@ How to do an update:
|
||||
determines with tests to run, as some tests are only enabled in some not-yet-released
|
||||
version.
|
||||
4. reapply local patches.
|
||||
5. update this readme and the .patch files
|
||||
5. update this readme and the .patch files.
|
||||
6. run writemanifest.py to update test manifest.
|
||||
|
473
content/canvas/test/webgl/mochitest-conformance-files.ini
Normal file
473
content/canvas/test/webgl/mochitest-conformance-files.ini
Normal file
@ -0,0 +1,473 @@
|
||||
[DEFAULT]
|
||||
support-files =
|
||||
conformance/00_readme.txt
|
||||
conformance/00_test_list.txt
|
||||
conformance/LICENSE_CHROMIUM
|
||||
conformance/attribs/00_test_list.txt
|
||||
conformance/attribs/gl-enable-vertex-attrib.html
|
||||
conformance/attribs/gl-vertex-attrib-zero-issues.html
|
||||
conformance/attribs/gl-vertex-attrib.html
|
||||
conformance/attribs/gl-vertexattribpointer-offsets.html
|
||||
conformance/attribs/gl-vertexattribpointer.html
|
||||
conformance/buffers/00_test_list.txt
|
||||
conformance/buffers/buffer-bind-test.html
|
||||
conformance/buffers/buffer-data-array-buffer.html
|
||||
conformance/buffers/index-validation-copies-indices.html
|
||||
conformance/buffers/index-validation-crash-with-buffer-sub-data.html
|
||||
conformance/buffers/index-validation-verifies-too-many-indices.html
|
||||
conformance/buffers/index-validation-with-resized-buffer.html
|
||||
conformance/buffers/index-validation.html
|
||||
conformance/canvas/00_test_list.txt
|
||||
conformance/canvas/buffer-offscreen-test.html
|
||||
conformance/canvas/buffer-preserve-test.html
|
||||
conformance/canvas/canvas-test.html
|
||||
conformance/canvas/canvas-zero-size.html
|
||||
conformance/canvas/drawingbuffer-static-canvas-test.html
|
||||
conformance/canvas/drawingbuffer-test.html
|
||||
conformance/canvas/viewport-unchanged-upon-resize.html
|
||||
conformance/context/00_test_list.txt
|
||||
conformance/context/constants.html
|
||||
conformance/context/context-attribute-preserve-drawing-buffer.html
|
||||
conformance/context/context-attributes-alpha-depth-stencil-antialias.html
|
||||
conformance/context/context-lost-restored.html
|
||||
conformance/context/context-lost.html
|
||||
conformance/context/context-type-test.html
|
||||
conformance/context/incorrect-context-object-behaviour.html
|
||||
conformance/context/methods.html
|
||||
conformance/context/premultiplyalpha-test.html
|
||||
conformance/context/resource-sharing-test.html
|
||||
conformance/extensions/00_test_list.txt
|
||||
conformance/extensions/ext-sRGB.html
|
||||
conformance/extensions/ext-texture-filter-anisotropic.html
|
||||
conformance/extensions/oes-standard-derivatives.html
|
||||
conformance/extensions/oes-texture-float.html
|
||||
conformance/extensions/oes-vertex-array-object.html
|
||||
conformance/extensions/webgl-compressed-texture-s3tc.html
|
||||
conformance/extensions/webgl-debug-renderer-info.html
|
||||
conformance/extensions/webgl-debug-shaders.html
|
||||
conformance/extensions/webgl-depth-texture.html
|
||||
conformance/glsl/00_test_list.txt
|
||||
conformance/glsl/functions/00_test_list.txt
|
||||
conformance/glsl/functions/glsl-function-abs.html
|
||||
conformance/glsl/functions/glsl-function-acos.html
|
||||
conformance/glsl/functions/glsl-function-asin.html
|
||||
conformance/glsl/functions/glsl-function-atan-xy.html
|
||||
conformance/glsl/functions/glsl-function-atan.html
|
||||
conformance/glsl/functions/glsl-function-ceil.html
|
||||
conformance/glsl/functions/glsl-function-clamp-float.html
|
||||
conformance/glsl/functions/glsl-function-clamp-gentype.html
|
||||
conformance/glsl/functions/glsl-function-cos.html
|
||||
conformance/glsl/functions/glsl-function-cross.html
|
||||
conformance/glsl/functions/glsl-function-distance.html
|
||||
conformance/glsl/functions/glsl-function-dot.html
|
||||
conformance/glsl/functions/glsl-function-faceforward.html
|
||||
conformance/glsl/functions/glsl-function-floor.html
|
||||
conformance/glsl/functions/glsl-function-fract.html
|
||||
conformance/glsl/functions/glsl-function-length.html
|
||||
conformance/glsl/functions/glsl-function-lessThan.html
|
||||
conformance/glsl/functions/glsl-function-max-float.html
|
||||
conformance/glsl/functions/glsl-function-max-gentype.html
|
||||
conformance/glsl/functions/glsl-function-min-float.html
|
||||
conformance/glsl/functions/glsl-function-min-gentype.html
|
||||
conformance/glsl/functions/glsl-function-mix-float.html
|
||||
conformance/glsl/functions/glsl-function-mix-gentype.html
|
||||
conformance/glsl/functions/glsl-function-mod-float.html
|
||||
conformance/glsl/functions/glsl-function-mod-gentype.html
|
||||
conformance/glsl/functions/glsl-function-normalize.html
|
||||
conformance/glsl/functions/glsl-function-reflect.html
|
||||
conformance/glsl/functions/glsl-function-refract.html
|
||||
conformance/glsl/functions/glsl-function-sign.html
|
||||
conformance/glsl/functions/glsl-function-sin.html
|
||||
conformance/glsl/functions/glsl-function-smoothstep-float.html
|
||||
conformance/glsl/functions/glsl-function-smoothstep-gentype.html
|
||||
conformance/glsl/functions/glsl-function-step-float.html
|
||||
conformance/glsl/functions/glsl-function-step-gentype.html
|
||||
conformance/glsl/functions/glsl-function.html
|
||||
conformance/glsl/implicit/00_test_list.txt
|
||||
conformance/glsl/implicit/add_int_float.vert.html
|
||||
conformance/glsl/implicit/add_int_mat2.vert.html
|
||||
conformance/glsl/implicit/add_int_mat3.vert.html
|
||||
conformance/glsl/implicit/add_int_mat4.vert.html
|
||||
conformance/glsl/implicit/add_int_vec2.vert.html
|
||||
conformance/glsl/implicit/add_int_vec3.vert.html
|
||||
conformance/glsl/implicit/add_int_vec4.vert.html
|
||||
conformance/glsl/implicit/add_ivec2_vec2.vert.html
|
||||
conformance/glsl/implicit/add_ivec3_vec3.vert.html
|
||||
conformance/glsl/implicit/add_ivec4_vec4.vert.html
|
||||
conformance/glsl/implicit/assign_int_to_float.vert.html
|
||||
conformance/glsl/implicit/assign_ivec2_to_vec2.vert.html
|
||||
conformance/glsl/implicit/assign_ivec3_to_vec3.vert.html
|
||||
conformance/glsl/implicit/assign_ivec4_to_vec4.vert.html
|
||||
conformance/glsl/implicit/construct_struct.vert.html
|
||||
conformance/glsl/implicit/divide_int_float.vert.html
|
||||
conformance/glsl/implicit/divide_int_mat2.vert.html
|
||||
conformance/glsl/implicit/divide_int_mat3.vert.html
|
||||
conformance/glsl/implicit/divide_int_mat4.vert.html
|
||||
conformance/glsl/implicit/divide_int_vec2.vert.html
|
||||
conformance/glsl/implicit/divide_int_vec3.vert.html
|
||||
conformance/glsl/implicit/divide_int_vec4.vert.html
|
||||
conformance/glsl/implicit/divide_ivec2_vec2.vert.html
|
||||
conformance/glsl/implicit/divide_ivec3_vec3.vert.html
|
||||
conformance/glsl/implicit/divide_ivec4_vec4.vert.html
|
||||
conformance/glsl/implicit/equal_int_float.vert.html
|
||||
conformance/glsl/implicit/equal_ivec2_vec2.vert.html
|
||||
conformance/glsl/implicit/equal_ivec3_vec3.vert.html
|
||||
conformance/glsl/implicit/equal_ivec4_vec4.vert.html
|
||||
conformance/glsl/implicit/function_int_float.vert.html
|
||||
conformance/glsl/implicit/function_ivec2_vec2.vert.html
|
||||
conformance/glsl/implicit/function_ivec3_vec3.vert.html
|
||||
conformance/glsl/implicit/function_ivec4_vec4.vert.html
|
||||
conformance/glsl/implicit/greater_than.vert.html
|
||||
conformance/glsl/implicit/greater_than_equal.vert.html
|
||||
conformance/glsl/implicit/less_than.vert.html
|
||||
conformance/glsl/implicit/less_than_equal.vert.html
|
||||
conformance/glsl/implicit/multiply_int_float.vert.html
|
||||
conformance/glsl/implicit/multiply_int_mat2.vert.html
|
||||
conformance/glsl/implicit/multiply_int_mat3.vert.html
|
||||
conformance/glsl/implicit/multiply_int_mat4.vert.html
|
||||
conformance/glsl/implicit/multiply_int_vec2.vert.html
|
||||
conformance/glsl/implicit/multiply_int_vec3.vert.html
|
||||
conformance/glsl/implicit/multiply_int_vec4.vert.html
|
||||
conformance/glsl/implicit/multiply_ivec2_vec2.vert.html
|
||||
conformance/glsl/implicit/multiply_ivec3_vec3.vert.html
|
||||
conformance/glsl/implicit/multiply_ivec4_vec4.vert.html
|
||||
conformance/glsl/implicit/not_equal_int_float.vert.html
|
||||
conformance/glsl/implicit/not_equal_ivec2_vec2.vert.html
|
||||
conformance/glsl/implicit/not_equal_ivec3_vec3.vert.html
|
||||
conformance/glsl/implicit/not_equal_ivec4_vec4.vert.html
|
||||
conformance/glsl/implicit/subtract_int_float.vert.html
|
||||
conformance/glsl/implicit/subtract_int_mat2.vert.html
|
||||
conformance/glsl/implicit/subtract_int_mat3.vert.html
|
||||
conformance/glsl/implicit/subtract_int_mat4.vert.html
|
||||
conformance/glsl/implicit/subtract_int_vec2.vert.html
|
||||
conformance/glsl/implicit/subtract_int_vec3.vert.html
|
||||
conformance/glsl/implicit/subtract_int_vec4.vert.html
|
||||
conformance/glsl/implicit/subtract_ivec2_vec2.vert.html
|
||||
conformance/glsl/implicit/subtract_ivec3_vec3.vert.html
|
||||
conformance/glsl/implicit/subtract_ivec4_vec4.vert.html
|
||||
conformance/glsl/implicit/ternary_int_float.vert.html
|
||||
conformance/glsl/implicit/ternary_ivec2_vec2.vert.html
|
||||
conformance/glsl/implicit/ternary_ivec3_vec3.vert.html
|
||||
conformance/glsl/implicit/ternary_ivec4_vec4.vert.html
|
||||
conformance/glsl/matrices/00_test_list.txt
|
||||
conformance/glsl/matrices/glsl-mat4-to-mat3.html
|
||||
conformance/glsl/misc/00_test_list.txt
|
||||
conformance/glsl/misc/attrib-location-length-limits.html
|
||||
conformance/glsl/misc/embedded-struct-definitions-forbidden.html
|
||||
conformance/glsl/misc/glsl-2types-of-textures-on-same-unit.html
|
||||
conformance/glsl/misc/glsl-function-nodes.html
|
||||
conformance/glsl/misc/glsl-long-variable-names.html
|
||||
conformance/glsl/misc/glsl-vertex-branch.html
|
||||
conformance/glsl/misc/include.vs
|
||||
conformance/glsl/misc/non-ascii-comments.vert.html
|
||||
conformance/glsl/misc/non-ascii.vert.html
|
||||
conformance/glsl/misc/re-compile-re-link.html
|
||||
conformance/glsl/misc/shader-with-256-character-identifier.frag.html
|
||||
conformance/glsl/misc/shader-with-257-character-identifier.frag.html
|
||||
conformance/glsl/misc/shader-with-_webgl-identifier.vert.html
|
||||
conformance/glsl/misc/shader-with-arbitrary-indexing.frag.html
|
||||
conformance/glsl/misc/shader-with-arbitrary-indexing.vert.html
|
||||
conformance/glsl/misc/shader-with-attrib-array.vert.html
|
||||
conformance/glsl/misc/shader-with-attrib-struct.vert.html
|
||||
conformance/glsl/misc/shader-with-clipvertex.vert.html
|
||||
conformance/glsl/misc/shader-with-comma-assignment.html
|
||||
conformance/glsl/misc/shader-with-comma-conditional-assignment.html
|
||||
conformance/glsl/misc/shader-with-conditional-scoping.html
|
||||
conformance/glsl/misc/shader-with-default-precision.frag.html
|
||||
conformance/glsl/misc/shader-with-default-precision.vert.html
|
||||
conformance/glsl/misc/shader-with-define-line-continuation.frag.html
|
||||
conformance/glsl/misc/shader-with-dfdx-no-ext.frag.html
|
||||
conformance/glsl/misc/shader-with-dfdx.frag.html
|
||||
conformance/glsl/misc/shader-with-do-scoping.html
|
||||
conformance/glsl/misc/shader-with-error-directive.html
|
||||
conformance/glsl/misc/shader-with-explicit-int-cast.vert.html
|
||||
conformance/glsl/misc/shader-with-float-return-value.frag.html
|
||||
conformance/glsl/misc/shader-with-for-loop.html
|
||||
conformance/glsl/misc/shader-with-for-scoping.html
|
||||
conformance/glsl/misc/shader-with-frag-depth.frag.html
|
||||
conformance/glsl/misc/shader-with-function-recursion.frag.html
|
||||
conformance/glsl/misc/shader-with-function-scoped-struct.html
|
||||
conformance/glsl/misc/shader-with-functional-scoping.html
|
||||
conformance/glsl/misc/shader-with-glcolor.vert.html
|
||||
conformance/glsl/misc/shader-with-gles-1.frag.html
|
||||
conformance/glsl/misc/shader-with-gles-symbol.frag.html
|
||||
conformance/glsl/misc/shader-with-glprojectionmatrix.vert.html
|
||||
conformance/glsl/misc/shader-with-hex-int-constant-macro.html
|
||||
conformance/glsl/misc/shader-with-implicit-vec3-to-vec4-cast.vert.html
|
||||
conformance/glsl/misc/shader-with-include.vert.html
|
||||
conformance/glsl/misc/shader-with-int-return-value.frag.html
|
||||
conformance/glsl/misc/shader-with-invalid-identifier.frag.html
|
||||
conformance/glsl/misc/shader-with-ivec2-return-value.frag.html
|
||||
conformance/glsl/misc/shader-with-ivec3-return-value.frag.html
|
||||
conformance/glsl/misc/shader-with-ivec4-return-value.frag.html
|
||||
conformance/glsl/misc/shader-with-limited-indexing.frag.html
|
||||
conformance/glsl/misc/shader-with-line-directive.html
|
||||
conformance/glsl/misc/shader-with-long-line.html
|
||||
conformance/glsl/misc/shader-with-non-ascii-error.frag.html
|
||||
conformance/glsl/misc/shader-with-precision.frag.html
|
||||
conformance/glsl/misc/shader-with-quoted-error.frag.html
|
||||
conformance/glsl/misc/shader-with-undefined-preprocessor-symbol.frag.html
|
||||
conformance/glsl/misc/shader-with-uniform-in-loop-condition.vert.html
|
||||
conformance/glsl/misc/shader-with-vec2-return-value.frag.html
|
||||
conformance/glsl/misc/shader-with-vec3-return-value.frag.html
|
||||
conformance/glsl/misc/shader-with-vec4-return-value.frag.html
|
||||
conformance/glsl/misc/shader-with-vec4-vec3-vec4-conditional.html
|
||||
conformance/glsl/misc/shader-with-version-100.frag.html
|
||||
conformance/glsl/misc/shader-with-version-100.vert.html
|
||||
conformance/glsl/misc/shader-with-version-120.vert.html
|
||||
conformance/glsl/misc/shader-with-version-130.vert.html
|
||||
conformance/glsl/misc/shader-with-webgl-identifier.vert.html
|
||||
conformance/glsl/misc/shader-without-precision.frag.html
|
||||
conformance/glsl/misc/shared.html
|
||||
conformance/glsl/misc/struct-nesting-exceeds-maximum.html
|
||||
conformance/glsl/misc/struct-nesting-under-maximum.html
|
||||
conformance/glsl/misc/uniform-location-length-limits.html
|
||||
conformance/glsl/reserved/00_test_list.txt
|
||||
conformance/glsl/reserved/_webgl_field.vert.html
|
||||
conformance/glsl/reserved/_webgl_function.vert.html
|
||||
conformance/glsl/reserved/_webgl_struct.vert.html
|
||||
conformance/glsl/reserved/_webgl_variable.vert.html
|
||||
conformance/glsl/reserved/webgl_field.vert.html
|
||||
conformance/glsl/reserved/webgl_function.vert.html
|
||||
conformance/glsl/reserved/webgl_struct.vert.html
|
||||
conformance/glsl/reserved/webgl_variable.vert.html
|
||||
conformance/glsl/samplers/00_test_list.txt
|
||||
conformance/glsl/samplers/glsl-function-texture2d-bias.html
|
||||
conformance/glsl/samplers/glsl-function-texture2dlod.html
|
||||
conformance/glsl/samplers/glsl-function-texture2dproj.html
|
||||
conformance/glsl/variables/00_test_list.txt
|
||||
conformance/glsl/variables/gl-fragcoord.html
|
||||
conformance/glsl/variables/gl-frontfacing.html
|
||||
conformance/glsl/variables/gl-pointcoord.html
|
||||
conformance/limits/00_test_list.txt
|
||||
conformance/limits/gl-max-texture-dimensions.html
|
||||
conformance/limits/gl-min-attribs.html
|
||||
conformance/limits/gl-min-textures.html
|
||||
conformance/limits/gl-min-uniforms.html
|
||||
conformance/misc/00_test_list.txt
|
||||
conformance/misc/bad-arguments-test.html
|
||||
conformance/misc/delayed-drawing.html
|
||||
conformance/misc/error-reporting.html
|
||||
conformance/misc/functions-returning-strings.html
|
||||
conformance/misc/instanceof-test.html
|
||||
conformance/misc/invalid-passed-params.html
|
||||
conformance/misc/is-object.html
|
||||
conformance/misc/null-object-behaviour.html
|
||||
conformance/misc/object-deletion-behaviour.html
|
||||
conformance/misc/shader-precision-format.html
|
||||
conformance/misc/type-conversion-test.html
|
||||
conformance/misc/uninitialized-test.html
|
||||
conformance/misc/webgl-specific.html
|
||||
conformance/more/00_test_list.txt
|
||||
conformance/more/README.md
|
||||
conformance/more/all_tests.html
|
||||
conformance/more/all_tests_linkonly.html
|
||||
conformance/more/all_tests_sequential.html
|
||||
conformance/more/conformance/argGenerators-A.js
|
||||
conformance/more/conformance/argGenerators-B1.js
|
||||
conformance/more/conformance/argGenerators-B2.js
|
||||
conformance/more/conformance/argGenerators-B3.js
|
||||
conformance/more/conformance/argGenerators-B4.js
|
||||
conformance/more/conformance/argGenerators-C.js
|
||||
conformance/more/conformance/argGenerators-D_G.js
|
||||
conformance/more/conformance/argGenerators-G_I.js
|
||||
conformance/more/conformance/argGenerators-L_S.js
|
||||
conformance/more/conformance/argGenerators-S_V.js
|
||||
conformance/more/conformance/badArgsArityLessThanArgc.html
|
||||
conformance/more/conformance/constants.html
|
||||
conformance/more/conformance/fuzzTheAPI.html
|
||||
conformance/more/conformance/getContext.html
|
||||
conformance/more/conformance/methods.html
|
||||
conformance/more/conformance/quickCheckAPI-A.html
|
||||
conformance/more/conformance/quickCheckAPI-B1.html
|
||||
conformance/more/conformance/quickCheckAPI-B2.html
|
||||
conformance/more/conformance/quickCheckAPI-B3.html
|
||||
conformance/more/conformance/quickCheckAPI-B4.html
|
||||
conformance/more/conformance/quickCheckAPI-C.html
|
||||
conformance/more/conformance/quickCheckAPI-D_G.html
|
||||
conformance/more/conformance/quickCheckAPI-G_I.html
|
||||
conformance/more/conformance/quickCheckAPI-L_S.html
|
||||
conformance/more/conformance/quickCheckAPI-S_V.html
|
||||
conformance/more/conformance/quickCheckAPI.js
|
||||
conformance/more/conformance/quickCheckAPIBadArgs.html
|
||||
conformance/more/conformance/webGLArrays.html
|
||||
conformance/more/demos/opengl_web.html
|
||||
conformance/more/demos/video.html
|
||||
conformance/more/functions/bindBuffer.html
|
||||
conformance/more/functions/bindBufferBadArgs.html
|
||||
conformance/more/functions/bindFramebufferLeaveNonZero.html
|
||||
conformance/more/functions/bufferData.html
|
||||
conformance/more/functions/bufferDataBadArgs.html
|
||||
conformance/more/functions/bufferSubData.html
|
||||
conformance/more/functions/bufferSubDataBadArgs.html
|
||||
conformance/more/functions/copyTexImage2D.html
|
||||
conformance/more/functions/copyTexImage2DBadArgs.html
|
||||
conformance/more/functions/copyTexSubImage2D.html
|
||||
conformance/more/functions/copyTexSubImage2DBadArgs.html
|
||||
conformance/more/functions/deleteBufferBadArgs.html
|
||||
conformance/more/functions/drawArrays.html
|
||||
conformance/more/functions/drawArraysOutOfBounds.html
|
||||
conformance/more/functions/drawElements.html
|
||||
conformance/more/functions/drawElementsBadArgs.html
|
||||
conformance/more/functions/isTests.html
|
||||
conformance/more/functions/readPixels.html
|
||||
conformance/more/functions/readPixelsBadArgs.html
|
||||
conformance/more/functions/texImage2D.html
|
||||
conformance/more/functions/texImage2DBadArgs.html
|
||||
conformance/more/functions/texImage2DHTML.html
|
||||
conformance/more/functions/texImage2DHTMLBadArgs.html
|
||||
conformance/more/functions/texSubImage2D.html
|
||||
conformance/more/functions/texSubImage2DBadArgs.html
|
||||
conformance/more/functions/texSubImage2DHTML.html
|
||||
conformance/more/functions/texSubImage2DHTMLBadArgs.html
|
||||
conformance/more/functions/uniformMatrix.html
|
||||
conformance/more/functions/uniformMatrixBadArgs.html
|
||||
conformance/more/functions/uniformf.html
|
||||
conformance/more/functions/uniformfArrayLen1.html
|
||||
conformance/more/functions/uniformfBadArgs.html
|
||||
conformance/more/functions/uniformi.html
|
||||
conformance/more/functions/uniformiBadArgs.html
|
||||
conformance/more/functions/vertexAttrib.html
|
||||
conformance/more/functions/vertexAttribBadArgs.html
|
||||
conformance/more/functions/vertexAttribPointer.html
|
||||
conformance/more/functions/vertexAttribPointerBadArgs.html
|
||||
conformance/more/glsl/arrayOutOfBounds.html
|
||||
conformance/more/glsl/longLoops.html
|
||||
conformance/more/glsl/uniformOutOfBounds.html
|
||||
conformance/more/glsl/unusedAttribsUniforms.html
|
||||
conformance/more/index.html
|
||||
conformance/more/performance/CPUvsGPU.html
|
||||
conformance/more/performance/bandwidth.html
|
||||
conformance/more/performance/jsGCPause.html
|
||||
conformance/more/performance/jsMatrixMult.html
|
||||
conformance/more/performance/jsToGLOverhead.html
|
||||
conformance/more/unit.css
|
||||
conformance/more/unit.js
|
||||
conformance/more/util.js
|
||||
conformance/programs/00_test_list.txt
|
||||
conformance/programs/get-active-test.html
|
||||
conformance/programs/gl-bind-attrib-location-test.html
|
||||
conformance/programs/gl-get-active-attribute.html
|
||||
conformance/programs/gl-get-active-uniform.html
|
||||
conformance/programs/gl-getshadersource.html
|
||||
conformance/programs/gl-shader-test.html
|
||||
conformance/programs/invalid-UTF-16.html
|
||||
conformance/programs/program-test.html
|
||||
conformance/reading/00_test_list.txt
|
||||
conformance/reading/read-pixels-pack-alignment.html
|
||||
conformance/reading/read-pixels-test.html
|
||||
conformance/renderbuffers/00_test_list.txt
|
||||
conformance/renderbuffers/framebuffer-object-attachment.html
|
||||
conformance/renderbuffers/framebuffer-test.html
|
||||
conformance/renderbuffers/renderbuffer-initialization.html
|
||||
conformance/rendering/00_test_list.txt
|
||||
conformance/rendering/draw-arrays-out-of-bounds.html
|
||||
conformance/rendering/draw-elements-out-of-bounds.html
|
||||
conformance/rendering/gl-clear.html
|
||||
conformance/rendering/gl-drawelements.html
|
||||
conformance/rendering/gl-scissor-test.html
|
||||
conformance/rendering/line-loop-tri-fan.html
|
||||
conformance/rendering/more-than-65536-indices.html
|
||||
conformance/rendering/point-size.html
|
||||
conformance/rendering/triangle.html
|
||||
conformance/resources/3x3.png
|
||||
conformance/resources/blue-1x1.jpg
|
||||
conformance/resources/boolUniformShader.vert
|
||||
conformance/resources/bug-32888-texture.png
|
||||
conformance/resources/floatUniformShader.vert
|
||||
conformance/resources/fragmentShader.frag
|
||||
conformance/resources/glsl-conformance-test.js
|
||||
conformance/resources/glsl-feature-tests.css
|
||||
conformance/resources/glsl-generator.js
|
||||
conformance/resources/gray-ramp-256-with-128-alpha.png
|
||||
conformance/resources/gray-ramp-256.png
|
||||
conformance/resources/gray-ramp-default-gamma.png
|
||||
conformance/resources/gray-ramp-gamma0.1.png
|
||||
conformance/resources/gray-ramp-gamma1.0.png
|
||||
conformance/resources/gray-ramp-gamma2.0.png
|
||||
conformance/resources/gray-ramp-gamma4.0.png
|
||||
conformance/resources/gray-ramp-gamma9.0.png
|
||||
conformance/resources/gray-ramp.png
|
||||
conformance/resources/green-2x2-16bit.png
|
||||
conformance/resources/intArrayUniformShader.vert
|
||||
conformance/resources/intUniformShader.vert
|
||||
conformance/resources/matUniformShader.vert
|
||||
conformance/resources/noopUniformShader.frag
|
||||
conformance/resources/noopUniformShader.vert
|
||||
conformance/resources/npot-video.mp4
|
||||
conformance/resources/npot-video.theora.ogv
|
||||
conformance/resources/npot-video.webmvp8.webm
|
||||
conformance/resources/pnglib.js
|
||||
conformance/resources/red-green.mp4
|
||||
conformance/resources/red-green.png
|
||||
conformance/resources/red-green.theora.ogv
|
||||
conformance/resources/red-green.webmvp8.webm
|
||||
conformance/resources/red-indexed.png
|
||||
conformance/resources/samplerUniformShader.frag
|
||||
conformance/resources/small-square-with-cie-rgb-profile.png
|
||||
conformance/resources/small-square-with-colormatch-profile.png
|
||||
conformance/resources/small-square-with-colorspin-profile.jpg
|
||||
conformance/resources/small-square-with-colorspin-profile.png
|
||||
conformance/resources/small-square-with-e-srgb-profile.png
|
||||
conformance/resources/small-square-with-smpte-c-profile.png
|
||||
conformance/resources/small-square-with-srgb-iec61966-2.1-profile.png
|
||||
conformance/resources/structUniformShader.vert
|
||||
conformance/resources/vertexShader.vert
|
||||
conformance/resources/webgl-test-utils.js
|
||||
conformance/resources/webgl-test.js
|
||||
conformance/resources/zero-alpha.png
|
||||
conformance/state/00_test_list.txt
|
||||
conformance/state/gl-enable-enum-test.html
|
||||
conformance/state/gl-enum-tests.html
|
||||
conformance/state/gl-get-calls.html
|
||||
conformance/state/gl-geterror.html
|
||||
conformance/state/gl-getstring.html
|
||||
conformance/state/gl-object-get-calls.html
|
||||
conformance/textures/00_test_list.txt
|
||||
conformance/textures/compressed-tex-image.html
|
||||
conformance/textures/copy-tex-image-and-sub-image-2d.html
|
||||
conformance/textures/gl-pixelstorei.html
|
||||
conformance/textures/gl-teximage.html
|
||||
conformance/textures/origin-clean-conformance.html
|
||||
conformance/textures/tex-image-and-sub-image-2d-with-array-buffer-view.html
|
||||
conformance/textures/tex-image-and-sub-image-2d-with-canvas.html
|
||||
conformance/textures/tex-image-and-sub-image-2d-with-image-data.html
|
||||
conformance/textures/tex-image-and-sub-image-2d-with-image.html
|
||||
conformance/textures/tex-image-and-sub-image-2d-with-video.html
|
||||
conformance/textures/tex-image-and-uniform-binding-bugs.html
|
||||
conformance/textures/tex-image-with-format-and-type.html
|
||||
conformance/textures/tex-image-with-invalid-data.html
|
||||
conformance/textures/tex-input-validation.html
|
||||
conformance/textures/tex-sub-image-2d-bad-args.html
|
||||
conformance/textures/tex-sub-image-2d.html
|
||||
conformance/textures/texparameter-test.html
|
||||
conformance/textures/texture-active-bind-2.html
|
||||
conformance/textures/texture-active-bind.html
|
||||
conformance/textures/texture-clear.html
|
||||
conformance/textures/texture-complete.html
|
||||
conformance/textures/texture-formats-test.html
|
||||
conformance/textures/texture-mips.html
|
||||
conformance/textures/texture-npot-video.html
|
||||
conformance/textures/texture-npot.html
|
||||
conformance/textures/texture-size-cube-maps.html
|
||||
conformance/textures/texture-size.html
|
||||
conformance/textures/texture-transparent-pixels-initialized.html
|
||||
conformance/typedarrays/00_test_list.txt
|
||||
conformance/typedarrays/array-buffer-crash.html
|
||||
conformance/typedarrays/array-buffer-view-crash.html
|
||||
conformance/typedarrays/array-unit-tests.html
|
||||
conformance/uniforms/00_test_list.txt
|
||||
conformance/uniforms/gl-uniform-arrays.html
|
||||
conformance/uniforms/gl-uniform-bool.html
|
||||
conformance/uniforms/gl-uniformmatrix4fv.html
|
||||
conformance/uniforms/gl-unknown-uniform.html
|
||||
conformance/uniforms/null-uniform-location.html
|
||||
conformance/uniforms/uniform-location.html
|
||||
conformance/uniforms/uniform-samplers-test.html
|
||||
resources/desktop-gl-constants.js
|
||||
resources/js-test-pre.js
|
||||
resources/js-test-style.css
|
||||
resources/opengl_logo.jpg
|
||||
resources/thunderbird-logo-64x64.png
|
||||
resources/webgl-logo.png
|
||||
resources/webgl-test-harness.js
|
@ -4,7 +4,8 @@
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
DIRS += ['non-conf-tests']
|
||||
|
||||
MOCHITEST_MANIFESTS += ['mochitest.ini']
|
||||
|
||||
MOCHITEST_MANIFESTS += [
|
||||
'mochitest-conformance-files.ini',
|
||||
'mochitest.ini',
|
||||
'non-conf-tests/mochitest.ini',
|
||||
]
|
||||
|
37
content/canvas/test/webgl/writemanifest.py
Normal file
37
content/canvas/test/webgl/writemanifest.py
Normal file
@ -0,0 +1,37 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
#
|
||||
# Write a Mochitest manifest for WebGL conformance test files.
|
||||
|
||||
import os
|
||||
from itertools import chain
|
||||
|
||||
CONFORMANCE_DIRS = [
|
||||
"conformance",
|
||||
"resources",
|
||||
]
|
||||
|
||||
def listfiles(dir, rel):
|
||||
"""List all files in dir recursively, yielding paths
|
||||
relative to rel.
|
||||
"""
|
||||
for root, folders, files in os.walk(dir):
|
||||
for f in files:
|
||||
yield os.path.relpath(os.path.join(root, f), rel)
|
||||
|
||||
def writemanifest():
|
||||
script_dir = os.path.dirname(__file__)
|
||||
list_dirs = [os.path.join(script_dir, d) for d in CONFORMANCE_DIRS]
|
||||
with open(os.path.join(script_dir, 'mochitest-conformance-files.ini'), 'w') as f:
|
||||
f.write("""[DEFAULT]
|
||||
support-files =
|
||||
%s
|
||||
""" % "\n ".join(sorted(chain.from_iterable(listfiles(d, script_dir)
|
||||
for d in list_dirs))))
|
||||
|
||||
if __name__ == '__main__':
|
||||
writemanifest()
|
||||
|
@ -205,16 +205,12 @@ nsresult HTMLAudioElement::SetAcceptHeader(nsIHttpChannel* aChannel)
|
||||
#ifdef MOZ_WEBM
|
||||
"audio/webm,"
|
||||
#endif
|
||||
#ifdef MOZ_OGG
|
||||
"audio/ogg,"
|
||||
#endif
|
||||
#ifdef MOZ_WAVE
|
||||
"audio/wav,"
|
||||
#endif
|
||||
"audio/*;q=0.9,"
|
||||
#ifdef MOZ_OGG
|
||||
"application/ogg;q=0.7,"
|
||||
#endif
|
||||
"video/*;q=0.6,*/*;q=0.5");
|
||||
|
||||
return aChannel->SetRequestHeader(NS_LITERAL_CSTRING("Accept"),
|
||||
|
@ -194,19 +194,6 @@ private:
|
||||
*/
|
||||
NS_HIDDEN_(void) StartObjectLoad(bool aNotify);
|
||||
|
||||
void GetTypeAttrValue(nsCString &aValue) const
|
||||
{
|
||||
if (mNodeInfo->Equals(nsGkAtoms::applet)) {
|
||||
aValue.AppendLiteral("application/x-java-vm");
|
||||
}
|
||||
else {
|
||||
nsAutoString type;
|
||||
GetAttr(kNameSpaceID_None, nsGkAtoms::type, type);
|
||||
|
||||
CopyUTF16toUTF8(type, aValue);
|
||||
}
|
||||
}
|
||||
|
||||
nsIAtom *URIAttrName() const
|
||||
{
|
||||
return mNodeInfo->Equals(nsGkAtoms::applet) ?
|
||||
|
@ -137,13 +137,9 @@ nsresult HTMLVideoElement::SetAcceptHeader(nsIHttpChannel* aChannel)
|
||||
#ifdef MOZ_WEBM
|
||||
"video/webm,"
|
||||
#endif
|
||||
#ifdef MOZ_OGG
|
||||
"video/ogg,"
|
||||
#endif
|
||||
"video/*;q=0.9,"
|
||||
#ifdef MOZ_OGG
|
||||
"application/ogg;q=0.7,"
|
||||
#endif
|
||||
"audio/*;q=0.6,*/*;q=0.5");
|
||||
|
||||
return aChannel->SetRequestHeader(NS_LITERAL_CSTRING("Accept"),
|
||||
|
@ -13,10 +13,8 @@
|
||||
#include "MediaPluginHost.h"
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_OGG
|
||||
#include "OggDecoder.h"
|
||||
#include "OggReader.h"
|
||||
#endif
|
||||
#ifdef MOZ_WAVE
|
||||
#include "WaveDecoder.h"
|
||||
#include "WaveReader.h"
|
||||
@ -102,7 +100,6 @@ IsRawType(const nsACString& aType)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_OGG
|
||||
// See http://www.rfc-editor.org/rfc/rfc5334.txt for the definitions
|
||||
// of Ogg media types and codec types
|
||||
static const char* const gOggTypes[4] = {
|
||||
@ -134,7 +131,6 @@ IsOggType(const nsACString& aType)
|
||||
|
||||
return CodecListContains(gOggTypes, aType);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_WAVE
|
||||
// See http://www.rfc-editor.org/rfc/rfc2361.txt for the definitions
|
||||
@ -203,10 +199,8 @@ IsGStreamerSupportedType(const nsACString& aMimeType)
|
||||
if (IsWebMType(aMimeType) && !Preferences::GetBool("media.prefer-gstreamer", false))
|
||||
return false;
|
||||
#endif
|
||||
#ifdef MOZ_OGG
|
||||
if (IsOggType(aMimeType) && !Preferences::GetBool("media.prefer-gstreamer", false))
|
||||
return false;
|
||||
#endif
|
||||
|
||||
return GStreamerDecoder::CanHandleMediaType(aMimeType, nullptr);
|
||||
}
|
||||
@ -376,12 +370,10 @@ DecoderTraits::CanHandleMediaType(const char* aMIMEType,
|
||||
result = CANPLAY_MAYBE;
|
||||
}
|
||||
#endif
|
||||
#ifdef MOZ_OGG
|
||||
if (IsOggType(nsDependentCString(aMIMEType))) {
|
||||
codecList = MediaDecoder::IsOpusEnabled() ? gOggCodecsWithOpus : gOggCodecs;
|
||||
result = CANPLAY_MAYBE;
|
||||
}
|
||||
#endif
|
||||
#ifdef MOZ_WAVE
|
||||
if (IsWaveType(nsDependentCString(aMIMEType))) {
|
||||
codecList = gWaveCodecs;
|
||||
@ -480,12 +472,10 @@ InstantiateDecoder(const nsACString& aType, MediaDecoderOwner* aOwner)
|
||||
return decoder.forget();
|
||||
}
|
||||
#endif
|
||||
#ifdef MOZ_OGG
|
||||
if (IsOggType(aType)) {
|
||||
decoder = new OggDecoder();
|
||||
return decoder.forget();
|
||||
}
|
||||
#endif
|
||||
#ifdef MOZ_WAVE
|
||||
if (IsWaveType(aType)) {
|
||||
decoder = new WaveDecoder();
|
||||
@ -590,11 +580,9 @@ MediaDecoderReader* DecoderTraits::CreateReader(const nsACString& aType, Abstrac
|
||||
decoderReader = new RawReader(aDecoder);
|
||||
} else
|
||||
#endif
|
||||
#ifdef MOZ_OGG
|
||||
if (IsOggType(aType)) {
|
||||
decoderReader = new OggReader(aDecoder);
|
||||
} else
|
||||
#endif
|
||||
#ifdef MOZ_WAVE
|
||||
if (IsWaveType(aType)) {
|
||||
decoderReader = new WaveReader(aDecoder);
|
||||
@ -647,9 +635,7 @@ MediaDecoderReader* DecoderTraits::CreateReader(const nsACString& aType, Abstrac
|
||||
bool DecoderTraits::IsSupportedInVideoDocument(const nsACString& aType)
|
||||
{
|
||||
return
|
||||
#ifdef MOZ_OGG
|
||||
IsOggType(aType) ||
|
||||
#endif
|
||||
#ifdef MOZ_OMX_DECODER
|
||||
// We support amr inside WebApps on firefoxOS but not in general web content.
|
||||
// Ensure we dont create a VideoDocument when accessing amr URLs directly.
|
||||
|
@ -1735,7 +1735,6 @@ MediaDecoder::IsRawEnabled()
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_OGG
|
||||
bool
|
||||
MediaDecoder::IsOpusEnabled()
|
||||
{
|
||||
@ -1751,7 +1750,6 @@ MediaDecoder::IsOggEnabled()
|
||||
{
|
||||
return Preferences::GetBool("media.ogg.enabled");
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_WAVE
|
||||
bool
|
||||
|
@ -816,10 +816,8 @@ public:
|
||||
static bool IsRawEnabled();
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_OGG
|
||||
static bool IsOggEnabled();
|
||||
static bool IsOpusEnabled();
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_WAVE
|
||||
static bool IsWaveEnabled();
|
||||
|
@ -9,9 +9,7 @@
|
||||
#include "prlog.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
|
||||
#ifdef MOZ_OGG
|
||||
#include "OggWriter.h"
|
||||
#endif
|
||||
#ifdef MOZ_OPUS
|
||||
#include "OpusTrackEncoder.h"
|
||||
|
||||
@ -127,7 +125,6 @@ MediaEncoder::CreateEncoder(const nsAString& aMIMEType, uint8_t aTrackTypes)
|
||||
mimeType = NS_LITERAL_STRING(VIDEO_MP4);
|
||||
}
|
||||
#endif // MOZ_OMX_ENCODER
|
||||
#ifdef MOZ_OGG
|
||||
else if (MediaDecoder::IsOggEnabled() && MediaDecoder::IsOpusEnabled() &&
|
||||
(aMIMEType.EqualsLiteral(AUDIO_OGG) ||
|
||||
(aTrackTypes & ContainerWriter::CREATE_AUDIO_TRACK))) {
|
||||
@ -137,7 +134,6 @@ MediaEncoder::CreateEncoder(const nsAString& aMIMEType, uint8_t aTrackTypes)
|
||||
NS_ENSURE_TRUE(audioEncoder, nullptr);
|
||||
mimeType = NS_LITERAL_STRING(AUDIO_OGG);
|
||||
}
|
||||
#endif // MOZ_OGG
|
||||
else {
|
||||
LOG(PR_LOG_ERROR, ("Can not find any encoder to record this media stream"));
|
||||
return nullptr;
|
||||
|
@ -7,6 +7,7 @@
|
||||
PARALLEL_DIRS += [
|
||||
'encoder',
|
||||
'mediasource',
|
||||
'ogg',
|
||||
'webaudio',
|
||||
'webvtt'
|
||||
]
|
||||
@ -14,9 +15,6 @@ PARALLEL_DIRS += [
|
||||
if CONFIG['MOZ_RAW']:
|
||||
PARALLEL_DIRS += ['raw']
|
||||
|
||||
if CONFIG['MOZ_OGG']:
|
||||
PARALLEL_DIRS += ['ogg']
|
||||
|
||||
if CONFIG['MOZ_WAVE']:
|
||||
PARALLEL_DIRS += ['wave']
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
function check_ogg(v, enabled) {
|
||||
function check(type, expected) {
|
||||
is(v.canPlayType(type), enabled ? expected : "no", type);
|
||||
is(v.canPlayType(type), enabled ? expected : "", type);
|
||||
}
|
||||
|
||||
// Ogg types
|
||||
|
@ -1,6 +1,6 @@
|
||||
function check_wave(v, enabled) {
|
||||
function check(type, expected) {
|
||||
is(v.canPlayType(type), enabled ? expected : "no", type);
|
||||
is(v.canPlayType(type), enabled ? expected : "", type);
|
||||
}
|
||||
|
||||
// Wave types
|
||||
|
@ -1,6 +1,6 @@
|
||||
function check_webm(v, enabled) {
|
||||
function check(type, expected) {
|
||||
is(v.canPlayType(type), enabled ? expected : "no", type);
|
||||
is(v.canPlayType(type), enabled ? expected : "", type);
|
||||
}
|
||||
|
||||
// WebM types
|
||||
|
@ -183,24 +183,38 @@ support-files =
|
||||
wavedata_s16.wav
|
||||
wavedata_u8.wav
|
||||
|
||||
[test_a4_tone.html]
|
||||
[test_access_control.html]
|
||||
[test_audio1.html]
|
||||
[test_audio2.html]
|
||||
[test_audio_event_adopt.html]
|
||||
[test_autoplay.html]
|
||||
[test_bug448534.html]
|
||||
[test_bug463162.xhtml]
|
||||
[test_bug495145.html]
|
||||
[test_bug495300.html]
|
||||
[test_bug654550.html]
|
||||
[test_bug686137.html]
|
||||
[test_bug686942.html]
|
||||
# [test_bug726904.html] # disabled - See bug 754860
|
||||
[test_bug874897.html]
|
||||
[test_bug883173.html]
|
||||
[test_bug895305.html]
|
||||
[test_bug895091.html]
|
||||
[test_bug919265.html]
|
||||
[test_bug957847.html]
|
||||
[test_chaining.html]
|
||||
[test_contentDuration1.html]
|
||||
[test_contentDuration2.html]
|
||||
[test_contentDuration3.html]
|
||||
[test_contentDuration4.html]
|
||||
[test_contentDuration5.html]
|
||||
[test_contentDuration6.html]
|
||||
[test_contentDuration7.html]
|
||||
[test_can_play_type.html]
|
||||
[test_can_play_type_mpeg.html]
|
||||
[test_can_play_type_ogg.html]
|
||||
[test_can_play_type_no_ogg.html]
|
||||
[test_closing_connections.html]
|
||||
[test_constants.html]
|
||||
[test_controls.html]
|
||||
@ -209,6 +223,7 @@ support-files =
|
||||
[test_defaultMuted.html]
|
||||
[test_delay_load.html]
|
||||
[test_error_on_404.html]
|
||||
[test_framebuffer.html]
|
||||
[test_info_leak.html]
|
||||
[test_invalid_reject.html]
|
||||
[test_load.html]
|
||||
@ -231,9 +246,12 @@ support-files =
|
||||
[test_progress.html]
|
||||
[test_reactivate.html]
|
||||
[test_readyState.html]
|
||||
[test_referer.html]
|
||||
[test_replay_metadata.html]
|
||||
[test_seek2.html]
|
||||
[test_seek_out_of_range.html]
|
||||
[test_seekable2.html]
|
||||
[test_seekable3.html]
|
||||
[test_source.html]
|
||||
[test_source_write.html]
|
||||
[test_source_null.html]
|
||||
@ -313,25 +331,6 @@ support-files =
|
||||
# The tests below contain backend-specific tests. Write backend independent
|
||||
# tests rather than adding to this list.
|
||||
|
||||
[test_can_play_type_ogg.html] run-if = ogg
|
||||
[test_can_play_type_no_ogg.html] skip-if = ogg
|
||||
[test_a4_tone.html] run-if = ogg
|
||||
[test_audio_event_adopt.html] run-if = ogg
|
||||
[test_bug686137.html] run-if = ogg
|
||||
[test_chaining.html] run-if = ogg
|
||||
[test_contentDuration1.html] run-if = ogg
|
||||
[test_contentDuration2.html] run-if = ogg
|
||||
[test_contentDuration3.html] run-if = ogg
|
||||
[test_contentDuration4.html] run-if = ogg
|
||||
[test_contentDuration5.html] run-if = ogg
|
||||
[test_contentDuration6.html] run-if = ogg
|
||||
[test_contentDuration7.html] run-if = ogg
|
||||
[test_framebuffer.html] run-if = ogg
|
||||
[test_referer.html] run-if = ogg
|
||||
[test_seekable2.html] run-if = ogg
|
||||
[test_seekable3.html] run-if = ogg
|
||||
# [test_bug726904.html] run-if = ogg # disabled - See bug 754860
|
||||
|
||||
[test_can_play_type_webm.html] run-if = webm
|
||||
[test_can_play_type_no_webm.html] skip-if = webm
|
||||
|
||||
|
@ -21,10 +21,17 @@ a Bug 469247</a>
|
||||
|
||||
<pre id="test">
|
||||
<script src="can_play_type_ogg.js"></script>
|
||||
<script>
|
||||
|
||||
check_ogg(document.getElementById('v'), false);
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
SpecialPowers.pushPrefEnv({"set": [["media.ogg.enabled", false]]},
|
||||
function() {
|
||||
check_ogg(document.getElementById('v'), false);
|
||||
mediaTestCleanup();
|
||||
SimpleTest.finish();
|
||||
}
|
||||
);
|
||||
|
||||
mediaTestCleanup();
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
|
@ -16,7 +16,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=490705
|
||||
<script class="testbody" type="text/javascript">
|
||||
var testFile = "bug495794.ogg";
|
||||
var testFileDuration = 0.30;
|
||||
var testFileChannelCount = 2;
|
||||
var testFileChannelCount = 6;
|
||||
var testFileSampleRate = 48000;
|
||||
var testFileFrameBufferLength = testFileChannelCount * 1024;
|
||||
|
||||
@ -29,7 +29,7 @@ function audioAvailable(event) {
|
||||
var buffer = event.frameBuffer;
|
||||
|
||||
if ( (typeof event.time !== "number") ||
|
||||
(Math.abs(event.time - currentSampleOffset / testFileSampleRate / testFileChannelCount) > 0.01) ) {
|
||||
(Math.abs(event.time - currentSampleOffset / testFileSampleRate / testFileChannelCount) > testFileDuration) ) {
|
||||
isTimePropertyValid = false;
|
||||
}
|
||||
|
||||
@ -96,7 +96,12 @@ function initTest() {
|
||||
}
|
||||
|
||||
window.addEventListener("load", function(e) {
|
||||
SpecialPowers.pushPrefEnv({"set": [["media.audio_data.enabled", true]]}, initTest);
|
||||
if (SpecialPowers.getBoolPref("media.audio_data.enabled")) {
|
||||
initTest();
|
||||
} else {
|
||||
ok(true, "old audio data api behind a pref");
|
||||
SimpleTest.finish();
|
||||
}
|
||||
}, false);
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
@ -576,8 +576,11 @@ bool
|
||||
Navigator::JavaEnabled(ErrorResult& aRv)
|
||||
{
|
||||
Telemetry::AutoTimer<Telemetry::CHECK_JAVA_ENABLED> telemetryTimer;
|
||||
// Return true if we have a handler for "application/x-java-vm",
|
||||
// otherwise return false.
|
||||
|
||||
// Return true if we have a handler for the java mime
|
||||
nsAdoptingString javaMIME = Preferences::GetString("plugin.java.mime");
|
||||
NS_ENSURE_TRUE(!javaMIME.IsEmpty(), false);
|
||||
|
||||
if (!mMimeTypes) {
|
||||
if (!mWindow) {
|
||||
aRv.Throw(NS_ERROR_UNEXPECTED);
|
||||
@ -588,8 +591,7 @@ Navigator::JavaEnabled(ErrorResult& aRv)
|
||||
|
||||
RefreshMIMEArray();
|
||||
|
||||
nsMimeType *mimeType =
|
||||
mMimeTypes->NamedItem(NS_LITERAL_STRING("application/x-java-vm"));
|
||||
nsMimeType *mimeType = mMimeTypes->NamedItem(javaMIME);
|
||||
|
||||
return mimeType && mimeType->GetEnabledPlugin();
|
||||
}
|
||||
|
@ -143,10 +143,7 @@ GetIncumbentGlobal()
|
||||
// override in place, the JS engine will lie to us and pretend that
|
||||
// there's nothing on the JS stack, which will cause us to check the
|
||||
// incumbent script stack below.
|
||||
JS::RootedScript script(cx);
|
||||
if (JS_DescribeScriptedCaller(cx, &script, nullptr)) {
|
||||
JS::RootedObject global(cx, JS_GetGlobalFromScript(script));
|
||||
MOZ_ASSERT(global);
|
||||
if (JSObject *global = JS::GetScriptedCallerGlobal(cx)) {
|
||||
return xpc::GetNativeForGlobal(global);
|
||||
}
|
||||
|
||||
|
@ -10536,9 +10536,9 @@ nsGlobalWindow::ShowSlowScriptDialog()
|
||||
NS_ENSURE_TRUE(prompt, KillSlowScript);
|
||||
|
||||
// Check if we should offer the option to debug
|
||||
JS::Rooted<JSScript*> script(cx);
|
||||
JS::AutoFilename filename;
|
||||
unsigned lineno;
|
||||
bool hasFrame = JS_DescribeScriptedCaller(cx, &script, &lineno);
|
||||
bool hasFrame = JS::DescribeScriptedCaller(cx, &filename, &lineno);
|
||||
|
||||
bool debugPossible = hasFrame && js::CanCallContextDebugHandler(cx);
|
||||
#ifdef MOZ_JSDEBUGGER
|
||||
@ -10623,23 +10623,20 @@ nsGlobalWindow::ShowSlowScriptDialog()
|
||||
}
|
||||
|
||||
// Append file and line number information, if available
|
||||
if (script) {
|
||||
const char *filename = JS_GetScriptFilename(cx, script);
|
||||
if (filename) {
|
||||
nsXPIDLString scriptLocation;
|
||||
NS_ConvertUTF8toUTF16 filenameUTF16(filename);
|
||||
const char16_t *formatParams[] = { filenameUTF16.get() };
|
||||
rv = nsContentUtils::FormatLocalizedString(nsContentUtils::eDOM_PROPERTIES,
|
||||
"KillScriptLocation",
|
||||
formatParams,
|
||||
scriptLocation);
|
||||
if (filename.get()) {
|
||||
nsXPIDLString scriptLocation;
|
||||
NS_ConvertUTF8toUTF16 filenameUTF16(filename.get());
|
||||
const char16_t *formatParams[] = { filenameUTF16.get() };
|
||||
rv = nsContentUtils::FormatLocalizedString(nsContentUtils::eDOM_PROPERTIES,
|
||||
"KillScriptLocation",
|
||||
formatParams,
|
||||
scriptLocation);
|
||||
|
||||
if (NS_SUCCEEDED(rv) && scriptLocation) {
|
||||
msg.AppendLiteral("\n\n");
|
||||
msg.Append(scriptLocation);
|
||||
msg.Append(':');
|
||||
msg.AppendInt(lineno);
|
||||
}
|
||||
if (NS_SUCCEEDED(rv) && scriptLocation) {
|
||||
msg.AppendLiteral("\n\n");
|
||||
msg.Append(scriptLocation);
|
||||
msg.Append(':');
|
||||
msg.AppendInt(lineno);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -526,8 +526,7 @@ NS_ScriptErrorReporter(JSContext *cx,
|
||||
// absence of werror are swallowed whole, so report those now.
|
||||
if (!JSREPORT_IS_WARNING(report->flags)) {
|
||||
nsIXPConnect* xpc = nsContentUtils::XPConnect();
|
||||
JS::Rooted<JSScript*> script(cx);
|
||||
if (JS_DescribeScriptedCaller(cx, &script, nullptr)) {
|
||||
if (JS::DescribeScriptedCaller(cx)) {
|
||||
xpc->MarkErrorUnreported(cx);
|
||||
return;
|
||||
}
|
||||
|
@ -32,14 +32,14 @@ bool
|
||||
nsJSUtils::GetCallingLocation(JSContext* aContext, const char* *aFilename,
|
||||
uint32_t* aLineno)
|
||||
{
|
||||
JS::Rooted<JSScript*> script(aContext);
|
||||
JS::AutoFilename filename;
|
||||
unsigned lineno = 0;
|
||||
|
||||
if (!JS_DescribeScriptedCaller(aContext, &script, &lineno)) {
|
||||
if (!JS::DescribeScriptedCaller(aContext, &filename, &lineno)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
*aFilename = ::JS_GetScriptFilename(aContext, script);
|
||||
*aFilename = filename.get();
|
||||
*aLineno = lineno;
|
||||
|
||||
return true;
|
||||
|
@ -1822,14 +1822,14 @@ GlobalObject::GlobalObject(JSContext* aCx, JSObject* aObject)
|
||||
nsISupports*
|
||||
GlobalObject::GetAsSupports() const
|
||||
{
|
||||
if (!NS_IsMainThread()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (mGlobalObject) {
|
||||
return mGlobalObject;
|
||||
}
|
||||
|
||||
if (!NS_IsMainThread()) {
|
||||
return UnwrapDOMObjectToISupports(mGlobalJSObject);
|
||||
}
|
||||
|
||||
JS::Rooted<JS::Value> val(mCx, JS::ObjectValue(*mGlobalJSObject));
|
||||
|
||||
// Switch this to UnwrapDOMObjectToISupports once our global objects are
|
||||
|
@ -1,271 +0,0 @@
|
||||
#
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
# Note: browserElementTestHelpers.js looks at the test's filename to determine
|
||||
# whether the test should be OOP. "_oop_" signals OOP, "_inproc_" signals in
|
||||
# process. Default is OOP.
|
||||
|
||||
MOCHITEST_FILES = \
|
||||
$(topsrcdir)/browser/base/content/test/general/audio.ogg \
|
||||
$(topsrcdir)/content/media/test/short-video.ogv \
|
||||
file_empty_script.js \
|
||||
file_empty.html \
|
||||
file_focus.html \
|
||||
browserElementTestHelpers.js \
|
||||
test_browserElement_NoAttr.html \
|
||||
test_browserElement_NoPref.html \
|
||||
test_browserElement_NoPermission.html \
|
||||
browserElement_LoadEvents.js \
|
||||
file_browserElement_LoadEvents.html \
|
||||
test_browserElement_inproc_LoadEvents.html \
|
||||
browserElement_DataURI.js \
|
||||
test_browserElement_inproc_DataURI.html \
|
||||
browserElement_ErrorSecurity.js \
|
||||
browserElement_Titlechange.js \
|
||||
test_browserElement_inproc_Titlechange.html \
|
||||
browserElement_TopBarrier.js \
|
||||
test_browserElement_inproc_TopBarrier.html \
|
||||
browserElement_AppWindowNamespace.js \
|
||||
test_browserElement_inproc_AppWindowNamespace.html \
|
||||
file_browserElement_AppWindowNamespace.html \
|
||||
browserElement_BrowserWindowNamespace.js \
|
||||
test_browserElement_inproc_BrowserWindowNamespace.html \
|
||||
file_browserElement_BrowserWindowNamespace.html \
|
||||
browserElement_Iconchange.js \
|
||||
browserElement_Metachange.js \
|
||||
file_browserElement_Metachange.sjs \
|
||||
browserElement_Opensearch.js \
|
||||
test_browserElement_inproc_Iconchange.html \
|
||||
test_browserElement_inproc_Metachange.html \
|
||||
test_browserElement_inproc_Opensearch.html \
|
||||
browserElement_GetScreenshot.js \
|
||||
browserElement_GetScreenshotDppx.js \
|
||||
test_browserElement_inproc_GetScreenshot.html \
|
||||
test_browserElement_inproc_GetScreenshotDppx.html \
|
||||
browserElement_BadScreenshot.js \
|
||||
test_browserElement_inproc_BadScreenshot.html \
|
||||
browserElement_SetVisible.js \
|
||||
test_browserElement_inproc_SetVisible.html \
|
||||
browserElement_SetVisibleFrames.js \
|
||||
test_browserElement_inproc_SetVisibleFrames.html \
|
||||
file_browserElement_SetVisibleFrames_Outer.html \
|
||||
file_browserElement_SetVisibleFrames_Inner.html \
|
||||
browserElement_SetVisibleFrames2.js \
|
||||
test_browserElement_inproc_SetVisibleFrames2.html \
|
||||
file_browserElement_SetVisibleFrames2_Outer.html \
|
||||
browserElement_KeyEvents.js \
|
||||
test_browserElement_inproc_KeyEvents.html \
|
||||
browserElement_XFrameOptions.js \
|
||||
test_browserElement_inproc_XFrameOptions.html \
|
||||
file_browserElement_XFrameOptions.sjs \
|
||||
browserElement_XFrameOptionsDeny.js \
|
||||
test_browserElement_inproc_XFrameOptionsDeny.html \
|
||||
file_browserElement_XFrameOptionsDeny.html \
|
||||
browserElement_XFrameOptionsSameOrigin.js \
|
||||
test_browserElement_inproc_XFrameOptionsSameOrigin.html \
|
||||
file_browserElement_XFrameOptionsSameOrigin.html \
|
||||
browserElement_XFrameOptionsAllowFrom.js \
|
||||
test_browserElement_inproc_XFrameOptionsAllowFrom.html \
|
||||
file_browserElement_XFrameOptionsAllowFrom.html \
|
||||
file_browserElement_XFrameOptionsAllowFrom.sjs \
|
||||
browserElement_FirstPaint.js \
|
||||
test_browserElement_inproc_FirstPaint.html \
|
||||
browserElement_NextPaint.js \
|
||||
test_browserElement_inproc_NextPaint.html \
|
||||
test_browserElement_oop_NextPaint.html \
|
||||
file_browserElement_NextPaint.html \
|
||||
browserElement_Alert.js \
|
||||
test_browserElement_inproc_Alert.html \
|
||||
browserElement_AlertInFrame.js \
|
||||
test_browserElement_inproc_AlertInFrame.html \
|
||||
file_browserElement_AlertInFrame.html \
|
||||
file_browserElement_AlertInFrame_Inner.html \
|
||||
browserElement_TargetTop.js \
|
||||
test_browserElement_inproc_TargetTop.html \
|
||||
file_browserElement_TargetTop.html \
|
||||
browserElement_ForwardName.js \
|
||||
test_browserElement_inproc_ForwardName.html \
|
||||
file_browserElement_ForwardName.html \
|
||||
browserElement_TargetBlank.js \
|
||||
test_browserElement_inproc_TargetBlank.html \
|
||||
file_browserElement_TargetBlank.html \
|
||||
browserElement_PromptCheck.js \
|
||||
test_browserElement_inproc_PromptCheck.html \
|
||||
browserElement_PromptConfirm.js \
|
||||
test_browserElement_inproc_PromptConfirm.html \
|
||||
browserElement_CookiesNotThirdParty.js \
|
||||
file_browserElement_CookiesNotThirdParty.html \
|
||||
test_browserElement_inproc_CookiesNotThirdParty.html \
|
||||
browserElement_Close.js \
|
||||
test_browserElement_inproc_Close.html \
|
||||
browserElement_CloseFromOpener.js \
|
||||
test_browserElement_inproc_CloseFromOpener.html \
|
||||
file_browserElement_CloseFromOpener.html \
|
||||
browserElement_CloseApp.js \
|
||||
test_browserElement_inproc_CloseApp.html \
|
||||
file_browserElement_CloseApp.html \
|
||||
browserElement_OpenWindow.js \
|
||||
test_browserElement_inproc_OpenWindow.html \
|
||||
file_browserElement_Open1.html \
|
||||
file_browserElement_Open2.html \
|
||||
browserElement_OpenWindowInFrame.js \
|
||||
test_browserElement_inproc_OpenWindowInFrame.html \
|
||||
file_browserElement_OpenWindowInFrame.html \
|
||||
browserElement_OpenWindowRejected.js \
|
||||
test_browserElement_inproc_OpenWindowRejected.html \
|
||||
file_browserElement_OpenWindowRejected.html \
|
||||
browserElement_OpenWindowDifferentOrigin.js \
|
||||
test_browserElement_inproc_OpenWindowDifferentOrigin.html \
|
||||
file_browserElement_OpenWindowDifferentOrigin.html \
|
||||
browserElement_OpenNamed.js \
|
||||
test_browserElement_inproc_OpenNamed.html \
|
||||
file_browserElement_OpenNamed.html \
|
||||
file_browserElement_OpenNamed2.html \
|
||||
browserElement_SecurityChange.js \
|
||||
test_browserElement_inproc_SecurityChange.html \
|
||||
file_browserElement_SecurityChange.html \
|
||||
browserElement_BackForward.js \
|
||||
test_browserElement_inproc_BackForward.html \
|
||||
file_bug741717.sjs \
|
||||
browserElement_Reload.js \
|
||||
file_bug709759.sjs \
|
||||
browserElement_Stop.js \
|
||||
test_browserElement_inproc_Stop.html \
|
||||
browserElement_ContextmenuEvents.js \
|
||||
test_browserElement_inproc_ContextmenuEvents.html \
|
||||
browserElement_SendEvent.js \
|
||||
test_browserElement_inproc_SendEvent.html \
|
||||
browserElement_ScrollEvent.js \
|
||||
test_browserElement_inproc_ScrollEvent.html \
|
||||
browserElement_Auth.js \
|
||||
test_browserElement_inproc_Auth.html \
|
||||
file_http_401_response.sjs \
|
||||
browserElement_RemoveBrowserElement.js \
|
||||
test_browserElement_inproc_RemoveBrowserElement.html \
|
||||
browserElement_DOMRequestError.js \
|
||||
test_browserElement_inproc_DOMRequestError.html \
|
||||
file_browserElement_AppFramePermission.html \
|
||||
browserElement_AppFramePermission.js \
|
||||
test_browserElement_inproc_AppFramePermission.html \
|
||||
file_wyciwyg.html \
|
||||
browserElement_ExposableURI.js \
|
||||
test_browserElement_inproc_ExposableURI.html \
|
||||
browserElement_FrameWrongURI.js \
|
||||
test_browserElement_inproc_FrameWrongURI.html \
|
||||
file_browserElement_FrameWrongURI.html \
|
||||
file_post_request.html \
|
||||
test_browserElement_inproc_ReloadPostRequest.html \
|
||||
browserElement_ReloadPostRequest.js \
|
||||
browserElement_PurgeHistory.js \
|
||||
test_browserElement_inproc_PurgeHistory.html \
|
||||
browserElement_DocumentFirstPaint.js \
|
||||
test_browserElement_inproc_DocumentFirstPaint.html \
|
||||
browserElement_VisibilityChange.js \
|
||||
test_browserElement_inproc_VisibilityChange.html \
|
||||
browserElement_BrowserWindowResize.js \
|
||||
test_browserElement_inproc_BrowserWindowResize.html \
|
||||
$(NULL)
|
||||
|
||||
# Disabled until we fix bug 906096.
|
||||
# browserElement_SetInputMethodActive.js \
|
||||
# test_browserElement_inproc_SetInputMethodActive.html \
|
||||
# file_inputmethod.html \
|
||||
|
||||
# Disabled due to https://bugzilla.mozilla.org/show_bug.cgi?id=774100
|
||||
# test_browserElement_inproc_Reload.html \
|
||||
|
||||
# Disabled due to focus issues (no bug that I'm aware of)
|
||||
# test_browserElement_oop_KeyEvents.html \
|
||||
|
||||
# Disable due to certificate issue (no bug that I'm aware of)
|
||||
# test_browserElement_inproc_ErrorSecurity.html \
|
||||
|
||||
# OOP tests don't work on native-fennec (bug 774939).
|
||||
#
|
||||
# Both the "inproc" and "oop" versions of OpenMixedProcess open remote frames,
|
||||
# so we don't run that test on platforms which don't support OOP tests.
|
||||
|
||||
|
||||
# Bug 960345 - Disabled on OSX debug for frequent crashes.
|
||||
ifeq ($(MOZ_WIDGET_TOOLKIT),cocoa)
|
||||
ifdef MOZ_DEBUG
|
||||
OSX_DEBUG=1
|
||||
endif
|
||||
endif
|
||||
|
||||
ifndef MOZ_ANDROID_OMTC #{
|
||||
ifndef OSX_DEBUG
|
||||
MOCHITEST_FILES += \
|
||||
browserElement_OpenMixedProcess.js \
|
||||
file_browserElement_OpenMixedProcess.html \
|
||||
test_browserElement_inproc_OpenMixedProcess.html \
|
||||
test_browserElement_inproc_ErrorSecurity.html \
|
||||
test_browserElement_oop_OpenMixedProcess.html \
|
||||
test_browserElement_oop_LoadEvents.html \
|
||||
test_browserElement_oop_DataURI.html \
|
||||
test_browserElement_oop_ErrorSecurity.html \
|
||||
test_browserElement_oop_Titlechange.html \
|
||||
test_browserElement_oop_AppWindowNamespace.html \
|
||||
test_browserElement_oop_BrowserWindowNamespace.html \
|
||||
test_browserElement_oop_TopBarrier.html \
|
||||
test_browserElement_oop_Iconchange.html \
|
||||
test_browserElement_oop_Metachange.html \
|
||||
test_browserElement_oop_Opensearch.html \
|
||||
test_browserElement_oop_GetScreenshot.html \
|
||||
test_browserElement_oop_GetScreenshotDppx.html \
|
||||
test_browserElement_oop_BadScreenshot.html \
|
||||
test_browserElement_oop_XFrameOptions.html \
|
||||
test_browserElement_oop_XFrameOptionsDeny.html \
|
||||
test_browserElement_oop_XFrameOptionsSameOrigin.html \
|
||||
test_browserElement_oop_XFrameOptionsAllowFrom.html \
|
||||
test_browserElement_oop_SendEvent.html \
|
||||
test_browserElement_oop_SetVisible.html \
|
||||
test_browserElement_oop_SetVisibleFrames.html \
|
||||
test_browserElement_oop_SetVisibleFrames2.html \
|
||||
test_browserElement_oop_Alert.html \
|
||||
test_browserElement_oop_AlertInFrame.html \
|
||||
test_browserElement_oop_TargetTop.html \
|
||||
test_browserElement_oop_FirstPaint.html \
|
||||
test_browserElement_oop_ForwardName.html \
|
||||
test_browserElement_oop_TargetBlank.html \
|
||||
test_browserElement_oop_PromptCheck.html \
|
||||
test_browserElement_oop_PromptConfirm.html \
|
||||
test_browserElement_oop_CookiesNotThirdParty.html \
|
||||
test_browserElement_oop_Close.html \
|
||||
test_browserElement_oop_OpenWindow.html \
|
||||
test_browserElement_oop_OpenWindowInFrame.html \
|
||||
test_browserElement_oop_OpenWindowRejected.html \
|
||||
test_browserElement_oop_OpenWindowDifferentOrigin.html \
|
||||
test_browserElement_oop_OpenNamed.html \
|
||||
test_browserElement_oop_SecurityChange.html \
|
||||
test_browserElement_oop_BackForward.html \
|
||||
test_browserElement_oop_Reload.html \
|
||||
test_browserElement_oop_Stop.html \
|
||||
test_browserElement_oop_ScrollEvent.html \
|
||||
test_browserElement_oop_Auth.html \
|
||||
test_browserElement_oop_RemoveBrowserElement.html \
|
||||
test_browserElement_oop_DOMRequestError.html \
|
||||
test_browserElement_oop_AppFramePermission.html \
|
||||
test_browserElement_oop_FrameWrongURI.html \
|
||||
test_browserElement_oop_ReloadPostRequest.html \
|
||||
test_browserElement_oop_PurgeHistory.html \
|
||||
test_browserElement_oop_DocumentFirstPaint.html \
|
||||
test_browserElement_oop_VisibilityChange.html \
|
||||
test_browserElement_oop_BrowserWindowResize.html \
|
||||
$(NULL)
|
||||
|
||||
# Disabled until bug 930449 makes it stop timing out
|
||||
# test_browserElement_oop_ContextmenuEvents.html \
|
||||
|
||||
# Disabled until bug 924771 makes them stop timing out
|
||||
# test_browserElement_oop_CloseFromOpener.html \
|
||||
# test_browserElement_oop_CloseApp.html \
|
||||
# test_browserElement_oop_ExposableURI.html \
|
||||
|
||||
# Disabled until we fix bug 906096.
|
||||
# test_browserElement_oop_SetInputMethodActive.html \
|
||||
|
||||
endif # OSX_DEBUG
|
||||
endif #}
|
77
dom/browser-element/mochitest/mochitest-oop.ini
Normal file
77
dom/browser-element/mochitest/mochitest-oop.ini
Normal file
@ -0,0 +1,77 @@
|
||||
[DEFAULT]
|
||||
# Both the "inproc" and "oop" versions of OpenMixedProcess open remote frames,
|
||||
# so we don't run that test on platforms which don't support OOP tests.
|
||||
# OOP tests don't work on native-fennec (bug 774939).
|
||||
# Bug 960345 - Disabled on OSX debug for frequent crashes.
|
||||
skip-if = os == "android" || (toolkit == "cocoa" && debug)
|
||||
support-files =
|
||||
browserElement_OpenMixedProcess.js
|
||||
file_browserElement_OpenMixedProcess.html
|
||||
|
||||
[test_browserElement_inproc_ErrorSecurity.html]
|
||||
[test_browserElement_inproc_OpenMixedProcess.html]
|
||||
[test_browserElement_oop_Alert.html]
|
||||
[test_browserElement_oop_AlertInFrame.html]
|
||||
[test_browserElement_oop_AppFramePermission.html]
|
||||
[test_browserElement_oop_AppWindowNamespace.html]
|
||||
[test_browserElement_oop_Auth.html]
|
||||
[test_browserElement_oop_BackForward.html]
|
||||
[test_browserElement_oop_BadScreenshot.html]
|
||||
[test_browserElement_oop_BrowserWindowNamespace.html]
|
||||
[test_browserElement_oop_BrowserWindowResize.html]
|
||||
[test_browserElement_oop_Close.html]
|
||||
[test_browserElement_oop_CookiesNotThirdParty.html]
|
||||
[test_browserElement_oop_DOMRequestError.html]
|
||||
[test_browserElement_oop_DataURI.html]
|
||||
[test_browserElement_oop_DocumentFirstPaint.html]
|
||||
[test_browserElement_oop_ErrorSecurity.html]
|
||||
[test_browserElement_oop_FirstPaint.html]
|
||||
[test_browserElement_oop_ForwardName.html]
|
||||
[test_browserElement_oop_FrameWrongURI.html]
|
||||
[test_browserElement_oop_GetScreenshot.html]
|
||||
[test_browserElement_oop_GetScreenshotDppx.html]
|
||||
[test_browserElement_oop_Iconchange.html]
|
||||
[test_browserElement_oop_LoadEvents.html]
|
||||
[test_browserElement_oop_Metachange.html]
|
||||
[test_browserElement_oop_OpenMixedProcess.html]
|
||||
[test_browserElement_oop_OpenNamed.html]
|
||||
[test_browserElement_oop_OpenWindow.html]
|
||||
[test_browserElement_oop_OpenWindowDifferentOrigin.html]
|
||||
[test_browserElement_oop_OpenWindowInFrame.html]
|
||||
[test_browserElement_oop_OpenWindowRejected.html]
|
||||
[test_browserElement_oop_Opensearch.html]
|
||||
[test_browserElement_oop_PromptCheck.html]
|
||||
[test_browserElement_oop_PromptConfirm.html]
|
||||
[test_browserElement_oop_PurgeHistory.html]
|
||||
[test_browserElement_oop_Reload.html]
|
||||
[test_browserElement_oop_ReloadPostRequest.html]
|
||||
[test_browserElement_oop_RemoveBrowserElement.html]
|
||||
[test_browserElement_oop_ScrollEvent.html]
|
||||
[test_browserElement_oop_SecurityChange.html]
|
||||
[test_browserElement_oop_SendEvent.html]
|
||||
[test_browserElement_oop_SetVisible.html]
|
||||
[test_browserElement_oop_SetVisibleFrames.html]
|
||||
[test_browserElement_oop_SetVisibleFrames2.html]
|
||||
[test_browserElement_oop_Stop.html]
|
||||
[test_browserElement_oop_TargetBlank.html]
|
||||
[test_browserElement_oop_TargetTop.html]
|
||||
[test_browserElement_oop_Titlechange.html]
|
||||
[test_browserElement_oop_TopBarrier.html]
|
||||
[test_browserElement_oop_VisibilityChange.html]
|
||||
[test_browserElement_oop_XFrameOptions.html]
|
||||
[test_browserElement_oop_XFrameOptionsAllowFrom.html]
|
||||
[test_browserElement_oop_XFrameOptionsDeny.html]
|
||||
[test_browserElement_oop_XFrameOptionsSameOrigin.html]
|
||||
# Disabled until bug 930449 makes it stop timing out
|
||||
[test_browserElement_oop_ContextmenuEvents.html]
|
||||
disabled = bug 930449
|
||||
# Disabled until bug 924771 makes them stop timing out
|
||||
[test_browserElement_oop_CloseFromOpener.html]
|
||||
disabled = bug 924771
|
||||
[test_browserElement_oop_CloseApp.html]
|
||||
disabled = bug 924771
|
||||
[test_browserElement_oop_ExposableURI.html]
|
||||
disabled = bug 924771
|
||||
# Disabled until we fix bug 906096.
|
||||
[test_browserElement_oop_SetInputMethodActive.html]
|
||||
disabled = bug 906096
|
177
dom/browser-element/mochitest/mochitest.ini
Normal file
177
dom/browser-element/mochitest/mochitest.ini
Normal file
@ -0,0 +1,177 @@
|
||||
[DEFAULT]
|
||||
support-files =
|
||||
../../../browser/base/content/test/general/audio.ogg
|
||||
../../../content/media/test/short-video.ogv
|
||||
browserElementTestHelpers.js
|
||||
browserElement_Alert.js
|
||||
browserElement_AlertInFrame.js
|
||||
browserElement_AppFramePermission.js
|
||||
browserElement_AppWindowNamespace.js
|
||||
browserElement_Auth.js
|
||||
browserElement_BackForward.js
|
||||
browserElement_BadScreenshot.js
|
||||
browserElement_BrowserWindowNamespace.js
|
||||
browserElement_BrowserWindowResize.js
|
||||
browserElement_Close.js
|
||||
browserElement_CloseApp.js
|
||||
browserElement_CloseFromOpener.js
|
||||
browserElement_ContextmenuEvents.js
|
||||
browserElement_CookiesNotThirdParty.js
|
||||
browserElement_DOMRequestError.js
|
||||
browserElement_DataURI.js
|
||||
browserElement_DocumentFirstPaint.js
|
||||
browserElement_ErrorSecurity.js
|
||||
browserElement_ExposableURI.js
|
||||
browserElement_FirstPaint.js
|
||||
browserElement_ForwardName.js
|
||||
browserElement_FrameWrongURI.js
|
||||
browserElement_GetScreenshot.js
|
||||
browserElement_GetScreenshotDppx.js
|
||||
browserElement_Iconchange.js
|
||||
browserElement_KeyEvents.js
|
||||
browserElement_LoadEvents.js
|
||||
browserElement_Metachange.js
|
||||
browserElement_NextPaint.js
|
||||
browserElement_OpenNamed.js
|
||||
browserElement_OpenWindow.js
|
||||
browserElement_OpenWindowDifferentOrigin.js
|
||||
browserElement_OpenWindowInFrame.js
|
||||
browserElement_OpenWindowRejected.js
|
||||
browserElement_Opensearch.js
|
||||
browserElement_PromptCheck.js
|
||||
browserElement_PromptConfirm.js
|
||||
browserElement_PurgeHistory.js
|
||||
browserElement_Reload.js
|
||||
browserElement_ReloadPostRequest.js
|
||||
browserElement_RemoveBrowserElement.js
|
||||
browserElement_ScrollEvent.js
|
||||
browserElement_SecurityChange.js
|
||||
browserElement_SendEvent.js
|
||||
browserElement_SetVisible.js
|
||||
browserElement_SetVisibleFrames.js
|
||||
browserElement_SetVisibleFrames2.js
|
||||
browserElement_Stop.js
|
||||
browserElement_TargetBlank.js
|
||||
browserElement_TargetTop.js
|
||||
browserElement_Titlechange.js
|
||||
browserElement_TopBarrier.js
|
||||
browserElement_VisibilityChange.js
|
||||
browserElement_XFrameOptions.js
|
||||
browserElement_XFrameOptionsAllowFrom.js
|
||||
browserElement_XFrameOptionsDeny.js
|
||||
browserElement_XFrameOptionsSameOrigin.js
|
||||
file_browserElement_AlertInFrame.html
|
||||
file_browserElement_AlertInFrame_Inner.html
|
||||
file_browserElement_AppFramePermission.html
|
||||
file_browserElement_AppWindowNamespace.html
|
||||
file_browserElement_BrowserWindowNamespace.html
|
||||
file_browserElement_CloseApp.html
|
||||
file_browserElement_CloseFromOpener.html
|
||||
file_browserElement_CookiesNotThirdParty.html
|
||||
file_browserElement_ForwardName.html
|
||||
file_browserElement_FrameWrongURI.html
|
||||
file_browserElement_LoadEvents.html
|
||||
file_browserElement_Metachange.sjs
|
||||
file_browserElement_NextPaint.html
|
||||
file_browserElement_Open1.html
|
||||
file_browserElement_Open2.html
|
||||
file_browserElement_OpenNamed.html
|
||||
file_browserElement_OpenNamed2.html
|
||||
file_browserElement_OpenWindowDifferentOrigin.html
|
||||
file_browserElement_OpenWindowInFrame.html
|
||||
file_browserElement_OpenWindowRejected.html
|
||||
file_browserElement_SecurityChange.html
|
||||
file_browserElement_SetVisibleFrames2_Outer.html
|
||||
file_browserElement_SetVisibleFrames_Inner.html
|
||||
file_browserElement_SetVisibleFrames_Outer.html
|
||||
file_browserElement_TargetBlank.html
|
||||
file_browserElement_TargetTop.html
|
||||
file_browserElement_XFrameOptions.sjs
|
||||
file_browserElement_XFrameOptionsAllowFrom.html
|
||||
file_browserElement_XFrameOptionsAllowFrom.sjs
|
||||
file_browserElement_XFrameOptionsDeny.html
|
||||
file_browserElement_XFrameOptionsSameOrigin.html
|
||||
file_bug709759.sjs
|
||||
file_bug741717.sjs
|
||||
file_empty.html
|
||||
file_empty_script.js
|
||||
file_focus.html
|
||||
file_http_401_response.sjs
|
||||
file_post_request.html
|
||||
file_wyciwyg.html
|
||||
|
||||
# Note: browserElementTestHelpers.js looks at the test's filename to determine
|
||||
# whether the test should be OOP. "_oop_" signals OOP, "_inproc_" signals in
|
||||
# process. Default is OOP.
|
||||
[test_browserElement_NoAttr.html]
|
||||
[test_browserElement_NoPref.html]
|
||||
[test_browserElement_NoPermission.html]
|
||||
[test_browserElement_inproc_Alert.html]
|
||||
[test_browserElement_inproc_AlertInFrame.html]
|
||||
[test_browserElement_inproc_AppFramePermission.html]
|
||||
[test_browserElement_inproc_AppWindowNamespace.html]
|
||||
[test_browserElement_inproc_Auth.html]
|
||||
[test_browserElement_inproc_BackForward.html]
|
||||
[test_browserElement_inproc_BadScreenshot.html]
|
||||
[test_browserElement_inproc_BrowserWindowNamespace.html]
|
||||
[test_browserElement_inproc_BrowserWindowResize.html]
|
||||
[test_browserElement_inproc_Close.html]
|
||||
[test_browserElement_inproc_CloseApp.html]
|
||||
[test_browserElement_inproc_CloseFromOpener.html]
|
||||
[test_browserElement_inproc_ContextmenuEvents.html]
|
||||
[test_browserElement_inproc_CookiesNotThirdParty.html]
|
||||
[test_browserElement_inproc_DOMRequestError.html]
|
||||
[test_browserElement_inproc_DataURI.html]
|
||||
[test_browserElement_inproc_DocumentFirstPaint.html]
|
||||
[test_browserElement_inproc_ExposableURI.html]
|
||||
[test_browserElement_inproc_FirstPaint.html]
|
||||
[test_browserElement_inproc_ForwardName.html]
|
||||
[test_browserElement_inproc_FrameWrongURI.html]
|
||||
[test_browserElement_inproc_GetScreenshot.html]
|
||||
[test_browserElement_inproc_GetScreenshotDppx.html]
|
||||
[test_browserElement_inproc_Iconchange.html]
|
||||
[test_browserElement_inproc_KeyEvents.html]
|
||||
[test_browserElement_inproc_LoadEvents.html]
|
||||
[test_browserElement_inproc_Metachange.html]
|
||||
[test_browserElement_inproc_NextPaint.html]
|
||||
[test_browserElement_inproc_OpenNamed.html]
|
||||
[test_browserElement_inproc_OpenWindow.html]
|
||||
[test_browserElement_inproc_OpenWindowDifferentOrigin.html]
|
||||
[test_browserElement_inproc_OpenWindowInFrame.html]
|
||||
[test_browserElement_inproc_OpenWindowRejected.html]
|
||||
[test_browserElement_inproc_Opensearch.html]
|
||||
[test_browserElement_inproc_PromptCheck.html]
|
||||
[test_browserElement_inproc_PromptConfirm.html]
|
||||
[test_browserElement_inproc_PurgeHistory.html]
|
||||
[test_browserElement_inproc_ReloadPostRequest.html]
|
||||
[test_browserElement_inproc_RemoveBrowserElement.html]
|
||||
[test_browserElement_inproc_ScrollEvent.html]
|
||||
[test_browserElement_inproc_SecurityChange.html]
|
||||
[test_browserElement_inproc_SendEvent.html]
|
||||
[test_browserElement_inproc_SetVisible.html]
|
||||
[test_browserElement_inproc_SetVisibleFrames.html]
|
||||
[test_browserElement_inproc_SetVisibleFrames2.html]
|
||||
[test_browserElement_inproc_Stop.html]
|
||||
[test_browserElement_inproc_TargetBlank.html]
|
||||
[test_browserElement_inproc_TargetTop.html]
|
||||
[test_browserElement_inproc_Titlechange.html]
|
||||
[test_browserElement_inproc_TopBarrier.html]
|
||||
[test_browserElement_inproc_VisibilityChange.html]
|
||||
[test_browserElement_inproc_XFrameOptions.html]
|
||||
[test_browserElement_inproc_XFrameOptionsAllowFrom.html]
|
||||
[test_browserElement_inproc_XFrameOptionsDeny.html]
|
||||
[test_browserElement_inproc_XFrameOptionsSameOrigin.html]
|
||||
[test_browserElement_oop_NextPaint.html]
|
||||
# Disabled until we fix bug 906096.
|
||||
[test_browserElement_inproc_SetInputMethodActive.html]
|
||||
disabled = bug 906096
|
||||
support-files = browserElement_SetInputMethodActive.js file_inputmethod.html
|
||||
# Disabled due to https://bugzilla.mozilla.org/show_bug.cgi?id=774100
|
||||
[test_browserElement_inproc_Reload.html]
|
||||
disabled = bug 774100
|
||||
# Disabled due to focus issues (no bug that I'm aware of)
|
||||
[test_browserElement_oop_KeyEvents.html]
|
||||
disabled =
|
||||
# Disable due to certificate issue (no bug that I'm aware of)
|
||||
[test_browserElement_inproc_ErrorSecurity.html]
|
||||
disabled =
|
@ -1,7 +0,0 @@
|
||||
# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
|
||||
# vim: set filetype=python:
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
MOCHITEST_MANIFESTS += ['priority/mochitest.ini']
|
@ -4,8 +4,6 @@
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
TEST_DIRS += ['mochitest']
|
||||
|
||||
EXPORTS.mozilla += [
|
||||
'BrowserElementParent.h',
|
||||
]
|
||||
@ -42,3 +40,8 @@ LOCAL_INCLUDES += [
|
||||
'/dom/ipc',
|
||||
]
|
||||
|
||||
MOCHITEST_MANIFESTS += [
|
||||
'mochitest/mochitest-oop.ini',
|
||||
'mochitest/mochitest.ini',
|
||||
'mochitest/priority/mochitest.ini',
|
||||
]
|
||||
|
@ -1,10 +0,0 @@
|
||||
# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
|
||||
# vim: set filetype=python:
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
MOCHITEST_MANIFESTS += ['mochitest.ini']
|
||||
|
||||
include('/ipc/chromium/chromium-config.mozbuild')
|
||||
|
@ -4,8 +4,6 @@
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
TEST_DIRS += ['test', 'ipc']
|
||||
|
||||
EXPORTS += [
|
||||
'DeviceStorage.h',
|
||||
'DeviceStorageFileDescriptor.h',
|
||||
@ -39,3 +37,8 @@ LOCAL_INCLUDES += [
|
||||
'/dom/ipc',
|
||||
]
|
||||
|
||||
MOCHITEST_MANIFESTS += [
|
||||
'ipc/mochitest.ini',
|
||||
'test/mochitest.ini',
|
||||
]
|
||||
MOCHITEST_CHROME_MANIFESTS += ['test/chrome.ini']
|
||||
|
@ -1,10 +0,0 @@
|
||||
# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
|
||||
# vim: set filetype=python:
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
MOCHITEST_MANIFESTS += ['mochitest.ini']
|
||||
|
||||
MOCHITEST_CHROME_MANIFESTS += ['chrome.ini']
|
||||
|
@ -330,6 +330,10 @@ const kEventConstructors = {
|
||||
return new RTCPeerConnectionIceEvent(aName, aProps);
|
||||
},
|
||||
},
|
||||
RTCPeerConnectionIdentityEvent: { create: function (aName, aProps) {
|
||||
return new RTCPeerConnectionIdentityEvent(aName, aProps);
|
||||
},
|
||||
},
|
||||
ScrollAreaEvent: { create: function (aName, aProps) {
|
||||
var e = document.createEvent("scrollareaevent");
|
||||
e.initScrollAreaEvent(aName, aProps.bubbles, aProps.cancelable,
|
||||
|
@ -1561,31 +1561,7 @@ ContentChild::RecvMinimizeMemoryUsage()
|
||||
do_GetService("@mozilla.org/memory-reporter-manager;1");
|
||||
NS_ENSURE_TRUE(mgr, true);
|
||||
|
||||
nsCOMPtr<nsICancelableRunnable> runnable =
|
||||
do_QueryReferent(mMemoryMinimizerRunnable);
|
||||
|
||||
// Cancel the previous task if it's still pending.
|
||||
if (runnable) {
|
||||
runnable->Cancel();
|
||||
runnable = nullptr;
|
||||
}
|
||||
|
||||
mgr->MinimizeMemoryUsage(/* callback = */ nullptr,
|
||||
getter_AddRefs(runnable));
|
||||
mMemoryMinimizerRunnable = do_GetWeakReference(runnable);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
ContentChild::RecvCancelMinimizeMemoryUsage()
|
||||
{
|
||||
nsCOMPtr<nsICancelableRunnable> runnable =
|
||||
do_QueryReferent(mMemoryMinimizerRunnable);
|
||||
if (runnable) {
|
||||
runnable->Cancel();
|
||||
mMemoryMinimizerRunnable = nullptr;
|
||||
}
|
||||
|
||||
mgr->MinimizeMemoryUsage(/* callback = */ nullptr);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -242,7 +242,6 @@ public:
|
||||
virtual bool
|
||||
RecvNotifyProcessPriorityChanged(const hal::ProcessPriority& aPriority) MOZ_OVERRIDE;
|
||||
virtual bool RecvMinimizeMemoryUsage() MOZ_OVERRIDE;
|
||||
virtual bool RecvCancelMinimizeMemoryUsage() MOZ_OVERRIDE;
|
||||
|
||||
virtual bool RecvLoadAndRegisterSheet(const URIParams& aURI,
|
||||
const uint32_t& aType) MOZ_OVERRIDE;
|
||||
@ -307,7 +306,6 @@ private:
|
||||
bool mIsForApp;
|
||||
bool mIsForBrowser;
|
||||
nsString mProcessName;
|
||||
nsWeakPtr mMemoryMinimizerRunnable;
|
||||
|
||||
static ContentChild* sSingleton;
|
||||
|
||||
|
@ -334,7 +334,6 @@ child:
|
||||
|
||||
NotifyProcessPriorityChanged(ProcessPriority priority);
|
||||
MinimizeMemoryUsage();
|
||||
CancelMinimizeMemoryUsage();
|
||||
|
||||
/**
|
||||
* Used to manage nsIStyleSheetService across processes.
|
||||
|
267
dom/media/IdpProxy.jsm
Normal file
267
dom/media/IdpProxy.jsm
Normal file
@ -0,0 +1,267 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
"use strict";
|
||||
|
||||
this.EXPORTED_SYMBOLS = ["IdpProxy"];
|
||||
|
||||
const {
|
||||
classes: Cc,
|
||||
interfaces: Ci,
|
||||
utils: Cu,
|
||||
results: Cr
|
||||
} = Components;
|
||||
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "Sandbox",
|
||||
"resource://gre/modules/identity/Sandbox.jsm");
|
||||
|
||||
/**
|
||||
* An invisible iframe for hosting the idp shim.
|
||||
*
|
||||
* There is no visible UX here, as we assume the user has already
|
||||
* logged in elsewhere (on a different screen in the web site hosting
|
||||
* the RTC functions).
|
||||
*/
|
||||
function IdpChannel(uri, messageCallback) {
|
||||
this.sandbox = null;
|
||||
this.messagechannel = null;
|
||||
this.source = uri;
|
||||
this.messageCallback = messageCallback;
|
||||
}
|
||||
|
||||
IdpChannel.prototype = {
|
||||
/**
|
||||
* Create a hidden, sandboxed iframe for hosting the IdP's js shim.
|
||||
*
|
||||
* @param callback
|
||||
* (function) invoked when this completes, with an error
|
||||
* argument if there is a problem, no argument if everything is
|
||||
* ok
|
||||
*/
|
||||
open: function(callback) {
|
||||
if (this.sandbox) {
|
||||
return callback(new Error("IdP channel already open"));
|
||||
}
|
||||
|
||||
let ready = this._sandboxReady.bind(this, callback);
|
||||
this.sandbox = new Sandbox(this.source, ready);
|
||||
},
|
||||
|
||||
_sandboxReady: function(aCallback, aSandbox) {
|
||||
// Inject a message channel into the subframe.
|
||||
this.messagechannel = new aSandbox._frame.contentWindow.MessageChannel();
|
||||
try {
|
||||
Object.defineProperty(
|
||||
aSandbox._frame.contentWindow.wrappedJSObject,
|
||||
"rtcwebIdentityPort",
|
||||
{
|
||||
value: this.messagechannel.port2
|
||||
}
|
||||
);
|
||||
} catch (e) {
|
||||
this.close();
|
||||
aCallback(e); // oops, the IdP proxy overwrote this.. bad
|
||||
return;
|
||||
}
|
||||
this.messagechannel.port1.onmessage = function(msg) {
|
||||
this.messageCallback(msg.data);
|
||||
}.bind(this);
|
||||
this.messagechannel.port1.start();
|
||||
aCallback();
|
||||
},
|
||||
|
||||
send: function(msg) {
|
||||
this.messagechannel.port1.postMessage(msg);
|
||||
},
|
||||
|
||||
close: function IdpChannel_close() {
|
||||
if (this.sandbox) {
|
||||
if (this.messagechannel) {
|
||||
this.messagechannel.port1.close();
|
||||
}
|
||||
this.sandbox.free();
|
||||
}
|
||||
this.messagechannel = null;
|
||||
this.sandbox = null;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* A message channel between the RTC PeerConnection and a designated IdP Proxy.
|
||||
*
|
||||
* @param domain (string) the domain to load up
|
||||
* @param protocol (string) Optional string for the IdP protocol
|
||||
*/
|
||||
function IdpProxy(domain, protocol) {
|
||||
IdpProxy.validateDomain(domain);
|
||||
IdpProxy.validateProtocol(protocol);
|
||||
|
||||
this.domain = domain;
|
||||
this.protocol = protocol || "default";
|
||||
|
||||
this._reset();
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that the domain is only a domain, and doesn't contain anything else.
|
||||
* Adds it to a URI, then checks that it matches perfectly.
|
||||
*/
|
||||
IdpProxy.validateDomain = function(domain) {
|
||||
let message = "Invalid domain for identity provider; ";
|
||||
if (!domain || typeof domain !== "string") {
|
||||
throw new Error(message + "must be a non-zero length string");
|
||||
}
|
||||
|
||||
message += "must only have a domain name and optionally a port";
|
||||
try {
|
||||
let ioService = Components.classes["@mozilla.org/network/io-service;1"]
|
||||
.getService(Components.interfaces.nsIIOService);
|
||||
let uri = ioService.newURI('https://' + domain + '/', null, null);
|
||||
|
||||
// this should trap errors
|
||||
// we could check uri.userPass, uri.path and uri.ref, but there is no need
|
||||
if (uri.hostPort !== domain) {
|
||||
throw new Error(message);
|
||||
}
|
||||
} catch (e if (e.result === Cr.NS_ERROR_MALFORMED_URI)) {
|
||||
throw new Error(message);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Checks that the IdP protocol is sane. In particular, we don't want someone
|
||||
* adding relative paths (e.g., "../../myuri"), which could be used to move
|
||||
* outside of /.well-known/ and into space that they control.
|
||||
*/
|
||||
IdpProxy.validateProtocol = function(protocol) {
|
||||
if (!protocol) {
|
||||
return; // falsy values turn into "default", so they are OK
|
||||
}
|
||||
let message = "Invalid protocol for identity provider; ";
|
||||
if (typeof protocol !== "string") {
|
||||
throw new Error(message + "must be a string");
|
||||
}
|
||||
if (decodeURIComponent(protocol).match(/[\/\\]/)) {
|
||||
throw new Error(message + "must not include '/' or '\\'");
|
||||
}
|
||||
};
|
||||
|
||||
IdpProxy.prototype = {
|
||||
_reset: function() {
|
||||
this.channel = null;
|
||||
this.ready = false;
|
||||
|
||||
this.counter = 0;
|
||||
this.tracking = {};
|
||||
this.pending = [];
|
||||
},
|
||||
|
||||
/**
|
||||
* Get a sandboxed iframe for hosting the idp-proxy's js. Create a message
|
||||
* channel down to the frame.
|
||||
*
|
||||
* @param errorCallback (function) a callback that will be invoked if there
|
||||
* is a fatal error starting the proxy
|
||||
*/
|
||||
start: function(errorCallback) {
|
||||
if (this.channel) {
|
||||
return;
|
||||
}
|
||||
let well_known = "https://" + this.domain;
|
||||
well_known += "/.well-known/idp-proxy/" + this.protocol;
|
||||
this.channel = new IdpChannel(well_known, this._messageReceived.bind(this));
|
||||
this.channel.open(function(error) {
|
||||
if (error) {
|
||||
this.close();
|
||||
if (typeof errorCallback === "function") {
|
||||
errorCallback(error);
|
||||
}
|
||||
}
|
||||
}.bind(this));
|
||||
},
|
||||
|
||||
/**
|
||||
* Send a message up to the idp proxy. This should be an RTC "SIGN" or
|
||||
* "VERIFY" message. This method adds the tracking 'id' parameter
|
||||
* automatically to the message so that the callback is only invoked for the
|
||||
* response to the message.
|
||||
*
|
||||
* This enqueues the message to send if the IdP hasn't signaled that it is
|
||||
* "READY", and sends the message when it is.
|
||||
*
|
||||
* The caller is responsible for ensuring that a response is received. If the
|
||||
* IdP doesn't respond, the callback simply isn't invoked.
|
||||
*/
|
||||
send: function(message, callback) {
|
||||
this.start();
|
||||
if (this.ready) {
|
||||
message.id = "" + (++this.counter);
|
||||
this.tracking[message.id] = callback;
|
||||
this.channel.send(message);
|
||||
} else {
|
||||
this.pending.push({ message: message, callback: callback });
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Handle a message from the IdP. This automatically sends if the message is
|
||||
* 'READY' so there is no need to track readiness state outside of this obj.
|
||||
*/
|
||||
_messageReceived: function(message) {
|
||||
if (!message) {
|
||||
return;
|
||||
}
|
||||
if (!this.ready && message.type === "READY") {
|
||||
this.ready = true;
|
||||
this.pending.forEach(function(p) {
|
||||
this.send(p.message, p.callback);
|
||||
}, this);
|
||||
this.pending = [];
|
||||
} else if (this.tracking[message.id]) {
|
||||
var callback = this.tracking[message.id];
|
||||
delete this.tracking[message.id];
|
||||
callback(message);
|
||||
} else {
|
||||
let console = Cc["@mozilla.org/consoleservice;1"].
|
||||
getService(Ci.nsIConsoleService);
|
||||
console.logStringMessage("Received bad message from IdP: " +
|
||||
message.id + ":" + message.type);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Performs cleanup. The object should be OK to use again.
|
||||
*/
|
||||
close: function() {
|
||||
if (!this.channel) {
|
||||
return;
|
||||
}
|
||||
|
||||
// clear out before letting others know in case they do something bad
|
||||
let trackingCopy = this.tracking;
|
||||
let pendingCopy = this.pending;
|
||||
|
||||
this.channel.close();
|
||||
this._reset();
|
||||
|
||||
// dump a message of type "ERROR" in response to all outstanding
|
||||
// messages to the IdP
|
||||
let error = { type: "ERROR", message: "IdP closed" };
|
||||
Object.keys(trackingCopy).forEach(function(k) {
|
||||
this.trackingCopy[k](error);
|
||||
}, this);
|
||||
pendingCopy.forEach(function(p) {
|
||||
p.callback(error);
|
||||
}, this);
|
||||
},
|
||||
|
||||
toString: function() {
|
||||
return this.domain + '/' + this.protocol;
|
||||
}
|
||||
};
|
||||
|
||||
this.IdpProxy = IdpProxy;
|
@ -1,3 +1,4 @@
|
||||
/* jshint moz:true, browser:true */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
@ -7,7 +8,10 @@
|
||||
const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
|
||||
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
Cu.import("resource://gre/modules/PopupNotifications.jsm");
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "PeerConnectionIdp",
|
||||
"resource://gre/modules/media/PeerConnectionIdp.jsm");
|
||||
|
||||
const PC_CONTRACT = "@mozilla.org/dom/peerconnection;1";
|
||||
const WEBRTC_GLOBAL_CONTRACT = "@mozilla.org/dom/webrtcglobalinformation1";
|
||||
@ -16,6 +20,7 @@ const PC_ICE_CONTRACT = "@mozilla.org/dom/rtcicecandidate;1";
|
||||
const PC_SESSION_CONTRACT = "@mozilla.org/dom/rtcsessiondescription;1";
|
||||
const PC_MANAGER_CONTRACT = "@mozilla.org/dom/peerconnectionmanager;1";
|
||||
const PC_STATS_CONTRACT = "@mozilla.org/dom/rtcstatsreport;1";
|
||||
const PC_IDENTITY_CONTRACT = "@mozilla.org/dom/rtcidentityassertion;1";
|
||||
|
||||
const PC_CID = Components.ID("{00e0e20d-1494-4776-8e0e-0f0acbea3c79}");
|
||||
const WEBRTC_GLOBAL_CID = Components.ID("{f6063d11-f467-49ad-9765-e7923050dc08}");
|
||||
@ -24,6 +29,7 @@ const PC_ICE_CID = Components.ID("{02b9970c-433d-4cc2-923d-f7028ac66073}");
|
||||
const PC_SESSION_CID = Components.ID("{1775081b-b62d-4954-8ffe-a067bbf508a7}");
|
||||
const PC_MANAGER_CID = Components.ID("{7293e901-2be3-4c02-b4bd-cbef6fc24f78}");
|
||||
const PC_STATS_CID = Components.ID("{7fe6e18b-0da3-4056-bf3b-440ef3809e06}");
|
||||
const PC_IDENTITY_CID = Components.ID("{1abc7499-3c54-43e0-bd60-686e2703f072}");
|
||||
|
||||
// Global list of PeerConnection objects, so they can be cleaned up when
|
||||
// a page is torn down. (Maps inner window ID to an array of PC objects).
|
||||
@ -99,7 +105,7 @@ GlobalPCList.prototype = {
|
||||
topic == "network:offline-about-to-go-offline") {
|
||||
// Delete all peerconnections on shutdown - mostly synchronously (we
|
||||
// need them to be done deleting transports and streams before we
|
||||
// return)! All socket operations must be queued to STS thread
|
||||
// return)! All socket operations must be queued to STS thread
|
||||
// before we return to here.
|
||||
// Also kill them if "Work Offline" is selected - more can be created
|
||||
// while offline, but attempts to connect them should fail.
|
||||
@ -110,7 +116,7 @@ GlobalPCList.prototype = {
|
||||
}
|
||||
else if (topic == "network:offline-status-changed") {
|
||||
if (data == "offline") {
|
||||
// this._list shold be empty here
|
||||
// this._list shold be empty here
|
||||
this._networkdown = true;
|
||||
} else if (data == "online") {
|
||||
this._networkdown = false;
|
||||
@ -290,6 +296,22 @@ RTCStatsReport.prototype = {
|
||||
get mozPcid() { return this._pcid; }
|
||||
};
|
||||
|
||||
function RTCIdentityAssertion() {}
|
||||
RTCIdentityAssertion.prototype = {
|
||||
classDescription: "RTCIdentityAssertion",
|
||||
classID: PC_IDENTITY_CID,
|
||||
contractID: PC_IDENTITY_CONTRACT,
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsISupports,
|
||||
Ci.nsIDOMGlobalPropertyInitializer]),
|
||||
|
||||
init: function(win) { this._win = win; },
|
||||
|
||||
__init: function(idp, name) {
|
||||
this.idp = idp;
|
||||
this.name = name;
|
||||
}
|
||||
};
|
||||
|
||||
function RTCPeerConnection() {
|
||||
this._queue = [];
|
||||
|
||||
@ -310,14 +332,15 @@ function RTCPeerConnection() {
|
||||
this._localType = null;
|
||||
this._remoteType = null;
|
||||
this._trickleIce = false;
|
||||
this._peerIdentity = null;
|
||||
|
||||
/**
|
||||
* Everytime we get a request from content, we put it in the queue. If
|
||||
* there are no pending operations though, we will execute it immediately.
|
||||
* In PeerConnectionObserver, whenever we are notified that an operation
|
||||
* has finished, we will check the queue for the next operation and execute
|
||||
* if neccesary. The _pending flag indicates whether an operation is currently
|
||||
* in progress.
|
||||
* Everytime we get a request from content, we put it in the queue. If there
|
||||
* are no pending operations though, we will execute it immediately. In
|
||||
* PeerConnectionObserver, whenever we are notified that an operation has
|
||||
* finished, we will check the queue for the next operation and execute if
|
||||
* neccesary. The _pending flag indicates whether an operation is currently in
|
||||
* progress.
|
||||
*/
|
||||
this._pending = false;
|
||||
|
||||
@ -355,15 +378,17 @@ RTCPeerConnection.prototype = {
|
||||
this.makeGetterSetterEH("onconnection");
|
||||
this.makeGetterSetterEH("onclosedconnection");
|
||||
this.makeGetterSetterEH("oniceconnectionstatechange");
|
||||
this.makeGetterSetterEH("onidentityresult");
|
||||
this.makeGetterSetterEH("onpeeridentity");
|
||||
|
||||
this._pc = new this._win.PeerConnectionImpl();
|
||||
|
||||
this.__DOM_IMPL__._innerObject = this;
|
||||
this._observer = new this._win.PeerConnectionObserver(this.__DOM_IMPL__);
|
||||
this._winID = this._win.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindowUtils).currentInnerWindowID;
|
||||
|
||||
// Add a reference to the PeerConnection to global list (before init).
|
||||
this._winID = this._win.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindowUtils).currentInnerWindowID;
|
||||
_globalPCList.addPC(this);
|
||||
|
||||
this._queueOrRun({
|
||||
@ -375,11 +400,12 @@ RTCPeerConnection.prototype = {
|
||||
},
|
||||
|
||||
_initialize: function(rtcConfig) {
|
||||
this._getPC().initialize(this._observer, this._win, rtcConfig,
|
||||
Services.tm.currentThread);
|
||||
this._impl.initialize(this._observer, this._win, rtcConfig,
|
||||
Services.tm.currentThread);
|
||||
this._initIdp();
|
||||
},
|
||||
|
||||
_getPC: function() {
|
||||
get _impl() {
|
||||
if (!this._pc) {
|
||||
throw new this._win.DOMError("",
|
||||
"RTCPeerConnection is gone (did you enter Offline mode?)");
|
||||
@ -387,11 +413,19 @@ RTCPeerConnection.prototype = {
|
||||
return this._pc;
|
||||
},
|
||||
|
||||
_initIdp: function() {
|
||||
let prefName = "media.peerconnection.identity.timeout";
|
||||
let idpTimeout = Services.prefs.getIntPref(prefName);
|
||||
let warningFunc = this.reportWarning.bind(this);
|
||||
this._localIdp = new PeerConnectionIdp(this._win, idpTimeout, warningFunc);
|
||||
this._remoteIdp = new PeerConnectionIdp(this._win, idpTimeout, warningFunc);
|
||||
},
|
||||
|
||||
/**
|
||||
* Add a function to the queue or run it immediately if the queue is empty.
|
||||
* Argument is an object with the func, args and wait properties; wait should
|
||||
* be set to true if the function has a success/error callback that will
|
||||
* call _executeNext, false if it doesn't have a callback.
|
||||
* be set to true if the function has a success/error callback that will call
|
||||
* _executeNext, false if it doesn't have a callback.
|
||||
*/
|
||||
_queueOrRun: function(obj) {
|
||||
this._checkClosed();
|
||||
@ -480,8 +514,8 @@ RTCPeerConnection.prototype = {
|
||||
* }
|
||||
*
|
||||
* WebIDL normalizes the top structure for us, but the mandatory constraints
|
||||
* member comes in as a raw object so we can detect unknown constraints.
|
||||
* We compare its members against ones we support, and fail if not found.
|
||||
* member comes in as a raw object so we can detect unknown constraints. We
|
||||
* compare its members against ones we support, and fail if not found.
|
||||
*/
|
||||
_mustValidateConstraints: function(constraints, errorMsg) {
|
||||
if (constraints.mandatory) {
|
||||
@ -599,7 +633,7 @@ RTCPeerConnection.prototype = {
|
||||
_createOffer: function(onSuccess, onError, constraints) {
|
||||
this._onCreateOfferSuccess = onSuccess;
|
||||
this._onCreateOfferFailure = onError;
|
||||
this._getPC().createOffer(constraints);
|
||||
this._impl.createOffer(constraints);
|
||||
},
|
||||
|
||||
_createAnswer: function(onSuccess, onError, constraints, provisional) {
|
||||
@ -622,7 +656,7 @@ RTCPeerConnection.prototype = {
|
||||
|
||||
// TODO: Implement provisional answer.
|
||||
|
||||
this._getPC().createAnswer(constraints);
|
||||
this._impl.createAnswer(constraints);
|
||||
},
|
||||
|
||||
createAnswer: function(onSuccess, onError, constraints, provisional) {
|
||||
@ -670,7 +704,7 @@ RTCPeerConnection.prototype = {
|
||||
_setLocalDescription: function(type, sdp, onSuccess, onError) {
|
||||
this._onSetLocalDescriptionSuccess = onSuccess;
|
||||
this._onSetLocalDescriptionFailure = onError;
|
||||
this._getPC().setLocalDescription(type, sdp);
|
||||
this._impl.setLocalDescription(type, sdp);
|
||||
},
|
||||
|
||||
setRemoteDescription: function(desc, onSuccess, onError) {
|
||||
@ -689,6 +723,15 @@ RTCPeerConnection.prototype = {
|
||||
"Invalid type " + desc.type + " provided to setRemoteDescription");
|
||||
}
|
||||
|
||||
try {
|
||||
let processIdentity = this._processIdentity.bind(this);
|
||||
this._remoteIdp.verifyIdentityFromSDP(desc.sdp, processIdentity);
|
||||
} catch (e) {
|
||||
this.reportWarning(e.message, e.fileName, e.lineNumber);
|
||||
// only happens if processing the SDP for identity doesn't work
|
||||
// let _setRemoteDescription do the error reporting
|
||||
}
|
||||
|
||||
this._queueOrRun({
|
||||
func: this._setRemoteDescription,
|
||||
args: [type, desc.sdp, onSuccess, onError],
|
||||
@ -697,10 +740,61 @@ RTCPeerConnection.prototype = {
|
||||
});
|
||||
},
|
||||
|
||||
_processIdentity: function(message) {
|
||||
if (message) {
|
||||
this._peerIdentity = new this._win.RTCIdentityAssertion(
|
||||
this._remoteIdp.provider, message.identity.name);
|
||||
|
||||
let args = { peerIdentity: this._peerIdentity };
|
||||
this.dispatchEvent(new this._win.Event("peeridentity"));
|
||||
}
|
||||
},
|
||||
|
||||
_setRemoteDescription: function(type, sdp, onSuccess, onError) {
|
||||
this._onSetRemoteDescriptionSuccess = onSuccess;
|
||||
this._onSetRemoteDescriptionFailure = onError;
|
||||
this._getPC().setRemoteDescription(type, sdp);
|
||||
this._impl.setRemoteDescription(type, sdp);
|
||||
},
|
||||
|
||||
setIdentityProvider: function(provider, protocol, username) {
|
||||
this._checkClosed();
|
||||
this._localIdp.setIdentityProvider(provider, protocol, username);
|
||||
},
|
||||
|
||||
_gotIdentityAssertion: function(assertion){
|
||||
let args = { assertion: assertion };
|
||||
let ev = new this._win.RTCPeerConnectionIdentityEvent("identityresult", args);
|
||||
this.dispatchEvent(ev);
|
||||
},
|
||||
|
||||
// we're going off spec with the error callback here.
|
||||
getIdentityAssertion: function(errorCallback) {
|
||||
this._checkClosed();
|
||||
if (typeof errorCallback !== "function") {
|
||||
if (errorCallback) {
|
||||
let message ="getIdentityAssertion argument must be a function";
|
||||
throw new this._win.DOMError("", message);
|
||||
}
|
||||
errorCallback = function() {
|
||||
this.reportWarning("getIdentityAssertion: no error callback set");
|
||||
}.bind(this);
|
||||
}
|
||||
|
||||
function gotAssertion(assertion) {
|
||||
if (assertion) {
|
||||
this._gotIdentityAssertion(assertion);
|
||||
} else {
|
||||
errorCallback("IdP did not produce an assertion");
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
this._localIdp.getIdentityAssertion(this._impl.fingerprint,
|
||||
gotAssertion.bind(this));
|
||||
}
|
||||
catch (e) {
|
||||
errorCallback("Could not get identity assertion: " + e.message);
|
||||
}
|
||||
},
|
||||
|
||||
updateIce: function(config, constraints) {
|
||||
@ -719,9 +813,9 @@ RTCPeerConnection.prototype = {
|
||||
},
|
||||
|
||||
_addIceCandidate: function(cand) {
|
||||
this._getPC().addIceCandidate(cand.candidate, cand.sdpMid || "",
|
||||
(cand.sdpMLineIndex === null)? 0 :
|
||||
cand.sdpMLineIndex + 1);
|
||||
this._impl.addIceCandidate(cand.candidate, cand.sdpMid || "",
|
||||
(cand.sdpMLineIndex === null) ? 0 :
|
||||
cand.sdpMLineIndex + 1);
|
||||
},
|
||||
|
||||
addStream: function(stream, constraints) {
|
||||
@ -739,11 +833,11 @@ RTCPeerConnection.prototype = {
|
||||
},
|
||||
|
||||
_addStream: function(stream, constraints) {
|
||||
this._getPC().addStream(stream, constraints);
|
||||
this._impl.addStream(stream, constraints);
|
||||
},
|
||||
|
||||
removeStream: function(stream) {
|
||||
//Bug 844295: Not implementing this functionality.
|
||||
// Bug 844295: Not implementing this functionality.
|
||||
throw new this._win.DOMError("", "removeStream not yet implemented");
|
||||
},
|
||||
|
||||
@ -758,32 +852,36 @@ RTCPeerConnection.prototype = {
|
||||
},
|
||||
|
||||
_close: function() {
|
||||
this._getPC().close();
|
||||
this._localIdp.close();
|
||||
this._remoteIdp.close();
|
||||
this._impl.close();
|
||||
},
|
||||
|
||||
getLocalStreams: function() {
|
||||
this._checkClosed();
|
||||
return this._getPC().getLocalStreams();
|
||||
return this._impl.getLocalStreams();
|
||||
},
|
||||
|
||||
getRemoteStreams: function() {
|
||||
this._checkClosed();
|
||||
return this._getPC().getRemoteStreams();
|
||||
return this._impl.getRemoteStreams();
|
||||
},
|
||||
|
||||
get localDescription() {
|
||||
this._checkClosed();
|
||||
let sdp = this._getPC().localDescription;
|
||||
let sdp = this._impl.localDescription;
|
||||
if (sdp.length == 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
sdp = this._localIdp.wrapSdp(sdp);
|
||||
return new this._win.mozRTCSessionDescription({ type: this._localType,
|
||||
sdp: sdp });
|
||||
},
|
||||
|
||||
get remoteDescription() {
|
||||
this._checkClosed();
|
||||
let sdp = this._getPC().remoteDescription;
|
||||
let sdp = this._impl.remoteDescription;
|
||||
if (sdp.length == 0) {
|
||||
return null;
|
||||
}
|
||||
@ -791,13 +889,14 @@ RTCPeerConnection.prototype = {
|
||||
sdp: sdp });
|
||||
},
|
||||
|
||||
get peerIdentity() { return this._peerIdentity; },
|
||||
get iceGatheringState() { return this._iceGatheringState; },
|
||||
get iceConnectionState() { return this._iceConnectionState; },
|
||||
|
||||
get signalingState() {
|
||||
// checking for our local pc closed indication
|
||||
// before invoking the pc methods.
|
||||
if(this._closed) {
|
||||
if (this._closed) {
|
||||
return "closed";
|
||||
}
|
||||
return {
|
||||
@ -808,7 +907,7 @@ RTCPeerConnection.prototype = {
|
||||
"SignalingHaveLocalPranswer": "have-local-pranswer",
|
||||
"SignalingHaveRemotePranswer": "have-remote-pranswer",
|
||||
"SignalingClosed": "closed"
|
||||
}[this._getPC().signalingState];
|
||||
}[this._impl.signalingState];
|
||||
},
|
||||
|
||||
changeIceGatheringState: function(state) {
|
||||
@ -840,7 +939,7 @@ RTCPeerConnection.prototype = {
|
||||
this._onGetStatsSuccess = onSuccess;
|
||||
this._onGetStatsFailure = onError;
|
||||
|
||||
this._getPC().getStats(selector, internal);
|
||||
this._impl.getStats(selector, internal);
|
||||
},
|
||||
|
||||
getLogging: function(pattern, onSuccess, onError) {
|
||||
@ -855,7 +954,7 @@ RTCPeerConnection.prototype = {
|
||||
this._onGetLoggingSuccess = onSuccess;
|
||||
this._onGetLoggingFailure = onError;
|
||||
|
||||
this._getPC().getLogging(pattern);
|
||||
this._impl.getLogging(pattern);
|
||||
},
|
||||
|
||||
createDataChannel: function(label, dict) {
|
||||
@ -868,7 +967,8 @@ RTCPeerConnection.prototype = {
|
||||
this.reportWarning("Deprecated RTCDataChannelInit dictionary entry maxRetransmitNum used!", null, 0);
|
||||
}
|
||||
if (dict.outOfOrderAllowed != undefined) {
|
||||
dict.ordered = !dict.outOfOrderAllowed; // the meaning is swapped with the name change
|
||||
dict.ordered = !dict.outOfOrderAllowed; // the meaning is swapped with
|
||||
// the name change
|
||||
this.reportWarning("Deprecated RTCDataChannelInit dictionary entry outOfOrderAllowed used!", null, 0);
|
||||
}
|
||||
if (dict.preset != undefined) {
|
||||
@ -903,7 +1003,7 @@ RTCPeerConnection.prototype = {
|
||||
}
|
||||
|
||||
// Synchronous since it doesn't block.
|
||||
let channel = this._getPC().createDataChannel(
|
||||
let channel = this._impl.createDataChannel(
|
||||
label, protocol, type, !dict.ordered, dict.maxRetransmitTime,
|
||||
dict.maxRetransmits, dict.negotiated ? true : false,
|
||||
dict.id != undefined ? dict.id : 0xFFFF
|
||||
@ -923,7 +1023,7 @@ RTCPeerConnection.prototype = {
|
||||
},
|
||||
|
||||
_connectDataConnection: function(localport, remoteport, numstreams) {
|
||||
this._getPC().connectDataConnection(localport, remoteport, numstreams);
|
||||
this._impl.connectDataConnection(localport, remoteport, numstreams);
|
||||
}
|
||||
};
|
||||
|
||||
@ -982,10 +1082,17 @@ PeerConnectionObserver.prototype = {
|
||||
},
|
||||
|
||||
onCreateOfferSuccess: function(sdp) {
|
||||
this.callCB(this._dompc._onCreateOfferSuccess,
|
||||
new this._dompc._win.mozRTCSessionDescription({ type: "offer",
|
||||
sdp: sdp }));
|
||||
this._dompc._executeNext();
|
||||
let pc = this._dompc;
|
||||
let fp = pc._impl.fingerprint;
|
||||
pc._localIdp.appendIdentityToSDP(sdp, fp, function(sdp, assertion) {
|
||||
if (assertion) {
|
||||
pc._gotIdentityAssertion(assertion);
|
||||
}
|
||||
this.callCB(pc._onCreateOfferSuccess,
|
||||
new pc._win.mozRTCSessionDescription({ type: "offer",
|
||||
sdp: sdp }));
|
||||
pc._executeNext();
|
||||
}.bind(this));
|
||||
},
|
||||
|
||||
onCreateOfferError: function(code, message) {
|
||||
@ -994,10 +1101,17 @@ PeerConnectionObserver.prototype = {
|
||||
},
|
||||
|
||||
onCreateAnswerSuccess: function(sdp) {
|
||||
this.callCB (this._dompc._onCreateAnswerSuccess,
|
||||
new this._dompc._win.mozRTCSessionDescription({ type: "answer",
|
||||
sdp: sdp }));
|
||||
this._dompc._executeNext();
|
||||
let pc = this._dompc;
|
||||
let fp = pc._impl.fingerprint;
|
||||
pc._localIdp.appendIdentityToSDP(sdp, fp, function(sdp, assertion) {
|
||||
if (assertion) {
|
||||
pc._gotIdentityAssertion(assertion);
|
||||
}
|
||||
this.callCB (pc._onCreateAnswerSuccess,
|
||||
new pc._win.mozRTCSessionDescription({ type: "answer",
|
||||
sdp: sdp }));
|
||||
pc._executeNext();
|
||||
}.bind(this));
|
||||
},
|
||||
|
||||
onCreateAnswerError: function(code, message) {
|
||||
@ -1241,6 +1355,7 @@ this.NSGetFactory = XPCOMUtils.generateNSGetFactory(
|
||||
RTCSessionDescription,
|
||||
RTCPeerConnection,
|
||||
RTCStatsReport,
|
||||
RTCIdentityAssertion,
|
||||
PeerConnectionObserver,
|
||||
WebrtcGlobalInformation]
|
||||
);
|
||||
|
@ -5,6 +5,7 @@ component {02b9970c-433d-4cc2-923d-f7028ac66073} PeerConnection.js
|
||||
component {1775081b-b62d-4954-8ffe-a067bbf508a7} PeerConnection.js
|
||||
component {7293e901-2be3-4c02-b4bd-cbef6fc24f78} PeerConnection.js
|
||||
component {7fe6e18b-0da3-4056-bf3b-440ef3809e06} PeerConnection.js
|
||||
component {1abc7499-3c54-43e0-bd60-686e2703f072} PeerConnection.js
|
||||
|
||||
contract @mozilla.org/dom/peerconnection;1 {00e0e20d-1494-4776-8e0e-0f0acbea3c79}
|
||||
contract @mozilla.org/dom/webrtcglobalinformation;1 {f6063d11-f467-49ad-9765-e7923050dc08}
|
||||
@ -13,3 +14,4 @@ contract @mozilla.org/dom/rtcicecandidate;1 {02b9970c-433d-4cc2-923d-f7028ac6607
|
||||
contract @mozilla.org/dom/rtcsessiondescription;1 {1775081b-b62d-4954-8ffe-a067bbf508a7}
|
||||
contract @mozilla.org/dom/peerconnectionmanager;1 {7293e901-2be3-4c02-b4bd-cbef6fc24f78}
|
||||
contract @mozilla.org/dom/rtcstatsreport;1 {7fe6e18b-0da3-4056-bf3b-440ef3809e06}
|
||||
contract @mozilla.org/dom/rtcidentityassertion;1 {1abc7499-3c54-43e0-bd60-686e2703f072}
|
||||
|
337
dom/media/PeerConnectionIdp.jsm
Normal file
337
dom/media/PeerConnectionIdp.jsm
Normal file
@ -0,0 +1,337 @@
|
||||
/* jshint moz:true, browser:true */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
this.EXPORTED_SYMBOLS = ["PeerConnectionIdp"];
|
||||
|
||||
const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
|
||||
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "IdpProxy",
|
||||
"resource://gre/modules/media/IdpProxy.jsm");
|
||||
|
||||
/**
|
||||
* Creates an IdP helper.
|
||||
*
|
||||
* @param window (object) the window object to use for miscellaneous goodies
|
||||
* @param timeout (int) the timeout in milliseconds
|
||||
* @param warningFunc (function) somewhere to dump warning messages
|
||||
*/
|
||||
function PeerConnectionIdp(window, timeout, warningFunc) {
|
||||
this._win = window;
|
||||
this._timeout = timeout || 5000;
|
||||
this._warning = warningFunc;
|
||||
|
||||
this.assertion = null;
|
||||
this.provider = null;
|
||||
}
|
||||
|
||||
(function() {
|
||||
PeerConnectionIdp._mLinePattern = new RegExp("^m=", "m");
|
||||
// attributes are funny, the 'a' is case sensitive, the name isn't
|
||||
let pattern = "^a=[iI][dD][eE][nN][tT][iI][tT][yY]:(\\S+)";
|
||||
PeerConnectionIdp._identityPattern = new RegExp(pattern, "m");
|
||||
pattern = "^a=[fF][iI][nN][gG][eE][rR][pP][rR][iI][nN][tT]:(\\S+) (\\S+)";
|
||||
PeerConnectionIdp._fingerprintPattern = new RegExp(pattern, "m");
|
||||
})();
|
||||
|
||||
PeerConnectionIdp.prototype = {
|
||||
setIdentityProvider: function(
|
||||
provider, protocol, username) {
|
||||
this.provider = provider;
|
||||
this._idpchannel = new IdpProxy(provider, protocol, username);
|
||||
},
|
||||
|
||||
close: function() {
|
||||
this.assertion = null;
|
||||
this.provider = null;
|
||||
if (this._idpchannel) {
|
||||
this._idpchannel.close();
|
||||
this._idpchannel = null;
|
||||
}
|
||||
},
|
||||
|
||||
_getFingerprintFromSdp: function(sdp) {
|
||||
let sections = sdp.split(PeerConnectionIdp._mLinePattern);
|
||||
let attributes = sections.map(function(sect) {
|
||||
let m = sect.match(PeerConnectionIdp._fingerprintPattern);
|
||||
if (m) {
|
||||
let remainder = sect.substring(m.index + m[0].length);
|
||||
if (!remainder.match(PeerConnectionIdp._fingerprintPattern)) {
|
||||
return { algorithm: m[1], digest: m[2] };
|
||||
}
|
||||
this._warning("RTC identity: two fingerprint values in same media " +
|
||||
"section are not supported", null, 0);
|
||||
// we have to return non-falsy here so that a media section doesn't
|
||||
// accidentally fall back to the session-level stuff (which is bad)
|
||||
return "error";
|
||||
}
|
||||
// return undefined unless there is exactly one match
|
||||
}, this);
|
||||
|
||||
let sessionLevel = attributes.shift();
|
||||
attributes = attributes.map(function(sectionLevel) {
|
||||
return sectionLevel || sessionLevel;
|
||||
});
|
||||
|
||||
let first = attributes.shift();
|
||||
function sameAsFirst(attr) {
|
||||
return typeof attr === "object" &&
|
||||
first.algorithm === attr.algorithm &&
|
||||
first.digest === attr.digest;
|
||||
}
|
||||
|
||||
if (typeof first === "object" && attributes.every(sameAsFirst)) {
|
||||
return first;
|
||||
}
|
||||
// undefined!
|
||||
},
|
||||
|
||||
_getIdentityFromSdp: function(sdp) {
|
||||
// we only pull from the session level right now
|
||||
// TODO allow for per-m=-section identity
|
||||
let mLineMatch = sdp.match(PeerConnectionIdp._mLinePattern);
|
||||
let sessionLevel = sdp.substring(0, mLineMatch.index);
|
||||
let idMatch = sessionLevel.match(PeerConnectionIdp._identityPattern);
|
||||
if (idMatch) {
|
||||
let assertion = {};
|
||||
try {
|
||||
assertion = JSON.parse(atob(idMatch[1]));
|
||||
} catch (e) {
|
||||
this._warning("RTC identity: invalid identity assertion: " + e, null, 0);
|
||||
} // for JSON.parse
|
||||
if (typeof assertion.idp === "object" &&
|
||||
typeof assertion.idp.domain === "string" &&
|
||||
typeof assertion.assertion === "string") {
|
||||
return assertion;
|
||||
}
|
||||
this._warning("RTC identity: assertion missing idp/idp.domain/assertion",
|
||||
null, 0);
|
||||
}
|
||||
// undefined!
|
||||
},
|
||||
|
||||
/**
|
||||
* Queues a task to verify the a=identity line the given SDP contains, if any.
|
||||
* If the verification succeeds callback is called with the message from the
|
||||
* IdP proxy as parameter, else (verification failed OR no a=identity line in
|
||||
* SDP at all) null is passed to callback.
|
||||
*/
|
||||
verifyIdentityFromSDP: function(sdp, callback) {
|
||||
let identity = this._getIdentityFromSdp(sdp);
|
||||
let fingerprint = this._getFingerprintFromSdp(sdp);
|
||||
// it's safe to use the fingerprint from the SDP here,
|
||||
// only because we ensure that there is only one
|
||||
if (!fingerprint || !identity) {
|
||||
callback(null);
|
||||
return;
|
||||
}
|
||||
if (!this._idpchannel) {
|
||||
this.setIdentityProvider(identity.idp.domain, identity.idp.protocol);
|
||||
}
|
||||
|
||||
this._verifyIdentity(identity.assertion, fingerprint, callback);
|
||||
},
|
||||
|
||||
/**
|
||||
* Checks that the name in the identity provided by the IdP is OK.
|
||||
*
|
||||
* @param name (string) the name to validate
|
||||
* @returns (string) an error message, iff the name isn't good
|
||||
*/
|
||||
_validateName: function(name) {
|
||||
if (typeof name !== "string") {
|
||||
return "name not a string";
|
||||
}
|
||||
let atIdx = name.indexOf("@");
|
||||
if (atIdx > 0) {
|
||||
// no third party assertions... for now
|
||||
let tail = name.substring(atIdx + 1);
|
||||
|
||||
// strip the port number, if present
|
||||
let provider = this.provider;
|
||||
let providerPortIdx = provider.indexOf(":");
|
||||
if (providerPortIdx > 0) {
|
||||
provider = provider.substring(0, providerPortIdx);
|
||||
}
|
||||
var idnService = Components.classes["@mozilla.org/network/idn-service;1"].
|
||||
getService(Components.interfaces.nsIIDNService);
|
||||
if (idnService.convertUTF8toACE(tail) !==
|
||||
idnService.convertUTF8toACE(provider)) {
|
||||
return "name '" + identity.name +
|
||||
"' doesn't match IdP: '" + this.provider + "'";
|
||||
}
|
||||
return null;
|
||||
}
|
||||
return "missing authority in name from IdP";
|
||||
},
|
||||
|
||||
// we are very defensive here when handling the message from the IdP
|
||||
// proxy so that broken IdPs can only do as little harm as possible.
|
||||
_checkVerifyResponse: function(
|
||||
message, fingerprint) {
|
||||
let warn = function(message) {
|
||||
this._warning("RTC identity: VERIFY error: " + message, null, 0);
|
||||
}.bind(this);
|
||||
|
||||
try {
|
||||
let contents = JSON.parse(message.contents);
|
||||
if (typeof contents.fingerprint !== "object" ||
|
||||
typeof message.identity !== "object") {
|
||||
warn("fingerprint or identity not objects");
|
||||
} else if (contents.fingerprint.digest !== fingerprint.digest ||
|
||||
contents.fingerprint.algorithm !== fingerprint.algorithm) {
|
||||
warn("fingerprint does not match");
|
||||
} else {
|
||||
let error = this._validateName(message.identity.name);
|
||||
if (error) {
|
||||
warn(error);
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} catch(e) {
|
||||
warn("invalid JSON in content");
|
||||
}
|
||||
return false;
|
||||
},
|
||||
|
||||
/**
|
||||
* Asks the IdP proxy to verify an identity.
|
||||
*/
|
||||
_verifyIdentity: function(
|
||||
assertion, fingerprint, callback) {
|
||||
function onVerification(message) {
|
||||
if (!message) {
|
||||
this._warning("RTC identity: verification failure", null, 0);
|
||||
callback(null);
|
||||
return;
|
||||
}
|
||||
if (this._checkVerifyResponse(message, fingerprint)) {
|
||||
callback(message);
|
||||
} else {
|
||||
callback(null);
|
||||
}
|
||||
}
|
||||
|
||||
this._sendToIdp("VERIFY", assertion, onVerification.bind(this));
|
||||
},
|
||||
|
||||
/**
|
||||
* Asks the IdP proxy for an identity assertion and, on success, enriches the
|
||||
* given SDP with an a=identity line and calls callback with the new SDP as
|
||||
* parameter. If no IdP is configured the original SDP (without a=identity
|
||||
* line) is passed to the callback.
|
||||
*/
|
||||
appendIdentityToSDP: function(
|
||||
sdp, fingerprint, callback) {
|
||||
if (!this._idpchannel) {
|
||||
callback(sdp);
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.assertion) {
|
||||
callback(this.wrapSdp(sdp));
|
||||
return;
|
||||
}
|
||||
|
||||
function onAssertion(assertion) {
|
||||
if (!assertion) {
|
||||
this._warning("RTC identity: assertion generation failure", null, 0);
|
||||
callback(sdp);
|
||||
return;
|
||||
}
|
||||
|
||||
this.assertion = btoa(JSON.stringify(assertion));
|
||||
callback(this.wrapSdp(sdp), this.assertion);
|
||||
}
|
||||
|
||||
this._getIdentityAssertion(fingerprint, onAssertion.bind(this));
|
||||
},
|
||||
|
||||
/**
|
||||
* Inserts an identity assertion into the given SDP.
|
||||
*/
|
||||
wrapSdp: function(sdp) {
|
||||
if (!this.assertion) {
|
||||
return sdp;
|
||||
}
|
||||
|
||||
// yes, we assume that this matches; if it doesn't something is *wrong*
|
||||
let match = sdp.match(PeerConnectionIdp._mLinePattern);
|
||||
return sdp.substring(0, match.index) +
|
||||
"a=identity:" + this.assertion + "\r\n" +
|
||||
sdp.substring(match.index);
|
||||
},
|
||||
|
||||
getIdentityAssertion: function(
|
||||
fingerprint, callback) {
|
||||
if (!this._idpchannel) {
|
||||
throw new Error("IdP not set");
|
||||
}
|
||||
|
||||
this._getIdentityAssertion(fingerprint, callback);
|
||||
},
|
||||
|
||||
_getIdentityAssertion: function(
|
||||
fingerprint, callback) {
|
||||
let [algorithm, digest] = fingerprint.split(" ");
|
||||
let message = {
|
||||
fingerprint: {
|
||||
algorithm: algorithm,
|
||||
digest: digest
|
||||
}
|
||||
};
|
||||
this._sendToIdp("SIGN", JSON.stringify(message), callback);
|
||||
},
|
||||
|
||||
/**
|
||||
* Packages a message and sends it to the IdP.
|
||||
*/
|
||||
_sendToIdp: function(type, message, callback) {
|
||||
// this is not secure
|
||||
// but there are no good alternatives until bug 968335 lands
|
||||
// when that happens, change this to use the new mechanism
|
||||
let origin = this._win.document.nodePrincipal.origin;
|
||||
|
||||
this._idpchannel.send({
|
||||
type: type,
|
||||
message: message,
|
||||
origin: origin
|
||||
}, this._wrapCallback(callback));
|
||||
},
|
||||
|
||||
/**
|
||||
* Wraps a callback, adding a timeout and ensuring that the callback doesn't
|
||||
* receive any message other than one where the IdP generated a "SUCCESS"
|
||||
* response.
|
||||
*/
|
||||
_wrapCallback: function(callback) {
|
||||
let timeout = this._win.setTimeout(function() {
|
||||
this._warning("RTC identity: IdP timeout for " + this._idpchannel + " " +
|
||||
(this._idpchannel.ready ? "[ready]" : "[not ready]"), null, 0);
|
||||
timeout = null;
|
||||
callback(null);
|
||||
}.bind(this), this._timeout);
|
||||
|
||||
return function(message) {
|
||||
if (!timeout) {
|
||||
return;
|
||||
}
|
||||
this._win.clearTimeout(timeout);
|
||||
timeout = null;
|
||||
var content = null;
|
||||
if (message.type === "SUCCESS") {
|
||||
content = message.message;
|
||||
} else {
|
||||
this._warning("RTC Identity: received response of type '" +
|
||||
message.type + "' from IdP: " + message.message, null, 0);
|
||||
}
|
||||
callback(content);
|
||||
}.bind(this);
|
||||
}
|
||||
};
|
||||
|
||||
this.PeerConnectionIdp = PeerConnectionIdp;
|
@ -12,7 +12,7 @@ if CONFIG['MOZ_WEBRTC']:
|
||||
'/media/webrtc/trunk',
|
||||
]
|
||||
|
||||
TEST_DIRS += ['tests/mochitest', 'tests/ipc']
|
||||
TEST_DIRS += ['tests/mochitest', 'tests/ipc', 'tests/identity']
|
||||
|
||||
XPIDL_SOURCES += [
|
||||
'nsIDOMMediaStream.idl',
|
||||
@ -40,6 +40,13 @@ EXTRA_COMPONENTS += [
|
||||
'PeerConnection.manifest',
|
||||
]
|
||||
|
||||
JS_MODULES_PATH = 'modules/media'
|
||||
|
||||
EXTRA_JS_MODULES += [
|
||||
'IdpProxy.jsm',
|
||||
'PeerConnectionIdp.jsm',
|
||||
]
|
||||
|
||||
if CONFIG['MOZ_B2G']:
|
||||
EXPORTS.mozilla += [
|
||||
'MediaPermissionGonk.h',
|
||||
|
96
dom/media/tests/identity/idp-proxy.js
Normal file
96
dom/media/tests/identity/idp-proxy.js
Normal file
@ -0,0 +1,96 @@
|
||||
(function(global) {
|
||||
"use strict";
|
||||
|
||||
function IDPJS() {
|
||||
this.domain = window.location.host;
|
||||
// so rather than create a million different IdP configurations and litter
|
||||
// the world with files all containing near-identical code, let's use the
|
||||
// hash/URL fragment as a way of generating instructions for the IdP
|
||||
this.instructions = window.location.hash.replace("#", "").split(":");
|
||||
this.port = window.rtcwebIdentityPort;
|
||||
this.port.onmessage = this.receiveMessage.bind(this);
|
||||
this.sendResponse({
|
||||
type : "READY"
|
||||
});
|
||||
}
|
||||
|
||||
IDPJS.prototype.getDelay = function() {
|
||||
// instructions in the form "delay123" have that many milliseconds
|
||||
// added before sending the response
|
||||
var delay = 0;
|
||||
function addDelay(instruction) {
|
||||
var m = instruction.match(/^delay(\d+)$/);
|
||||
if (m) {
|
||||
delay += parseInt(m[1], 10);
|
||||
}
|
||||
}
|
||||
this.instructions.forEach(addDelay);
|
||||
return delay;
|
||||
};
|
||||
|
||||
function is(target) {
|
||||
return function(instruction) {
|
||||
return instruction === target;
|
||||
};
|
||||
}
|
||||
|
||||
IDPJS.prototype.sendResponse = function(response) {
|
||||
// we don't touch the READY message unless told to
|
||||
if (response.type === "READY" && !this.instructions.some(is("ready"))) {
|
||||
this.port.postMessage(response);
|
||||
return;
|
||||
}
|
||||
|
||||
// if any instruction is "error", return an error.
|
||||
if (this.instructions.some(is("error"))) {
|
||||
response.type = "ERROR";
|
||||
}
|
||||
|
||||
window.setTimeout(function() {
|
||||
this.port.postMessage(response);
|
||||
}.bind(this), this.getDelay());
|
||||
};
|
||||
|
||||
IDPJS.prototype.receiveMessage = function(ev) {
|
||||
var message = ev.data;
|
||||
switch (message.type) {
|
||||
case "SIGN":
|
||||
this.sendResponse({
|
||||
type : "SUCCESS",
|
||||
id : message.id,
|
||||
message : {
|
||||
idp : {
|
||||
domain : this.domain,
|
||||
protocol : "idp.html"
|
||||
},
|
||||
assertion : JSON.stringify({
|
||||
identity : "someone@" + this.domain,
|
||||
contents : message.message
|
||||
})
|
||||
}
|
||||
});
|
||||
break;
|
||||
case "VERIFY":
|
||||
this.sendResponse({
|
||||
type : "SUCCESS",
|
||||
id : message.id,
|
||||
message : {
|
||||
identity : {
|
||||
name : "someone@" + this.domain,
|
||||
displayname : "Someone"
|
||||
},
|
||||
contents : JSON.parse(message.message).contents
|
||||
}
|
||||
});
|
||||
break;
|
||||
default:
|
||||
this.sendResponse({
|
||||
type : "ERROR",
|
||||
error : JSON.stringify(message)
|
||||
});
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
global.idp = new IDPJS();
|
||||
}(this));
|
11
dom/media/tests/identity/idp.html
Normal file
11
dom/media/tests/identity/idp.html
Normal file
@ -0,0 +1,11 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>IDP Proxy</title>
|
||||
<script src="idp-proxy.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
Test IDP Proxy
|
||||
</body>
|
||||
</html>
|
19
dom/media/tests/identity/mochitest.ini
Normal file
19
dom/media/tests/identity/mochitest.ini
Normal file
@ -0,0 +1,19 @@
|
||||
[DEFAULT]
|
||||
support-files =
|
||||
/.well-known/idp-proxy/idp.html
|
||||
/.well-known/idp-proxy/idp-proxy.js
|
||||
|
||||
# All tests are disabled on android due to lack of https support in mochitest
|
||||
# (Bug 975149)
|
||||
# All tests are disabled on b2g due to lack of e10s support in WebRTC identity
|
||||
# (Bug 975144)
|
||||
[test_idpproxy.html]
|
||||
skip-if = os == "android" || appname == "b2g"
|
||||
[test_getIdentityAssertion.html]
|
||||
skip-if = os == "android" || appname == "b2g"
|
||||
[test_setIdentityProvider.html]
|
||||
skip-if = os == "android" || appname == "b2g"
|
||||
[test_setIdentityProviderWithErrors.html]
|
||||
skip-if = os == "android" || appname == "b2g"
|
||||
[../mochitest/test_zmedia_cleanup.html]
|
||||
skip-if = os == "android" || appname == "b2g"
|
85
dom/media/tests/identity/test_getIdentityAssertion.html
Normal file
85
dom/media/tests/identity/test_getIdentityAssertion.html
Normal file
@ -0,0 +1,85 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="application/javascript" src="../mochitest/head.js"></script>
|
||||
<script type="application/javascript" src="../mochitest/pc.js"></script>
|
||||
<script type="application/javascript" src="../mochitest/templates.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
createHTML({
|
||||
title: "getIdentityAssertion Tests"
|
||||
});
|
||||
|
||||
var test;
|
||||
function theTest() {
|
||||
test = new PeerConnectionTest();
|
||||
test.setMediaConstraints([{audio: true}], [{audio: true}]);
|
||||
test.chain.append([
|
||||
[
|
||||
"GET_IDENTITY_ASSERTION_FAILS_WITHOUT_PROVIDER",
|
||||
function(test) {
|
||||
test.pcLocal._pc.getIdentityAssertion(function(err) {
|
||||
ok(err, "getIdentityAssertion must fail without provider");
|
||||
test.next();
|
||||
});
|
||||
},
|
||||
],
|
||||
[
|
||||
"GET_IDENTITY_ASSERTION_FIRES_EVENTUALLY_AND_SUBSEQUENTLY",
|
||||
function(test) {
|
||||
var fired = 0;
|
||||
test.setIdentityProvider(test.pcLocal, 'example.com', 'idp.html', 'nobody');
|
||||
test.pcLocal._pc.onidentityresult = function() {
|
||||
fired++;
|
||||
if (fired == 1) {
|
||||
ok(true, "identityresult fired");
|
||||
} else if (fired == 2) {
|
||||
ok(true, "identityresult fired 2x");
|
||||
test.next();
|
||||
}
|
||||
};
|
||||
test.pcLocal._pc.getIdentityAssertion();
|
||||
test.pcLocal._pc.getIdentityAssertion();
|
||||
}
|
||||
],
|
||||
[
|
||||
"GET_IDENTITY_ASSERTION_FAILS",
|
||||
function(test) {
|
||||
test.setIdentityProvider(test.pcLocal, 'example.com', 'idp.html#error');
|
||||
test.pcLocal._pc.onidentityresult = function(e) {
|
||||
ok(false, "Should not get an identity result");
|
||||
test.next();
|
||||
};
|
||||
test.pcLocal._pc.getIdentityAssertion(function(err) {
|
||||
ok(err, "Got error callback from getIdentityAssertion");
|
||||
test.next();
|
||||
});
|
||||
}
|
||||
],
|
||||
[
|
||||
"GET_IDENTITY_ASSERTION_IDP_NOT_READY",
|
||||
function(test) {
|
||||
test.setIdentityProvider(test.pcLocal, 'example.com', 'idp.html#error:ready');
|
||||
test.pcLocal._pc.onidentityresult = function(e) {
|
||||
ok(false, "Should not get an identity result");
|
||||
test.next();
|
||||
};
|
||||
test.pcLocal._pc.getIdentityAssertion(function(err) {
|
||||
ok(err, "Got error callback from getIdentityAssertion");
|
||||
test.next();
|
||||
});
|
||||
}
|
||||
]
|
||||
]);
|
||||
test.run();
|
||||
}
|
||||
runTest(theTest);
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
133
dom/media/tests/identity/test_idpproxy.html
Normal file
133
dom/media/tests/identity/test_idpproxy.html
Normal file
@ -0,0 +1,133 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script class="testbody" type="application/javascript">
|
||||
"use strict";
|
||||
var Cu = SpecialPowers.Cu;
|
||||
var rtcid = Cu.import("resource://gre/modules/media/IdpProxy.jsm");
|
||||
var IdpProxy = rtcid.IdpProxy;
|
||||
var request = {
|
||||
type: "SIGN",
|
||||
message: "foo"
|
||||
};
|
||||
|
||||
function test_domain_sandbox(done) {
|
||||
var diabolical = {
|
||||
toString : function() {
|
||||
return "example.com/path";
|
||||
}
|
||||
};
|
||||
var domains = [ "ex/foo", "user@ex", "user:pass@ex", "ex#foo", "ex?foo",
|
||||
"", 12, null, diabolical, true ];
|
||||
domains.forEach(function(domain) {
|
||||
try {
|
||||
var idp = new IdpProxy(domain);
|
||||
ok(false, "IdpProxy didn't catch bad domain: " + domain);
|
||||
} catch (e) {
|
||||
var str = (typeof domain === "string") ? domain : typeof domain;
|
||||
ok(true, "Evil domain '" + str + "' raises exception");
|
||||
}
|
||||
});
|
||||
done();
|
||||
}
|
||||
|
||||
function test_protocol_sandbox(done) {
|
||||
var protos = [ "../evil/proto", "..%2Fevil%2Fproto",
|
||||
"\\evil", "%5cevil", 12, true, {} ];
|
||||
protos.forEach(function(proto) {
|
||||
try {
|
||||
var idp = new IdpProxy("example.com", proto);
|
||||
ok(false, "IdpProxy didn't catch bad protocol: " + proto);
|
||||
} catch (e) {
|
||||
var str = (typeof proto === "string") ? proto : typeof proto;
|
||||
ok(true, "Evil protocol '" + proto + "' raises exception");
|
||||
}
|
||||
});
|
||||
done();
|
||||
}
|
||||
|
||||
function handleFailure(done) {
|
||||
function failure(error) {
|
||||
ok(false, "IdP error" + error);
|
||||
done();
|
||||
}
|
||||
setTimeout(failure, 5000);
|
||||
return failure;
|
||||
}
|
||||
|
||||
function test_success_response(done) {
|
||||
var idp;
|
||||
var failure = handleFailure(done);
|
||||
var timeout = setTimeout(failure, 5000);;
|
||||
|
||||
function handleResponse(response) {
|
||||
is(SpecialPowers.wrap(response).type, "SUCCESS", "IdP responds with SUCCESS");
|
||||
idp.close();
|
||||
clearTimeout(timeout);
|
||||
done();
|
||||
}
|
||||
|
||||
idp = new IdpProxy("example.com", "idp.html");
|
||||
idp.start(failure);
|
||||
idp.send(request, handleResponse);
|
||||
}
|
||||
|
||||
function test_error_response(done) {
|
||||
var idp;
|
||||
var failure = handleFailure(done);
|
||||
var timeout = setTimeout(failure, 5000);;
|
||||
|
||||
function handleResponse(response) {
|
||||
is(SpecialPowers.wrap(response).type, "ERROR", "IdP should produce ERROR");
|
||||
idp.close();
|
||||
clearTimeout(timeout);
|
||||
done();
|
||||
}
|
||||
|
||||
idp = new IdpProxy("example.com", "idp.html#error");
|
||||
idp.start(failure);
|
||||
idp.send(request, handleResponse);
|
||||
}
|
||||
|
||||
function test_delayed_response(done) {
|
||||
var idp;
|
||||
var failure = handleFailure(done);
|
||||
var timeout = setTimeout(failure, 5000);;
|
||||
|
||||
function handleResponse(response) {
|
||||
is(SpecialPowers.wrap(response).type, "SUCCESS",
|
||||
"IdP should handle delayed response");
|
||||
idp.close();
|
||||
clearTimeout(timeout);
|
||||
done();
|
||||
}
|
||||
|
||||
idp = new IdpProxy("example.com", "idp.html#delay100");
|
||||
idp.start(failure);
|
||||
idp.send(request, handleResponse);
|
||||
}
|
||||
|
||||
var TESTS = [ test_domain_sandbox, test_protocol_sandbox,
|
||||
test_success_response, test_error_response,
|
||||
test_delayed_response ];
|
||||
|
||||
function run_next_test() {
|
||||
if (TESTS.length) {
|
||||
var test = TESTS.shift();
|
||||
test(run_next_test);
|
||||
} else {
|
||||
SimpleTest.finish();
|
||||
}
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
SpecialPowers.pushPrefEnv({
|
||||
"set" : [ [ "dom.messageChannel.enabled", true ] ]
|
||||
}, run_next_test);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
100
dom/media/tests/identity/test_setIdentityProvider.html
Normal file
100
dom/media/tests/identity/test_setIdentityProvider.html
Normal file
@ -0,0 +1,100 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="application/javascript" src="../mochitest/head.js"></script>
|
||||
<script type="application/javascript" src="../mochitest/pc.js"></script>
|
||||
<script type="application/javascript" src="../mochitest/templates.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
createHTML({
|
||||
title: "setIdentityProvider leads to peerIdentity and assertions in SDP"
|
||||
});
|
||||
|
||||
var test;
|
||||
function theTest() {
|
||||
test = new PeerConnectionTest();
|
||||
test.setMediaConstraints([{audio: true}], [{audio: true}]);
|
||||
test.setIdentityProvider(test.pcLocal, "test1.example.com", "idp.html", "someone");
|
||||
test.setIdentityProvider(test.pcRemote, "test2.example.com", "idp.html", "someone");
|
||||
test.chain.append([
|
||||
[
|
||||
"PEER_IDENTITY_IS_SET_CORRECTLY",
|
||||
function(test) {
|
||||
var outstanding = 0;
|
||||
// we have to wait for the identity result in order to get the actual
|
||||
// identity information, since the call will complete before the identity
|
||||
// provider has a chance to finish verifying... that's OK, but it makes
|
||||
// testing more difficult
|
||||
|
||||
function checkOrSetupCheck(pc, pfx, idp, name) {
|
||||
function checkIdentity() {
|
||||
is(pc.peerIdentity.idp, idp, pfx + "IdP is correct");
|
||||
is(pc.peerIdentity.name, name + "@" + idp, pfx + "identity is correct");
|
||||
}
|
||||
if (pc.peerIdentity) {
|
||||
info(pfx + "peerIdentity already set");
|
||||
checkIdentity();
|
||||
} else {
|
||||
++outstanding;
|
||||
info(pfx + "setting onpeeridentity handler");
|
||||
pc.onpeeridentity = function checkIdentityEvent(e) {
|
||||
info(pfx + "checking peerIdentity");
|
||||
checkIdentity();
|
||||
--outstanding;
|
||||
if (outstanding <= 0) {
|
||||
test.next();
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
setTimeout(function() {
|
||||
ok(false, "Timed out waiting for peerIdentity.");
|
||||
test.next();
|
||||
}, 5000); // probably should be something in the base harness for this
|
||||
|
||||
checkOrSetupCheck(test.pcLocal._pc, "local: ", "test2.example.com", "someone");
|
||||
checkOrSetupCheck(test.pcRemote._pc, "remote: ", "test1.example.com", "someone");
|
||||
if (outstanding <= 0) {
|
||||
test.next();
|
||||
}
|
||||
}
|
||||
],
|
||||
[
|
||||
"OFFERS_AND_ANSWERS_INCLUDE_IDENTITY",
|
||||
function(test) {
|
||||
ok(test.pcLocal._last_offer.sdp.contains("a=identity"), "a=identity is in the offer SDP");
|
||||
ok(test.pcRemote._last_answer.sdp.contains("a=identity"), "a=identity is in the answer SDP");
|
||||
test.next();
|
||||
}
|
||||
],
|
||||
[
|
||||
"DESCRIPTIONS_CONTAIN_IDENTITY",
|
||||
function(test) {
|
||||
ok(test.pcLocal.localDescription.sdp.contains("a=identity"),
|
||||
"a=identity is in the local copy of the offer");
|
||||
ok(test.pcRemote.localDescription.sdp.contains("a=identity"),
|
||||
"a=identity is in the remote copy of the offer");
|
||||
ok(test.pcLocal.remoteDescription.sdp.contains("a=identity"),
|
||||
"a=identity is in the local copy of the answer");
|
||||
ok(test.pcRemote.remoteDescription.sdp.contains("a=identity"),
|
||||
"a=identity is in the remote copy of the answer");
|
||||
test.next();
|
||||
}
|
||||
]
|
||||
]);
|
||||
test.run();
|
||||
}
|
||||
runTest(theTest);
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,49 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="application/javascript" src="../mochitest/head.js"></script>
|
||||
<script type="application/javascript" src="../mochitest/pc.js"></script>
|
||||
<script type="application/javascript" src="../mochitest/templates.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
createHTML({
|
||||
title: "Identity Provider returning errors is handled correctly"
|
||||
});
|
||||
|
||||
var test;
|
||||
runTest(function () {
|
||||
test = new PeerConnectionTest();
|
||||
test.setMediaConstraints([{audio: true}], [{audio: true}]);
|
||||
// first example generates an error
|
||||
test.setIdentityProvider(test.pcLocal, 'example.com', 'idp.html#error', 'nobody');
|
||||
// first doesn't even get a ready message from the IdP - results in a timeout
|
||||
test.setIdentityProvider(test.pcRemote, 'example.com', 'idp.html#error:ready', 'nobody');
|
||||
test.chain.append([
|
||||
[
|
||||
"PEER_IDENTITY_IS_EMPTY",
|
||||
function(test) {
|
||||
ok(!test.pcLocal._pc.peerIdentity, "local peerIdentity is not set");
|
||||
ok(!test.pcRemote._pc.peerIdentity, "remote peerIdentity is not set");
|
||||
test.next();
|
||||
}
|
||||
],
|
||||
[
|
||||
"OFFERS_AND_ANSWERS_DONT_INCLUDE_IDENTITY",
|
||||
function(test) {
|
||||
ok(!test.pcLocal._last_offer.sdp.contains("a=identity"), "a=identity not contained in the offer SDP");
|
||||
ok(!test.pcRemote._last_answer.sdp.contains("a=identity"), "a=identity not contained in the answer SDP");
|
||||
test.next();
|
||||
}
|
||||
],
|
||||
]);
|
||||
test.run();
|
||||
});
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
@ -117,7 +117,10 @@ function runTest(aCallback) {
|
||||
// Running as a Mochitest.
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
SpecialPowers.pushPrefEnv({'set': [
|
||||
['dom.messageChannel.enabled', true],
|
||||
['media.peerconnection.enabled', true],
|
||||
['media.peerconnection.identity.enabled', true],
|
||||
['media.peerconnection.identity.timeout', 3000],
|
||||
['media.navigator.permission.disabled', true]]
|
||||
}, function () {
|
||||
try {
|
||||
|
@ -530,6 +530,11 @@ function PCT_createOffer(peer, onSuccess) {
|
||||
});
|
||||
};
|
||||
|
||||
PeerConnectionTest.prototype.setIdentityProvider =
|
||||
function(peer, provider, protocol, identity) {
|
||||
peer.setIdentityProvider(provider, protocol, identity);
|
||||
};
|
||||
|
||||
/**
|
||||
* Sets the local description for the specified peer connection instance
|
||||
* and automatically handles the failure case.
|
||||
@ -765,7 +770,7 @@ DataChannelTest.prototype = Object.create(PeerConnectionTest.prototype, {
|
||||
});
|
||||
} else {
|
||||
check_next_test();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
@ -1210,6 +1215,10 @@ PeerConnectionWrapper.prototype = {
|
||||
return this._pc.iceConnectionState;
|
||||
},
|
||||
|
||||
setIdentityProvider: function(provider, protocol, identity) {
|
||||
this._pc.setIdentityProvider(provider, protocol, identity);
|
||||
},
|
||||
|
||||
/**
|
||||
* Callback when we get media from either side. Also an appropriate
|
||||
* HTML media element will be created.
|
||||
|
@ -124,6 +124,7 @@ using mozilla::TimeStamp;
|
||||
|
||||
static const char *kPrefWhitelist = "plugin.allowed_types";
|
||||
static const char *kPrefDisableFullPage = "plugin.disable_full_page_plugin_for_types";
|
||||
static const char *kPrefJavaMIME = "plugin.java.mime";
|
||||
|
||||
// Version of cached plugin info
|
||||
// 0.01 first implementation
|
||||
@ -1555,13 +1556,23 @@ nsPluginHost::SiteHasData(nsIPluginTag* plugin, const nsACString& domain,
|
||||
|
||||
bool nsPluginHost::IsJavaMIMEType(const char* aType)
|
||||
{
|
||||
// The java mime pref may well not be one of these,
|
||||
// e.g. application/x-java-test used in the test suite
|
||||
nsAdoptingCString javaMIME = Preferences::GetCString(kPrefJavaMIME);
|
||||
return aType &&
|
||||
((0 == PL_strncasecmp(aType, "application/x-java-vm",
|
||||
(javaMIME.EqualsIgnoreCase(aType) ||
|
||||
(0 == PL_strncasecmp(aType, "application/x-java-vm",
|
||||
sizeof("application/x-java-vm") - 1)) ||
|
||||
(0 == PL_strncasecmp(aType, "application/x-java-applet",
|
||||
sizeof("application/x-java-applet") - 1)) ||
|
||||
(0 == PL_strncasecmp(aType, "application/x-java-bean",
|
||||
sizeof("application/x-java-bean") - 1)));
|
||||
sizeof("application/x-java-bean") - 1))
|
||||
#ifdef DEBUG
|
||||
// Emulate java handling for the npjavatest plugin
|
||||
|| (0 == PL_strncasecmp(aType, "application/x-java-test",
|
||||
sizeof("application/x-java-test") - 1))
|
||||
#endif
|
||||
);
|
||||
}
|
||||
|
||||
// Check whether or not a tag is a live, valid tag, and that it's loaded.
|
||||
|
87
dom/plugins/test/mochitest/file_bug738396.html
Normal file
87
dom/plugins/test/mochitest/file_bug738396.html
Normal file
@ -0,0 +1,87 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Helper for test_bug738396.html</title>
|
||||
<meta charset="utf-8">
|
||||
</head>
|
||||
<body>
|
||||
<!-- Test that the plugin sees "good" in each of these cases -->
|
||||
<div id="codebasevis">
|
||||
<applet codebase="good" codebase="bad" ></applet>
|
||||
|
||||
<applet codebase="bad">
|
||||
<param name="codebase" value="good">
|
||||
</applet>
|
||||
|
||||
<applet codebase="bad">
|
||||
<param name="codebase" value="stillbad">
|
||||
<param name="codebase" value="good">
|
||||
</applet>
|
||||
|
||||
<applet>
|
||||
<param name="codebase" value="good">
|
||||
</applet>
|
||||
|
||||
<object type="application/x-java-test" codebase="good" codebase="bad"></object>
|
||||
|
||||
<object type="application/x-java-test" codebase="bad">
|
||||
<param name="codebase" value="good">
|
||||
</object>
|
||||
|
||||
<object type="application/x-java-test" codebase="bad">
|
||||
<param name="codebase" value="stillbad">
|
||||
<param name="codebase" value="good">
|
||||
</object>
|
||||
|
||||
<object type="application/x-java-test">
|
||||
<param name="codebase" value="good">
|
||||
</object>
|
||||
|
||||
<embed type="application/x-java-test" codebase="good" codebase="bad">
|
||||
</div>
|
||||
<div id="blockedcodebase">
|
||||
<!-- Test that none of these are allowed to load -->
|
||||
<applet codebase="file:///" codebase="notused"></applet>
|
||||
|
||||
<applet codebase="notused">
|
||||
<param name="codebase" value="file:///">
|
||||
</applet>
|
||||
|
||||
<applet codebase="notused">
|
||||
<param name="codebase" value="notused">
|
||||
<param name="codebase" value="file:///">
|
||||
</applet>
|
||||
|
||||
<applet>
|
||||
<param name="codebase" value="file:///">
|
||||
</applet>
|
||||
|
||||
<object type="application/x-java-test" codebase="file:///" codebase="notused"></object>
|
||||
|
||||
<object type="application/x-java-test" codebase="notused">
|
||||
<param name="codebase" value="file:///">
|
||||
</object>
|
||||
|
||||
<object type="application/x-java-test" codebase="notused">
|
||||
<param name="codebase" value="notused">
|
||||
<param name="codebase" value="file:///">
|
||||
</object>
|
||||
|
||||
<object type="application/x-java-test">
|
||||
<param name="codebase" value="file:///">
|
||||
</object>
|
||||
|
||||
<embed type="application/x-java-test" codebase="file:///" codebase="notused">
|
||||
</div>
|
||||
<div id="nocodebase">
|
||||
<applet></applet>
|
||||
<object type="application/x-java-test"></object>
|
||||
<embed type="application/x-java-test">
|
||||
</div>
|
||||
<div id="emptycodebase">
|
||||
<applet codebase=""></applet>
|
||||
<object type="application/x-java-test" codebase=""></object>
|
||||
<embed type="application/x-java-test" codebase="">
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
@ -2,6 +2,7 @@
|
||||
support-files =
|
||||
307-xo-redirect.sjs
|
||||
crashing_subpage.html
|
||||
file_bug738396.html
|
||||
file_bug771202.html
|
||||
file_bug863792.html
|
||||
large-pic.jpg
|
||||
@ -23,13 +24,16 @@ support-files =
|
||||
[test_GCrace.html]
|
||||
[test_NPNVdocumentOrigin.html]
|
||||
[test_NPPVpluginWantsAllNetworkStreams.html]
|
||||
[test_bug406541.html]
|
||||
[test_bug532208.html]
|
||||
[test_bug539565-1.html]
|
||||
[test_bug539565-2.html]
|
||||
[test_bug738396.html]
|
||||
[test_bug771202.html]
|
||||
[test_bug777098.html]
|
||||
[test_bug784131.html]
|
||||
[test_bug813906.html]
|
||||
[test_bug852315.html]
|
||||
[test_bug854082.html]
|
||||
[test_bug863792.html]
|
||||
[test_bug967694.html]
|
||||
|
100
dom/plugins/test/mochitest/test_bug406541.html
Normal file
100
dom/plugins/test/mochitest/test_bug406541.html
Normal file
@ -0,0 +1,100 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Test for Bug 406541</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="text/javascript" src="utils.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8">
|
||||
</head>
|
||||
<body>
|
||||
<script type="application/x-child-payload" id="child-payload">
|
||||
// This is injected into the file:/// origin iframe, see below.
|
||||
|
||||
// appletA should spawn, appletB, with a codebase outside the temp directory,
|
||||
// should not.
|
||||
var appletA = document.createElement("applet");
|
||||
var appletB = document.createElement("applet");
|
||||
var appletC = document.createElement("applet");
|
||||
appletA.type = appletB.type = appletC.type = "application/x-java-test";
|
||||
appletB.setAttribute("codebase", "file:///");
|
||||
appletC.setAttribute("codebase", "./subdir_bug406541/");
|
||||
document.body.appendChild(appletA);
|
||||
document.body.appendChild(appletB);
|
||||
document.body.appendChild(appletC);
|
||||
function isSpawned(plugin) {
|
||||
try {
|
||||
var x = plugin.getJavaCodebase();
|
||||
return true;
|
||||
} catch (e) {}
|
||||
return false;
|
||||
}
|
||||
window.parent.postMessage({ "A": isSpawned(appletA),
|
||||
"B": isSpawned(appletB),
|
||||
"C": isSpawned(appletC) }, "*");
|
||||
</script>
|
||||
<script type="application/javascript">
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED,
|
||||
"Java Test Plug-in");
|
||||
SpecialPowers.pushPrefEnv({ "set": [
|
||||
['plugin.java.mime', 'application/x-java-test']
|
||||
] }, runTest);
|
||||
|
||||
function runTest() {
|
||||
// Create a empty file and point an iframe at it
|
||||
var Cc = SpecialPowers.Cc;
|
||||
var Ci = SpecialPowers.Ci;
|
||||
var file = Cc["@mozilla.org/file/directory_service;1"]
|
||||
.getService(Ci.nsIProperties)
|
||||
.get("TmpD", Ci.nsIFile);
|
||||
var subdir = Cc["@mozilla.org/file/directory_service;1"]
|
||||
.getService(Ci.nsIProperties)
|
||||
.get("TmpD", Ci.nsIFile);
|
||||
file.append("test_bug406541.html");
|
||||
file.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE, 0600);
|
||||
subdir.append("subdir_bug406541");
|
||||
subdir.createUnique(Ci.nsIFile.DIRECTORY_TYPE, 0600);
|
||||
|
||||
var i = document.createElement("iframe");
|
||||
var loaded = false;
|
||||
i.addEventListener("load", function initialLoad() {
|
||||
if (!loaded) {
|
||||
// Once loaded, use special powers to point it at the file
|
||||
SpecialPowers.wrap(i.contentWindow).location.href = "file://" + file.path;
|
||||
loaded = true;
|
||||
} else {
|
||||
// Inject the child-payload script to the file:/// origin. Let it test
|
||||
// applet spawning and send the results in a postMessage. (Because I
|
||||
// couldn't get SpecialPowers to let me touch applets cross-origin, then
|
||||
// gave up.)
|
||||
var innerdoc = SpecialPowers.wrap(i.contentWindow).document;
|
||||
var s = innerdoc.createElement("script");
|
||||
s.type = "text/javascript";
|
||||
s.textContent = document.getElementById("child-payload").textContent;
|
||||
var finished = false;
|
||||
window.onmessage = function(message) {
|
||||
ok(message.data.A, "Plugin A should spawn");
|
||||
ok(!message.data.B, "Plugin B should NOT spawn");
|
||||
ok(message.data.C, "Plugin C should spawn");
|
||||
file.remove(false);
|
||||
subdir.remove(false);
|
||||
finished = true;
|
||||
SimpleTest.finish();
|
||||
};
|
||||
innerdoc.body.appendChild(s);
|
||||
|
||||
SimpleTest.executeSoon(function() {
|
||||
if (!finished) {
|
||||
ok(finished, "Should have received callback by now");
|
||||
SimpleTest.finish();
|
||||
}
|
||||
});
|
||||
}
|
||||
}, false);
|
||||
document.body.appendChild(i);
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
88
dom/plugins/test/mochitest/test_bug738396.html
Normal file
88
dom/plugins/test/mochitest/test_bug738396.html
Normal file
@ -0,0 +1,88 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Test for Bug 738396</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="text/javascript" src="utils.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8">
|
||||
</head>
|
||||
<body>
|
||||
<script type="text/javascript">
|
||||
setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED,
|
||||
"Java Test Plug-in");
|
||||
|
||||
SpecialPowers.pushPrefEnv({ "set": [
|
||||
['plugin.java.mime', 'application/x-java-test']
|
||||
] }, loadFrame);
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
function loadFrame() {
|
||||
var iframe = document.createElement("iframe");
|
||||
iframe.src = "./file_bug738396.html";
|
||||
iframe.addEventListener("load", function() {
|
||||
runTest(iframe.contentDocument);
|
||||
});
|
||||
document.body.appendChild(iframe);
|
||||
}
|
||||
|
||||
function runTest(doc) {
|
||||
// Check that the canonicalized version of the codebase 'good' was passed
|
||||
// to the plugin in all cases
|
||||
var a = doc.createElement('a');
|
||||
a.href = "good";
|
||||
var goodCodebase = a.href;
|
||||
var codebasevis = doc.getElementById("codebasevis")
|
||||
.querySelectorAll("applet, object, embed");
|
||||
for (var elem of codebasevis) {
|
||||
var codebase = null;
|
||||
try {
|
||||
codebase = elem.getJavaCodebase();
|
||||
} catch (e) {}
|
||||
is(codebase, goodCodebase,
|
||||
"Check that the test plugin sees the proper codebase");
|
||||
}
|
||||
// Check that none of the applets in blockedcodebase were allowed to spawn
|
||||
var blockedcodebase = doc.getElementById("blockedcodebase")
|
||||
.querySelectorAll("applet, object, embed");
|
||||
for (var elem of blockedcodebase) {
|
||||
var spawned = false;
|
||||
try {
|
||||
elem.getObjectValue();
|
||||
spawned = true;
|
||||
} catch (e) {}
|
||||
ok(!spawned, "Plugin should not be allowed to spawn");
|
||||
}
|
||||
|
||||
// With no codebase, the codebase should resolve to "."
|
||||
a.href = ".";
|
||||
goodCodebase = a.href;
|
||||
var nocodebase = doc.getElementById("nocodebase")
|
||||
.querySelectorAll("applet, object, embed");
|
||||
for (var elem of nocodebase) {
|
||||
var codebase = null;
|
||||
try {
|
||||
codebase = elem.getJavaCodebase();
|
||||
} catch (e) {}
|
||||
is(codebase, goodCodebase, "Codebase should resolve to '.'");
|
||||
}
|
||||
|
||||
// With empty codebase, the codebase should resolve to "/"
|
||||
a.href = "/";
|
||||
goodCodebase = a.href;
|
||||
var nocodebase = doc.getElementById("emptycodebase")
|
||||
.querySelectorAll("applet, object, embed");
|
||||
for (var elem of nocodebase) {
|
||||
var codebase = null;
|
||||
try {
|
||||
codebase = elem.getJavaCodebase();
|
||||
} catch (e) {}
|
||||
is(codebase, goodCodebase, "Codebase should resolve to '/'");
|
||||
}
|
||||
|
||||
SimpleTest.finish();
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
49
dom/plugins/test/mochitest/test_bug852315.html
Normal file
49
dom/plugins/test/mochitest/test_bug852315.html
Normal file
@ -0,0 +1,49 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Test for Bug 852315</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="text/javascript" src="utils.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">
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED);
|
||||
|
||||
// Tests that the document-inactive notification stopping plugins does not
|
||||
// fatally re-enter when adding other plugins to the document.
|
||||
|
||||
var i = document.createElement("iframe");
|
||||
var ob = document.body;
|
||||
i.addEventListener("load", function loadfunc() {
|
||||
var d = i.contentWindow.document;
|
||||
var e = i.contentDocument.createElement("embed");
|
||||
var destroyran = false;
|
||||
e.type = "application/x-test";
|
||||
i.contentDocument.body.appendChild(e);
|
||||
|
||||
// On despawn, append an embed tag to document.
|
||||
e.callOnDestroy(function() {
|
||||
var e2 = d.createElement("embed");
|
||||
d.body.appendChild(e2);
|
||||
destroyran = true;
|
||||
});
|
||||
|
||||
// Navigate the frame to cause the document with the plugin to go inactive
|
||||
i.removeEventListener("load", loadfunc);
|
||||
i.src = "about:blank";
|
||||
SimpleTest.executeSoon(function() {
|
||||
ok(destroyran, "OnDestroy callback ran and did not crash");
|
||||
SimpleTest.finish();
|
||||
});
|
||||
});
|
||||
document.body.appendChild(i);
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
38
dom/plugins/test/testplugin/javaplugin/Info.plist
Normal file
38
dom/plugins/test/testplugin/javaplugin/Info.plist
Normal file
@ -0,0 +1,38 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>English</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>libnptestjava.dylib</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>org.mozilla.JavaTestPlugin</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>BRPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0.0.0</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>JAVATEST</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1.0.0.0</string>
|
||||
<key>WebPluginName</key>
|
||||
<string>Java Test Plug-in</string>
|
||||
<key>WebPluginDescription</key>
|
||||
<string>Dummy Java plug-in for testing purposes.</string>
|
||||
<key>WebPluginMIMETypes</key>
|
||||
<dict>
|
||||
<key>application/x-java-test</key>
|
||||
<dict>
|
||||
<key>WebPluginExtensions</key>
|
||||
<array>
|
||||
<string>tstjava</string>
|
||||
</array>
|
||||
<key>WebPluginTypeDescription</key>
|
||||
<string>Dummy java type</string>
|
||||
</dict>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
@ -1,7 +1,8 @@
|
||||
#
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
# You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
MOCHITEST_FILES := ../test/devicestorage_common.js
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
RELATIVE_PATH=..
|
||||
COCOA_NAME=JavaTest
|
||||
include @srcdir@/../testplugin.mk
|
@ -4,5 +4,7 @@
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
MOCHITEST_CHROME_MANIFESTS += ['chrome.ini']
|
||||
LIBRARY_NAME = 'nptestjava'
|
||||
|
||||
relative_path = '..'
|
||||
include('../testplugin.mozbuild')
|
7
dom/plugins/test/testplugin/javaplugin/nptest.def
Normal file
7
dom/plugins/test/testplugin/javaplugin/nptest.def
Normal file
@ -0,0 +1,7 @@
|
||||
LIBRARY NPJAVATEST
|
||||
|
||||
EXPORTS
|
||||
NP_GetEntryPoints @1
|
||||
NP_Initialize @2
|
||||
NP_Shutdown @3
|
||||
NP_GetMIMEDescription @4
|
42
dom/plugins/test/testplugin/javaplugin/nptest.rc
Normal file
42
dom/plugins/test/testplugin/javaplugin/nptest.rc
Normal file
@ -0,0 +1,42 @@
|
||||
#include<winver.h>
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Version
|
||||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 1,0,0,0
|
||||
PRODUCTVERSION 1,0,0,0
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
#else
|
||||
FILEFLAGS 0x0L
|
||||
#endif
|
||||
FILEOS VOS__WINDOWS32
|
||||
FILETYPE VFT_DLL
|
||||
FILESUBTYPE 0x0L
|
||||
BEGIN
|
||||
BLOCK "StringFileInfo"
|
||||
BEGIN
|
||||
BLOCK "040904e4"
|
||||
BEGIN
|
||||
VALUE "CompanyName", "mozilla.org"
|
||||
VALUE "FileDescription", L"Dummy Java plug-in for testing purposes."
|
||||
VALUE "FileExtents", "tstjava"
|
||||
VALUE "FileOpenName", "Dummy java test type"
|
||||
VALUE "FileVersion", "1.0"
|
||||
VALUE "InternalName", "nptestjava"
|
||||
VALUE "MIMEType", "application/x-java-test"
|
||||
VALUE "OriginalFilename", "nptestjava.dll"
|
||||
VALUE "ProductName", "Java Test Plug-in"
|
||||
VALUE "ProductVersion", "1.0"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", 0x409, 1252
|
||||
END
|
||||
END
|
7
dom/plugins/test/testplugin/javaplugin/nptest_name.cpp
Normal file
7
dom/plugins/test/testplugin/javaplugin/nptest_name.cpp
Normal file
@ -0,0 +1,7 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
const char *sPluginName = "Java Test Plug-in";
|
||||
const char *sPluginDescription = "Dummy Java plug-in for testing purposes.";
|
||||
const char *sMimeDescription = "application/x-java-test:tstjava:Dummy java type";
|
@ -4,7 +4,7 @@
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
DIRS += ['secondplugin']
|
||||
DIRS += ['secondplugin', 'javaplugin']
|
||||
|
||||
LIBRARY_NAME = 'nptest'
|
||||
|
||||
|
@ -52,6 +52,7 @@
|
||||
#include <float.h>
|
||||
#include <windows.h>
|
||||
#define getpid _getpid
|
||||
#define strcasecmp _stricmp
|
||||
#else
|
||||
#include <unistd.h>
|
||||
#include <pthread.h>
|
||||
@ -139,6 +140,7 @@ static bool setPluginWantsAllStreams(NPObject* npobj, const NPVariant* args, uin
|
||||
static bool crashPlugin(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result);
|
||||
static bool crashOnDestroy(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result);
|
||||
static bool getObjectValue(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result);
|
||||
static bool getJavaCodebase(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result);
|
||||
static bool checkObjectValue(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result);
|
||||
static bool enableFPExceptions(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result);
|
||||
static bool setCookie(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result);
|
||||
@ -202,6 +204,7 @@ static const NPUTF8* sPluginMethodIdentifierNames[] = {
|
||||
"crash",
|
||||
"crashOnDestroy",
|
||||
"getObjectValue",
|
||||
"getJavaCodebase",
|
||||
"checkObjectValue",
|
||||
"enableFPExceptions",
|
||||
"setCookie",
|
||||
@ -266,6 +269,7 @@ static const ScriptableFunction sPluginMethodFunctions[] = {
|
||||
crashPlugin,
|
||||
crashOnDestroy,
|
||||
getObjectValue,
|
||||
getJavaCodebase,
|
||||
checkObjectValue,
|
||||
enableFPExceptions,
|
||||
setCookie,
|
||||
@ -959,6 +963,11 @@ NPP_New(NPMIMEType pluginType, NPP instance, uint16_t mode, int16_t argc, char*
|
||||
if (strcmp(argn[i], "bugmode") == 0) {
|
||||
instanceData->bugMode = atoi(argv[i]);
|
||||
}
|
||||
// Try to emulate java's codebase handling: Use the last seen codebase
|
||||
// value, regardless of whether it is in attributes or params.
|
||||
if (strcasecmp(argn[i], "codebase") == 0) {
|
||||
instanceData->javaCodebase = argv[i];
|
||||
}
|
||||
}
|
||||
|
||||
if (!browserSupportsWindowless || !pluginSupportsWindowlessMode()) {
|
||||
@ -2889,6 +2898,18 @@ static const NPClass kTestSharedNPClass = {
|
||||
// Everything else is nullptr
|
||||
};
|
||||
|
||||
static bool getJavaCodebase(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result)
|
||||
{
|
||||
if (argCount != 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
NPP npp = static_cast<TestNPObject*>(npobj)->npp;
|
||||
InstanceData* id = static_cast<InstanceData*>(npp->pdata);
|
||||
STRINGZ_TO_NPVARIANT(NPN_StrDup(id->javaCodebase.c_str()), *result);
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool getObjectValue(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result)
|
||||
{
|
||||
NPP npp = static_cast<TestNPObject*>(npobj)->npp;
|
||||
|
@ -152,6 +152,7 @@ typedef struct InstanceData {
|
||||
NPAsyncSurface *backBuffer;
|
||||
int32_t mouseUpEventCount;
|
||||
int32_t bugMode;
|
||||
std::string javaCodebase;
|
||||
} InstanceData;
|
||||
|
||||
void notifyDidPaint(InstanceData* instanceData);
|
||||
|
@ -13,7 +13,6 @@
|
||||
#include "PromiseCallback.h"
|
||||
#include "PromiseNativeHandler.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "WorkerPrivate.h"
|
||||
#include "WorkerRunnable.h"
|
||||
#include "nsJSPrincipals.h"
|
||||
@ -190,7 +189,7 @@ NS_IMPL_CYCLE_COLLECTION_CLASS(Promise)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(Promise)
|
||||
tmp->MaybeReportRejected();
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mWindow)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mGlobal)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mResolveCallbacks);
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mRejectCallbacks);
|
||||
tmp->mResult = JS::UndefinedValue();
|
||||
@ -198,7 +197,7 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(Promise)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(Promise)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mWindow)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mGlobal)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mResolveCallbacks);
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mRejectCallbacks);
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_SCRIPT_OBJECTS
|
||||
@ -217,15 +216,16 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(Promise)
|
||||
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
Promise::Promise(nsPIDOMWindow* aWindow)
|
||||
: mWindow(aWindow)
|
||||
Promise::Promise(nsIGlobalObject* aGlobal)
|
||||
: mGlobal(aGlobal)
|
||||
, mResult(JS::UndefinedValue())
|
||||
, mState(Pending)
|
||||
, mTaskPending(false)
|
||||
, mHadRejectCallback(false)
|
||||
, mResolvePending(false)
|
||||
{
|
||||
MOZ_COUNT_CTOR(Promise);
|
||||
MOZ_ASSERT(mGlobal);
|
||||
|
||||
mozilla::HoldJSObjects(this);
|
||||
SetIsDOMBinding();
|
||||
}
|
||||
@ -235,7 +235,6 @@ Promise::~Promise()
|
||||
MaybeReportRejected();
|
||||
mResult = JS::UndefinedValue();
|
||||
mozilla::DropJSObjects(this);
|
||||
MOZ_COUNT_DTOR(Promise);
|
||||
}
|
||||
|
||||
JSObject*
|
||||
@ -244,6 +243,31 @@ Promise::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aScope)
|
||||
return PromiseBinding::Wrap(aCx, aScope, this);
|
||||
}
|
||||
|
||||
JSObject*
|
||||
Promise::GetOrCreateWrapper(JSContext* aCx)
|
||||
{
|
||||
if (JSObject* wrapper = GetWrapper()) {
|
||||
return wrapper;
|
||||
}
|
||||
|
||||
nsIGlobalObject* global = GetParentObject();
|
||||
MOZ_ASSERT(global);
|
||||
|
||||
JS::Rooted<JSObject*> scope(aCx, global->GetGlobalJSObject());
|
||||
if (!scope) {
|
||||
JS_ReportError(aCx, "can't get scope");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
JS::Rooted<JS::Value> val(aCx);
|
||||
if (!WrapNewBindingObject(aCx, scope, this, &val)) {
|
||||
MOZ_ASSERT(JS_IsExceptionPending(aCx));
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return GetWrapper();
|
||||
}
|
||||
|
||||
void
|
||||
Promise::MaybeResolve(JSContext* aCx,
|
||||
JS::Handle<JS::Value> aValue)
|
||||
@ -453,18 +477,15 @@ Promise::Constructor(const GlobalObject& aGlobal,
|
||||
PromiseInit& aInit, ErrorResult& aRv)
|
||||
{
|
||||
JSContext* cx = aGlobal.GetContext();
|
||||
nsCOMPtr<nsPIDOMWindow> window;
|
||||
|
||||
// On workers, let the window be null.
|
||||
if (MOZ_LIKELY(NS_IsMainThread())) {
|
||||
window = do_QueryInterface(aGlobal.GetAsSupports());
|
||||
if (!window) {
|
||||
aRv.Throw(NS_ERROR_UNEXPECTED);
|
||||
return nullptr;
|
||||
}
|
||||
nsCOMPtr<nsIGlobalObject> global;
|
||||
global = do_QueryInterface(aGlobal.GetAsSupports());
|
||||
if (!global) {
|
||||
aRv.Throw(NS_ERROR_UNEXPECTED);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsRefPtr<Promise> promise = new Promise(window);
|
||||
nsRefPtr<Promise> promise = new Promise(global);
|
||||
|
||||
JS::Rooted<JSObject*> resolveFunc(cx,
|
||||
CreateFunction(cx, aGlobal.Get(), promise,
|
||||
@ -513,24 +534,21 @@ Promise::Resolve(const GlobalObject& aGlobal, JSContext* aCx,
|
||||
}
|
||||
}
|
||||
|
||||
nsCOMPtr<nsPIDOMWindow> window;
|
||||
if (MOZ_LIKELY(NS_IsMainThread())) {
|
||||
window = do_QueryInterface(aGlobal.GetAsSupports());
|
||||
if (!window) {
|
||||
aRv.Throw(NS_ERROR_UNEXPECTED);
|
||||
return nullptr;
|
||||
}
|
||||
nsCOMPtr<nsIGlobalObject> global =
|
||||
do_QueryInterface(aGlobal.GetAsSupports());
|
||||
if (!global) {
|
||||
aRv.Throw(NS_ERROR_UNEXPECTED);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return Resolve(window, aCx, aValue, aRv);
|
||||
return Resolve(global, aCx, aValue, aRv);
|
||||
}
|
||||
|
||||
/* static */ already_AddRefed<Promise>
|
||||
Promise::Resolve(nsPIDOMWindow* aWindow, JSContext* aCx,
|
||||
Promise::Resolve(nsIGlobalObject* aGlobal, JSContext* aCx,
|
||||
JS::Handle<JS::Value> aValue, ErrorResult& aRv)
|
||||
{
|
||||
// aWindow may be null.
|
||||
nsRefPtr<Promise> promise = new Promise(aWindow);
|
||||
nsRefPtr<Promise> promise = new Promise(aGlobal);
|
||||
|
||||
promise->MaybeResolveInternal(aCx, aValue);
|
||||
return promise.forget();
|
||||
@ -540,24 +558,21 @@ Promise::Resolve(nsPIDOMWindow* aWindow, JSContext* aCx,
|
||||
Promise::Reject(const GlobalObject& aGlobal, JSContext* aCx,
|
||||
JS::Handle<JS::Value> aValue, ErrorResult& aRv)
|
||||
{
|
||||
nsCOMPtr<nsPIDOMWindow> window;
|
||||
if (MOZ_LIKELY(NS_IsMainThread())) {
|
||||
window = do_QueryInterface(aGlobal.GetAsSupports());
|
||||
if (!window) {
|
||||
aRv.Throw(NS_ERROR_UNEXPECTED);
|
||||
return nullptr;
|
||||
}
|
||||
nsCOMPtr<nsIGlobalObject> global =
|
||||
do_QueryInterface(aGlobal.GetAsSupports());
|
||||
if (!global) {
|
||||
aRv.Throw(NS_ERROR_UNEXPECTED);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return Reject(window, aCx, aValue, aRv);
|
||||
return Reject(global, aCx, aValue, aRv);
|
||||
}
|
||||
|
||||
/* static */ already_AddRefed<Promise>
|
||||
Promise::Reject(nsPIDOMWindow* aWindow, JSContext* aCx,
|
||||
Promise::Reject(nsIGlobalObject* aGlobal, JSContext* aCx,
|
||||
JS::Handle<JS::Value> aValue, ErrorResult& aRv)
|
||||
{
|
||||
// aWindow may be null.
|
||||
nsRefPtr<Promise> promise = new Promise(aWindow);
|
||||
nsRefPtr<Promise> promise = new Promise(aGlobal);
|
||||
|
||||
promise->MaybeRejectInternal(aCx, aValue);
|
||||
return promise.forget();
|
||||
@ -716,13 +731,11 @@ NS_IMPL_CYCLE_COLLECTION_1(AllResolveHandler, mCountdownHolder)
|
||||
Promise::All(const GlobalObject& aGlobal, JSContext* aCx,
|
||||
const Sequence<JS::Value>& aIterable, ErrorResult& aRv)
|
||||
{
|
||||
nsCOMPtr<nsPIDOMWindow> window;
|
||||
if (MOZ_LIKELY(NS_IsMainThread())) {
|
||||
window = do_QueryInterface(aGlobal.GetAsSupports());
|
||||
if (!window) {
|
||||
aRv.Throw(NS_ERROR_UNEXPECTED);
|
||||
return nullptr;
|
||||
}
|
||||
nsCOMPtr<nsIGlobalObject> global =
|
||||
do_QueryInterface(aGlobal.GetAsSupports());
|
||||
if (!global) {
|
||||
aRv.Throw(NS_ERROR_UNEXPECTED);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (aIterable.Length() == 0) {
|
||||
@ -735,7 +748,7 @@ Promise::All(const GlobalObject& aGlobal, JSContext* aCx,
|
||||
return Promise::Resolve(aGlobal, aCx, value, aRv);
|
||||
}
|
||||
|
||||
nsRefPtr<Promise> promise = new Promise(window);
|
||||
nsRefPtr<Promise> promise = new Promise(global);
|
||||
nsRefPtr<CountdownHolder> holder =
|
||||
new CountdownHolder(aGlobal, promise, aIterable.Length());
|
||||
|
||||
@ -764,16 +777,14 @@ Promise::All(const GlobalObject& aGlobal, JSContext* aCx,
|
||||
Promise::Race(const GlobalObject& aGlobal, JSContext* aCx,
|
||||
const Sequence<JS::Value>& aIterable, ErrorResult& aRv)
|
||||
{
|
||||
nsCOMPtr<nsPIDOMWindow> window;
|
||||
if (MOZ_LIKELY(NS_IsMainThread())) {
|
||||
window = do_QueryInterface(aGlobal.GetAsSupports());
|
||||
if (!window) {
|
||||
aRv.Throw(NS_ERROR_UNEXPECTED);
|
||||
return nullptr;
|
||||
}
|
||||
nsCOMPtr<nsIGlobalObject> global =
|
||||
do_QueryInterface(aGlobal.GetAsSupports());
|
||||
if (!global) {
|
||||
aRv.Throw(NS_ERROR_UNEXPECTED);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsRefPtr<Promise> promise = new Promise(window);
|
||||
nsRefPtr<Promise> promise = new Promise(global);
|
||||
nsRefPtr<PromiseCallback> resolveCb = new ResolvePromiseCallback(promise);
|
||||
nsRefPtr<PromiseCallback> rejectCb = new RejectPromiseCallback(promise);
|
||||
|
||||
@ -1057,5 +1068,26 @@ Promise::RunResolveTask(JS::Handle<JS::Value> aValue,
|
||||
RunTask();
|
||||
}
|
||||
|
||||
bool
|
||||
Promise::ArgumentToJSValue(const nsAString& aArgument,
|
||||
JSContext* aCx,
|
||||
JSObject* aScope,
|
||||
JS::MutableHandle<JS::Value> aValue)
|
||||
{
|
||||
// XXXkhuey I'd love to use xpc::NonVoidStringToJsval here, but it requires
|
||||
// a non-const nsAString for silly reasons.
|
||||
nsStringBuffer* sharedBuffer;
|
||||
if (!XPCStringConvert::ReadableToJSVal(aCx, aArgument, &sharedBuffer,
|
||||
aValue)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (sharedBuffer) {
|
||||
NS_ADDREF(sharedBuffer);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
@ -9,14 +9,16 @@
|
||||
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/ErrorResult.h"
|
||||
#include "mozilla/TypeTraits.h"
|
||||
#include "mozilla/dom/BindingDeclarations.h"
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
#include "mozilla/dom/PromiseBinding.h"
|
||||
#include "nsWrapperCache.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "js/TypeDecls.h"
|
||||
|
||||
class nsIGlobalObject;
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
@ -38,23 +40,40 @@ class Promise MOZ_FINAL : public nsISupports,
|
||||
friend class WorkerPromiseTask;
|
||||
friend class WrapperPromiseCallback;
|
||||
|
||||
~Promise();
|
||||
|
||||
public:
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(Promise)
|
||||
|
||||
Promise(nsPIDOMWindow* aWindow);
|
||||
~Promise();
|
||||
Promise(nsIGlobalObject* aGlobal);
|
||||
|
||||
typedef void (Promise::*MaybeFunc)(JSContext* aCx,
|
||||
JS::Handle<JS::Value> aValue);
|
||||
|
||||
void MaybeResolve(JSContext* aCx,
|
||||
JS::Handle<JS::Value> aValue);
|
||||
void MaybeReject(JSContext* aCx,
|
||||
JS::Handle<JS::Value> aValue);
|
||||
|
||||
// Helpers for using Promise from C++.
|
||||
// Most DOM objects are handled already. To add a new type T, such as ints,
|
||||
// or dictionaries, add an ArgumentToJSVal overload below.
|
||||
template <typename T>
|
||||
void MaybeResolve(T& aArg) {
|
||||
MaybeSomething(aArg, &Promise::MaybeResolve);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void MaybeReject(T& aArg) {
|
||||
MaybeSomething(aArg, &Promise::MaybeReject);
|
||||
}
|
||||
|
||||
// WebIDL
|
||||
|
||||
nsPIDOMWindow* GetParentObject() const
|
||||
nsIGlobalObject* GetParentObject() const
|
||||
{
|
||||
return mWindow;
|
||||
return mGlobal;
|
||||
}
|
||||
|
||||
virtual JSObject*
|
||||
@ -69,7 +88,7 @@ public:
|
||||
JS::Handle<JS::Value> aValue, ErrorResult& aRv);
|
||||
|
||||
static already_AddRefed<Promise>
|
||||
Resolve(nsPIDOMWindow* aWindow, JSContext* aCx,
|
||||
Resolve(nsIGlobalObject* aGlobal, JSContext* aCx,
|
||||
JS::Handle<JS::Value> aValue, ErrorResult& aRv);
|
||||
|
||||
static already_AddRefed<Promise>
|
||||
@ -77,7 +96,7 @@ public:
|
||||
JS::Handle<JS::Value> aValue, ErrorResult& aRv);
|
||||
|
||||
static already_AddRefed<Promise>
|
||||
Reject(nsPIDOMWindow* aWindow, JSContext* aCx,
|
||||
Reject(nsIGlobalObject* aGlobal, JSContext* aCx,
|
||||
JS::Handle<JS::Value> aValue, ErrorResult& aRv);
|
||||
|
||||
already_AddRefed<Promise>
|
||||
@ -154,6 +173,64 @@ private:
|
||||
JS::Handle<JS::Value> aValue,
|
||||
PromiseTaskSync aSync = AsyncTask);
|
||||
|
||||
// Helper methods for using Promises from C++
|
||||
JSObject* GetOrCreateWrapper(JSContext* aCx);
|
||||
|
||||
// If ArgumentToJSValue returns false, it must set an exception on the
|
||||
// JSContext.
|
||||
|
||||
// Accept strings.
|
||||
bool
|
||||
ArgumentToJSValue(const nsAString& aArgument,
|
||||
JSContext* aCx,
|
||||
JSObject* aScope,
|
||||
JS::MutableHandle<JS::Value> aValue);
|
||||
|
||||
// Accept objects that inherit from nsWrapperCache and nsISupports (e.g. most
|
||||
// DOM objects).
|
||||
template <class T>
|
||||
typename EnableIf<IsBaseOf<nsWrapperCache, T>::value &&
|
||||
IsBaseOf<nsISupports, T>::value, bool>::Type
|
||||
ArgumentToJSValue(T& aArgument,
|
||||
JSContext* aCx,
|
||||
JSObject* aScope,
|
||||
JS::MutableHandle<JS::Value> aValue)
|
||||
{
|
||||
JS::Rooted<JSObject*> scope(aCx, aScope);
|
||||
|
||||
return WrapNewBindingObject(aCx, scope, aArgument, aValue);
|
||||
}
|
||||
|
||||
template <template <typename> class SmartPtr, typename T>
|
||||
bool
|
||||
ArgumentToJSValue(const SmartPtr<T>& aArgument,
|
||||
JSContext* aCx,
|
||||
JSObject* aScope,
|
||||
JS::MutableHandle<JS::Value> aValue)
|
||||
{
|
||||
return ArgumentToJSValue(*aArgument.get(), aCx, aScope, aValue);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void MaybeSomething(T& aArgument, MaybeFunc aFunc) {
|
||||
ThreadsafeAutoJSContext cx;
|
||||
|
||||
JSObject* wrapper = GetOrCreateWrapper(cx);
|
||||
if (!wrapper) {
|
||||
HandleException(cx);
|
||||
return;
|
||||
}
|
||||
|
||||
JSAutoCompartment ac(cx, wrapper);
|
||||
JS::Rooted<JS::Value> val(cx);
|
||||
if (!ArgumentToJSValue(aArgument, cx, wrapper, &val)) {
|
||||
HandleException(cx);
|
||||
return;
|
||||
}
|
||||
|
||||
(this->*aFunc)(cx, val);
|
||||
}
|
||||
|
||||
// Static methods for the PromiseInit functions.
|
||||
static bool
|
||||
JSCallback(JSContext *aCx, unsigned aArgc, JS::Value *aVp);
|
||||
@ -175,7 +252,7 @@ private:
|
||||
|
||||
void HandleException(JSContext* aCx);
|
||||
|
||||
nsRefPtr<nsPIDOMWindow> mWindow;
|
||||
nsRefPtr<nsIGlobalObject> mGlobal;
|
||||
|
||||
nsTArray<nsRefPtr<PromiseCallback> > mResolveCallbacks;
|
||||
nsTArray<nsRefPtr<PromiseCallback> > mRejectCallbacks;
|
||||
|
@ -697,7 +697,10 @@ Notification::Get(const GlobalObject& aGlobal,
|
||||
const GetNotificationOptions& aFilter,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(aGlobal.GetAsSupports());
|
||||
nsCOMPtr<nsIGlobalObject> global =
|
||||
do_QueryInterface(aGlobal.GetAsSupports());
|
||||
MOZ_ASSERT(global);
|
||||
nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(global);
|
||||
MOZ_ASSERT(window);
|
||||
nsIDocument* doc = window->GetExtantDoc();
|
||||
if (!doc) {
|
||||
@ -719,7 +722,7 @@ Notification::Get(const GlobalObject& aGlobal,
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsRefPtr<Promise> promise = new Promise(window);
|
||||
nsRefPtr<Promise> promise = new Promise(global);
|
||||
nsCOMPtr<nsINotificationStorageCallback> callback =
|
||||
new NotificationStorageCallback(aGlobal, window, promise);
|
||||
nsString tag = aFilter.mTag.WasPassed() ?
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user