merge mozilla-inbound to mozilla-central a=merge

This commit is contained in:
Carsten "Tomcat" Book 2014-11-24 13:30:23 +01:00
commit 1abed3b5a2
303 changed files with 5813 additions and 2335 deletions

View File

@ -1,5 +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/.
REVIEWBOARD_URL = 'https://reviewboard.allizom.org/'

View File

@ -508,7 +508,7 @@ HyperTextAccessible::FindOffset(uint32_t aOffset, nsDirection aDirection,
const bool kIsKeyboardSelect = true; // is keyboard selection
const bool kIsVisualBidi = false; // use visual order for bidi text
nsPeekOffsetStruct pos(aAmount, aDirection, innerContentOffset,
0, kIsJumpLinesOk, kIsScrollViewAStop,
nsPoint(0, 0), kIsJumpLinesOk, kIsScrollViewAStop,
kIsKeyboardSelect, kIsVisualBidi,
aWordMovementType);
nsresult rv = frameAtOffset->PeekOffset(&pos);

View File

@ -434,6 +434,8 @@ pref("dom.ipc.processCount", 100000);
pref("dom.ipc.browser_frames.oop_by_default", false);
pref("dom.meta-viewport.enabled", true);
// SMS/MMS
pref("dom.sms.enabled", true);

View File

@ -1820,4 +1820,9 @@ pref("print.enable_e10s_testing", false);
pref("print.enable_e10s_testing", true);
#endif
#ifdef NIGHTLY_BUILD
// Enable e10s add-on interposition by default.
pref("extensions.interposition.enabled", true);
#endif
pref("browser.defaultbrowser.notificationbar", false);

View File

@ -413,13 +413,12 @@ this.DownloadsCommon = {
if (shouldApplySmoothing) {
// Apply hysteresis to favor downward over upward swings. Trust only 30%
// of the new value if lower, and 10% if higher (exponential smoothing).
let (diff = aSeconds - aLastSeconds) {
aSeconds = aLastSeconds + (diff < 0 ? .3 : .1) * diff;
}
let diff = aSeconds - aLastSeconds;
aSeconds = aLastSeconds + (diff < 0 ? .3 : .1) * diff;
// If the new time is similar, reuse something close to the last time
// left, but subtract a little to provide forward progress.
let diff = aSeconds - aLastSeconds;
diff = aSeconds - aLastSeconds;
let diffPercent = diff / aLastSeconds * 100;
if (Math.abs(diff) < 5 || Math.abs(diffPercent) < 5) {
aSeconds = aLastSeconds - (diff < 0 ? .4 : .2);

View File

@ -98,25 +98,25 @@ support-files =
testactors.js
[browser_dbg_aaa_run_first_leaktest.js]
skip-if = e10s
skip-if = e10s && debug
[browser_dbg_addonactor.js]
skip-if = e10s
skip-if = e10s && debug
[browser_dbg_addon-sources.js]
skip-if = e10s
skip-if = e10s && debug
[browser_dbg_addon-modules.js]
skip-if = e10s
skip-if = e10s # TODO
[browser_dbg_addon-modules-unpacked.js]
skip-if = e10s
skip-if = e10s # TODO
[browser_dbg_addon-panels.js]
skip-if = e10s
skip-if = e10s && debug
[browser_dbg_addon-console.js]
skip-if = e10s || os == 'win' # bug 1005274
skip-if = e10s && debug || os == 'win' # bug 1005274
[browser_dbg_auto-pretty-print-01.js]
skip-if = e10s
skip-if = e10s && debug
[browser_dbg_auto-pretty-print-02.js]
skip-if = e10s
skip-if = e10s && debug
[browser_dbg_bfcache.js]
skip-if = e10s
skip-if = e10s # TODO
[browser_dbg_blackboxing-01.js]
skip-if = e10s && debug
[browser_dbg_blackboxing-02.js]
@ -130,9 +130,9 @@ skip-if = e10s && debug
[browser_dbg_blackboxing-06.js]
skip-if = e10s && debug
[browser_dbg_breadcrumbs-access.js]
skip-if = e10s
skip-if = e10s && debug
[browser_dbg_break-on-dom-01.js]
skip-if = e10s
skip-if = e10s && debug
[browser_dbg_break-on-dom-02.js]
skip-if = e10s && debug
[browser_dbg_break-on-dom-03.js]
@ -150,7 +150,7 @@ skip-if = e10s && debug
[browser_dbg_break-on-dom-event-01.js]
skip-if = e10s || os == "mac" || e10s # Bug 895426
[browser_dbg_break-on-dom-event-02.js]
skip-if = e10s
skip-if = e10s # TODO
[browser_dbg_breakpoints-actual-location.js]
skip-if = e10s && debug
[browser_dbg_breakpoints-actual-location2.js]
@ -180,21 +180,21 @@ skip-if = e10s && debug
[browser_dbg_breakpoints-reload.js]
skip-if = e10s && debug
[browser_dbg_chrome-create.js]
skip-if = e10s
skip-if = e10s && debug
[browser_dbg_chrome-debugging.js]
skip-if = e10s
skip-if = e10s && debug
[browser_dbg_clean-exit-window.js]
skip-if = true # Bug 933950 (leaky test)
[browser_dbg_clean-exit.js]
skip-if = true # Bug 1044985 (racy test)
[browser_dbg_closure-inspection.js]
skip-if = e10s
skip-if = e10s && debug
[browser_dbg_cmd-blackbox.js]
skip-if = e10s
skip-if = e10s && debug
[browser_dbg_cmd-break.js]
skip-if = e10s
skip-if = e10s # TODO
[browser_dbg_cmd-dbg.js]
skip-if = e10s
skip-if = e10s # TODO
[browser_dbg_conditional-breakpoints-01.js]
skip-if = e10s && debug
[browser_dbg_conditional-breakpoints-02.js]
@ -212,73 +212,73 @@ skip-if = e10s && debug
[browser_dbg_server-conditional-bp-04.js]
skip-if = e10s && debug
[browser_dbg_controller-evaluate-01.js]
skip-if = e10s
skip-if = e10s && debug
[browser_dbg_controller-evaluate-02.js]
skip-if = e10s
skip-if = e10s && debug
[browser_dbg_debugger-statement.js]
skip-if = e10s
skip-if = e10s && debug
[browser_dbg_editor-contextmenu.js]
skip-if = e10s
skip-if = e10s && debug
[browser_dbg_editor-mode.js]
skip-if = e10s
skip-if = e10s && debug
[browser_dbg_event-listeners-01.js]
skip-if = e10s
skip-if = e10s && debug
[browser_dbg_event-listeners-02.js]
skip-if = e10s
skip-if = e10s && debug
[browser_dbg_event-listeners-03.js]
skip-if = e10s
skip-if = e10s && debug
[browser_dbg_file-reload.js]
skip-if = e10s
skip-if = e10s && debug
[browser_dbg_function-display-name.js]
skip-if = e10s
skip-if = e10s && debug
[browser_dbg_global-method-override.js]
skip-if = e10s
skip-if = e10s && debug
[browser_dbg_globalactor.js]
skip-if = e10s
skip-if = e10s # TODO
[browser_dbg_hide-toolbar-buttons.js]
skip-if = e10s
[browser_dbg_hit-counts-01.js]
skip-if = e10s
skip-if = e10s && debug
[browser_dbg_hit-counts-02.js]
skip-if = e10s
skip-if = e10s && debug
[browser_dbg_host-layout.js]
skip-if = e10s
skip-if = e10s && debug
[browser_dbg_iframes.js]
skip-if = e10s
skip-if = e10s # TODO
[browser_dbg_instruments-pane-collapse.js]
skip-if = e10s
skip-if = e10s && debug
[browser_dbg_interrupts.js]
skip-if = e10s
skip-if = e10s && debug
[browser_dbg_listaddons.js]
skip-if = e10s
skip-if = e10s && debug
[browser_dbg_listtabs-01.js]
skip-if = e10s
skip-if = e10s # TODO
[browser_dbg_listtabs-02.js]
skip-if = e10s
skip-if = e10s # TODO
[browser_dbg_listtabs-03.js]
skip-if = e10s
skip-if = e10s && debug
[browser_dbg_location-changes-01-simple.js]
skip-if = e10s
skip-if = e10s && debug
[browser_dbg_location-changes-02-blank.js]
skip-if = e10s
skip-if = e10s && debug
[browser_dbg_location-changes-03-new.js]
skip-if = e10s
skip-if = e10s # TODO
[browser_dbg_location-changes-04-breakpoint.js]
skip-if = e10s
skip-if = e10s # TODO
[browser_dbg_multiple-windows.js]
skip-if = e10s
skip-if = e10s # TODO
[browser_dbg_navigation.js]
skip-if = e10s
skip-if = e10s && debug
[browser_dbg_no-page-sources.js]
skip-if = e10s
skip-if = e10s && debug
[browser_dbg_on-pause-highlight.js]
skip-if = e10s
skip-if = e10s && debug
[browser_dbg_on-pause-raise.js]
skip-if = e10s || os == "linux" || e10s # Bug 888811 & bug 891176
skip-if = e10s && debug || os == "linux" # Bug 888811 & bug 891176
[browser_dbg_optimized-out-vars.js]
skip-if = e10s
skip-if = e10s && debug
[browser_dbg_panel-size.js]
skip-if = e10s
skip-if = e10s && debug
[browser_dbg_parser-01.js]
skip-if = e10s && debug
[browser_dbg_parser-02.js]
@ -300,13 +300,13 @@ skip-if = e10s && debug
[browser_dbg_parser-10.js]
skip-if = e10s && debug
[browser_dbg_pause-exceptions-01.js]
skip-if = e10s
skip-if = e10s && debug
[browser_dbg_pause-exceptions-02.js]
skip-if = e10s
skip-if = e10s && debug
[browser_dbg_pause-resume.js]
skip-if = e10s
skip-if = e10s && debug
[browser_dbg_pause-warning.js]
skip-if = e10s
skip-if = e10s && debug
[browser_dbg_paused-keybindings.js]
skip-if = e10s
[browser_dbg_pretty-print-01.js]
@ -338,21 +338,21 @@ skip-if = e10s && debug
[browser_dbg_pretty-print-on-paused.js]
skip-if = e10s && debug
[browser_dbg_progress-listener-bug.js]
skip-if = e10s
skip-if = e10a && debug
[browser_dbg_reload-preferred-script-01.js]
skip-if = e10s
skip-if = e10s && debug
[browser_dbg_reload-preferred-script-02.js]
skip-if = e10s
skip-if = e10s && debug
[browser_dbg_reload-preferred-script-03.js]
skip-if = e10s
skip-if = e10s && debug
[browser_dbg_reload-same-script.js]
skip-if = e10s
skip-if = e10s && debug
[browser_dbg_scripts-switching-01.js]
skip-if = e10s
skip-if = e10s && debug
[browser_dbg_scripts-switching-02.js]
skip-if = e10s
skip-if = e10s && debug
[browser_dbg_scripts-switching-03.js]
skip-if = e10s
skip-if = e10s && debug
[browser_dbg_search-autofill-identifier.js]
skip-if = e10s && debug
[browser_dbg_search-basic-01.js]
@ -400,13 +400,13 @@ skip-if = e10s && debug
[browser_dbg_source-maps-04.js]
skip-if = e10s # Bug 1093535
[browser_dbg_sources-cache.js]
skip-if = e10s
skip-if = e10s && debug
[browser_dbg_sources-labels.js]
skip-if = e10s
skip-if = e10s && debug
[browser_dbg_sources-sorting.js]
skip-if = e10s
skip-if = e10s && debug
[browser_dbg_split-console-paused-reload.js]
skip-if = e10s
skip-if = e10s && debug
[browser_dbg_stack-01.js]
skip-if = e10s && debug
[browser_dbg_stack-02.js]
@ -422,13 +422,13 @@ skip-if = e10s && debug
[browser_dbg_stack-07.js]
skip-if = e10s && debug
[browser_dbg_step-out.js]
skip-if = e10s
skip-if = e10s && debug
[browser_dbg_tabactor-01.js]
skip-if = e10s
skip-if = e10s # TODO
[browser_dbg_tabactor-02.js]
skip-if = e10s
skip-if = e10s # TODO
[browser_dbg_terminate-on-tab-close.js]
skip-if = e10s
skip-if = e10s && debug
[browser_dbg_tracing-01.js]
skip-if = e10s && debug
[browser_dbg_tracing-02.js]

View File

@ -14,15 +14,14 @@ function test() {
// GC from previous tests does not interfere with the debugger suite.
requestLongerTimeout(2);
initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => {
initDebugger(TAB_URL).then(([aTab,, aPanel]) => {
ok(aTab, "Should have a tab available.");
ok(aDebuggee, "Should have a debuggee available.");
ok(aPanel, "Should have a debugger pane available.");
waitForSourceAndCaretAndScopes(aPanel, "-02.js", 1).then(() => {
resumeDebuggerThenCloseAndFinish(aPanel);
});
aDebuggee.firstCall();
callInTab(aTab, "firstCall");
});
}

View File

@ -5,7 +5,7 @@
const TAB_URL = EXAMPLE_URL + "doc_auto-pretty-print-01.html";
let gTab, gDebuggee, gPanel, gDebugger;
let gTab, gPanel, gDebugger;
let gEditor, gSources, gPrefs, gOptions, gView;
let gFirstSourceLabel = "code_ugly-5.js";
@ -15,9 +15,8 @@ let gOriginalPref = Services.prefs.getBoolPref("devtools.debugger.auto-pretty-pr
Services.prefs.setBoolPref("devtools.debugger.auto-pretty-print", true);
function test(){
initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => {
initDebugger(TAB_URL).then(([aTab,, aPanel]) => {
gTab = aTab;
gDebuggee = aDebuggee;
gPanel = aPanel;
gDebugger = gPanel.panelWin;
gEditor = gDebugger.DebuggerView.editor;
@ -99,7 +98,6 @@ function testSourceIsPretty() {
registerCleanupFunction(function() {
gTab = null;
gDebuggee = null;
gPanel = null;
gDebugger = null;
gEditor = null;

View File

@ -8,12 +8,11 @@
const TAB_URL = EXAMPLE_URL + "doc_script-switching-01.html";
function test() {
let gTab, gDebuggee, gPanel, gDebugger;
let gTab, gPanel, gDebugger;
let gSources, gFrames;
initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => {
initDebugger(TAB_URL).then(([aTab,, aPanel]) => {
gTab = aTab;
gDebuggee = aDebuggee;
gPanel = aPanel;
gDebugger = gPanel.panelWin;
gSources = gDebugger.DebuggerView.Sources;
@ -28,7 +27,7 @@ function test() {
ok(false, "Got an error: " + aError.message + "\n" + aError.stack);
});
gDebuggee.firstCall();
callInTab(gTab, "firstCall");
});
function checkNavigationWhileNotFocused() {

View File

@ -8,7 +8,7 @@
const TAB_URL = EXAMPLE_URL + "doc_event-listeners-02.html";
function test() {
initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => {
initDebugger(TAB_URL).then(([aTab,, aPanel]) => {
let gDebugger = aPanel.panelWin;
let gView = gDebugger.DebuggerView;
let gEvents = gView.EventListeners;

View File

@ -5,14 +5,13 @@
* Test that closing a tab with the debugger in a paused state exits cleanly.
*/
let gTab, gDebuggee, gPanel, gDebugger;
let gTab, gPanel, gDebugger;
const TAB_URL = EXAMPLE_URL + "doc_inline-debugger-statement.html";
function test() {
initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => {
initDebugger(TAB_URL).then(([aTab,, aPanel]) => {
gTab = aTab;
gDebuggee = aDebuggee;
gPanel = aPanel;
gDebugger = gPanel.panelWin;
@ -28,12 +27,11 @@ function testCleanExit() {
return waitForDebuggerEvents(gPanel, gDebugger.EVENTS.AFTER_FRAMES_REFILLED);
}).then(() => closeDebuggerAndFinish(gPanel, { whilePaused: true }));
gDebuggee.runDebuggerStatement();
callInTab(gTab, "runDebuggerStatement");
}
registerCleanupFunction(function() {
gTab = null;
gDebuggee = null;
gPanel = null;
gDebugger = null;
});

View File

@ -6,14 +6,12 @@ const TAB_URL = EXAMPLE_URL + "doc_closures.html";
// Test that inspecting a closure works as expected.
function test() {
let gPanel, gTab, gDebuggee, gDebugger;
let gPanel, gTab, gDebugger;
initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => {
initDebugger(TAB_URL).then(([aTab,, aPanel]) => {
gTab = aTab;
gDebuggee = aDebuggee;
gPanel = aPanel;
gDebugger = gPanel.panelWin;
gDebuggee.gRecurseLimit = 2;
waitForSourceShown(gPanel, ".html")
.then(testClosure)
@ -24,13 +22,7 @@ function test() {
});
function testClosure() {
// Spin the event loop before causing the debuggee to pause, to allow
// this function to return first.
executeSoon(() => {
EventUtils.sendMouseEvent({ type: "click" },
gDebuggee.document.querySelector("button"),
gDebuggee);
});
sendMouseClickToTab(gTab, content.document.querySelector("button"));
return waitForDebuggerEvents(gPanel, gDebugger.EVENTS.FETCHED_SCOPES).then(() => {
let gVars = gDebugger.DebuggerView.Variables;

View File

@ -9,7 +9,7 @@ const TAB_URL = EXAMPLE_URL + "doc_script-switching-01.html";
function test() {
Task.spawn(function() {
let [tab, debuggee, panel] = yield initDebugger(TAB_URL);
let [tab,, panel] = yield initDebugger(TAB_URL);
let win = panel.panelWin;
let frames = win.DebuggerController.StackFrames;
let framesView = win.DebuggerView.StackFrames;
@ -45,8 +45,7 @@ function test() {
"Evaluating shouldn't work while the debuggee isn't paused.");
}
// Allow this generator function to yield first.
executeSoon(() => debuggee.firstCall());
callInTab(tab, "firstCall");
yield waitForSourceAndCaretAndScopes(panel, "-02.js", 1);
checkView(0, 1, 1, [/secondCall/, 118]);

View File

@ -9,7 +9,7 @@ const TAB_URL = EXAMPLE_URL + "doc_script-switching-01.html";
function test() {
Task.spawn(function() {
let [tab, debuggee, panel] = yield initDebugger(TAB_URL);
let [tab,, panel] = yield initDebugger(TAB_URL);
let win = panel.panelWin;
let frames = win.DebuggerController.StackFrames;
let framesView = win.DebuggerView.StackFrames;
@ -38,7 +38,7 @@ function test() {
is(sources._cache.size, 2, "There should be two cached sources in the cache.");
// Allow this generator function to yield first.
executeSoon(() => debuggee.firstCall());
callInTab(tab, "firstCall");
yield waitForSourceAndCaretAndScopes(panel, "-02.js", 1);
checkView(0, 1, 1, [/secondCall/, 118]);

View File

@ -8,6 +8,7 @@
const TAB_URL = EXAMPLE_URL + "doc_inline-debugger-statement.html";
let gClient;
let gTab;
function test() {
if (!DebuggerServer.initialized) {
@ -22,7 +23,10 @@ function test() {
"Root actor should identify itself as a browser.");
addTab(TAB_URL)
.then(() => attachTabActorForUrl(gClient, TAB_URL))
.then((aTab) => {
gTab = aTab;
return attachTabActorForUrl(gClient, TAB_URL)
})
.then(testEarlyDebuggerStatement)
.then(testDebuggerStatement)
.then(closeConnection)
@ -45,8 +49,7 @@ function testEarlyDebuggerStatement([aGrip, aResponse]) {
// This should continue without nesting an event loop and calling
// the onPaused hook, because we haven't attached yet.
let debuggee = gBrowser.selectedTab.linkedBrowser.contentWindow.wrappedJSObject;
debuggee.runDebuggerStatement();
callInTab(gTab, "runDebuggerStatement");
gClient.removeListener("paused", onPaused);
@ -72,8 +75,7 @@ function testDebuggerStatement([aGrip, aResponse]) {
});
// Reach around the debugging protocol and execute the debugger statement.
let debuggee = gBrowser.selectedTab.linkedBrowser.contentWindow.wrappedJSObject;
debuggee.runDebuggerStatement();
callInTab(gTab, "runDebuggerStatement");
}
function closeConnection() {

View File

@ -8,12 +8,11 @@
const TAB_URL = EXAMPLE_URL + "doc_script-switching-01.html";
function test() {
let gTab, gDebuggee, gPanel, gDebugger;
let gTab, gPanel, gDebugger;
let gEditor, gSources, gContextMenu;
initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => {
initDebugger(TAB_URL).then(([aTab,, aPanel]) => {
gTab = aTab;
gDebuggee = aDebuggee;
gPanel = aPanel;
gDebugger = gPanel.panelWin;
gEditor = gDebugger.DebuggerView.editor;
@ -21,7 +20,7 @@ function test() {
gContextMenu = gDebugger.document.getElementById("sourceEditorContextMenu");
waitForSourceAndCaretAndScopes(gPanel, "-02.js", 1).then(performTest).then(null, info);
gDebuggee.firstCall();
callInTab(gTab, "firstCall");
});
function performTest() {

View File

@ -8,13 +8,12 @@
const TAB_URL = EXAMPLE_URL + "doc_editor-mode.html";
let gTab, gDebuggee, gPanel, gDebugger;
let gTab, gPanel, gDebugger;
let gEditor, gSources;
function test() {
initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => {
initDebugger(TAB_URL).then(([aTab,, aPanel]) => {
gTab = aTab;
gDebuggee = aDebuggee;
gPanel = aPanel;
gDebugger = gPanel.panelWin;
gEditor = gDebugger.DebuggerView.editor;
@ -29,7 +28,7 @@ function test() {
ok(false, "Got an error: " + aError.message + "\n" + aError.stack);
});
gDebuggee.firstCall();
callInTab(gTab, "firstCall");
});
}
@ -85,7 +84,6 @@ function testSwitch2() {
registerCleanupFunction(function() {
gTab = null;
gDebuggee = null;
gPanel = null;
gDebugger = null;
gEditor = null;

View File

@ -8,6 +8,7 @@
const TAB_URL = EXAMPLE_URL + "doc_event-listeners-01.html";
let gClient;
let gTab;
function test() {
if (!DebuggerServer.initialized) {
@ -22,7 +23,10 @@ function test() {
"Root actor should identify itself as a browser.");
addTab(TAB_URL)
.then(() => attachThreadActorForUrl(gClient, TAB_URL))
.then((aTab) => {
gTab = aTab;
return attachThreadActorForUrl(gClient, TAB_URL)
})
.then(pauseDebuggee)
.then(testEventListeners)
.then(closeConnection)
@ -45,13 +49,7 @@ function pauseDebuggee(aThreadClient) {
deferred.resolve(aThreadClient);
});
// Spin the event loop before causing the debuggee to pause, to allow
// this function to return first.
executeSoon(() => {
EventUtils.sendMouseEvent({ type: "click" },
content.document.querySelector("button"),
content);
});
sendMouseClickToTab(gTab, content.document.querySelector("button"));
return deferred.promise;
}

View File

@ -9,6 +9,7 @@
const TAB_URL = EXAMPLE_URL + "doc_event-listeners-03.html";
let gClient;
let gTab;
function test() {
if (!DebuggerServer.initialized) {
@ -23,7 +24,10 @@ function test() {
"Root actor should identify itself as a browser.");
addTab(TAB_URL)
.then(() => attachThreadActorForUrl(gClient, TAB_URL))
.then((aTab) => {
gTab = aTab;
return attachThreadActorForUrl(gClient, TAB_URL);
})
.then(pauseDebuggee)
.then(testEventListeners)
.then(closeConnection)
@ -46,13 +50,7 @@ function pauseDebuggee(aThreadClient) {
deferred.resolve(aThreadClient);
});
// Spin the event loop before causing the debuggee to pause, to allow
// this function to return first.
executeSoon(() => {
EventUtils.sendMouseEvent({ type: "click" },
content.document.querySelector("button"),
content);
});
sendMouseClickToTab(gTab, content.document.querySelector("button"));
return deferred.promise;
}

View File

@ -9,6 +9,7 @@
const TAB_URL = EXAMPLE_URL + "doc_native-event-handler.html";
let gClient;
let gTab;
function test() {
if (!DebuggerServer.initialized) {
@ -23,7 +24,10 @@ function test() {
"Root actor should identify itself as a browser.");
addTab(TAB_URL)
.then(() => attachThreadActorForUrl(gClient, TAB_URL))
.then((aTab) => {
gTab = aTab;
return attachThreadActorForUrl(gClient, TAB_URL)
})
.then(pauseDebuggee)
.then(testEventListeners)
.then(closeConnection)
@ -46,13 +50,7 @@ function pauseDebuggee(aThreadClient) {
deferred.resolve(aThreadClient);
});
// Spin the event loop before causing the debuggee to pause, to allow
// this function to return first.
executeSoon(() => {
EventUtils.sendMouseEvent({ type: "click" },
content.document.querySelector("button"),
content);
});
sendMouseClickToTab(gTab, content.document.querySelector("button"));
return deferred.promise;
}

View File

@ -9,7 +9,7 @@ const TAB_URL = EXAMPLE_URL + "doc_random-javascript.html";
const JS_URL = EXAMPLE_URL + "sjs_random-javascript.sjs";
function test() {
initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => {
initDebugger(TAB_URL).then(([aTab,, aPanel]) => {
let gDebugger = aPanel.panelWin;
let gEditor = gDebugger.DebuggerView.editor;
let gSources = gDebugger.DebuggerView.Sources;

View File

@ -8,12 +8,11 @@
const TAB_URL = EXAMPLE_URL + "doc_function-display-name.html";
let gTab, gDebuggee, gPanel, gDebugger;
let gTab, gPanel, gDebugger;
function test() {
initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => {
initDebugger(TAB_URL).then(([aTab,, aPanel]) => {
gTab = aTab;
gDebuggee = aDebuggee;
gPanel = aPanel;
gDebugger = gPanel.panelWin;
@ -35,7 +34,7 @@ function testAnonCall() {
testInferredName();
});
gDebuggee.evalCall();
callInTab(gTab, "evalCall");
}
function testInferredName() {
@ -57,7 +56,6 @@ function testInferredName() {
registerCleanupFunction(function() {
gTab = null;
gDebuggee = null;
gPanel = null;
gDebugger = null;
});

View File

@ -10,7 +10,7 @@
const TAB_URL = EXAMPLE_URL + "doc_global-method-override.html";
function test() {
initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => {
initDebugger(TAB_URL).then(([aTab,, aPanel]) => {
let gDebugger = aPanel.panelWin;
ok(gDebugger, "Should have a debugger available.");
is(gDebugger.gThreadClient.state, "attached", "Debugger should be attached.");

View File

@ -9,16 +9,15 @@
const TAB_URL = EXAMPLE_URL + "doc_same-line-functions.html";
const CODE_URL = "code_same-line-functions.js";
let gTab, gDebuggee, gPanel, gDebugger;
let gTab, gPanel, gDebugger;
let gEditor;
function test() {
Task.async(function* () {
yield pushPrefs(["devtools.debugger.tracer", true]);
initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => {
initDebugger(TAB_URL).then(([aTab,, aPanel]) => {
gTab = aTab;
gDebuggee = aDebuggee;
gPanel = aPanel;
gDebugger = gPanel.panelWin;
gEditor = gDebugger.DebuggerView.editor;
@ -44,9 +43,7 @@ function test() {
}
function clickButton() {
EventUtils.sendMouseEvent({ type: "click" },
gDebuggee.document.querySelector("button"),
gDebuggee);
sendMouseClickToTab(gTab, content.document.querySelector("button"));
}
function testHitCounts() {
@ -58,8 +55,7 @@ function testHitCounts() {
registerCleanupFunction(function() {
gTab = null;
gDebuggee = null;
gPanel = null;
gDebugger = null;
gEditor = null;
});
});

View File

@ -8,16 +8,15 @@
const TAB_URL = EXAMPLE_URL + "doc_same-line-functions.html";
const CODE_URL = "code_same-line-functions.js";
let gTab, gDebuggee, gPanel, gDebugger;
let gTab, gPanel, gDebugger;
let gEditor;
function test() {
Task.async(function* () {
yield pushPrefs(["devtools.debugger.tracer", true]);
initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => {
initDebugger(TAB_URL).then(([aTab,, aPanel]) => {
gTab = aTab;
gDebuggee = aDebuggee;
gPanel = aPanel;
gDebugger = gPanel.panelWin;
gEditor = gDebugger.DebuggerView.editor;
@ -46,9 +45,7 @@ function test() {
}
function clickButton() {
EventUtils.sendMouseEvent({ type: "click" },
gDebuggee.document.querySelector("button"),
gDebuggee);
sendMouseClickToTab(gTab, content.document.querySelector("button"));
}
function testHitCountsBeforeStopping() {
@ -63,8 +60,7 @@ function testHitCountsAfterStopping() {
registerCleanupFunction(function() {
gTab = null;
gDebuggee = null;
gPanel = null;
gDebugger = null;
gEditor = null;
});
});

View File

@ -27,14 +27,14 @@ function testHosts(aHostTypes, aLayoutTypes) {
return Task.spawn(function() {
let [tab, debuggee, panel] = yield initDebugger("about:blank");
yield testHost(tab, debuggee, panel, firstHost, firstLayout);
yield switchAndTestHost(tab, debuggee, panel, secondHost, secondLayout);
yield switchAndTestHost(tab, debuggee, panel, thirdHost, thirdLayout);
yield testHost(tab, panel, firstHost, firstLayout);
yield switchAndTestHost(tab, panel, secondHost, secondLayout);
yield switchAndTestHost(tab, panel, thirdHost, thirdLayout);
yield teardown(panel);
});
}
function switchAndTestHost(aTab, aDebuggee, aPanel, aHostType, aLayoutType) {
function switchAndTestHost(aTab, aPanel, aHostType, aLayoutType) {
let gToolbox = aPanel._toolbox;
let gDebugger = aPanel.panelWin;
@ -48,7 +48,7 @@ function switchAndTestHost(aTab, aDebuggee, aPanel, aHostType, aLayoutType) {
yield layoutChanged;
ok(true, "The debugger's layout has changed.");
yield testHost(aTab, aDebuggee, aPanel, aHostType, aLayoutType);
yield testHost(aTab, aPanel, aHostType, aLayoutType);
});
function once(aTarget, aEvent) {
@ -58,7 +58,7 @@ function switchAndTestHost(aTab, aDebuggee, aPanel, aHostType, aLayoutType) {
}
}
function testHost(aTab, aDebuggee, aPanel, aHostType, aLayoutType) {
function testHost(aTab, aPanel, aHostType, aLayoutType) {
let gDebugger = aPanel.panelWin;
let gView = gDebugger.DebuggerView;

View File

@ -7,13 +7,12 @@
const TAB_URL = EXAMPLE_URL + "doc_recursion-stack.html";
let gTab, gDebuggee, gPanel, gDebugger;
let gTab, gPanel, gDebugger;
let gPrefs, gOptions;
function test() {
initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => {
initDebugger(TAB_URL).then(([aTab,, aPanel]) => {
gTab = aTab;
gDebuggee = aDebuggee;
gPanel = aPanel;
gDebugger = gPanel.panelWin;
gPrefs = gDebugger.Prefs;
@ -146,7 +145,6 @@ function testPanesStartupPref() {
registerCleanupFunction(function() {
gTab = null;
gDebuggee = null;
gPanel = null;
gDebugger = null;
gPrefs = null;

View File

@ -8,12 +8,11 @@
const TAB_URL = EXAMPLE_URL + "doc_script-switching-01.html";
function test() {
let gTab, gDebuggee, gPanel, gDebugger;
let gTab, gPanel, gDebugger;
let gSources, gBreakpoints, gTarget, gResumeButton, gResumeKey, gThreadClient;
initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => {
initDebugger(TAB_URL).then(([aTab,, aPanel]) => {
gTab = aTab;
gDebuggee = aDebuggee;
gPanel = aPanel;
gDebugger = gPanel.panelWin;
gSources = gDebugger.DebuggerView.Sources;

View File

@ -7,13 +7,12 @@
const TAB_URL = EXAMPLE_URL + "doc_recursion-stack.html";
let gTab, gDebuggee, gPanel, gDebugger;
let gTab, gPanel, gDebugger;
let gEditor, gSources, gFrames;
function test() {
initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => {
initDebugger(TAB_URL).then(([aTab,, aPanel]) => {
gTab = aTab;
gDebuggee = aDebuggee;
gPanel = aPanel;
gDebugger = gPanel.panelWin;
gEditor = gDebugger.DebuggerView.editor;
@ -21,7 +20,7 @@ function test() {
gFrames = gDebugger.DebuggerView.StackFrames;
waitForSourceAndCaretAndScopes(gPanel, ".html", 14).then(performTest);
gDebuggee.simpleCall();
callInTab(gTab, "simpleCall");
});
}
@ -62,7 +61,6 @@ function testLocationChange() {
registerCleanupFunction(function() {
gTab = null;
gDebuggee = null;
gPanel = null;
gDebugger = null;
gEditor = null;

View File

@ -7,13 +7,12 @@
const TAB_URL = EXAMPLE_URL + "doc_recursion-stack.html";
let gTab, gDebuggee, gPanel, gDebugger;
let gTab, gPanel, gDebugger;
let gEditor, gSources, gFrames;
function test() {
initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => {
initDebugger(TAB_URL).then(([aTab,, aPanel]) => {
gTab = aTab;
gDebuggee = aDebuggee;
gPanel = aPanel;
gDebugger = gPanel.panelWin;
gEditor = gDebugger.DebuggerView.editor;
@ -21,7 +20,7 @@ function test() {
gFrames = gDebugger.DebuggerView.StackFrames;
waitForSourceAndCaretAndScopes(gPanel, ".html", 14).then(testLocationChange);
gDebuggee.simpleCall();
callInTab(gTab, "simpleCall");
});
}
@ -53,7 +52,6 @@ function testLocationChange() {
registerCleanupFunction(function() {
gTab = null;
gDebuggee = null;
gPanel = null;
gDebugger = null;
gEditor = null;

View File

@ -8,13 +8,12 @@
const TAB_URL = EXAMPLE_URL + "doc_recursion-stack.html";
let gTab, gDebuggee, gPanel, gDebugger;
let gTab, gPanel, gDebugger;
let gToolbox, gToolboxTab;
function test() {
initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => {
initDebugger(TAB_URL).then(([aTab,, aPanel]) => {
gTab = aTab;
gDebuggee = aDebuggee;
gPanel = aPanel;
gDebugger = gPanel.panelWin;
gToolbox = gPanel._toolbox;
@ -69,7 +68,6 @@ function testResume() {
registerCleanupFunction(function() {
gTab = null;
gDebuggee = null;
gPanel = null;
gDebugger = null;
gToolbox = null;

View File

@ -7,13 +7,12 @@
const TAB_URL = EXAMPLE_URL + "doc_recursion-stack.html";
let gTab, gDebuggee, gPanel, gDebugger;
let gTab, gPanel, gDebugger;
let gNewTab, gFocusedWindow, gToolbox, gToolboxTab;
function test() {
initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => {
initDebugger(TAB_URL).then(([aTab,, aPanel]) => {
gTab = aTab;
gDebuggee = aDebuggee;
gPanel = aPanel;
gDebugger = gPanel.panelWin;
gToolbox = gPanel._toolbox;
@ -132,7 +131,6 @@ registerCleanupFunction(function() {
Services.prefs.setCharPref("devtools.toolbox.host", devtools.Toolbox.HostType.BOTTOM);
gTab = null;
gDebuggee = null;
gPanel = null;
gDebugger = null;

View File

@ -8,7 +8,7 @@ function test() {
const TAB_URL = EXAMPLE_URL + "doc_closure-optimized-out.html";
let gDebugger, sources;
let [, debuggee, panel] = yield initDebugger(TAB_URL);
let [tab,, panel] = yield initDebugger(TAB_URL);
gDebugger = panel.panelWin;
sources = gDebugger.DebuggerView.Sources;
@ -18,11 +18,7 @@ function test() {
// Spin the event loop before causing the debuggee to pause, to allow
// this function to return first.
executeSoon(() => {
EventUtils.sendMouseEvent({ type: "click" },
debuggee.document.querySelector("button"),
debuggee);
});
sendMouseClickToTab(tab, content.document.querySelector("button"));
yield waitForDebuggerEvents(panel, gDebugger.EVENTS.FETCHED_SCOPES);
let gVars = gDebugger.DebuggerView.Variables;

View File

@ -9,12 +9,11 @@
const TAB_URL = EXAMPLE_URL + "doc_recursion-stack.html";
function test() {
let gTab, gDebuggee, gPanel, gDebugger;
let gTab, gPanel, gDebugger;
let gPrefs, gSources, gInstruments;
initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => {
initDebugger(TAB_URL).then(([aTab,, aPanel]) => {
gTab = aTab;
gDebuggee = aDebuggee;
gPanel = aPanel;
gDebugger = gPanel.panelWin;
gPrefs = gDebugger.Prefs;

View File

@ -7,14 +7,13 @@
const TAB_URL = EXAMPLE_URL + "doc_pause-exceptions.html";
let gTab, gDebuggee, gPanel, gDebugger;
let gTab, gPanel, gDebugger;
let gFrames, gVariables, gPrefs, gOptions;
function test() {
requestLongerTimeout(2);
initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => {
initDebugger(TAB_URL).then(([aTab,, aPanel]) => {
gTab = aTab;
gDebuggee = aDebuggee;
gPanel = aPanel;
gDebugger = gPanel.panelWin;
gFrames = gDebugger.DebuggerView.StackFrames;
@ -78,9 +77,7 @@ function testPauseOnExceptionsDisabled() {
return finished;
});
EventUtils.sendMouseEvent({ type: "click" },
gDebuggee.document.querySelector("button"),
gDebuggee);
sendMouseClickToTab(gTab, content.document.querySelector("button"));
return finished;
}
@ -151,9 +148,7 @@ function testPauseOnExceptionsEnabled() {
return finished;
});
EventUtils.sendMouseEvent({ type: "click" },
gDebuggee.document.querySelector("button"),
gDebuggee);
sendMouseClickToTab(gTab, content.document.querySelector("button"));
return finished;
}
@ -236,7 +231,6 @@ function disableIgnoreCaughtExceptions() {
registerCleanupFunction(function() {
gTab = null;
gDebuggee = null;
gPanel = null;
gDebugger = null;
gFrames = null;

View File

@ -7,13 +7,12 @@
const TAB_URL = EXAMPLE_URL + "doc_pause-exceptions.html";
let gTab, gDebuggee, gPanel, gDebugger;
let gTab, gPanel, gDebugger;
let gFrames, gVariables, gPrefs, gOptions;
function test() {
initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => {
initDebugger(TAB_URL).then(([aTab,, aPanel]) => {
gTab = aTab;
gDebuggee = aDebuggee;
gPanel = aPanel;
gDebugger = gPanel.panelWin;
gFrames = gDebugger.DebuggerView.StackFrames;
@ -105,13 +104,7 @@ function testPauseOnExceptionsAfterReload() {
return finished;
});
// Spin the event loop before causing the debuggee to pause, to allow
// this function to return first.
executeSoon(() => {
EventUtils.sendMouseEvent({ type: "click" },
gDebuggee.document.querySelector("button"),
gDebuggee.window);
});
sendMouseClickToTab(gTab, content.document.querySelector("button"));
return finished;
}
@ -194,7 +187,6 @@ function disableIgnoreCaughtExceptions() {
registerCleanupFunction(function() {
gTab = null;
gDebuggee = null;
gPanel = null;
gDebugger = null;
gFrames = null;

View File

@ -7,13 +7,12 @@
const TAB_URL = EXAMPLE_URL + "doc_pause-exceptions.html";
let gTab, gDebuggee, gPanel, gDebugger;
let gTab, gPanel, gDebugger;
let gResumeButton, gResumeKey, gFrames;
function test() {
initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => {
initDebugger(TAB_URL).then(([aTab,, aPanel]) => {
gTab = aTab;
gDebuggee = aDebuggee;
gPanel = aPanel;
gDebugger = gPanel.panelWin;
gResumeButton = gDebugger.document.getElementById("resume");
@ -69,7 +68,6 @@ function testResume() {
registerCleanupFunction(function() {
gTab = null;
gDebuggee = null;
gPanel = null;
gDebugger = null;
gResumeButton = null;

View File

@ -7,13 +7,12 @@
const TAB_URL = EXAMPLE_URL + "doc_inline-script.html";
let gTab, gDebuggee, gPanel, gDebugger;
let gTab, gPanel, gDebugger;
let gTarget, gToolbox;
function test() {
initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => {
initDebugger(TAB_URL).then(([aTab,, aPanel]) => {
gTab = aTab;
gDebuggee = aDebuggee;
gPanel = aPanel;
gDebugger = gPanel.panelWin;
gTarget = gPanel.target;
@ -90,7 +89,6 @@ function testResume() {
registerCleanupFunction(function() {
gTab = null;
gDebuggee = null;
gPanel = null;
gDebugger = null;
gTarget = null;

View File

@ -6,7 +6,7 @@
* WebProgress argument's DOMWindow property in onStateChange() (bug 771655).
*/
let gTab, gDebuggee, gPanel, gDebugger;
let gTab, gPanel, gDebugger;
let gOldListener;
const TAB_URL = EXAMPLE_URL + "doc_inline-script.html";
@ -14,9 +14,8 @@ const TAB_URL = EXAMPLE_URL + "doc_inline-script.html";
function test() {
installListener();
initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => {
initDebugger(TAB_URL).then(([aTab,, aPanel]) => {
gTab = aTab;
gDebuggee = aDebuggee;
gPanel = aPanel;
gDebugger = gPanel.panelWin;
@ -37,7 +36,7 @@ function testPause() {
resumeDebuggerThenCloseAndFinish(gPanel);
});
gDebuggee.runDebuggerStatement();
callInTab(gTab, "runDebuggerStatement");
}
// This is taken almost verbatim from bug 771655.
@ -80,7 +79,6 @@ registerCleanupFunction(function() {
}
gTab = null;
gDebuggee = null;
gPanel = null;
gDebugger = null;
gOldListener = null;

View File

@ -9,13 +9,12 @@
const TAB_URL = EXAMPLE_URL + "doc_script-switching-01.html";
const PREFERRED_URL = EXAMPLE_URL + "code_script-switching-02.js";
let gTab, gDebuggee, gPanel, gDebugger;
let gTab, gPanel, gDebugger;
let gSources;
function test() {
initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => {
initDebugger(TAB_URL).then(([aTab,, aPanel]) => {
gTab = aTab;
gDebuggee = aDebuggee;
gPanel = aPanel;
gDebugger = gPanel.panelWin;
gSources = gDebugger.DebuggerView.Sources;
@ -39,7 +38,6 @@ function finishTest() {
registerCleanupFunction(function() {
gTab = null;
gDebuggee = null;
gPanel = null;
gDebugger = null;
gSources = null;

View File

@ -10,13 +10,12 @@ const TAB_URL = EXAMPLE_URL + "doc_script-switching-01.html";
const FIRST_URL = EXAMPLE_URL + "code_script-switching-01.js";
const SECOND_URL = EXAMPLE_URL + "code_script-switching-02.js";
let gTab, gDebuggee, gPanel, gDebugger;
let gTab, gPanel, gDebugger;
let gSources;
function test() {
initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => {
initDebugger(TAB_URL).then(([aTab,, aPanel]) => {
gTab = aTab;
gDebuggee = aDebuggee;
gPanel = aPanel;
gDebugger = gPanel.panelWin;
gSources = gDebugger.DebuggerView.Sources;
@ -52,7 +51,6 @@ function switchToSource(aUrl) {
registerCleanupFunction(function() {
gTab = null;
gDebuggee = null;
gPanel = null;
gDebugger = null;
gSources = null;

View File

@ -13,12 +13,11 @@ function test() {
// Debug test slaves are a bit slow at this test.
requestLongerTimeout(2);
let gTab, gDebuggee, gPanel, gDebugger;
let gTab, gPanel, gDebugger;
let gSources, gStep;
initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => {
initDebugger(TAB_URL).then(([aTab,, aPanel]) => {
gTab = aTab;
gDebuggee = aDebuggee;
gPanel = aPanel;
gDebugger = aPanel.panelWin;
gSources = gDebugger.DebuggerView.Sources;

View File

@ -7,13 +7,12 @@
const TAB_URL = EXAMPLE_URL + "doc_script-switching-01.html";
let gTab, gDebuggee, gPanel, gDebugger;
let gTab, gPanel, gDebugger;
let gEditor, gSources;
function test() {
initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => {
initDebugger(TAB_URL).then(([aTab,, aPanel]) => {
gTab = aTab;
gDebuggee = aDebuggee;
gPanel = aPanel;
gDebugger = gPanel.panelWin;
gEditor = gDebugger.DebuggerView.editor;
@ -32,7 +31,7 @@ function test() {
ok(false, "Got an error: " + aError.message + "\n" + aError.stack);
});
gDebuggee.firstCall();
callInTab(gTab, "firstCall");
});
}
@ -187,7 +186,6 @@ function testSwitchRunning() {
registerCleanupFunction(function() {
gTab = null;
gDebuggee = null;
gPanel = null;
gDebugger = null;
gEditor = null;

View File

@ -7,13 +7,12 @@
const TAB_URL = EXAMPLE_URL + "doc_script-switching-02.html";
let gTab, gDebuggee, gPanel, gDebugger;
let gTab, gPanel, gDebugger;
let gEditor, gSources;
function test() {
initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => {
initDebugger(TAB_URL).then(([aTab,, aPanel]) => {
gTab = aTab;
gDebuggee = aDebuggee;
gPanel = aPanel;
gDebugger = gPanel.panelWin;
gEditor = gDebugger.DebuggerView.editor;
@ -29,7 +28,7 @@ function test() {
ok(false, "Got an error: " + aError.message + "\n" + aError.stack);
});
gDebuggee.firstCall();
callInTab(gTab, "firstCall");
});
}
@ -176,7 +175,6 @@ function testSwitchRunning() {
registerCleanupFunction(function() {
gTab = null;
gDebuggee = null;
gPanel = null;
gDebugger = null;
gEditor = null;

View File

@ -7,13 +7,12 @@
const TAB_URL = EXAMPLE_URL + "doc_script-switching-01.html";
let gTab, gDebuggee, gPanel, gDebugger;
let gTab, gPanel, gDebugger;
let gView, gEditor, gL10N;
function test() {
initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => {
initDebugger(TAB_URL).then(([aTab,, aPanel]) => {
gTab = aTab;
gDebuggee = aDebuggee;
gPanel = aPanel;
gDebugger = gPanel.panelWin;
gView = gDebugger.DebuggerView;
@ -43,7 +42,6 @@ function testDebuggerLoadingError() {
registerCleanupFunction(function() {
gTab = null;
gDebuggee = null;
gPanel = null;
gDebugger = null;
gView = null;

View File

@ -8,12 +8,11 @@
const TAB_URL = EXAMPLE_URL + "doc_recursion-stack.html";
function test() {
let gTab, gDebuggee, gPanel, gDebugger;
let gTab, gPanel, gDebugger;
let gSources, gUtils;
initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => {
initDebugger(TAB_URL).then(([aTab,, aPanel]) => {
gTab = aTab;
gDebuggee = aDebuggee;
gPanel = aPanel;
gDebugger = gPanel.panelWin;
gSources = gDebugger.DebuggerView.Sources;

View File

@ -7,13 +7,12 @@
const TAB_URL = EXAMPLE_URL + "doc_recursion-stack.html";
let gTab, gDebuggee, gPanel, gDebugger;
let gTab, gPanel, gDebugger;
let gSources, gUtils;
function test() {
initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => {
initDebugger(TAB_URL).then(([aTab,, aPanel]) => {
gTab = aTab;
gDebuggee = aDebuggee;
gPanel = aPanel;
gDebugger = gPanel.panelWin;
gSources = gDebugger.DebuggerView.Sources;
@ -129,7 +128,6 @@ function checkSourcesOrder(aMethod) {
registerCleanupFunction(function() {
gTab = null;
gDebuggee = null;
gPanel = null;
gDebugger = null;
gSources = null;

View File

@ -7,13 +7,12 @@
const TAB_URL = EXAMPLE_URL + "doc_step-out.html";
let gTab, gDebuggee, gPanel, gDebugger;
let gTab, gPanel, gDebugger;
let gVars;
function test() {
initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => {
initDebugger(TAB_URL).then(([aTab,, aPanel]) => {
gTab = aTab;
gDebuggee = aDebuggee;
gPanel = aPanel;
gDebugger = gPanel.panelWin;
gVars = gDebugger.DebuggerView.Variables;
@ -41,9 +40,7 @@ function testNormalReturn() {
gDebugger);
});
EventUtils.sendMouseEvent({ type: "click" },
gDebuggee.document.getElementById("return"),
gDebuggee);
sendMouseClickToTab(gTab, content.document.getElementById("return"));
}
function testReturnWithException() {
@ -65,9 +62,7 @@ function testReturnWithException() {
gDebugger);
});
EventUtils.sendMouseEvent({ type: "click" },
gDebuggee.document.getElementById("throw"),
gDebuggee);
sendMouseClickToTab(gTab, content.document.getElementById("throw"));
}
function resumeDebuggee() {
@ -78,7 +73,6 @@ function resumeDebuggee() {
registerCleanupFunction(function() {
gTab = null;
gDebuggee = null;
gPanel = null;
gDebugger = null;
gVars = null;

View File

@ -7,12 +7,11 @@
const TAB_URL = EXAMPLE_URL + "doc_terminate-on-tab-close.html";
let gTab, gDebuggee, gDebugger, gPanel;
let gTab, gDebugger, gPanel;
function test() {
initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => {
initDebugger(TAB_URL).then(([aTab,, aPanel]) => {
gTab = aTab;
gDebuggee = aDebuggee;
gPanel = aPanel;
gDebugger = gPanel.panelWin;
@ -27,12 +26,11 @@ function testTerminate() {
});
});
gDebuggee.debuggerThenThrow();
callInTab(gTab, "debuggerThenThrow");
}
registerCleanupFunction(function() {
gTab = null;
gDebuggee = null;
gPanel = null;
gDebugger = null;
});

View File

@ -90,7 +90,9 @@ def GeckoProgram(name, linkage='standalone', **kwargs):
'''
Program(name)
GeckoBinary(linkage=linkage, mozglue='program', **kwargs)
kwargs.setdefault('mozglue', 'program')
GeckoBinary(linkage=linkage, **kwargs)
@template
@ -103,7 +105,9 @@ def GeckoSimplePrograms(names, **kwargs):
'''
SimplePrograms(names)
GeckoBinary(mozglue='program', **kwargs)
kwargs.setdefault('mozglue', 'program')
GeckoBinary(**kwargs)
@template
@ -116,7 +120,9 @@ def GeckoCppUnitTests(names, **kwargs):
'''
CppUnitTests(names)
GeckoBinary(mozglue='program', **kwargs)
kwargs.setdefault('mozglue', 'program')
GeckoBinary(**kwargs)
@template
@ -128,7 +134,9 @@ def GeckoSharedLibrary(name, **kwargs):
'''
SharedLibrary(name)
GeckoBinary(mozglue='library', **kwargs)
kwargs.setdefault('mozglue', 'library')
GeckoBinary(**kwargs)
@template
@ -140,7 +148,9 @@ def GeckoFramework(name, **kwargs):
'''
Framework(name)
GeckoBinary(mozglue='library', **kwargs)
kwargs.setdefault('mozglue', 'library')
GeckoBinary(**kwargs)
@template

View File

@ -3988,13 +3988,7 @@ MOZ_ARG_WITH_STRING(xulrunner-stub-name,
XULRUNNER_STUB_NAME=$withval)
if test -z "$XULRUNNER_STUB_NAME"; then
case "$target_os" in
darwin*)
XULRUNNER_STUB_NAME=xulrunner
;;
*)
XULRUNNER_STUB_NAME=xulrunner-stub
esac
XULRUNNER_STUB_NAME=xulrunner-stub
fi
AC_SUBST(XULRUNNER_STUB_NAME)

View File

@ -13189,12 +13189,15 @@ nsDocShell::OnLinkClickSync(nsIContent *aContent,
uint32_t flags = INTERNAL_LOAD_FLAGS_NONE;
if (IsElementAnchor(aContent)) {
MOZ_ASSERT(aContent->IsHTML());
if (aContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::rel,
NS_LITERAL_STRING("noreferrer"),
aContent->IsInHTMLDocument() ?
eIgnoreCase : eCaseMatters)) {
nsAutoString referrer;
aContent->GetAttr(kNameSpaceID_None, nsGkAtoms::rel, referrer);
nsWhitespaceTokenizerTemplate<nsContentUtils::IsHTMLWhitespace> tok(referrer);
while (tok.hasMoreTokens()) {
if (tok.nextToken().LowerCaseEqualsLiteral("noreferrer")) {
flags |= INTERNAL_LOAD_FLAGS_DONT_SEND_REFERRER |
INTERNAL_LOAD_FLAGS_NO_OPENER;
break;
}
}
}

View File

@ -1,7 +1,7 @@
<!DOCTYPE html>
<html>
<body onload="window.parent.onloadCount++">
<a href="bug530396-noref.sjs" rel="noreferrer" id="target1">bug530396-noref.sjs</a>
<a href="bug530396-noref.sjs?newwindow" rel="noreferrer" id="target2" target="newwindow">bug530396-noref.sjs with new window</a>
<a href="bug530396-noref.sjs" rel="noreferrer foo" id="target1">bug530396-noref.sjs</a>
<a href="bug530396-noref.sjs?newwindow" rel="nofollow noreferrer" id="target2" target="newwindow">bug530396-noref.sjs with new window</a>
</body>
</html>

View File

@ -3263,7 +3263,7 @@ this.DOMApplicationRegistry = {
// can proceed to access the app. We also throw an error to alert
// the caller that the package wasn't downloaded.
this._sendAppliedEvent(aOldApp);
throw new Error("PACKAGE_UNCHANGED");
throw "PACKAGE_UNCHANGED";
}
let newManifest = yield this._openAndReadPackage(zipFile, aOldApp, aNewApp,
@ -3922,6 +3922,13 @@ this.DOMApplicationRegistry = {
return;
}
// If the error that got us here was that the package hasn't changed,
// since we already sent a success and an applied, let's not confuse
// the clients...
if (aError == "PACKAGE_UNCHANGED") {
return;
}
let download = AppDownloadManager.get(aNewApp.manifestURL);
aOldApp.downloading = false;
@ -3933,7 +3940,9 @@ this.DOMApplicationRegistry = {
: aIsUpdate ? "installed"
: "pending";
if (aOldApp.staged) {
// Erase the .staged properties only if there's no download available
// anymore.
if (!aOldApp.downloadAvailable && aOldApp.staged) {
delete aOldApp.staged;
}

View File

@ -30,6 +30,10 @@ function handleRequest(request, response) {
var alreadyDeferred = Number(getState("alreadyDeferred"));
var role = query.role || "";
var failPackageDownloadOnce = "failPackageDownloadOnce" in query;
var failOnce = "failOnce" in query;
var alreadyFailed = Number(getState("alreadyFailed"));
if (allowCancel && getPackage && !alreadyDeferred) {
// Only do this for the actual package delivery.
response.processAsync();
@ -37,6 +41,15 @@ function handleRequest(request, response) {
setState("alreadyDeferred", "1");
}
if (failOnce && !alreadyFailed) {
setState("alreadyFailed", "1");
// We need to simulate a network error... let's just try closing the connection
// without any output
response.seizePower();
response.finish();
return;
}
response.setHeader("Access-Control-Allow-Origin", "*", false);
// If this is a version update, update state, prepare the manifest,
@ -49,8 +62,9 @@ function handleRequest(request, response) {
setState("packageName", packageName);
var packagePath = "/" + gBasePath + "file_packaged_app.sjs?" +
(allowCancel?"allowCancel&": "") + "getPackage=" +
packageName;
(allowCancel ? "allowCancel&" : "") +
(failPackageDownloadOnce ? "failOnce&" : "") +
"getPackage=" + packageName;
setState("packagePath", packagePath);
if (version == packageVersion) {

View File

@ -57,17 +57,22 @@ var PackagedTestHelper = (function PackagedTestHelper() {
finish();
}
function setAppVersion(aVersion, aCb, aDontUpdatePackage, aAllowCancel, aRole) {
function setAppVersion(aVersion, aCb, aDontUpdatePackage, aAllowCancel, aRole, aFailOnce) {
var xhr = new XMLHttpRequest();
var dontUpdate = "";
var allowCancel = "";
var failOnce = "";
if (aDontUpdatePackage) {
dontUpdate = "&dontUpdatePackage=1";
}
if (aAllowCancel) {
allowCancel= "&allowCancel=1";
}
var url = gSJS + "?setVersion=" + aVersion + dontUpdate + allowCancel;
if (aFailOnce) {
failOnce = "&failPackageDownloadOnce=1";
}
var url = gSJS + "?setVersion=" + aVersion + dontUpdate + allowCancel +
failOnce;
if (aRole) {
url += "&role=" + aRole;
}

View File

@ -72,12 +72,13 @@ function checkLastAppState(aMiniManifestURL, aExpectedReady, aExpectedDownload,
expected, true, false, aCb);
}
function updateApp(aExpectedReady, aPreviousVersion, aNextVersion) {
function updateApp(aExpectedReady, aPreviousVersion, aNextVersion, aFailOnError) {
var lApp = PackagedTestHelper.gApp;
var ondownloadappliedhandler =
checkLastAppState.bind(PackagedTestHelper, miniManifestURL, false, false,
aNextVersion, PackagedTestHelper.next);
aNextVersion,
setTimeout.bind(undefined, PackagedTestHelper.next, 500));
var ondownloadsuccesshandler =
checkLastAppState.bind(undefined, miniManifestURL,
@ -86,8 +87,15 @@ function updateApp(aExpectedReady, aPreviousVersion, aNextVersion) {
navigator.mozApps.mgmt.applyDownload(lApp);
});
var ondownloaderrorhandler = aFailOnError ?
function() {
ok(false, "We should not get an error but got " +
lApp.downloadError.name);
PackagedTestHelper.finish();
} : null;
checkForUpdate(true, ondownloadsuccesshandler, ondownloadappliedhandler,
null, true);
ondownloaderrorhandler, true);
}
@ -238,12 +246,58 @@ var steps = [
},
function() {
info("== TEST == Update packaged app - same package");
updateApp(false, 3, 3);
updateApp(false, 3, 3, true);
},
function() {
info("== TEST == Check for Update after getting the same package");
checkForUpdate(false);
},
function() {
PackagedTestHelper.setAppVersion(5, PackagedTestHelper.next,
/* aDontUpdatePackage */ false,
/* aAllowCancel */ false,
/* aRole */ undefined,
/* aFailOnce */ true);
},
function() {
info("== TEST == Update packaged app - fail the update once");
var downloadSuccess = function() {
ok(false, "We got an unexpected downloadsuccess or downloadapplied");
PackagedTestHelper.finish();
};
var downloadError = function() {
info("We got an expected download error: " +
PackagedTestHelper.gApp.downloadError.name);
PackagedTestHelper.next();
};
checkForUpdate(true, downloadSuccess, downloadSuccess, downloadError,
/* aLaunchDownload */ true);
},
function() {
info("=== TEST == Update packaged app - apply the update after failing");
var lApp = PackagedTestHelper.gApp;
lApp.ondownloadsuccess = function() {
info("Download succeeded, applying it");
navigator.mozApps.mgmt.applyDownload(lApp);
};
lApp.ondownloadapplied = function() {
info("Download successfuly applied");
PackagedTestHelper.next();
};
lApp.ondownloaderror = function() {
ok(false, "Got an unexpected error: " + lApp.downloaderror.name);
PackagedTestHelper.finish();
};
lApp.download();
},
function() {
info("== TEST == Check for Update applying a previously failed package");
checkForUpdate(false);
},
function() {
PackagedTestHelper.setAppVersion(1, PackagedTestHelper.next);
},

View File

@ -7758,6 +7758,13 @@ nsDocument::GetViewportInfo(const ScreenIntSize& aDisplaySize)
CSSToScreenScale defaultScale = layoutDeviceScale
* LayoutDeviceToScreenScale(1.0);
if (!Preferences::GetBool("dom.meta-viewport.enabled", false)) {
return nsViewportInfo(aDisplaySize,
defaultScale,
/*allowZoom*/ false,
/*allowDoubleTapZoom*/ true);
}
// In cases where the width of the CSS viewport is less than or equal to the width
// of the display (i.e. width <= device-width) then we disable double-tap-to-zoom
// behaviour. See bug 941995 for details.

View File

@ -83,6 +83,24 @@ const char * const sSelectPageDownString = "cmd_selectPageDown";
const char * const sSelectTopString = "cmd_selectTop";
const char * const sSelectBottomString = "cmd_selectBottom";
// Physical-direction movement and selection commands
const char * const sMoveLeftString = "cmd_moveLeft";
const char * const sMoveRightString = "cmd_moveRight";
const char * const sMoveUpString = "cmd_moveUp";
const char * const sMoveDownString = "cmd_moveDown";
const char * const sMoveLeft2String = "cmd_moveLeft2";
const char * const sMoveRight2String = "cmd_moveRight2";
const char * const sMoveUp2String = "cmd_moveUp2";
const char * const sMoveDown2String = "cmd_moveDown2";
const char * const sSelectLeftString = "cmd_selectLeft";
const char * const sSelectRightString = "cmd_selectRight";
const char * const sSelectUpString = "cmd_selectUp";
const char * const sSelectDownString = "cmd_selectDown";
const char * const sSelectLeft2String = "cmd_selectLeft2";
const char * const sSelectRight2String = "cmd_selectRight2";
const char * const sSelectUp2String = "cmd_selectUp2";
const char * const sSelectDown2String = "cmd_selectDown2";
#if 0
#pragma mark -
@ -116,6 +134,16 @@ public:
// no member variables, please, we're stateless!
};
// this class implements physical-movement versions of the above
class nsPhysicalSelectMoveScrollCommand : public nsSelectionCommandsBase
{
public:
NS_IMETHOD DoCommand(const char * aCommandName, nsISupports *aCommandContext);
// no member variables, please, we're stateless!
};
// this class implements other selection commands
class nsSelectCommand : public nsSelectionCommandsBase
{
@ -126,6 +154,16 @@ public:
// no member variables, please, we're stateless!
};
// this class implements physical-movement versions of selection commands
class nsPhysicalSelectCommand : public nsSelectionCommandsBase
{
public:
NS_IMETHOD DoCommand(const char * aCommandName, nsISupports *aCommandContext);
// no member variables, please, we're stateless!
};
#if 0
#pragma mark -
#endif
@ -194,6 +232,39 @@ nsSelectionCommandsBase::GetSelectionControllerFromWindow(nsPIDOMWindow *aWindow
#pragma mark -
#endif
// Helpers for nsSelectMoveScrollCommand and nsPhysicalSelectMoveScrollCommand
static void
AdjustFocusAfterCaretMove(nsPIDOMWindow* aWindow)
{
// adjust the focus to the new caret position
nsIFocusManager* fm = nsFocusManager::GetFocusManager();
if (fm) {
nsCOMPtr<nsIDOMElement> result;
fm->MoveFocus(aWindow, nullptr, nsIFocusManager::MOVEFOCUS_CARET,
nsIFocusManager::FLAG_NOSCROLL, getter_AddRefs(result));
}
}
static bool
IsCaretOnInWindow(nsPIDOMWindow* aWindow, nsISelectionController* aSelCont)
{
// We allow the caret to be moved with arrow keys on any window for which
// the caret is enabled. In particular, this includes caret-browsing mode
// in non-chrome documents.
bool caretOn = false;
aSelCont->GetCaretEnabled(&caretOn);
if (!caretOn) {
caretOn = Preferences::GetBool("accessibility.browsewithcaret");
if (caretOn) {
nsCOMPtr<nsIDocShell> docShell = aWindow->GetDocShell();
if (docShell && docShell->ItemType() == nsIDocShellTreeItem::typeChrome) {
caretOn = false;
}
}
}
return caretOn;
}
static const struct BrowseCommand {
const char *reverse, *forward;
nsresult (NS_STDCALL nsISelectionController::*scroll)(bool);
@ -235,85 +306,158 @@ nsSelectMoveScrollCommand::DoCommand(const char *aCommandName, nsISupports *aCom
GetSelectionControllerFromWindow(piWindow, getter_AddRefs(selCont));
NS_ENSURE_TRUE(selCont, NS_ERROR_NOT_INITIALIZED);
// We allow the caret to be moved with arrow keys on any window for which
// the caret is enabled. In particular, this includes caret-browsing mode
// in non-chrome documents.
bool caretOn = false;
selCont->GetCaretEnabled(&caretOn);
if (!caretOn) {
caretOn = Preferences::GetBool("accessibility.browsewithcaret");
if (caretOn) {
nsCOMPtr<nsIDocShell> docShell = piWindow->GetDocShell();
if (docShell && docShell->ItemType() == nsIDocShellTreeItem::typeChrome) {
caretOn = false;
}
}
}
bool caretOn = IsCaretOnInWindow(piWindow, selCont);
for (size_t i = 0; i < ArrayLength(browseCommands); i++) {
bool forward = !strcmp(aCommandName, browseCommands[i].forward);
if (forward || !strcmp(aCommandName, browseCommands[i].reverse)) {
if (caretOn && browseCommands[i].move &&
NS_SUCCEEDED((selCont->*(browseCommands[i].move))(forward, false))) {
// adjust the focus to the new caret position
nsIFocusManager* fm = nsFocusManager::GetFocusManager();
if (fm) {
nsCOMPtr<nsIDOMElement> result;
fm->MoveFocus(piWindow, nullptr, nsIFocusManager::MOVEFOCUS_CARET,
nsIFocusManager::FLAG_NOSCROLL,
getter_AddRefs(result));
}
AdjustFocusAfterCaretMove(piWindow);
return NS_OK;
}
return (selCont->*(browseCommands[i].scroll))(forward);
}
}
return NS_ERROR_NOT_IMPLEMENTED;
}
#if 0
#pragma mark -
#endif
// XXX It's not clear to me yet how we should handle the "scroll" option
// for these commands; for now, I'm mapping them back to ScrollCharacter,
// ScrollLine, etc., as if for horizontal-mode content, but this may need
// to be reconsidered once we have more experience with vertical content.
static const struct PhysicalBrowseCommand {
const char *command;
int16_t direction, amount;
nsresult (NS_STDCALL nsISelectionController::*scroll)(bool);
} physicalBrowseCommands[] = {
{ sMoveLeftString, nsISelectionController::MOVE_LEFT, 0,
&nsISelectionController::ScrollCharacter },
{ sMoveRightString, nsISelectionController::MOVE_RIGHT, 0,
&nsISelectionController::ScrollCharacter },
{ sMoveUpString, nsISelectionController::MOVE_UP, 0,
&nsISelectionController::ScrollLine },
{ sMoveDownString, nsISelectionController::MOVE_DOWN, 0,
&nsISelectionController::ScrollLine },
{ sMoveLeft2String, nsISelectionController::MOVE_LEFT, 1,
&nsISelectionController::ScrollCharacter },
{ sMoveRight2String, nsISelectionController::MOVE_RIGHT, 1,
&nsISelectionController::ScrollCharacter },
{ sMoveUp2String, nsISelectionController::MOVE_UP, 1,
&nsISelectionController::CompleteScroll },
{ sMoveDown2String, nsISelectionController::MOVE_DOWN, 1,
&nsISelectionController::CompleteScroll },
};
nsresult
nsSelectCommand::DoCommand(const char *aCommandName, nsISupports *aCommandContext)
nsPhysicalSelectMoveScrollCommand::DoCommand(const char *aCommandName,
nsISupports *aCommandContext)
{
nsCOMPtr<nsPIDOMWindow> piWindow(do_QueryInterface(aCommandContext));
nsCOMPtr<nsISelectionController> selCont;
GetSelectionControllerFromWindow(piWindow, getter_AddRefs(selCont));
NS_ENSURE_TRUE(selCont, NS_ERROR_NOT_INITIALIZED);
nsresult rv = NS_ERROR_NOT_IMPLEMENTED;
bool caretOn = IsCaretOnInWindow(piWindow, selCont);
for (size_t i = 0; i < ArrayLength(physicalBrowseCommands); i++) {
const PhysicalBrowseCommand& cmd = physicalBrowseCommands[i];
if (!strcmp(aCommandName, cmd.command)) {
int16_t dir = cmd.direction;
if (caretOn &&
NS_SUCCEEDED(selCont->PhysicalMove(dir, cmd.amount, false))) {
AdjustFocusAfterCaretMove(piWindow);
return NS_OK;
}
bool forward = (dir == nsISelectionController::MOVE_RIGHT ||
dir == nsISelectionController::MOVE_DOWN);
return (selCont->*(cmd.scroll))(forward);
}
}
return NS_ERROR_NOT_IMPLEMENTED;
}
#if 0
#pragma mark -
#endif
static const struct SelectCommand {
const char *reverse, *forward;
nsresult (NS_STDCALL nsISelectionController::*select)(bool, bool);
} selectCommands[] = {
{ sSelectCharPreviousString, sSelectCharNextString,
&nsISelectionController::CharacterMove },
{ sSelectWordPreviousString, sSelectWordNextString,
&nsISelectionController::WordMove },
{ sSelectBeginLineString, sSelectEndLineString,
&nsISelectionController::IntraLineMove },
{ sSelectLinePreviousString, sSelectLineNextString,
&nsISelectionController::LineMove },
{ sSelectPageUpString, sSelectPageDownString,
&nsISelectionController::PageMove },
{ sSelectTopString, sSelectBottomString,
&nsISelectionController::CompleteMove }
};
nsresult
nsSelectCommand::DoCommand(const char *aCommandName,
nsISupports *aCommandContext)
{
nsCOMPtr<nsPIDOMWindow> piWindow(do_QueryInterface(aCommandContext));
nsCOMPtr<nsISelectionController> selCont;
GetSelectionControllerFromWindow(piWindow, getter_AddRefs(selCont));
NS_ENSURE_TRUE(selCont, NS_ERROR_NOT_INITIALIZED);
// These commands are so the browser can use caret navigation key bindings -
// Helps with accessibility - aaronl@netscape.com
if (!nsCRT::strcmp(aCommandName, sSelectCharPreviousString))
rv = selCont->CharacterMove(false, true);
else if (!nsCRT::strcmp(aCommandName, sSelectCharNextString))
rv = selCont->CharacterMove(true, true);
else if (!nsCRT::strcmp(aCommandName, sSelectWordPreviousString))
rv = selCont->WordMove(false, true);
else if (!nsCRT::strcmp(aCommandName, sSelectWordNextString))
rv = selCont->WordMove(true, true);
else if (!nsCRT::strcmp(aCommandName, sSelectBeginLineString))
rv = selCont->IntraLineMove(false, true);
else if (!nsCRT::strcmp(aCommandName, sSelectEndLineString))
rv = selCont->IntraLineMove(true, true);
else if (!nsCRT::strcmp(aCommandName, sSelectLinePreviousString))
rv = selCont->LineMove(false, true);
else if (!nsCRT::strcmp(aCommandName, sSelectLineNextString))
rv = selCont->LineMove(true, true);
else if (!nsCRT::strcmp(aCommandName, sSelectPageUpString))
rv = selCont->PageMove(false, true);
else if (!nsCRT::strcmp(aCommandName, sSelectPageDownString))
rv = selCont->PageMove(true, true);
else if (!nsCRT::strcmp(aCommandName, sSelectTopString))
rv = selCont->CompleteMove(false, true);
else if (!nsCRT::strcmp(aCommandName, sSelectBottomString))
rv = selCont->CompleteMove(true, true);
for (size_t i = 0; i < ArrayLength(selectCommands); i++) {
bool forward = !strcmp(aCommandName, selectCommands[i].forward);
if (forward || !strcmp(aCommandName, selectCommands[i].reverse)) {
return (selCont->*(selectCommands[i].select))(forward, true);
}
}
return NS_ERROR_NOT_IMPLEMENTED;
}
return rv;
#if 0
#pragma mark -
#endif
static const struct PhysicalSelectCommand {
const char *command;
int16_t direction, amount;
} physicalSelectCommands[] = {
{ sSelectLeftString, nsISelectionController::MOVE_LEFT, 0 },
{ sSelectRightString, nsISelectionController::MOVE_RIGHT, 0 },
{ sSelectUpString, nsISelectionController::MOVE_UP, 0 },
{ sSelectDownString, nsISelectionController::MOVE_DOWN, 0 },
{ sSelectLeft2String, nsISelectionController::MOVE_LEFT, 1 },
{ sSelectRight2String, nsISelectionController::MOVE_RIGHT, 1 },
{ sSelectUp2String, nsISelectionController::MOVE_UP, 1 },
{ sSelectDown2String, nsISelectionController::MOVE_DOWN, 1 }
};
nsresult
nsPhysicalSelectCommand::DoCommand(const char *aCommandName,
nsISupports *aCommandContext)
{
nsCOMPtr<nsPIDOMWindow> piWindow(do_QueryInterface(aCommandContext));
nsCOMPtr<nsISelectionController> selCont;
GetSelectionControllerFromWindow(piWindow, getter_AddRefs(selCont));
NS_ENSURE_TRUE(selCont, NS_ERROR_NOT_INITIALIZED);
for (size_t i = 0; i < ArrayLength(physicalSelectCommands); i++) {
if (!strcmp(aCommandName, physicalSelectCommands[i].command)) {
return selCont->PhysicalMove(physicalSelectCommands[i].direction,
physicalSelectCommands[i].amount,
true);
}
}
return NS_ERROR_NOT_IMPLEMENTED;
}
#if 0
@ -868,6 +1012,15 @@ nsWindowCommandRegistration::RegisterWindowCommands(
NS_REGISTER_NEXT_COMMAND(nsSelectMoveScrollCommand, sCharPreviousString);
NS_REGISTER_LAST_COMMAND(nsSelectMoveScrollCommand, sCharNextString);
NS_REGISTER_FIRST_COMMAND(nsPhysicalSelectMoveScrollCommand, sMoveLeftString);
NS_REGISTER_NEXT_COMMAND(nsPhysicalSelectMoveScrollCommand, sMoveRightString);
NS_REGISTER_NEXT_COMMAND(nsPhysicalSelectMoveScrollCommand, sMoveUpString);
NS_REGISTER_NEXT_COMMAND(nsPhysicalSelectMoveScrollCommand, sMoveDownString);
NS_REGISTER_NEXT_COMMAND(nsPhysicalSelectMoveScrollCommand, sMoveLeft2String);
NS_REGISTER_NEXT_COMMAND(nsPhysicalSelectMoveScrollCommand, sMoveRight2String);
NS_REGISTER_NEXT_COMMAND(nsPhysicalSelectMoveScrollCommand, sMoveUp2String);
NS_REGISTER_LAST_COMMAND(nsPhysicalSelectMoveScrollCommand, sMoveDown2String);
NS_REGISTER_FIRST_COMMAND(nsSelectCommand, sSelectCharPreviousString);
NS_REGISTER_NEXT_COMMAND(nsSelectCommand, sSelectCharNextString);
NS_REGISTER_NEXT_COMMAND(nsSelectCommand, sSelectWordPreviousString);
@ -881,6 +1034,15 @@ nsWindowCommandRegistration::RegisterWindowCommands(
NS_REGISTER_NEXT_COMMAND(nsSelectCommand, sSelectTopString);
NS_REGISTER_LAST_COMMAND(nsSelectCommand, sSelectBottomString);
NS_REGISTER_FIRST_COMMAND(nsPhysicalSelectCommand, sSelectLeftString);
NS_REGISTER_NEXT_COMMAND(nsPhysicalSelectCommand, sSelectRightString);
NS_REGISTER_NEXT_COMMAND(nsPhysicalSelectCommand, sSelectUpString);
NS_REGISTER_NEXT_COMMAND(nsPhysicalSelectCommand, sSelectDownString);
NS_REGISTER_NEXT_COMMAND(nsPhysicalSelectCommand, sSelectLeft2String);
NS_REGISTER_NEXT_COMMAND(nsPhysicalSelectCommand, sSelectRight2String);
NS_REGISTER_NEXT_COMMAND(nsPhysicalSelectCommand, sSelectUp2String);
NS_REGISTER_LAST_COMMAND(nsPhysicalSelectCommand, sSelectDown2String);
NS_REGISTER_ONE_COMMAND(nsClipboardCommand, "cmd_cut");
NS_REGISTER_ONE_COMMAND(nsClipboardCommand, "cmd_copy");
NS_REGISTER_ONE_COMMAND(nsClipboardCommand, "cmd_paste");

View File

@ -16,7 +16,7 @@ interface nsIDOMNode;
interface nsISelection;
interface nsISelectionDisplay;
[scriptable, uuid(b1ff7faa-8097-431d-b7f1-b0615e3cd596)]
[scriptable, uuid(7835DE46-DB36-4BB7-8684-1049A0C13049)]
interface nsISelectionController : nsISelectionDisplay
{
const short SELECTION_NONE=0;
@ -143,6 +143,26 @@ interface nsISelectionController : nsISelectionDisplay
*/
void characterMove(in boolean forward, in boolean extend);
/** PhysicalMove will move the selection one "unit" in a given direction
* within the document.
* this will also have the effect of collapsing the selection if the aExtend = PR_FALSE
* the "point" of selection that is extended is considered the "focus" point.
* or the last point adjusted by the selection.
* @param aDirection
* @param aAmount character/line; word/lineBoundary
* @param aExtend should it collapse the selection of extend it?
*/
void physicalMove(in short direction, in short amount, in boolean extend);
/**
* nsFrameSelection::PhysicalMove depends on the ordering of these values;
* do not change without checking there!
*/
const short MOVE_LEFT = 0;
const short MOVE_RIGHT = 1;
const short MOVE_UP = 2;
const short MOVE_DOWN = 3;
/**
* CharacterExtendForDelete will extend the selection one character cell
* forward in the document.

View File

@ -17,6 +17,7 @@ var is_remote;
}
compartment_test();
regexp_test();
postmessage_test();
sync_test();
async_test();
rpc_test();
@ -179,6 +180,11 @@ function regexp_test()
sendSyncMessage("cpows:regexp_test", {}, { regexp: /myRegExp/g });
}
function postmessage_test()
{
sendSyncMessage("cpows:postmessage_test", {}, { win: content.window });
}
function sync_test()
{
dump('beginning cpow sync test\n');

View File

@ -270,6 +270,12 @@
is(regexp.toString(), shell.toString(), ".compile works right");
}
function recvPostMessageTest(message) {
let win = message.objects.win;
win.postMessage('nookery', '*');
ok(true, "Didn't crash invoking postMessage over CPOW");
}
let savedWilldieObj;
let wontDie = {f:2, __exposedProps__: {"f": "r"}};
function recvLifetimeTest1(message) {
@ -327,6 +333,7 @@
}
mm.addMessageListener("cpows:compartment_test", recvCompartmentTest);
mm.addMessageListener("cpows:regexp_test", recvRegExpTest);
mm.addMessageListener("cpows:postmessage_test", recvPostMessageTest);
mm.addMessageListener("cpows:lifetime_test_1", recvLifetimeTest1);
mm.addMessageListener("cpows:lifetime_test_2", recvLifetimeTest2);
mm.loadFrameScript("chrome://mochitests/content/chrome/dom/base/test/chrome/cpows_child.js", true);

View File

@ -684,12 +684,19 @@ skip-if = buildapp == 'b2g' || toolkit == 'android' || e10s #bug 775227
[test_ipc_messagemanager_blob.html]
skip-if = (toolkit == 'android' && processor == 'x86') #x86 only bug 936226
[test_meta_viewport0.html]
skip-if = buildapp != 'b2g' # meta-viewport tag support is only on b2g
[test_meta_viewport1.html]
skip-if = buildapp != 'b2g' # meta-viewport tag support is only on b2g
[test_meta_viewport2.html]
skip-if = buildapp != 'b2g' # meta-viewport tag support is only on b2g
[test_meta_viewport3.html]
skip-if = buildapp != 'b2g' # meta-viewport tag support is only on b2g
[test_meta_viewport4.html]
skip-if = buildapp != 'b2g' # meta-viewport tag support is only on b2g
[test_meta_viewport5.html]
skip-if = buildapp != 'b2g' # meta-viewport tag support is only on b2g
[test_meta_viewport6.html]
skip-if = buildapp != 'b2g' # meta-viewport tag support is only on b2g
[test_mozfiledataurl.html]
skip-if = buildapp == 'mulet' || buildapp == 'b2g' || toolkit == 'android' || e10s #TIMED_OUT
[test_mozMatchesSelector.html]

View File

@ -44,8 +44,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=882653
[ 'document.createTreeWalker(document, 0xFFFFFFFF, { acceptNode: 5 }).nextNode()',
"Property 'acceptNode' is not callable.",
"non-callable callback interface operation property" ],
[ '(new TextEncoder).encode("", new RegExp())',
"Argument 2 of TextEncoder.encode can't be converted to a dictionary.",
[ '(new TextDecoder).decode(new Uint8Array(), new RegExp())',
"Argument 2 of TextDecoder.decode can't be converted to a dictionary.",
"regexp passed for a dictionary" ],
[ 'URL.createObjectURL(null, null)',
"Argument 1 is not valid for any of the 2-argument overloads of URL.createObjectURL.",

View File

@ -73,15 +73,12 @@ WebGL2Context::ValidateSizedInternalFormat(GLenum internalformat, const char* in
return true;
}
if (IsCompressedTextureFormat(internalformat)) {
if (IsCompressedTextureFormat(internalformat))
return true;
}
const char* name = EnumName(internalformat);
if (name && name[0] != '[')
ErrorInvalidEnum("%s: invalid internal format %s", info, name);
else
ErrorInvalidEnum("%s: invalid internal format 0x%04X", info, internalformat);
nsCString name;
EnumName(internalformat, &name);
ErrorInvalidEnum("%s: invalid internal format %s", info, name.get());
return false;
}

View File

@ -242,7 +242,11 @@ public:
* This version is like gl::GLenumToStr but with out the GL_ prefix to
* keep consistency with how errors are reported from WebGL.
*/
static const char *EnumName(GLenum glenum);
// Returns nullptr if glenum is unknown.
static const char* EnumName(GLenum glenum);
// Returns hex formatted version of glenum if glenum is unknown.
static void EnumName(GLenum glenum, nsACString* out_name);
bool IsCompressedTextureFormat(GLenum format);
bool IsTextureFormatCompressed(TexInternalFormat format);

View File

@ -1444,24 +1444,31 @@ WebGLContext::GetProgramParameter(WebGLProgram *prog, GLenum pname)
MakeContextCurrent();
GLint i = 0;
if (IsWebGL2()) {
switch (pname) {
case LOCAL_GL_ACTIVE_UNIFORM_BLOCKS:
case LOCAL_GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH:
gl->fGetProgramiv(progname, pname, &i);
return JS::Int32Value(i);
}
}
switch (pname) {
case LOCAL_GL_ATTACHED_SHADERS:
case LOCAL_GL_ACTIVE_UNIFORMS:
case LOCAL_GL_ACTIVE_ATTRIBUTES:
{
GLint i = 0;
gl->fGetProgramiv(progname, pname, &i);
return JS::Int32Value(i);
}
case LOCAL_GL_DELETE_STATUS:
return JS::BooleanValue(prog->IsDeleteRequested());
case LOCAL_GL_LINK_STATUS:
{
return JS::BooleanValue(prog->LinkStatus());
}
case LOCAL_GL_VALIDATE_STATUS:
{
GLint i = 0;
#ifdef XP_MACOSX
// See comment in ValidateProgram below.
if (gl->WorkAroundDriverBugs())
@ -1472,8 +1479,6 @@ WebGLContext::GetProgramParameter(WebGLProgram *prog, GLenum pname)
gl->fGetProgramiv(progname, pname, &i);
#endif
return JS::BooleanValue(bool(i));
}
break;
default:
ErrorInvalidEnumInfo("getProgramParameter: parameter", pname);

View File

@ -14,6 +14,7 @@
#include "nsIDOMEvent.h"
#include "nsIScriptSecurityManager.h"
#include "nsIVariant.h"
#include "nsPrintfCString.h"
#include "nsServiceManagerUtils.h"
#include "prprf.h"
#include "WebGLBuffer.h"
@ -505,7 +506,10 @@ WebGLContext::ErrorInvalidEnum(const char *fmt, ...)
void
WebGLContext::ErrorInvalidEnumInfo(const char *info, GLenum enumvalue)
{
return ErrorInvalidEnum("%s: invalid enum value 0x%x", info, enumvalue);
nsCString name;
EnumName(enumvalue, &name);
return ErrorInvalidEnum("%s: invalid enum value %s", info, name.get());
}
void
@ -574,6 +578,7 @@ WebGLContext::ErrorName(GLenum error)
}
}
// This version is 'fallible' and will return NULL if glenum is not recognized.
const char*
WebGLContext::EnumName(GLenum glenum)
{
@ -625,10 +630,289 @@ WebGLContext::EnumName(GLenum glenum)
XX(UNSIGNED_SHORT_4_4_4_4);
XX(UNSIGNED_SHORT_5_5_5_1);
XX(UNSIGNED_SHORT_5_6_5);
XX(READ_BUFFER);
XX(UNPACK_ROW_LENGTH);
XX(UNPACK_SKIP_ROWS);
XX(UNPACK_SKIP_PIXELS);
XX(PACK_ROW_LENGTH);
XX(PACK_SKIP_ROWS);
XX(PACK_SKIP_PIXELS);
XX(COLOR);
XX(DEPTH);
XX(STENCIL);
XX(RED);
XX(RGB8);
XX(RGBA8);
XX(RGB10_A2);
XX(TEXTURE_BINDING_3D);
XX(UNPACK_SKIP_IMAGES);
XX(UNPACK_IMAGE_HEIGHT);
XX(TEXTURE_WRAP_R);
XX(MAX_3D_TEXTURE_SIZE);
XX(UNSIGNED_INT_2_10_10_10_REV);
XX(MAX_ELEMENTS_VERTICES);
XX(MAX_ELEMENTS_INDICES);
XX(TEXTURE_MIN_LOD);
XX(TEXTURE_MAX_LOD);
XX(TEXTURE_BASE_LEVEL);
XX(TEXTURE_MAX_LEVEL);
XX(MIN);
XX(MAX);
XX(DEPTH_COMPONENT24);
XX(MAX_TEXTURE_LOD_BIAS);
XX(TEXTURE_COMPARE_MODE);
XX(TEXTURE_COMPARE_FUNC);
XX(CURRENT_QUERY);
XX(QUERY_RESULT);
XX(QUERY_RESULT_AVAILABLE);
XX(STREAM_READ);
XX(STREAM_COPY);
XX(STATIC_READ);
XX(STATIC_COPY);
XX(DYNAMIC_READ);
XX(DYNAMIC_COPY);
XX(MAX_DRAW_BUFFERS);
XX(DRAW_BUFFER0);
XX(DRAW_BUFFER1);
XX(DRAW_BUFFER2);
XX(DRAW_BUFFER3);
XX(DRAW_BUFFER4);
XX(DRAW_BUFFER5);
XX(DRAW_BUFFER6);
XX(DRAW_BUFFER7);
XX(DRAW_BUFFER8);
XX(DRAW_BUFFER9);
XX(DRAW_BUFFER10);
XX(DRAW_BUFFER11);
XX(DRAW_BUFFER12);
XX(DRAW_BUFFER13);
XX(DRAW_BUFFER14);
XX(DRAW_BUFFER15);
XX(MAX_FRAGMENT_UNIFORM_COMPONENTS);
XX(MAX_VERTEX_UNIFORM_COMPONENTS);
XX(SAMPLER_3D);
XX(SAMPLER_2D_SHADOW);
XX(FRAGMENT_SHADER_DERIVATIVE_HINT);
XX(PIXEL_PACK_BUFFER);
XX(PIXEL_UNPACK_BUFFER);
XX(PIXEL_PACK_BUFFER_BINDING);
XX(PIXEL_UNPACK_BUFFER_BINDING);
XX(FLOAT_MAT2x3);
XX(FLOAT_MAT2x4);
XX(FLOAT_MAT3x2);
XX(FLOAT_MAT3x4);
XX(FLOAT_MAT4x2);
XX(FLOAT_MAT4x3);
XX(SRGB8);
XX(SRGB8_ALPHA8);
XX(COMPARE_REF_TO_TEXTURE);
XX(VERTEX_ATTRIB_ARRAY_INTEGER);
XX(MAX_ARRAY_TEXTURE_LAYERS);
XX(MIN_PROGRAM_TEXEL_OFFSET);
XX(MAX_PROGRAM_TEXEL_OFFSET);
XX(MAX_VARYING_COMPONENTS);
XX(TEXTURE_2D_ARRAY);
XX(TEXTURE_BINDING_2D_ARRAY);
XX(R11F_G11F_B10F);
XX(UNSIGNED_INT_10F_11F_11F_REV);
XX(RGB9_E5);
XX(UNSIGNED_INT_5_9_9_9_REV);
XX(TRANSFORM_FEEDBACK_BUFFER_MODE);
XX(MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS);
XX(TRANSFORM_FEEDBACK_VARYINGS);
XX(TRANSFORM_FEEDBACK_BUFFER_START);
XX(TRANSFORM_FEEDBACK_BUFFER_SIZE);
XX(TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN);
XX(RASTERIZER_DISCARD);
XX(MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS);
XX(MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS);
XX(INTERLEAVED_ATTRIBS);
XX(SEPARATE_ATTRIBS);
XX(TRANSFORM_FEEDBACK_BUFFER);
XX(TRANSFORM_FEEDBACK_BUFFER_BINDING);
XX(RGBA32UI);
XX(RGB32UI);
XX(RGBA16UI);
XX(RGB16UI);
XX(RGBA8UI);
XX(RGB8UI);
XX(RGBA32I);
XX(RGB32I);
XX(RGBA16I);
XX(RGB16I);
XX(RGBA8I);
XX(RGB8I);
XX(RED_INTEGER);
XX(RGB_INTEGER);
XX(RGBA_INTEGER);
XX(SAMPLER_2D_ARRAY);
XX(SAMPLER_2D_ARRAY_SHADOW);
XX(SAMPLER_CUBE_SHADOW);
XX(UNSIGNED_INT_VEC2);
XX(UNSIGNED_INT_VEC3);
XX(UNSIGNED_INT_VEC4);
XX(INT_SAMPLER_2D);
XX(INT_SAMPLER_3D);
XX(INT_SAMPLER_CUBE);
XX(INT_SAMPLER_2D_ARRAY);
XX(UNSIGNED_INT_SAMPLER_2D);
XX(UNSIGNED_INT_SAMPLER_3D);
XX(UNSIGNED_INT_SAMPLER_CUBE);
XX(UNSIGNED_INT_SAMPLER_2D_ARRAY);
XX(DEPTH_COMPONENT32F);
XX(DEPTH32F_STENCIL8);
XX(FLOAT_32_UNSIGNED_INT_24_8_REV);
XX(FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING);
XX(FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE);
XX(FRAMEBUFFER_ATTACHMENT_RED_SIZE);
XX(FRAMEBUFFER_ATTACHMENT_GREEN_SIZE);
XX(FRAMEBUFFER_ATTACHMENT_BLUE_SIZE);
XX(FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE);
XX(FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE);
XX(FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE);
XX(FRAMEBUFFER_DEFAULT);
XX(DEPTH_STENCIL_ATTACHMENT);
XX(UNSIGNED_NORMALIZED);
XX(DRAW_FRAMEBUFFER_BINDING);
XX(READ_FRAMEBUFFER);
XX(DRAW_FRAMEBUFFER);
XX(READ_FRAMEBUFFER_BINDING);
XX(RENDERBUFFER_SAMPLES);
XX(FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER);
XX(MAX_COLOR_ATTACHMENTS);
XX(COLOR_ATTACHMENT1);
XX(COLOR_ATTACHMENT2);
XX(COLOR_ATTACHMENT3);
XX(COLOR_ATTACHMENT4);
XX(COLOR_ATTACHMENT5);
XX(COLOR_ATTACHMENT6);
XX(COLOR_ATTACHMENT7);
XX(COLOR_ATTACHMENT8);
XX(COLOR_ATTACHMENT9);
XX(COLOR_ATTACHMENT10);
XX(COLOR_ATTACHMENT11);
XX(COLOR_ATTACHMENT12);
XX(COLOR_ATTACHMENT13);
XX(COLOR_ATTACHMENT14);
XX(COLOR_ATTACHMENT15);
XX(FRAMEBUFFER_INCOMPLETE_MULTISAMPLE);
XX(MAX_SAMPLES);
XX(RG);
XX(RG_INTEGER);
XX(R8);
XX(RG8);
XX(R16F);
XX(R32F);
XX(RG16F);
XX(RG32F);
XX(R8I);
XX(R8UI);
XX(R16I);
XX(R16UI);
XX(R32I);
XX(R32UI);
XX(RG8I);
XX(RG8UI);
XX(RG16I);
XX(RG16UI);
XX(RG32I);
XX(RG32UI);
XX(VERTEX_ARRAY_BINDING);
XX(R8_SNORM);
XX(RG8_SNORM);
XX(RGB8_SNORM);
XX(RGBA8_SNORM);
XX(SIGNED_NORMALIZED);
XX(PRIMITIVE_RESTART_FIXED_INDEX);
XX(COPY_READ_BUFFER);
XX(COPY_WRITE_BUFFER);
XX(UNIFORM_BUFFER);
XX(UNIFORM_BUFFER_BINDING);
XX(UNIFORM_BUFFER_START);
XX(UNIFORM_BUFFER_SIZE);
XX(MAX_VERTEX_UNIFORM_BLOCKS);
XX(MAX_FRAGMENT_UNIFORM_BLOCKS);
XX(MAX_COMBINED_UNIFORM_BLOCKS);
XX(MAX_UNIFORM_BUFFER_BINDINGS);
XX(MAX_UNIFORM_BLOCK_SIZE);
XX(MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS);
XX(MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS);
XX(UNIFORM_BUFFER_OFFSET_ALIGNMENT);
XX(ACTIVE_UNIFORM_BLOCKS);
XX(UNIFORM_TYPE);
XX(UNIFORM_SIZE);
XX(UNIFORM_BLOCK_INDEX);
XX(UNIFORM_OFFSET);
XX(UNIFORM_ARRAY_STRIDE);
XX(UNIFORM_MATRIX_STRIDE);
XX(UNIFORM_IS_ROW_MAJOR);
XX(UNIFORM_BLOCK_BINDING);
XX(UNIFORM_BLOCK_DATA_SIZE);
XX(UNIFORM_BLOCK_ACTIVE_UNIFORMS);
XX(UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES);
XX(UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER);
XX(UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER);
XX(MAX_VERTEX_OUTPUT_COMPONENTS);
XX(MAX_FRAGMENT_INPUT_COMPONENTS);
XX(MAX_SERVER_WAIT_TIMEOUT);
XX(OBJECT_TYPE);
XX(SYNC_CONDITION);
XX(SYNC_STATUS);
XX(SYNC_FLAGS);
XX(SYNC_FENCE);
XX(SYNC_GPU_COMMANDS_COMPLETE);
XX(UNSIGNALED);
XX(SIGNALED);
XX(ALREADY_SIGNALED);
XX(TIMEOUT_EXPIRED);
XX(CONDITION_SATISFIED);
XX(WAIT_FAILED);
XX(VERTEX_ATTRIB_ARRAY_DIVISOR);
XX(ANY_SAMPLES_PASSED);
XX(ANY_SAMPLES_PASSED_CONSERVATIVE);
XX(SAMPLER_BINDING);
XX(RGB10_A2UI);
XX(TEXTURE_SWIZZLE_R);
XX(TEXTURE_SWIZZLE_G);
XX(TEXTURE_SWIZZLE_B);
XX(TEXTURE_SWIZZLE_A);
XX(GREEN);
XX(BLUE);
XX(INT_2_10_10_10_REV);
XX(TRANSFORM_FEEDBACK);
XX(TRANSFORM_FEEDBACK_PAUSED);
XX(TRANSFORM_FEEDBACK_ACTIVE);
XX(TRANSFORM_FEEDBACK_BINDING);
XX(COMPRESSED_R11_EAC);
XX(COMPRESSED_SIGNED_R11_EAC);
XX(COMPRESSED_RG11_EAC);
XX(COMPRESSED_SIGNED_RG11_EAC);
XX(COMPRESSED_RGB8_ETC2);
XX(COMPRESSED_SRGB8_ETC2);
XX(COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2);
XX(COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2);
XX(COMPRESSED_RGBA8_ETC2_EAC);
XX(COMPRESSED_SRGB8_ALPHA8_ETC2_EAC);
XX(TEXTURE_IMMUTABLE_FORMAT);
XX(MAX_ELEMENT_INDEX);
XX(NUM_SAMPLE_COUNTS);
XX(TEXTURE_IMMUTABLE_LEVELS);
#undef XX
}
return "[Unknown enum name]";
return nullptr;
}
void
WebGLContext::EnumName(GLenum glenum, nsACString* out_name)
{
const char* name = EnumName(glenum);
if (name) {
*out_name = nsDependentCString(name);
} else {
nsPrintfCString enumAsHex("<enum 0x%04x>", glenum);
*out_name = enumAsHex;
}
}
bool

View File

@ -21,27 +21,53 @@ struct WebGLUniformInfo {
int ElementSize() const {
switch (type) {
case LOCAL_GL_INT:
case LOCAL_GL_FLOAT:
case LOCAL_GL_INT:
case LOCAL_GL_UNSIGNED_INT:
case LOCAL_GL_BOOL:
case LOCAL_GL_SAMPLER_2D:
case LOCAL_GL_SAMPLER_3D:
case LOCAL_GL_SAMPLER_CUBE:
case LOCAL_GL_SAMPLER_2D_SHADOW:
case LOCAL_GL_SAMPLER_2D_ARRAY:
case LOCAL_GL_SAMPLER_2D_ARRAY_SHADOW:
case LOCAL_GL_SAMPLER_CUBE_SHADOW:
case LOCAL_GL_INT_SAMPLER_2D:
case LOCAL_GL_INT_SAMPLER_3D:
case LOCAL_GL_INT_SAMPLER_CUBE:
case LOCAL_GL_INT_SAMPLER_2D_ARRAY:
case LOCAL_GL_UNSIGNED_INT_SAMPLER_2D:
case LOCAL_GL_UNSIGNED_INT_SAMPLER_3D:
case LOCAL_GL_UNSIGNED_INT_SAMPLER_CUBE:
case LOCAL_GL_UNSIGNED_INT_SAMPLER_2D_ARRAY:
return 1;
case LOCAL_GL_INT_VEC2:
case LOCAL_GL_FLOAT_VEC2:
case LOCAL_GL_INT_VEC2:
case LOCAL_GL_UNSIGNED_INT_VEC2:
case LOCAL_GL_BOOL_VEC2:
return 2;
case LOCAL_GL_INT_VEC3:
case LOCAL_GL_FLOAT_VEC3:
case LOCAL_GL_INT_VEC3:
case LOCAL_GL_UNSIGNED_INT_VEC3:
case LOCAL_GL_BOOL_VEC3:
return 3;
case LOCAL_GL_INT_VEC4:
case LOCAL_GL_FLOAT_VEC4:
case LOCAL_GL_INT_VEC4:
case LOCAL_GL_UNSIGNED_INT_VEC4:
case LOCAL_GL_BOOL_VEC4:
case LOCAL_GL_FLOAT_MAT2:
return 4;
case LOCAL_GL_FLOAT_MAT2x3:
case LOCAL_GL_FLOAT_MAT3x2:
return 6;
case LOCAL_GL_FLOAT_MAT2x4:
case LOCAL_GL_FLOAT_MAT4x2:
return 8;
case LOCAL_GL_FLOAT_MAT3:
return 9;
case LOCAL_GL_FLOAT_MAT3x4:
case LOCAL_GL_FLOAT_MAT4x3:
return 12;
case LOCAL_GL_FLOAT_MAT4:
return 16;
default:

View File

@ -0,0 +1,5 @@
<script>
var canvas = document.createElement("canvas");
var context = canvas.getContext("2d");
context.fillText("", 0, 0);
</script>

View File

@ -21,3 +21,4 @@ load 896047-1.html
load 896047-2.html
load 916128-1.html
load 934939-1.html
load 1099143-1.html

View File

@ -1,10 +1,13 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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 "mozilla/dom/TextDecoder.h"
#include "mozilla/dom/EncodingUtils.h"
#include "mozilla/dom/UnionTypes.h"
#include "nsContentUtils.h"
#include <stdint.h>
namespace mozilla {
namespace dom {
@ -93,6 +96,40 @@ TextDecoder::Decode(const char* aInput, const int32_t aLength,
}
}
void
TextDecoder::Decode(const Optional<ArrayBufferViewOrArrayBuffer>& aBuffer,
const TextDecodeOptions& aOptions,
nsAString& aOutDecodedString,
ErrorResult& aRv)
{
if (!aBuffer.WasPassed()) {
Decode(nullptr, 0, aOptions.mStream, aOutDecodedString, aRv);
return;
}
const ArrayBufferViewOrArrayBuffer& buf = aBuffer.Value();
uint8_t* data;
uint32_t length;
if (buf.IsArrayBufferView()) {
buf.GetAsArrayBufferView().ComputeLengthAndData();
data = buf.GetAsArrayBufferView().Data();
length = buf.GetAsArrayBufferView().Length();
} else {
MOZ_ASSERT(buf.IsArrayBuffer());
buf.GetAsArrayBuffer().ComputeLengthAndData();
data = buf.GetAsArrayBuffer().Data();
length = buf.GetAsArrayBuffer().Length();
}
// The other Decode signature takes a signed int, because that's
// what nsIUnicodeDecoder::Convert takes as the length. Throw if
// our length is too big.
if (length > INT32_MAX) {
aRv.Throw(NS_ERROR_OUT_OF_MEMORY);
return;
}
Decode(reinterpret_cast<char*>(data), length, aOptions.mStream,
aOutDecodedString, aRv);
}
void
TextDecoder::GetEncoding(nsAString& aEncoding)
{

View File

@ -1,3 +1,4 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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/. */
@ -16,6 +17,8 @@ class ErrorResult;
namespace dom {
class ArrayBufferViewOrArrayBuffer;
class TextDecoder MOZ_FINAL
: public NonRefcountedDOMObject
{
@ -98,18 +101,13 @@ public:
const bool aStream, nsAString& aOutDecodedString,
ErrorResult& aRv);
void Decode(nsAString& aOutDecodedString,
ErrorResult& aRv) {
Decode(nullptr, 0, false, aOutDecodedString, aRv);
}
void Decode(const ArrayBufferView& aView,
void Decode(const Optional<ArrayBufferViewOrArrayBuffer>& aBuffer,
const TextDecodeOptions& aOptions,
nsAString& aOutDecodedString,
ErrorResult& aRv) {
aView.ComputeLengthAndData();
Decode(reinterpret_cast<char*>(aView.Data()), aView.Length(),
aOptions.mStream, aOutDecodedString, aRv);
ErrorResult& aRv);
bool Fatal() const {
return mFatal;
}
private:

View File

@ -1,3 +1,4 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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/. */
@ -38,8 +39,7 @@ void
TextEncoder::Encode(JSContext* aCx,
JS::Handle<JSObject*> aObj,
const nsAString& aString,
const bool aStream,
JS::MutableHandle<JSObject*> aRetval,
JS::MutableHandle<JSObject*> aRetval,
ErrorResult& aRv)
{
// Run the steps of the encoding algorithm.
@ -63,14 +63,11 @@ TextEncoder::Encode(JSContext* aCx,
int32_t dstLen = maxLen;
rv = mEncoder->Convert(data, &srcLen, buf, &dstLen);
// If the internal streaming flag is not set, then reset
// the encoding algorithm state to the default values for encoding.
if (!aStream) {
int32_t finishLen = maxLen - dstLen;
rv = mEncoder->Finish(buf + dstLen, &finishLen);
if (NS_SUCCEEDED(rv)) {
dstLen += finishLen;
}
// Now reset the encoding algorithm state to the default values for encoding.
int32_t finishLen = maxLen - dstLen;
rv = mEncoder->Finish(buf + dstLen, &finishLen);
if (NS_SUCCEEDED(rv)) {
dstLen += finishLen;
}
JSObject* outView = nullptr;

View File

@ -1,3 +1,4 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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/. */
@ -46,15 +47,6 @@ public:
return TextEncoderBinding::Wrap(aCx, this, aTookOwnership);
}
void Encode(JSContext* aCx,
JS::Handle<JSObject*> aObj,
const nsAString& aString,
const TextEncodeOptions& aOptions,
JS::MutableHandle<JSObject*> aRetval,
ErrorResult& aRv) {
TextEncoder::Encode(aCx, aObj, aString, aOptions.mStream, aRetval, aRv);
}
protected:
/**
@ -82,20 +74,14 @@ public:
* @param aCx Javascript context.
* @param aObj the wrapper of the TextEncoder
* @param aString utf-16 code units to be encoded.
* @param aOptions Streaming option. Initialised by default to false.
* If the streaming option is false, then the encoding
* algorithm state will get reset. If set to true then
* the previous encoding is reused/continued.
* @return JSObject* The Uint8Array wrapped in a JS object. Returned via
* the aRetval out param.
*/
void Encode(JSContext* aCx,
JS::Handle<JSObject*> aObj,
const nsAString& aString,
const bool aStream,
JS::MutableHandle<JSObject*> aRetval,
ErrorResult& aRv);
JS::Handle<JSObject*> aObj,
const nsAString& aString,
JS::MutableHandle<JSObject*> aRetval,
ErrorResult& aRv);
private:
nsCString mEncoding;
nsCOMPtr<nsIUnicodeEncoder> mEncoder;

View File

@ -604,6 +604,23 @@ ContentEventHandler::GetLineBreakType(bool aUseNativeLineBreak)
LINE_BREAK_TYPE_NATIVE : LINE_BREAK_TYPE_XP;
}
// Similar to nsFrameSelection::GetFrameForNodeOffset,
// but this is more flexible for OnQueryTextRect to use
static nsresult GetFrameForTextRect(nsINode* aNode,
int32_t aNodeOffset,
bool aHint,
nsIFrame** aReturnFrame)
{
NS_ENSURE_TRUE(aNode && aNode->IsNodeOfType(nsINode::eCONTENT),
NS_ERROR_UNEXPECTED);
nsIContent* content = static_cast<nsIContent*>(aNode);
nsIFrame* frame = content->GetPrimaryFrame();
NS_ENSURE_TRUE(frame, NS_ERROR_FAILURE);
int32_t childNodeOffset = 0;
return frame->GetChildFrameContainingOffset(aNodeOffset, aHint,
&childNodeOffset, aReturnFrame);
}
nsresult
ContentEventHandler::OnQuerySelectedText(WidgetQueryContentEvent* aEvent)
{
@ -646,6 +663,14 @@ ContentEventHandler::OnQuerySelectedText(WidgetQueryContentEvent* aEvent)
NS_ENSURE_SUCCESS(rv, rv);
}
nsIFrame* frame = nullptr;
rv = GetFrameForTextRect(focusNode, focusOffset, true, &frame);
if (NS_SUCCEEDED(rv) && frame) {
aEvent->mReply.mWritingMode = frame->GetWritingMode();
} else {
aEvent->mReply.mWritingMode = WritingMode();
}
aEvent->mSucceeded = true;
return NS_OK;
}
@ -697,23 +722,6 @@ static nsINode* AdjustTextRectNode(nsINode* aNode,
return node;
}
// Similar to nsFrameSelection::GetFrameForNodeOffset,
// but this is more flexible for OnQueryTextRect to use
static nsresult GetFrameForTextRect(nsINode* aNode,
int32_t aNodeOffset,
bool aHint,
nsIFrame** aReturnFrame)
{
NS_ENSURE_TRUE(aNode && aNode->IsNodeOfType(nsINode::eCONTENT),
NS_ERROR_UNEXPECTED);
nsIContent* content = static_cast<nsIContent*>(aNode);
nsIFrame* frame = content->GetPrimaryFrame();
NS_ENSURE_TRUE(frame, NS_ERROR_FAILURE);
int32_t childNodeOffset = 0;
return frame->GetChildFrameContainingOffset(aNodeOffset, aHint,
&childNodeOffset, aReturnFrame);
}
nsresult
ContentEventHandler::OnQueryTextRect(WidgetQueryContentEvent* aEvent)
{

View File

@ -227,6 +227,7 @@ public:
NS_IMETHOD GetCaretEnabled(bool *_retval);
NS_IMETHOD GetCaretVisible(bool *_retval);
NS_IMETHOD SetCaretVisibilityDuringSelection(bool aVisibility);
NS_IMETHOD PhysicalMove(int16_t aDirection, int16_t aAmount, bool aExtend) MOZ_OVERRIDE;
NS_IMETHOD CharacterMove(bool aForward, bool aExtend);
NS_IMETHOD CharacterExtendForDelete();
NS_IMETHOD CharacterExtendForBackspace();
@ -445,6 +446,15 @@ nsTextInputSelectionImpl::SetCaretVisibilityDuringSelection(bool aVisibility)
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP
nsTextInputSelectionImpl::PhysicalMove(int16_t aDirection, int16_t aAmount,
bool aExtend)
{
if (mFrameSelection)
return mFrameSelection->PhysicalMove(aDirection, aAmount, aExtend);
return NS_ERROR_NULL_POINTER;
}
NS_IMETHODIMP
nsTextInputSelectionImpl::CharacterMove(bool aForward, bool aExtend)
{

View File

@ -353,6 +353,13 @@ parent:
*/
ContentReceivedTouch(ScrollableLayerGuid aGuid, uint64_t aInputBlockId, bool aPreventDefault);
/**
* Notifies the APZ code of the results of the gecko hit-test for a
* particular input block. Each target corresponds to one touch point in the
* touch event.
*/
SetTargetAPZC(uint64_t aInputBlockId, ScrollableLayerGuid[] aTargets);
/**
* Updates the zoom constraints for a scrollable frame in this tab.
* The zoom controller code lives on the parent side and so this allows it to

View File

@ -53,6 +53,7 @@
#include "nsIDOMWindow.h"
#include "nsIDOMWindowUtils.h"
#include "nsIDocShell.h"
#include "nsIFrame.h"
#include "nsIURI.h"
#include "nsIURIFixup.h"
#include "nsCDefaultURIFixup.h"
@ -2395,6 +2396,137 @@ TabChild::CancelTapTracking()
mTapHoldTimer = nullptr;
}
static nsIScrollableFrame*
GetScrollableAncestorFrame(nsIFrame* aTarget)
{
if (!aTarget) {
return nullptr;
}
uint32_t flags = nsLayoutUtils::SCROLLABLE_ALWAYS_MATCH_ROOT
| nsLayoutUtils::SCROLLABLE_ONLY_ASYNC_SCROLLABLE;
return nsLayoutUtils::GetNearestScrollableFrame(aTarget, flags);
}
static dom::Element*
GetDisplayportElementFor(nsIScrollableFrame* aScrollableFrame)
{
if (!aScrollableFrame) {
return nullptr;
}
nsIFrame* scrolledFrame = aScrollableFrame->GetScrolledFrame();
if (!scrolledFrame) {
return nullptr;
}
// |scrolledFrame| should at this point be the root content frame of the
// nearest ancestor scrollable frame. The element corresponding to this
// frame should be the one with the displayport set on it, so find that
// element and return it.
nsIContent* content = scrolledFrame->GetContent();
MOZ_ASSERT(content->IsElement()); // roc says this must be true
return content->AsElement();
}
class DisplayportSetListener : public nsAPostRefreshObserver {
public:
DisplayportSetListener(TabChild* aTabChild,
nsIPresShell* aPresShell,
const uint64_t& aInputBlockId,
const nsTArray<ScrollableLayerGuid>& aTargets)
: mTabChild(aTabChild)
, mPresShell(aPresShell)
, mInputBlockId(aInputBlockId)
, mTargets(aTargets)
{
}
virtual ~DisplayportSetListener()
{
}
void DidRefresh() MOZ_OVERRIDE {
if (!mTabChild) {
MOZ_ASSERT_UNREACHABLE("Post-refresh observer fired again after failed attempt at unregistering it");
return;
}
TABC_LOG("Got refresh, sending target APZCs for input block %" PRIu64 "\n", mInputBlockId);
mTabChild->SendSetTargetAPZC(mInputBlockId, mTargets);
if (!mPresShell->RemovePostRefreshObserver(this)) {
MOZ_ASSERT_UNREACHABLE("Unable to unregister post-refresh observer! Leaking it instead of leaving garbage registered");
// Graceful handling, just in case...
mTabChild = nullptr;
mPresShell = nullptr;
return;
}
delete this;
}
private:
nsRefPtr<TabChild> mTabChild;
nsRefPtr<nsIPresShell> mPresShell;
uint64_t mInputBlockId;
nsTArray<ScrollableLayerGuid> mTargets;
};
void
TabChild::SendSetTargetAPZCNotification(const WidgetTouchEvent& aEvent,
const ScrollableLayerGuid& aGuid,
const uint64_t& aInputBlockId)
{
nsCOMPtr<nsIDocument> document(GetDocument());
nsIPresShell* shell = document->GetShell();
if (!shell) {
return;
}
nsIFrame* rootFrame = shell->GetRootFrame();
if (!rootFrame) {
return;
}
bool waitForRefresh = false;
nsTArray<ScrollableLayerGuid> targets;
for (size_t i = 0; i < aEvent.touches.Length(); i++) {
ScrollableLayerGuid guid(aGuid.mLayersId, 0, FrameMetrics::NULL_SCROLL_ID);
nsPoint touchPoint = nsLayoutUtils::GetEventCoordinatesRelativeTo(
WebWidget(), aEvent.touches[i]->mRefPoint, rootFrame);
nsIFrame* target = nsLayoutUtils::GetFrameForPoint(rootFrame, touchPoint,
nsLayoutUtils::IGNORE_ROOT_SCROLL_FRAME);
nsIScrollableFrame* scrollAncestor = GetScrollableAncestorFrame(target);
nsCOMPtr<dom::Element> dpElement = GetDisplayportElementFor(scrollAncestor);
nsAutoString dpElementDesc;
if (dpElement) {
dpElement->Describe(dpElementDesc);
}
TABC_LOG("For input block %" PRIu64 " found scrollable element %p (%s)\n",
aInputBlockId, dpElement.get(),
NS_LossyConvertUTF16toASCII(dpElementDesc).get());
bool guidIsValid = APZCCallbackHelper::GetOrCreateScrollIdentifiers(
dpElement, &(guid.mPresShellId), &(guid.mScrollId));
targets.AppendElement(guid);
if (guidIsValid && !nsLayoutUtils::GetDisplayPort(dpElement, nullptr)) {
TABC_LOG("%p didn't have a displayport, so setting one...\n", dpElement.get());
waitForRefresh |= nsLayoutUtils::CalculateAndSetDisplayPortMargins(
scrollAncestor, nsLayoutUtils::RepaintMode::Repaint);
}
}
if (waitForRefresh) {
TABC_LOG("At least one target got a new displayport, need to wait for refresh\n");
waitForRefresh = shell->AddPostRefreshObserver(
new DisplayportSetListener(this, shell, aInputBlockId, targets));
}
if (!waitForRefresh) {
TABC_LOG("Sending target APZCs for input block %" PRIu64 "\n", aInputBlockId);
SendSetTargetAPZC(aInputBlockId, targets);
} else {
TABC_LOG("Successfully registered post-refresh observer\n");
}
}
bool
TabChild::RecvRealTouchEvent(const WidgetTouchEvent& aEvent,
const ScrollableLayerGuid& aGuid,
@ -2402,12 +2534,17 @@ TabChild::RecvRealTouchEvent(const WidgetTouchEvent& aEvent,
{
TABC_LOG("Receiving touch event of type %d\n", aEvent.message);
WidgetTouchEvent localEvent(aEvent);
localEvent.widget = mWidget;
for (size_t i = 0; i < localEvent.touches.Length(); i++) {
for (size_t i = 0; i < aEvent.touches.Length(); i++) {
aEvent.touches[i]->mRefPoint = APZCCallbackHelper::ApplyCallbackTransform(aEvent.touches[i]->mRefPoint, aGuid, mWidget->GetDefaultScale());
}
if (aEvent.message == NS_TOUCH_START && IsAsyncPanZoomEnabled()) {
SendSetTargetAPZCNotification(aEvent, aGuid, aInputBlockId);
}
WidgetTouchEvent localEvent(aEvent);
localEvent.widget = mWidget;
// Dispatch event to content (potentially a long-running operation)
nsEventStatus status = DispatchWidgetEvent(localEvent);
if (!IsAsyncPanZoomEnabled()) {

View File

@ -573,6 +573,10 @@ private:
void SendPendingTouchPreventedResponse(bool aPreventDefault,
const ScrollableLayerGuid& aGuid);
void SendSetTargetAPZCNotification(const WidgetTouchEvent& aEvent,
const mozilla::layers::ScrollableLayerGuid& aGuid,
const uint64_t& aInputBlockId);
void SetTabId(const TabId& aTabId)
{
MOZ_ASSERT(mUniqueId == 0);

View File

@ -2101,6 +2101,16 @@ TabParent::RecvContentReceivedTouch(const ScrollableLayerGuid& aGuid,
return true;
}
bool
TabParent::RecvSetTargetAPZC(const uint64_t& aInputBlockId,
const nsTArray<ScrollableLayerGuid>& aTargets)
{
if (RenderFrameParent* rfp = GetRenderFrame()) {
rfp->SetTargetAPZC(aInputBlockId, aTargets);
}
return true;
}
already_AddRefed<nsILoadContext>
TabParent::GetLoadContext()
{

View File

@ -208,6 +208,8 @@ public:
virtual bool RecvContentReceivedTouch(const ScrollableLayerGuid& aGuid,
const uint64_t& aInputBlockId,
const bool& aPreventDefault) MOZ_OVERRIDE;
virtual bool RecvSetTargetAPZC(const uint64_t& aInputBlockId,
const nsTArray<ScrollableLayerGuid>& aTargets) MOZ_OVERRIDE;
virtual PColorPickerParent*
AllocPColorPickerParent(const nsString& aTitle, const nsString& aInitialColor) MOZ_OVERRIDE;

View File

@ -186,6 +186,7 @@ MediaDecoderStateMachine::MediaDecoderStateMachine(MediaDecoder* aDecoder,
mCurrentFrameTime(0),
mAudioStartTime(-1),
mAudioEndTime(-1),
mDecodedAudioEndTime(-1),
mVideoFrameEndTime(-1),
mVolume(1.0),
mPlaybackRate(1.0),
@ -704,6 +705,7 @@ MediaDecoderStateMachine::OnAudioDecoded(AudioData* aAudioSample)
nsRefPtr<AudioData> audio(aAudioSample);
MOZ_ASSERT(audio);
mAudioRequestPending = false;
mDecodedAudioEndTime = audio->GetEndTime();
SAMPLE_LOG("OnAudioDecoded [%lld,%lld] disc=%d",
(audio ? audio->mTime : -1),
@ -1493,6 +1495,7 @@ void MediaDecoderStateMachine::ResetPlayback()
mVideoFrameEndTime = -1;
mAudioStartTime = -1;
mAudioEndTime = -1;
mDecodedAudioEndTime = -1;
mAudioCompleted = false;
AudioQueue().Reset();
VideoQueue().Reset();
@ -1947,7 +1950,10 @@ bool MediaDecoderStateMachine::HasLowUndecodedData(int64_t aUsecs)
}
int64_t endOfDecodedAudioData = INT64_MAX;
if (HasAudio() && !AudioQueue().AtEndOfStream()) {
endOfDecodedAudioData = AudioQueue().Peek() ? AudioQueue().Peek()->GetEndTime() : GetAudioClock();
// mDecodedAudioEndTime could be -1 when no audio samples are decoded.
// But that is fine since we consider ourself as low in decoded data when
// we don't have any decoded audio samples at all.
endOfDecodedAudioData = mDecodedAudioEndTime;
}
int64_t endOfDecodedData = std::min(endOfDecodedVideoData, endOfDecodedAudioData);

View File

@ -818,6 +818,10 @@ protected:
// audio stream, unless another frame is pushed to the hardware.
int64_t mAudioEndTime;
// The end time of the last decoded audio frame. This signifies the end of
// decoded audio data. Used to check if we are low in decoded data.
int64_t mDecodedAudioEndTime;
// The presentation end time of the last video frame which has been displayed
// in microseconds. Accessed from the state machine thread.
int64_t mVideoFrameEndTime;

View File

@ -213,11 +213,11 @@ public:
// Decode thread.
virtual already_AddRefed<MediaDataDecoder>
CreateH264Decoder(const mp4_demuxer::VideoDecoderConfig& aConfig,
layers::LayersBackend aLayersBackend,
layers::ImageContainer* aImageContainer,
MediaTaskQueue* aVideoTaskQueue,
MediaDataDecoderCallback* aCallback) MOZ_OVERRIDE {
CreateVideoDecoder(const mp4_demuxer::VideoDecoderConfig& aConfig,
layers::LayersBackend aLayersBackend,
layers::ImageContainer* aImageContainer,
MediaTaskQueue* aVideoTaskQueue,
MediaDataDecoderCallback* aCallback) MOZ_OVERRIDE {
BlankVideoDataCreator* creator = new BlankVideoDataCreator(
aConfig.display_width, aConfig.display_height, aImageContainer);
nsRefPtr<MediaDataDecoder> decoder =

View File

@ -139,20 +139,6 @@ MP4Reader::~MP4Reader()
MOZ_COUNT_DTOR(MP4Reader);
}
class DestroyPDMTask : public nsRunnable {
public:
DestroyPDMTask(nsAutoPtr<PlatformDecoderModule>& aPDM)
: mPDM(aPDM)
{}
NS_IMETHOD Run() MOZ_OVERRIDE {
MOZ_ASSERT(NS_IsMainThread());
mPDM = nullptr;
return NS_OK;
}
private:
nsAutoPtr<PlatformDecoderModule> mPDM;
};
void
MP4Reader::Shutdown()
{
@ -180,10 +166,8 @@ MP4Reader::Shutdown()
mQueuedVideoSample = nullptr;
if (mPlatform) {
// PDMs are supposed to be destroyed on the main thread...
nsRefPtr<DestroyPDMTask> task(new DestroyPDMTask(mPlatform));
MOZ_ASSERT(!mPlatform);
NS_DispatchToMainThread(task);
mPlatform->Shutdown();
mPlatform = nullptr;
}
}
@ -327,6 +311,14 @@ MP4Reader::IsSupportedAudioMimeType(const char* aMimeType)
mPlatform->SupportsAudioMimeType(aMimeType);
}
bool
MP4Reader::IsSupportedVideoMimeType(const char* aMimeType)
{
return (!strcmp(aMimeType, "video/mp4") ||
!strcmp(aMimeType, "video/avc")) &&
mPlatform->SupportsVideoMimeType(aMimeType);
}
nsresult
MP4Reader::ReadMetadata(MediaInfo* aInfo,
MetadataTags** aTags)
@ -429,22 +421,25 @@ MP4Reader::ReadMetadata(MediaInfo* aInfo,
if (HasVideo()) {
const VideoDecoderConfig& video = mDemuxer->VideoConfig();
if (mInfo.mVideo.mHasVideo && !IsSupportedVideoMimeType(video.mime_type)) {
return NS_ERROR_FAILURE;
}
mInfo.mVideo.mDisplay =
nsIntSize(video.display_width, video.display_height);
mVideo.mCallback = new DecoderCallback(this, kVideo);
if (mSharedDecoderManager) {
mVideo.mDecoder =
mSharedDecoderManager->CreateH264Decoder(video,
mLayersBackendType,
mDecoder->GetImageContainer(),
mVideo.mTaskQueue,
mVideo.mCallback);
mSharedDecoderManager->CreateVideoDecoder(video,
mLayersBackendType,
mDecoder->GetImageContainer(),
mVideo.mTaskQueue,
mVideo.mCallback);
} else {
mVideo.mDecoder = mPlatform->CreateH264Decoder(video,
mLayersBackendType,
mDecoder->GetImageContainer(),
mVideo.mTaskQueue,
mVideo.mCallback);
mVideo.mDecoder = mPlatform->CreateVideoDecoder(video,
mLayersBackendType,
mDecoder->GetImageContainer(),
mVideo.mTaskQueue,
mVideo.mCallback);
}
NS_ENSURE_TRUE(mVideo.mDecoder != nullptr, NS_ERROR_FAILURE);
nsresult rv = mVideo.mDecoder->Init();

View File

@ -109,6 +109,7 @@ private:
void DrainComplete(mp4_demuxer::TrackType aTrack);
void UpdateIndex();
bool IsSupportedAudioMimeType(const char* aMimeType);
bool IsSupportedVideoMimeType(const char* aMimeType);
void NotifyResourcesStatusChanged();
bool IsWaitingOnCodecResource();
virtual bool IsWaitingOnCDMResource() MOZ_OVERRIDE;

View File

@ -182,4 +182,10 @@ PlatformDecoderModule::SupportsAudioMimeType(const char* aMimeType)
return !strcmp(aMimeType, "audio/mp4a-latm");
}
bool
PlatformDecoderModule::SupportsVideoMimeType(const char* aMimeType)
{
return !strcmp(aMimeType, "video/mp4") || !strcmp(aMimeType, "video/avc");
}
} // namespace mozilla

View File

@ -97,7 +97,7 @@ public:
// It is safe to store a reference to aConfig.
// This is called on the decode task queue.
virtual already_AddRefed<MediaDataDecoder>
CreateH264Decoder(const mp4_demuxer::VideoDecoderConfig& aConfig,
CreateVideoDecoder(const mp4_demuxer::VideoDecoderConfig& aConfig,
layers::LayersBackend aLayersBackend,
layers::ImageContainer* aImageContainer,
MediaTaskQueue* aVideoTaskQueue,
@ -122,6 +122,7 @@ public:
// If more audio codec is to be supported, SupportsAudioMimeType will have
// to be extended
virtual bool SupportsAudioMimeType(const char* aMimeType);
virtual bool SupportsVideoMimeType(const char* aMimeType);
virtual ~PlatformDecoderModule() {}

View File

@ -66,14 +66,14 @@ SharedDecoderManager::SharedDecoderManager()
SharedDecoderManager::~SharedDecoderManager() {}
already_AddRefed<MediaDataDecoder>
SharedDecoderManager::CreateH264Decoder(
SharedDecoderManager::CreateVideoDecoder(
const mp4_demuxer::VideoDecoderConfig& aConfig,
layers::LayersBackend aLayersBackend, layers::ImageContainer* aImageContainer,
MediaTaskQueue* aVideoTaskQueue, MediaDataDecoderCallback* aCallback)
{
if (!mDecoder) {
nsAutoPtr<PlatformDecoderModule> platform(PlatformDecoderModule::Create());
mDecoder = platform->CreateH264Decoder(
mDecoder = platform->CreateVideoDecoder(
aConfig, aLayersBackend, aImageContainer, aVideoTaskQueue, mCallback);
if (!mDecoder) {
return nullptr;

View File

@ -24,7 +24,7 @@ public:
SharedDecoderManager();
already_AddRefed<MediaDataDecoder> CreateH264Decoder(
already_AddRefed<MediaDataDecoder> CreateVideoDecoder(
const mp4_demuxer::VideoDecoderConfig& aConfig,
layers::LayersBackend aLayersBackend,
layers::ImageContainer* aImageContainer, MediaTaskQueue* aVideoTaskQueue,

View File

@ -135,7 +135,7 @@ bool AndroidDecoderModule::SupportsAudioMimeType(const char* aMimeType) {
}
already_AddRefed<MediaDataDecoder>
AndroidDecoderModule::CreateH264Decoder(
AndroidDecoderModule::CreateVideoDecoder(
const mp4_demuxer::VideoDecoderConfig& aConfig,
layers::LayersBackend aLayersBackend,
layers::ImageContainer* aImageContainer,

View File

@ -34,11 +34,11 @@ public:
virtual nsresult Shutdown() MOZ_OVERRIDE;
virtual already_AddRefed<MediaDataDecoder>
CreateH264Decoder(const mp4_demuxer::VideoDecoderConfig& aConfig,
layers::LayersBackend aLayersBackend,
layers::ImageContainer* aImageContainer,
MediaTaskQueue* aVideoTaskQueue,
MediaDataDecoderCallback* aCallback) MOZ_OVERRIDE;
CreateVideoDecoder(const mp4_demuxer::VideoDecoderConfig& aConfig,
layers::LayersBackend aLayersBackend,
layers::ImageContainer* aImageContainer,
MediaTaskQueue* aVideoTaskQueue,
MediaDataDecoderCallback* aCallback) MOZ_OVERRIDE;
virtual already_AddRefed<MediaDataDecoder>
CreateAudioDecoder(const mp4_demuxer::AudioDecoderConfig& aConfig,

View File

@ -144,11 +144,11 @@ AppleDecoderModule::Shutdown()
}
already_AddRefed<MediaDataDecoder>
AppleDecoderModule::CreateH264Decoder(const mp4_demuxer::VideoDecoderConfig& aConfig,
layers::LayersBackend aLayersBackend,
layers::ImageContainer* aImageContainer,
MediaTaskQueue* aVideoTaskQueue,
MediaDataDecoderCallback* aCallback)
AppleDecoderModule::CreateVideoDecoder(const mp4_demuxer::VideoDecoderConfig& aConfig,
layers::LayersBackend aLayersBackend,
layers::ImageContainer* aImageContainer,
MediaTaskQueue* aVideoTaskQueue,
MediaDataDecoderCallback* aCallback)
{
nsRefPtr<MediaDataDecoder> decoder;

View File

@ -26,11 +26,11 @@ public:
// Decode thread.
virtual already_AddRefed<MediaDataDecoder>
CreateH264Decoder(const mp4_demuxer::VideoDecoderConfig& aConfig,
layers::LayersBackend aLayersBackend,
layers::ImageContainer* aImageContainer,
MediaTaskQueue* aVideoTaskQueue,
MediaDataDecoderCallback* aCallback) MOZ_OVERRIDE;
CreateVideoDecoder(const mp4_demuxer::VideoDecoderConfig& aConfig,
layers::LayersBackend aLayersBackend,
layers::ImageContainer* aImageContainer,
MediaTaskQueue* aVideoTaskQueue,
MediaDataDecoderCallback* aCallback) MOZ_OVERRIDE;
// Decode thread.
virtual already_AddRefed<MediaDataDecoder>

View File

@ -194,11 +194,11 @@ EMEDecoderModule::Shutdown()
}
already_AddRefed<MediaDataDecoder>
EMEDecoderModule::CreateH264Decoder(const VideoDecoderConfig& aConfig,
layers::LayersBackend aLayersBackend,
layers::ImageContainer* aImageContainer,
MediaTaskQueue* aVideoTaskQueue,
MediaDataDecoderCallback* aCallback)
EMEDecoderModule::CreateVideoDecoder(const VideoDecoderConfig& aConfig,
layers::LayersBackend aLayersBackend,
layers::ImageContainer* aImageContainer,
MediaTaskQueue* aVideoTaskQueue,
MediaDataDecoderCallback* aCallback)
{
if (mCDMDecodesVideo && aConfig.crypto.valid) {
nsRefPtr<MediaDataDecoder> decoder(new EMEH264Decoder(mProxy,
@ -210,11 +210,11 @@ EMEDecoderModule::CreateH264Decoder(const VideoDecoderConfig& aConfig,
return decoder.forget();
}
nsRefPtr<MediaDataDecoder> decoder(mPDM->CreateH264Decoder(aConfig,
aLayersBackend,
aImageContainer,
aVideoTaskQueue,
aCallback));
nsRefPtr<MediaDataDecoder> decoder(mPDM->CreateVideoDecoder(aConfig,
aLayersBackend,
aImageContainer,
aVideoTaskQueue,
aCallback));
if (!decoder) {
return nullptr;
}

View File

@ -34,7 +34,7 @@ public:
// Decode thread.
virtual already_AddRefed<MediaDataDecoder>
CreateH264Decoder(const mp4_demuxer::VideoDecoderConfig& aConfig,
CreateVideoDecoder(const mp4_demuxer::VideoDecoderConfig& aConfig,
layers::LayersBackend aLayersBackend,
layers::ImageContainer* aImageContainer,
MediaTaskQueue* aVideoTaskQueue,

View File

@ -26,11 +26,11 @@ public:
virtual nsresult Shutdown() MOZ_OVERRIDE { return NS_OK; }
virtual already_AddRefed<MediaDataDecoder>
CreateH264Decoder(const mp4_demuxer::VideoDecoderConfig& aConfig,
layers::LayersBackend aLayersBackend,
layers::ImageContainer* aImageContainer,
MediaTaskQueue* aVideoTaskQueue,
MediaDataDecoderCallback* aCallback) MOZ_OVERRIDE
CreateVideoDecoder(const mp4_demuxer::VideoDecoderConfig& aConfig,
layers::LayersBackend aLayersBackend,
layers::ImageContainer* aImageContainer,
MediaTaskQueue* aVideoTaskQueue,
MediaDataDecoderCallback* aCallback) MOZ_OVERRIDE
{
nsRefPtr<MediaDataDecoder> decoder =
new FFmpegH264Decoder<V>(aVideoTaskQueue, aCallback, aConfig,

View File

@ -35,11 +35,11 @@ GonkDecoderModule::Shutdown()
}
already_AddRefed<MediaDataDecoder>
GonkDecoderModule::CreateH264Decoder(const mp4_demuxer::VideoDecoderConfig& aConfig,
mozilla::layers::LayersBackend aLayersBackend,
mozilla::layers::ImageContainer* aImageContainer,
MediaTaskQueue* aVideoTaskQueue,
MediaDataDecoderCallback* aCallback)
GonkDecoderModule::CreateVideoDecoder(const mp4_demuxer::VideoDecoderConfig& aConfig,
mozilla::layers::LayersBackend aLayersBackend,
mozilla::layers::ImageContainer* aImageContainer,
MediaTaskQueue* aVideoTaskQueue,
MediaDataDecoderCallback* aCallback)
{
nsRefPtr<MediaDataDecoder> decoder =
new GonkMediaDataDecoder(new GonkVideoDecoderManager(aImageContainer,aConfig),

View File

@ -21,11 +21,11 @@ public:
// Decode thread.
virtual already_AddRefed<MediaDataDecoder>
CreateH264Decoder(const mp4_demuxer::VideoDecoderConfig& aConfig,
mozilla::layers::LayersBackend aLayersBackend,
mozilla::layers::ImageContainer* aImageContainer,
MediaTaskQueue* aVideoTaskQueue,
MediaDataDecoderCallback* aCallback) MOZ_OVERRIDE;
CreateVideoDecoder(const mp4_demuxer::VideoDecoderConfig& aConfig,
mozilla::layers::LayersBackend aLayersBackend,
mozilla::layers::ImageContainer* aImageContainer,
MediaTaskQueue* aVideoTaskQueue,
MediaDataDecoderCallback* aCallback) MOZ_OVERRIDE;
// Decode thread.
virtual already_AddRefed<MediaDataDecoder>

Some files were not shown because too many files have changed in this diff Show More