merge mozilla-inbound to mozilla-central a=merge

This commit is contained in:
Carsten "Tomcat" Book 2014-11-18 17:25:29 +01:00
commit 6a293a24ca
439 changed files with 9611 additions and 10520 deletions

View File

@ -451,6 +451,18 @@ AndroidPresenter.prototype.liveRegion =
UtteranceGenerator.genForLiveRegion(aContext, aIsHide, aModifiedText)); UtteranceGenerator.genForLiveRegion(aContext, aIsHide, aModifiedText));
}; };
AndroidPresenter.prototype.noMove =
function AndroidPresenter_noMove(aMoveMethod) {
return {
type: this.type,
details: [
{ eventType: this.ANDROID_VIEW_ACCESSIBILITY_FOCUSED,
exitView: aMoveMethod,
text: ['']
}]
};
};
/** /**
* A B2G presenter for Gaia. * A B2G presenter for Gaia.
*/ */

View File

@ -709,12 +709,12 @@
</p> </p>
<p id="area17"> <p id="area17">
<span style="-moz-text-decoration-line: underline;">underline <span style="text-decoration-line: underline;">underline
</span><span style="text-decoration: underline; -moz-text-decoration-color: blue;">blue </span><span style="text-decoration: underline; text-decoration-color: blue;">blue
</span><span style="text-decoration: underline; -moz-text-decoration-style: dotted;">dotted </span><span style="text-decoration: underline; text-decoration-style: dotted;">dotted
</span><span style="-moz-text-decoration-line: line-through;">linethrough </span><span style="text-decoration-line: line-through;">linethrough
</span><span style="text-decoration: line-through; -moz-text-decoration-color: blue;">blue </span><span style="text-decoration: line-through; text-decoration-color: blue;">blue
</span><span style="text-decoration: line-through; -moz-text-decoration-style: wavy;">wavy </span><span style="text-decoration: line-through; text-decoration-style: wavy;">wavy
</span> </span>
</p> </p>

View File

@ -10,7 +10,6 @@ ac_add_options --with-gonk="$topsrcdir/gonk-toolchain"
export TOOLCHAIN_HOST=linux-x86 export TOOLCHAIN_HOST=linux-x86
export GONK_PRODUCT=generic export GONK_PRODUCT=generic
ac_add_options --with-gonk-toolchain-prefix="$topsrcdir/gonk-toolchain/prebuilt/$TOOLCHAIN_HOST/toolchain/arm-linux-androideabi-4.4.x/bin/arm-linux-androideabi-" ac_add_options --with-gonk-toolchain-prefix="$topsrcdir/gonk-toolchain/prebuilt/$TOOLCHAIN_HOST/toolchain/arm-linux-androideabi-4.4.x/bin/arm-linux-androideabi-"
ac_add_options --disable-elf-hack
ac_add_options --enable-debug-symbols ac_add_options --enable-debug-symbols
ac_add_options --enable-debug ac_add_options --enable-debug
#. "$topsrcdir/build/mozconfig.cache" #. "$topsrcdir/build/mozconfig.cache"

View File

@ -11,7 +11,6 @@ ac_add_options --with-gonk="$topsrcdir/gonk-toolchain"
export TOOLCHAIN_HOST=linux-x86 export TOOLCHAIN_HOST=linux-x86
export GONK_PRODUCT=generic export GONK_PRODUCT=generic
ac_add_options --with-gonk-toolchain-prefix="$topsrcdir/gonk-toolchain/prebuilt/$TOOLCHAIN_HOST/toolchain/arm-linux-androideabi-4.4.x/bin/arm-linux-androideabi-" ac_add_options --with-gonk-toolchain-prefix="$topsrcdir/gonk-toolchain/prebuilt/$TOOLCHAIN_HOST/toolchain/arm-linux-androideabi-4.4.x/bin/arm-linux-androideabi-"
ac_add_options --disable-elf-hack
ac_add_options --enable-debug-symbols ac_add_options --enable-debug-symbols
# ac_add_options --enable-profiling # ac_add_options --enable-profiling
#. "$topsrcdir/build/mozconfig.cache" #. "$topsrcdir/build/mozconfig.cache"

View File

@ -29,7 +29,6 @@ no_sccache=
#B2G options #B2G options
ac_add_options --enable-application=b2g ac_add_options --enable-application=b2g
ENABLE_MARIONETTE=1 ENABLE_MARIONETTE=1
ac_add_options --disable-elf-hack
export CXXFLAGS=-DMOZ_ENABLE_JS_DUMP export CXXFLAGS=-DMOZ_ENABLE_JS_DUMP
GAIADIR=$topsrcdir/gaia GAIADIR=$topsrcdir/gaia

View File

@ -27,7 +27,6 @@ no_sccache=
#B2G options #B2G options
ac_add_options --enable-application=b2g ac_add_options --enable-application=b2g
ac_add_options --disable-elf-hack
export CXXFLAGS=-DMOZ_ENABLE_JS_DUMP export CXXFLAGS=-DMOZ_ENABLE_JS_DUMP
GAIADIR=$topsrcdir/gaia GAIADIR=$topsrcdir/gaia

View File

@ -29,7 +29,6 @@ no_sccache=
#B2G options #B2G options
ac_add_options --enable-application=b2g ac_add_options --enable-application=b2g
ENABLE_MARIONETTE=1 ENABLE_MARIONETTE=1
ac_add_options --disable-elf-hack
export CXXFLAGS=-DMOZ_ENABLE_JS_DUMP export CXXFLAGS=-DMOZ_ENABLE_JS_DUMP
GAIADIR=$topsrcdir/gaia GAIADIR=$topsrcdir/gaia

View File

@ -27,7 +27,6 @@ no_sccache=
#B2G options #B2G options
ac_add_options --enable-application=b2g ac_add_options --enable-application=b2g
ac_add_options --disable-elf-hack
export CXXFLAGS=-DMOZ_ENABLE_JS_DUMP export CXXFLAGS=-DMOZ_ENABLE_JS_DUMP
GAIADIR=$topsrcdir/gaia GAIADIR=$topsrcdir/gaia

View File

@ -83,9 +83,6 @@ ifdef GKMEDIAS_SHARED_LIBRARY
DEFINES += -DGKMEDIAS_SHARED_LIBRARY DEFINES += -DGKMEDIAS_SHARED_LIBRARY
endif endif
ifdef MOZ_REPLACE_MALLOC
DEFINES += -DMOZ_REPLACE_MALLOC
endif
ifdef MOZ_JEMALLOC3 ifdef MOZ_JEMALLOC3
DEFINES += -DMOZ_JEMALLOC3 DEFINES += -DMOZ_JEMALLOC3
endif endif

View File

@ -21,6 +21,7 @@ skip-if = os == "mac" # Intermittent failures, bug 898317
[browser_newtab_bug998387.js] [browser_newtab_bug998387.js]
[browser_newtab_disable.js] [browser_newtab_disable.js]
[browser_newtab_drag_drop.js] [browser_newtab_drag_drop.js]
skip-if = os == "win" && debug # bug 1097056; test fails in --run-by-dir mode on win8 x64 debug
[browser_newtab_drag_drop_ext.js] [browser_newtab_drag_drop_ext.js]
[browser_newtab_drop_preview.js] [browser_newtab_drop_preview.js]
[browser_newtab_enhanced.js] [browser_newtab_enhanced.js]

View File

@ -36,4 +36,4 @@ skip-if = e10s # Bug ?????? - Test uses load event and checks event.target.
[browser_yahoo_behavior.js] [browser_yahoo_behavior.js]
skip-if = e10s # Bug ?????? - some issue with progress listeners [JavaScript Error: "req.originalURI is null" {file: "chrome://mochitests/content/browser/browser/components/search/test/browser_bing_behavior.js" line: 127}] skip-if = e10s # Bug ?????? - some issue with progress listeners [JavaScript Error: "req.originalURI is null" {file: "chrome://mochitests/content/browser/browser/components/search/test/browser_bing_behavior.js" line: 127}]
[browser_abouthome_behavior.js] [browser_abouthome_behavior.js]
skip-if = e10s # Bug ??????? skip-if = e10s || true # Bug ??????, Bug 1100301 - leaks windows until shutdown when --run-by-dir

View File

@ -19,7 +19,7 @@ support-files =
[browser_tabview_bug587231.js] [browser_tabview_bug587231.js]
skip-if = buildapp == 'mulet' skip-if = buildapp == 'mulet'
[browser_tabview_bug587276.js] [browser_tabview_bug587276.js]
skip-if = e10s # Bug 1091200 skip-if = e10s || true # Bug 1091200, bug 1096285
[browser_tabview_bug587351.js] [browser_tabview_bug587351.js]
[browser_tabview_bug587503.js] [browser_tabview_bug587503.js]
[browser_tabview_bug587990.js] [browser_tabview_bug587990.js]

View File

@ -2,7 +2,6 @@
ac_add_options --enable-signmar ac_add_options --enable-signmar
ac_add_options --enable-profiling ac_add_options --enable-profiling
ac_add_options --disable-elf-hack # --enable-elf-hack conflicts with --enable-profiling
# Nightlies only since this has a cost in performance # Nightlies only since this has a cost in performance
ac_add_options --enable-js-diagnostics ac_add_options --enable-js-diagnostics

View File

@ -5,7 +5,6 @@ no_sccache=1
ac_add_options --enable-valgrind ac_add_options --enable-valgrind
ac_add_options --disable-jemalloc ac_add_options --disable-jemalloc
ac_add_options --disable-elf-hack
ac_add_options --enable-optimize="-g -O -freorder-blocks" ac_add_options --enable-optimize="-g -O -freorder-blocks"
ac_add_options --disable-install-strip ac_add_options --disable-install-strip

View File

@ -2,7 +2,6 @@
ac_add_options --enable-signmar ac_add_options --enable-signmar
ac_add_options --enable-profiling ac_add_options --enable-profiling
ac_add_options --disable-elf-hack # --enable-elf-hack conflicts with --enable-profiling
# Nightlies only since this has a cost in performance # Nightlies only since this has a cost in performance
ac_add_options --enable-js-diagnostics ac_add_options --enable-js-diagnostics

View File

@ -5,7 +5,6 @@ no_sccache=1
ac_add_options --enable-valgrind ac_add_options --enable-valgrind
ac_add_options --disable-jemalloc ac_add_options --disable-jemalloc
ac_add_options --disable-elf-hack
ac_add_options --enable-optimize="-g -O -freorder-blocks" ac_add_options --enable-optimize="-g -O -freorder-blocks"
ac_add_options --disable-install-strip ac_add_options --disable-install-strip

View File

@ -34,7 +34,6 @@ whitelist['nightly']['linux32'] += [
'export MOZ_TELEMETRY_REPORTING=1', 'export MOZ_TELEMETRY_REPORTING=1',
"mk_add_options PROFILE_GEN_SCRIPT='$(PYTHON) @MOZ_OBJDIR@/_profile/pgo/profileserver.py 10'", "mk_add_options PROFILE_GEN_SCRIPT='$(PYTHON) @MOZ_OBJDIR@/_profile/pgo/profileserver.py 10'",
'STRIP_FLAGS="--strip-debug"', 'STRIP_FLAGS="--strip-debug"',
'ac_add_options --disable-elf-hack # --enable-elf-hack conflicts with --enable-profiling',
] ]
whitelist['nightly']['linux64'] += [ whitelist['nightly']['linux64'] += [
@ -44,7 +43,6 @@ whitelist['nightly']['linux64'] += [
'STRIP_FLAGS="--strip-debug"', 'STRIP_FLAGS="--strip-debug"',
'ac_add_options --with-ccache=/usr/bin/ccache', 'ac_add_options --with-ccache=/usr/bin/ccache',
'. "$topsrcdir/build/mozconfig.cache"', '. "$topsrcdir/build/mozconfig.cache"',
'ac_add_options --disable-elf-hack # --enable-elf-hack conflicts with --enable-profiling',
] ]
whitelist['nightly']['macosx-universal'] += [ whitelist['nightly']['macosx-universal'] += [

View File

@ -354,43 +354,43 @@ skip-if = e10s
[browser_dbg_scripts-switching-03.js] [browser_dbg_scripts-switching-03.js]
skip-if = e10s skip-if = e10s
[browser_dbg_search-autofill-identifier.js] [browser_dbg_search-autofill-identifier.js]
skip-if = e10s skip-if = e10s && debug
[browser_dbg_search-basic-01.js] [browser_dbg_search-basic-01.js]
skip-if = e10s skip-if = e10s && debug
[browser_dbg_search-basic-02.js] [browser_dbg_search-basic-02.js]
skip-if = e10s skip-if = e10s && debug
[browser_dbg_search-basic-03.js] [browser_dbg_search-basic-03.js]
skip-if = e10s skip-if = e10s && debug
[browser_dbg_search-basic-04.js] [browser_dbg_search-basic-04.js]
skip-if = e10s skip-if = e10s && debug
[browser_dbg_search-global-01.js] [browser_dbg_search-global-01.js]
skip-if = e10s skip-if = e10s && debug
[browser_dbg_search-global-02.js] [browser_dbg_search-global-02.js]
skip-if = e10s skip-if = e10s && debug
[browser_dbg_search-global-03.js] [browser_dbg_search-global-03.js]
skip-if = e10s skip-if = e10s # Bug 1093535
[browser_dbg_search-global-04.js] [browser_dbg_search-global-04.js]
skip-if = e10s skip-if = e10s && debug
[browser_dbg_search-global-05.js] [browser_dbg_search-global-05.js]
skip-if = e10s skip-if = e10s && debug
[browser_dbg_search-global-06.js] [browser_dbg_search-global-06.js]
skip-if = e10s skip-if = e10s && debug
[browser_dbg_search-popup-jank.js] [browser_dbg_search-popup-jank.js]
skip-if = e10s skip-if = e10s && debug
[browser_dbg_search-sources-01.js] [browser_dbg_search-sources-01.js]
skip-if = e10s skip-if = e10s && debug
[browser_dbg_search-sources-02.js] [browser_dbg_search-sources-02.js]
skip-if = e10s skip-if = e10s && debug
[browser_dbg_search-sources-03.js] [browser_dbg_search-sources-03.js]
skip-if = e10s skip-if = e10s && debug
[browser_dbg_search-symbols.js] [browser_dbg_search-symbols.js]
skip-if = e10s skip-if = e10s && debug
[browser_dbg_searchbox-help-popup-01.js] [browser_dbg_searchbox-help-popup-01.js]
skip-if = e10s skip-if = e10s && debug
[browser_dbg_searchbox-help-popup-02.js] [browser_dbg_searchbox-help-popup-02.js]
skip-if = e10s skip-if = e10s && debug
[browser_dbg_searchbox-parse.js] [browser_dbg_searchbox-parse.js]
skip-if = e10s skip-if = e10s && debug
[browser_dbg_source-maps-01.js] [browser_dbg_source-maps-01.js]
skip-if = e10s && debug skip-if = e10s && debug
[browser_dbg_source-maps-02.js] [browser_dbg_source-maps-02.js]

View File

@ -10,7 +10,7 @@
function test() { function test() {
const TAB_URL = EXAMPLE_URL + "doc_function-search.html"; const TAB_URL = EXAMPLE_URL + "doc_function-search.html";
initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => { initDebugger(TAB_URL).then(([aTab,, aPanel]) => {
let Source = 'code_function-search-01.js'; let Source = 'code_function-search-01.js';
let Debugger = aPanel.panelWin; let Debugger = aPanel.panelWin;
let Editor = Debugger.DebuggerView.editor; let Editor = Debugger.DebuggerView.editor;

View File

@ -7,13 +7,12 @@
const TAB_URL = EXAMPLE_URL + "doc_recursion-stack.html"; const TAB_URL = EXAMPLE_URL + "doc_recursion-stack.html";
let gTab, gDebuggee, gPanel, gDebugger; let gTab, gPanel, gDebugger;
let gEditor, gSources, gFiltering, gSearchBox; let gEditor, gSources, gFiltering, gSearchBox;
function test() { function test() {
initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => { initDebugger(TAB_URL).then(([aTab,, aPanel]) => {
gTab = aTab; gTab = aTab;
gDebuggee = aDebuggee;
gPanel = aPanel; gPanel = aPanel;
gDebugger = gPanel.panelWin; gDebugger = gPanel.panelWin;
gEditor = gDebugger.DebuggerView.editor; gEditor = gDebugger.DebuggerView.editor;
@ -309,7 +308,6 @@ function performTest() {
registerCleanupFunction(function() { registerCleanupFunction(function() {
gTab = null; gTab = null;
gDebuggee = null;
gPanel = null; gPanel = null;
gDebugger = null; gDebugger = null;
gEditor = null; gEditor = null;

View File

@ -7,13 +7,12 @@
const TAB_URL = EXAMPLE_URL + "doc_script-switching-01.html"; const TAB_URL = EXAMPLE_URL + "doc_script-switching-01.html";
let gTab, gDebuggee, gPanel, gDebugger; let gTab, gPanel, gDebugger;
let gSources, gSearchBox; let gSources, gSearchBox;
function test() { function test() {
initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => { initDebugger(TAB_URL).then(([aTab,, aPanel]) => {
gTab = aTab; gTab = aTab;
gDebuggee = aDebuggee;
gPanel = aPanel; gPanel = aPanel;
gDebugger = gPanel.panelWin; gDebugger = gPanel.panelWin;
gSources = gDebugger.DebuggerView.Sources; gSources = gDebugger.DebuggerView.Sources;
@ -33,7 +32,7 @@ function test() {
ok(false, "Got an error: " + aError.message + "\n" + aError.stack); ok(false, "Got an error: " + aError.message + "\n" + aError.stack);
}); });
gDebuggee.firstCall(); callInTab(gTab, "firstCall");
}); });
} }
@ -116,7 +115,6 @@ function verifySourceAndCaret(aUrl, aLine, aColumn, aSelection) {
registerCleanupFunction(function() { registerCleanupFunction(function() {
gTab = null; gTab = null;
gDebuggee = null;
gPanel = null; gPanel = null;
gDebugger = null; gDebugger = null;
gSources = null; gSources = null;

View File

@ -8,13 +8,12 @@
const TAB_URL = EXAMPLE_URL + "doc_script-switching-01.html"; const TAB_URL = EXAMPLE_URL + "doc_script-switching-01.html";
let gTab, gDebuggee, gPanel, gDebugger; let gTab, gPanel, gDebugger;
let gSources, gSearchBox; let gSources, gSearchBox;
function test() { function test() {
initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => { initDebugger(TAB_URL).then(([aTab,, aPanel]) => {
gTab = aTab; gTab = aTab;
gDebuggee = aDebuggee;
gPanel = aPanel; gPanel = aPanel;
gDebugger = gPanel.panelWin; gDebugger = gPanel.panelWin;
gSources = gDebugger.DebuggerView.Sources; gSources = gDebugger.DebuggerView.Sources;
@ -37,7 +36,7 @@ function test() {
ok(false, "Got an error: " + aError.message + "\n" + aError.stack); ok(false, "Got an error: " + aError.message + "\n" + aError.stack);
}); });
gDebuggee.firstCall(); callInTab(gTab, "firstCall");
}); });
} }
@ -112,7 +111,6 @@ function verifySourceAndCaret(aUrl, aLine, aColumn) {
registerCleanupFunction(function() { registerCleanupFunction(function() {
gTab = null; gTab = null;
gDebuggee = null;
gPanel = null; gPanel = null;
gDebugger = null; gDebugger = null;
gSources = null; gSources = null;

View File

@ -8,13 +8,12 @@
const TAB_URL = EXAMPLE_URL + "doc_script-switching-01.html"; const TAB_URL = EXAMPLE_URL + "doc_script-switching-01.html";
let gTab, gDebuggee, gPanel, gDebugger; let gTab, gPanel, gDebugger;
let gEditor, gSources, gSearchBox; let gEditor, gSources, gSearchBox;
function test() { function test() {
initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => { initDebugger(TAB_URL).then(([aTab,, aPanel]) => {
gTab = aTab; gTab = aTab;
gDebuggee = aDebuggee;
gPanel = aPanel; gPanel = aPanel;
gDebugger = gPanel.panelWin; gDebugger = gPanel.panelWin;
gEditor = gDebugger.DebuggerView.editor; gEditor = gDebugger.DebuggerView.editor;
@ -123,7 +122,6 @@ function testTokenSearch() {
registerCleanupFunction(function() { registerCleanupFunction(function() {
gTab = null; gTab = null;
gDebuggee = null;
gPanel = null; gPanel = null;
gDebugger = null; gDebugger = null;
gEditor = null; gEditor = null;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -7,13 +7,12 @@
const TAB_URL = EXAMPLE_URL + "doc_editor-mode.html"; const TAB_URL = EXAMPLE_URL + "doc_editor-mode.html";
let gTab, gDebuggee, gPanel, gDebugger; let gTab, gPanel, gDebugger;
let gSearchBox; let gSearchBox;
function test() { function test() {
initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => { initDebugger(TAB_URL).then(([aTab,, aPanel]) => {
gTab = aTab; gTab = aTab;
gDebuggee = aDebuggee;
gPanel = aPanel; gPanel = aPanel;
gDebugger = gPanel.panelWin; gDebugger = gPanel.panelWin;
gSearchBox = gDebugger.DebuggerView.Filtering._searchbox; gSearchBox = gDebugger.DebuggerView.Filtering._searchbox;
@ -111,7 +110,6 @@ function pressKeyToHide(aKey) {
registerCleanupFunction(function() { registerCleanupFunction(function() {
gTab = null; gTab = null;
gDebuggee = null;
gPanel = null; gPanel = null;
gDebugger = null; gDebugger = null;
gSearchBox = null; gSearchBox = null;

View File

@ -7,16 +7,15 @@
const TAB_URL = EXAMPLE_URL + "doc_script-switching-01.html"; const TAB_URL = EXAMPLE_URL + "doc_script-switching-01.html";
let gTab, gDebuggee, gPanel, gDebugger; let gTab, gPanel, gDebugger;
let gSources, gSearchView, gSearchBox; let gSources, gSearchView, gSearchBox;
function test() { function test() {
// Debug test slaves are a bit slow at this test. // Debug test slaves are a bit slow at this test.
requestLongerTimeout(3); requestLongerTimeout(3);
initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => { initDebugger(TAB_URL).then(([aTab,, aPanel]) => {
gTab = aTab; gTab = aTab;
gDebuggee = aDebuggee;
gPanel = aPanel; gPanel = aPanel;
gDebugger = gPanel.panelWin; gDebugger = gPanel.panelWin;
gSources = gDebugger.DebuggerView.Sources; gSources = gDebugger.DebuggerView.Sources;
@ -226,7 +225,6 @@ function verifyContents(aArgs) {
registerCleanupFunction(function() { registerCleanupFunction(function() {
gTab = null; gTab = null;
gDebuggee = null;
gPanel = null; gPanel = null;
gDebugger = null; gDebugger = null;
gSources = null; gSources = null;

View File

@ -7,16 +7,15 @@
const TAB_URL = EXAMPLE_URL + "doc_editor-mode.html"; const TAB_URL = EXAMPLE_URL + "doc_editor-mode.html";
let gTab, gDebuggee, gPanel, gDebugger; let gTab, gPanel, gDebugger;
let gSources, gSourceUtils, gSearchView, gSearchBox; let gSources, gSourceUtils, gSearchView, gSearchBox;
function test() { function test() {
// Debug test slaves are a bit slow at this test. // Debug test slaves are a bit slow at this test.
requestLongerTimeout(3); requestLongerTimeout(3);
initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => { initDebugger(TAB_URL).then(([aTab,, aPanel]) => {
gTab = aTab; gTab = aTab;
gDebuggee = aDebuggee;
gPanel = aPanel; gPanel = aPanel;
gDebugger = gPanel.panelWin; gDebugger = gPanel.panelWin;
gSources = gDebugger.DebuggerView.Sources; gSources = gDebugger.DebuggerView.Sources;
@ -268,7 +267,6 @@ function verifyContents(aMatches) {
registerCleanupFunction(function() { registerCleanupFunction(function() {
gTab = null; gTab = null;
gDebuggee = null;
gPanel = null; gPanel = null;
gDebugger = null; gDebugger = null;
gSources = null; gSources = null;

View File

@ -7,13 +7,12 @@
const TAB_URL = EXAMPLE_URL + "doc_editor-mode.html"; const TAB_URL = EXAMPLE_URL + "doc_editor-mode.html";
let gTab, gDebuggee, gPanel, gDebugger; let gTab, gPanel, gDebugger;
let gSources, gSearchBox; let gSources, gSearchBox;
function test() { function test() {
initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => { initDebugger(TAB_URL).then(([aTab,, aPanel]) => {
gTab = aTab; gTab = aTab;
gDebuggee = aDebuggee;
gPanel = aPanel; gPanel = aPanel;
gDebugger = gPanel.panelWin; gDebugger = gPanel.panelWin;
gSources = gDebugger.DebuggerView.Sources; gSources = gDebugger.DebuggerView.Sources;
@ -92,7 +91,6 @@ function verifySourcesPane() {
registerCleanupFunction(function() { registerCleanupFunction(function() {
gTab = null; gTab = null;
gDebuggee = null;
gPanel = null; gPanel = null;
gDebugger = null; gDebugger = null;
gSources = null; gSources = null;

View File

@ -7,13 +7,12 @@
const TAB_URL = EXAMPLE_URL + "doc_function-search.html"; const TAB_URL = EXAMPLE_URL + "doc_function-search.html";
let gTab, gDebuggee, gPanel, gDebugger; let gTab, gPanel, gDebugger;
let gEditor, gSources, gSearchBox, gFilteredFunctions; let gEditor, gSources, gSearchBox, gFilteredFunctions;
function test() { function test() {
initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => { initDebugger(TAB_URL).then(([aTab,, aPanel]) => {
gTab = aTab; gTab = aTab;
gDebuggee = aDebuggee;
gPanel = aPanel; gPanel = aPanel;
gDebugger = gPanel.panelWin; gDebugger = gPanel.panelWin;
gEditor = gDebugger.DebuggerView.editor; gEditor = gDebugger.DebuggerView.editor;
@ -459,7 +458,6 @@ function writeInfo() {
registerCleanupFunction(function() { registerCleanupFunction(function() {
gTab = null; gTab = null;
gDebuggee = null;
gPanel = null; gPanel = null;
gDebugger = null; gDebugger = null;
gEditor = null; gEditor = null;

View File

@ -8,13 +8,12 @@
const TAB_URL = EXAMPLE_URL + "doc_script-switching-01.html"; const TAB_URL = EXAMPLE_URL + "doc_script-switching-01.html";
let gTab, gDebuggee, gPanel, gDebugger; let gTab, gPanel, gDebugger;
let gSearchBox, gSearchBoxPanel; let gSearchBox, gSearchBoxPanel;
function test() { function test() {
initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => { initDebugger(TAB_URL).then(([aTab,, aPanel]) => {
gTab = aTab; gTab = aTab;
gDebuggee = aDebuggee;
gPanel = aPanel; gPanel = aPanel;
gDebugger = gPanel.panelWin; gDebugger = gPanel.panelWin;
gSearchBox = gDebugger.DebuggerView.Filtering._searchbox; gSearchBox = gDebugger.DebuggerView.Filtering._searchbox;
@ -28,7 +27,7 @@ function test() {
ok(false, "Got an error: " + aError.message + "\n" + aError.stack); ok(false, "Got an error: " + aError.message + "\n" + aError.stack);
}); });
gDebuggee.firstCall(); callInTab(gTab, "firstCall");
}); });
} }
@ -52,7 +51,6 @@ function hidePopup() {
registerCleanupFunction(function() { registerCleanupFunction(function() {
gTab = null; gTab = null;
gDebuggee = null;
gPanel = null; gPanel = null;
gDebugger = null; gDebugger = null;
gSearchBox = null; gSearchBox = null;

View File

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

View File

@ -6,7 +6,7 @@
*/ */
function test() { function test() {
initDebugger("about:blank").then(([aTab, aDebuggee, aPanel]) => { initDebugger("about:blank").then(([aTab,, aPanel]) => {
let filterView = aPanel.panelWin.DebuggerView.Filtering; let filterView = aPanel.panelWin.DebuggerView.Filtering;
let searchbox = aPanel.panelWin.DebuggerView.Filtering._searchbox; let searchbox = aPanel.panelWin.DebuggerView.Filtering._searchbox;

View File

@ -130,9 +130,6 @@ endif
ifdef MOZ_SHARED_ICU ifdef MOZ_SHARED_ICU
DEFINES += -DMOZ_SHARED_ICU DEFINES += -DMOZ_SHARED_ICU
endif endif
ifdef MOZ_REPLACE_MALLOC
DEFINES += -DMOZ_REPLACE_MALLOC
endif
ifdef MOZ_JEMALLOC3 ifdef MOZ_JEMALLOC3
DEFINES += -DMOZ_JEMALLOC3 DEFINES += -DMOZ_JEMALLOC3
endif endif

View File

@ -103,7 +103,7 @@
.cm-s-mozilla .cm-unused-line { .cm-s-mozilla .cm-unused-line {
text-decoration: line-through; text-decoration: line-through;
-moz-text-decoration-color: #5f88b0; text-decoration-color: #5f88b0;
} }
.cm-s-mozilla .cm-executed-line { .cm-s-mozilla .cm-executed-line {

View File

@ -76,7 +76,7 @@
.cm-s-mozilla .cm-unused-line { .cm-s-mozilla .cm-unused-line {
text-decoration: line-through; text-decoration: line-through;
-moz-text-decoration-color: #5f88b0; text-decoration-color: #5f88b0;
} }
.cm-s-mozilla .cm-executed-line { .cm-s-mozilla .cm-executed-line {

View File

@ -198,7 +198,7 @@
} }
.theme-light .ruleview-overridden { .theme-light .ruleview-overridden {
-moz-text-decoration-color: #667380; /* Content (Text) - Dark Grey */ text-decoration-color: #667380; /* Content (Text) - Dark Grey */
} }
.styleinspector-propertyeditor { .styleinspector-propertyeditor {

View File

@ -7161,6 +7161,7 @@ if test -n "$MOZ_REPLACE_MALLOC" -a -z "$MOZ_MEMORY"; then
dnl deliberate choice not to enable it (bug 702250, for instance) dnl deliberate choice not to enable it (bug 702250, for instance)
AC_MSG_ERROR([--enable-replace-malloc requires --enable-jemalloc]) AC_MSG_ERROR([--enable-replace-malloc requires --enable-jemalloc])
elif test -n "$MOZ_REPLACE_MALLOC"; then elif test -n "$MOZ_REPLACE_MALLOC"; then
AC_DEFINE(MOZ_REPLACE_MALLOC)
MOZ_NATIVE_JEMALLOC= MOZ_NATIVE_JEMALLOC=
dnl Replace-malloc Mac linkage quirks dnl Replace-malloc Mac linkage quirks
@ -7383,17 +7384,7 @@ USE_ELF_HACK=1
MOZ_ARG_DISABLE_BOOL(elf-hack, MOZ_ARG_DISABLE_BOOL(elf-hack,
[ --disable-elf-hack Disable elf hacks], [ --disable-elf-hack Disable elf hacks],
[USE_ELF_HACK=], [USE_ELF_HACK=],
[USE_ELF_HACK=F # Force enable elf-hack]) [USE_ELF_HACK=1])
# Disable elf hack for profiling because the built in profiler
# doesn't read the segments properly with elf hack. This is
# temporary and should be fixed soon in the profiler.
if test "$MOZ_PROFILING" = 1; then
if test "$USE_ELF_HACK" = F; then
AC_ERROR([--enable-elf-hack is not compatible with --enable-profiling])
fi
USE_ELF_HACK=
fi
# Only enable elfhack where supported # Only enable elfhack where supported
if test "$USE_ELF_HACK" = 1; then if test "$USE_ELF_HACK" = 1; then

View File

@ -62,7 +62,6 @@ EventSource::EventSource(nsPIDOMWindow* aOwnerWindow) :
mGoingToDispatchAllMessages(false), mGoingToDispatchAllMessages(false),
mWithCredentials(false), mWithCredentials(false),
mWaitingForOnStopRequest(false), mWaitingForOnStopRequest(false),
mInterrupted(false),
mLastConvertionResult(NS_OK), mLastConvertionResult(NS_OK),
mReadyState(CONNECTING), mReadyState(CONNECTING),
mScriptLine(0), mScriptLine(0),
@ -341,21 +340,14 @@ EventSource::OnStartRequest(nsIRequest *aRequest,
nsCOMPtr<nsIHttpChannel> httpChannel = do_QueryInterface(aRequest, &rv); nsCOMPtr<nsIHttpChannel> httpChannel = do_QueryInterface(aRequest, &rv);
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
bool requestSucceeded;
rv = httpChannel->GetRequestSucceeded(&requestSucceeded);
NS_ENSURE_SUCCESS(rv, rv);
nsAutoCString contentType;
rv = httpChannel->GetContentType(contentType);
NS_ENSURE_SUCCESS(rv, rv);
nsresult status; nsresult status;
aRequest->GetStatus(&status); rv = aRequest->GetStatus(&status);
NS_ENSURE_SUCCESS(rv, rv);
if (NS_FAILED(status) || !requestSucceeded || if (NS_FAILED(status)) {
!contentType.EqualsLiteral(TEXT_EVENT_STREAM)) { // EventSource::OnStopRequest will evaluate if it shall either reestablish
DispatchFailConnection(); // or fail the connection
return NS_ERROR_NOT_AVAILABLE; return NS_ERROR_ABORT;
} }
uint32_t httpStatus; uint32_t httpStatus;
@ -363,7 +355,15 @@ EventSource::OnStartRequest(nsIRequest *aRequest,
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
if (httpStatus != 200) { if (httpStatus != 200) {
mInterrupted = true; DispatchFailConnection();
return NS_ERROR_ABORT;
}
nsAutoCString contentType;
rv = httpChannel->GetContentType(contentType);
NS_ENSURE_SUCCESS(rv, rv);
if (!contentType.EqualsLiteral(TEXT_EVENT_STREAM)) {
DispatchFailConnection(); DispatchFailConnection();
return NS_ERROR_ABORT; return NS_ERROR_ABORT;
} }
@ -454,19 +454,27 @@ EventSource::OnStopRequest(nsIRequest *aRequest,
return NS_ERROR_ABORT; return NS_ERROR_ABORT;
} }
if (NS_FAILED(aStatusCode)) { // "Network errors that prevents the connection from being established in the
// first place (e.g. DNS errors), must cause the user agent to asynchronously
// reestablish the connection.
//
// (...) the cancelation of the fetch algorithm by the user agent (e.g. in
// response to window.stop() or the user canceling the network connection
// manually) must cause the user agent to fail the connection.
if (NS_FAILED(aStatusCode) &&
aStatusCode != NS_ERROR_CONNECTION_REFUSED &&
aStatusCode != NS_ERROR_NET_TIMEOUT &&
aStatusCode != NS_ERROR_NET_RESET &&
aStatusCode != NS_ERROR_NET_INTERRUPT &&
aStatusCode != NS_ERROR_PROXY_CONNECTION_REFUSED &&
aStatusCode != NS_ERROR_DNS_LOOKUP_QUEUE_FULL) {
DispatchFailConnection(); DispatchFailConnection();
return aStatusCode; return NS_ERROR_ABORT;
} }
nsresult rv; nsresult rv = CheckHealthOfRequestCallback(aRequest);
nsresult healthOfRequestResult = CheckHealthOfRequestCallback(aRequest); NS_ENSURE_SUCCESS(rv, rv);
if (NS_SUCCEEDED(healthOfRequestResult) &&
mLastConvertionResult == NS_PARTIAL_MORE_INPUT) {
// we had an incomplete UTF8 char at the end of the stream
rv = ParseCharacter(REPLACEMENT_CHAR);
NS_ENSURE_SUCCESS(rv, rv);
}
ClearFields(); ClearFields();
@ -477,7 +485,7 @@ EventSource::OnStopRequest(nsIRequest *aRequest,
rv = NS_DispatchToMainThread(event); rv = NS_DispatchToMainThread(event);
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
return healthOfRequestResult; return NS_OK;
} }
/** /**
@ -869,11 +877,6 @@ EventSource::ReestablishConnection()
return; return;
} }
if (mReadyState != OPEN) {
NS_WARNING("Unexpected mReadyState!!!");
return;
}
nsresult rv = ResetConnection(); nsresult rv = ResetConnection();
if (NS_FAILED(rv)) { if (NS_FAILED(rv)) {
NS_WARNING("Failed to reset the connection!!!"); NS_WARNING("Failed to reset the connection!!!");
@ -994,7 +997,7 @@ EventSource::ConsoleError()
NS_ConvertUTF8toUTF16 specUTF16(targetSpec); NS_ConvertUTF8toUTF16 specUTF16(targetSpec);
const char16_t *formatStrings[] = { specUTF16.get() }; const char16_t *formatStrings[] = { specUTF16.get() };
if (mReadyState == CONNECTING && !mInterrupted) { if (mReadyState == CONNECTING) {
rv = PrintErrorOnConsole("chrome://global/locale/appstrings.properties", rv = PrintErrorOnConsole("chrome://global/locale/appstrings.properties",
MOZ_UTF16("connectionFailure"), MOZ_UTF16("connectionFailure"),
formatStrings, ArrayLength(formatStrings)); formatStrings, ArrayLength(formatStrings));

View File

@ -221,7 +221,6 @@ protected:
bool mGoingToDispatchAllMessages; bool mGoingToDispatchAllMessages;
bool mWithCredentials; bool mWithCredentials;
bool mWaitingForOnStopRequest; bool mWaitingForOnStopRequest;
bool mInterrupted;
// used while reading the input streams // used while reading the input streams
nsCOMPtr<nsIUnicodeDecoder> mUnicodeDecoder; nsCOMPtr<nsIUnicodeDecoder> mUnicodeDecoder;

View File

@ -14094,8 +14094,12 @@ void
nsGlobalWindow::ClearDocumentDependentSlots(JSContext* aCx) nsGlobalWindow::ClearDocumentDependentSlots(JSContext* aCx)
{ {
MOZ_ASSERT(IsInnerWindow()); MOZ_ASSERT(IsInnerWindow());
WindowBinding::ClearCachedDocumentValue(aCx, this);
WindowBinding::ClearCachedPerformanceValue(aCx, this); // If JSAPI OOMs here, there is basically nothing we can do to recover safely.
if (!WindowBinding::ClearCachedDocumentValue(aCx, this) ||
!WindowBinding::ClearCachedPerformanceValue(aCx, this)) {
MOZ_CRASH("Unhandlable OOM while clearing document dependent slots.");
}
} }
/* static */ /* static */

View File

@ -182,7 +182,7 @@ nsImageLoadingContent::Notify(imgIRequest* aRequest,
} }
nsresult status = nsresult status =
reqStatus & imgIRequest::STATUS_ERROR ? NS_ERROR_FAILURE : NS_OK; reqStatus & imgIRequest::STATUS_ERROR ? NS_ERROR_FAILURE : NS_OK;
return OnStopRequest(aRequest, status); return OnLoadComplete(aRequest, status);
} }
if (aType == imgINotificationObserver::DECODE_COMPLETE) { if (aType == imgINotificationObserver::DECODE_COMPLETE) {
@ -205,8 +205,7 @@ nsImageLoadingContent::Notify(imgIRequest* aRequest,
} }
nsresult nsresult
nsImageLoadingContent::OnStopRequest(imgIRequest* aRequest, nsImageLoadingContent::OnLoadComplete(imgIRequest* aRequest, nsresult aStatus)
nsresult aStatus)
{ {
uint32_t oldStatus; uint32_t oldStatus;
aRequest->GetImageStatus(&oldStatus); aRequest->GetImageStatus(&oldStatus);

View File

@ -209,7 +209,7 @@ protected:
nsIContent* aBindingParent, bool aCompileEventHandlers); nsIContent* aBindingParent, bool aCompileEventHandlers);
void UnbindFromTree(bool aDeep, bool aNullParent); void UnbindFromTree(bool aDeep, bool aNullParent);
nsresult OnStopRequest(imgIRequest* aRequest, nsresult aStatus); nsresult OnLoadComplete(imgIRequest* aRequest, nsresult aStatus);
void OnUnlockedDraw(); void OnUnlockedDraw();
nsresult OnImageIsAnimated(imgIRequest *aRequest); nsresult OnImageIsAnimated(imgIRequest *aRequest);

View File

@ -2411,14 +2411,6 @@ DOMGCSliceCallback(JSRuntime *aRt, JS::GCProgress aProgress, const JS::GCDescrip
(*sPrevGCSliceCallback)(aRt, aProgress, aDesc); (*sPrevGCSliceCallback)(aRt, aProgress, aDesc);
} }
void
nsJSContext::ReportPendingException()
{
if (mIsInitialized) {
nsJSUtils::ReportPendingException(mContext);
}
}
void void
nsJSContext::SetWindowProxy(JS::Handle<JSObject*> aWindowProxy) nsJSContext::SetWindowProxy(JS::Handle<JSObject*> aWindowProxy)
{ {

View File

@ -146,11 +146,6 @@ protected:
nsresult AddSupportsPrimitiveTojsvals(nsISupports *aArg, JS::Value *aArgv); nsresult AddSupportsPrimitiveTojsvals(nsISupports *aArg, JS::Value *aArgv);
// Report the pending exception on our mContext, if any. This
// function will set aside the frame chain on mContext before
// reporting.
void ReportPendingException();
private: private:
void DestroyJSContext(); void DestroyJSContext();

View File

@ -28,6 +28,7 @@
#include "nsHashKeys.h" #include "nsHashKeys.h"
#include "nsCCUncollectableMarker.h" #include "nsCCUncollectableMarker.h"
#include "nsNameSpaceManager.h" #include "nsNameSpaceManager.h"
#include "nsDocument.h"
using namespace mozilla; using namespace mozilla;
using mozilla::dom::NodeInfo; using mozilla::dom::NodeInfo;
@ -153,11 +154,6 @@ NS_IMPL_CYCLE_COLLECTION_CLASS(nsNodeInfoManager)
NS_IMPL_CYCLE_COLLECTION_UNLINK_0(nsNodeInfoManager) NS_IMPL_CYCLE_COLLECTION_UNLINK_0(nsNodeInfoManager)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsNodeInfoManager) NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsNodeInfoManager)
if (tmp->mDocument &&
nsCCUncollectableMarker::InGeneration(cb,
tmp->mDocument->GetMarkedCCGeneration())) {
return NS_SUCCESS_INTERRUPTED_TRAVERSE;
}
if (tmp->mNonDocumentNodeInfos) { if (tmp->mNonDocumentNodeInfos) {
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_RAWPTR(mDocument) NS_IMPL_CYCLE_COLLECTION_TRAVERSE_RAWPTR(mDocument)
} }
@ -167,6 +163,24 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(nsNodeInfoManager, AddRef) NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(nsNodeInfoManager, AddRef)
NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(nsNodeInfoManager, Release) NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(nsNodeInfoManager, Release)
NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_BEGIN(nsNodeInfoManager)
if (tmp->mDocument) {
return NS_CYCLE_COLLECTION_PARTICIPANT(nsDocument)->CanSkip(tmp->mDocument, aRemovingAllowed);
}
NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_END
NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_IN_CC_BEGIN(nsNodeInfoManager)
if (tmp->mDocument) {
return NS_CYCLE_COLLECTION_PARTICIPANT(nsDocument)->CanSkipInCC(tmp->mDocument);
}
NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_IN_CC_END
NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_THIS_BEGIN(nsNodeInfoManager)
if (tmp->mDocument) {
return NS_CYCLE_COLLECTION_PARTICIPANT(nsDocument)->CanSkipThis(tmp->mDocument);
}
NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_THIS_END
nsresult nsresult
nsNodeInfoManager::Init(nsIDocument *aDocument) nsNodeInfoManager::Init(nsIDocument *aDocument)
{ {

View File

@ -40,7 +40,7 @@ private:
public: public:
nsNodeInfoManager(); nsNodeInfoManager();
NS_DECL_CYCLE_COLLECTION_NATIVE_CLASS(nsNodeInfoManager) NS_DECL_CYCLE_COLLECTION_SKIPPABLE_NATIVE_CLASS(nsNodeInfoManager)
NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(nsNodeInfoManager) NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(nsNodeInfoManager)

View File

@ -353,13 +353,13 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=338583
function fnMessageListenerTest3h(e) { function fnMessageListenerTest3h(e) {
fnMessageListenerTest3h.msg_ok = (fnMessageListenerTest3h.msg_ok && e.data == "ok"); fnMessageListenerTest3h.msg_ok = (fnMessageListenerTest3h.msg_ok && e.data == "ok");
fnMessageListenerTest3h.id_ok = (fnMessageListenerTest3h.msg_ok && e.lastEventId == ""); fnMessageListenerTest3h.id_ok = (fnMessageListenerTest3h.id_ok && e.lastEventId == "");
} }
function doTest3_h(test_id) { function doTest3_h(test_id) {
gEventSourceObj3_h = new EventSource("badMessageEvent2.eventsource"); gEventSourceObj3_h = new EventSource("badMessageEvent2.eventsource");
gEventSourceObj3_h.addEventListener('message event', fnMessageListenerTest3h, true); gEventSourceObj3_h.addEventListener('message', fnMessageListenerTest3h, true);
fnMessageListenerTest3h.msg_ok = true; fnMessageListenerTest3h.msg_ok = true;
fnMessageListenerTest3h.id_ok = true; fnMessageListenerTest3h.id_ok = true;
@ -375,7 +375,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=338583
} }
gEventSourceObj3_h.close(); gEventSourceObj3_h.close();
setTestHasFinished(test_id); setTestHasFinished(test_id);
}, parseInt(3000*stress_factor)); }, parseInt(6000*stress_factor));
} }
// in order to test (4) // in order to test (4)

View File

@ -3474,7 +3474,6 @@ class CGClearCachedValueMethod(CGAbstractMethod):
JSAutoCompartment ac(aCx, obj); JSAutoCompartment ac(aCx, obj);
if (!get_${name}(aCx, obj, aObject, args)) { if (!get_${name}(aCx, obj, aObject, args)) {
js::SetReservedSlot(obj, ${slotIndex}, oldValue); js::SetReservedSlot(obj, ${slotIndex}, oldValue);
nsJSUtils::ReportPendingException(aCx);
return false; return false;
} }
return true; return true;

View File

@ -4,47 +4,48 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "WebGL1Context.h" #include "WebGL1Context.h"
#include "mozilla/dom/WebGLRenderingContextBinding.h"
#include "mozilla/dom/WebGLRenderingContextBinding.h"
#include "mozilla/Telemetry.h" #include "mozilla/Telemetry.h"
using namespace mozilla; namespace mozilla {
// ----------------------------------------------------------------------------- /*static*/ WebGL1Context*
// CONSTRUCTOR & DESTRUCTOR WebGL1Context::Create()
{
return new WebGL1Context();
}
WebGL1Context::WebGL1Context() WebGL1Context::WebGL1Context()
: WebGLContext() : WebGLContext()
{ {
} }
WebGL1Context::~WebGL1Context() WebGL1Context::~WebGL1Context()
{ {
} }
////////////////////////////////////////
// ----------------------------------------------------------------------------- // nsWrapperCache
// IMPLEMENT nsWrapperCache
JSObject* JSObject*
WebGL1Context::WrapObject(JSContext *cx) WebGL1Context::WrapObject(JSContext* cx)
{ {
return dom::WebGLRenderingContextBinding::Wrap(cx, this); return dom::WebGLRenderingContextBinding::Wrap(cx, this);
} }
} // namespace mozilla
// ----------------------------------------------------------------------------- ////////////////////////////////////////
// INSTANCING nsIDOMWebGLRenderingContext // nsIDOMWebGLRenderingContext
nsresult nsresult
NS_NewCanvasRenderingContextWebGL(nsIDOMWebGLRenderingContext** aResult) NS_NewCanvasRenderingContextWebGL(nsIDOMWebGLRenderingContext** out_result)
{ {
Telemetry::Accumulate(Telemetry::CANVAS_WEBGL_USED, 1); mozilla::Telemetry::Accumulate(mozilla::Telemetry::CANVAS_WEBGL_USED, 1);
nsIDOMWebGLRenderingContext* ctx = new WebGL1Context();
NS_ADDREF(*aResult = ctx); nsIDOMWebGLRenderingContext* ctx = mozilla::WebGL1Context::Create();
NS_ADDREF(*out_result = ctx);
return NS_OK; return NS_OK;
} }

View File

@ -3,8 +3,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef WEBGL1CONTEXT_H_ #ifndef WEBGL_1_CONTEXT_H_
#define WEBGL1CONTEXT_H_ #define WEBGL_1_CONTEXT_H_
#include "WebGLContext.h" #include "WebGLContext.h"
@ -13,34 +13,23 @@ namespace mozilla {
class WebGL1Context class WebGL1Context
: public WebGLContext : public WebGLContext
{ {
// -----------------------------------------------------------------------------
// PUBLIC
public: public:
static WebGL1Context* Create();
// ------------------------------------------------------------------------- private:
// CONSTRUCTOR & DESTRUCTOR
WebGL1Context(); WebGL1Context();
public:
virtual ~WebGL1Context(); virtual ~WebGL1Context();
virtual bool IsWebGL2() const MOZ_OVERRIDE {
// -------------------------------------------------------------------------
// IMPLEMENT WebGLContext
virtual bool IsWebGL2() const MOZ_OVERRIDE
{
return false; return false;
} }
// nsWrapperCache
// ------------------------------------------------------------------------- virtual JSObject* WrapObject(JSContext* cx) MOZ_OVERRIDE;
// IMPLEMENT nsWrapperCache
virtual JSObject* WrapObject(JSContext *cx) MOZ_OVERRIDE;
}; };
} // namespace mozilla } // namespace mozilla
#endif #endif // WEBGL_1_CONTEXT_H_

View File

@ -4,6 +4,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "WebGL2Context.h" #include "WebGL2Context.h"
#include "WebGLSampler.h"
#include "GLContext.h" #include "GLContext.h"
using namespace mozilla; using namespace mozilla;
@ -12,67 +13,206 @@ using namespace mozilla::dom;
already_AddRefed<WebGLSampler> already_AddRefed<WebGLSampler>
WebGL2Context::CreateSampler() WebGL2Context::CreateSampler()
{ {
MOZ_CRASH("Not Implemented."); if (IsContextLost())
return nullptr; return nullptr;
GLuint sampler;
MakeContextCurrent();
gl->fGenSamplers(1, &sampler);
nsRefPtr<WebGLSampler> globj = new WebGLSampler(this, sampler);
return globj.forget();
} }
void void
WebGL2Context::DeleteSampler(WebGLSampler* sampler) WebGL2Context::DeleteSampler(WebGLSampler* sampler)
{ {
MOZ_CRASH("Not Implemented."); if (IsContextLost())
return;
if (!ValidateObjectAllowDeletedOrNull("deleteSampler", sampler))
return;
if (!sampler || sampler->IsDeleted())
return;
sampler->RequestDelete();
} }
bool bool
WebGL2Context::IsSampler(WebGLSampler* sampler) WebGL2Context::IsSampler(WebGLSampler* sampler)
{ {
MOZ_CRASH("Not Implemented."); if (IsContextLost())
return false; return false;
if (!sampler)
return false;
if (!ValidateObjectAllowDeleted("isSampler", sampler))
return false;
if (sampler->IsDeleted())
return false;
return !sampler->HasEverBeenBound();
} }
void void
WebGL2Context::BindSampler(GLuint unit, WebGLSampler* sampler) WebGL2Context::BindSampler(GLuint unit, WebGLSampler* sampler)
{ {
MOZ_CRASH("Not Implemented."); if (IsContextLost())
return;
if (!ValidateObjectAllowDeletedOrNull("bindSampler", sampler))
return;
if (GLint(unit) >= mGLMaxTextureUnits)
return ErrorInvalidValue("bindSampler: unit must be < %d", mGLMaxTextureUnits);
if (sampler && sampler->IsDeleted())
return ErrorInvalidOperation("bindSampler: binding deleted sampler");
WebGLContextUnchecked::BindSampler(unit, sampler);
} }
void void
WebGL2Context::SamplerParameteri(WebGLSampler* sampler, GLenum pname, GLint param) WebGL2Context::SamplerParameteri(WebGLSampler* sampler, GLenum pname, GLint param)
{ {
MOZ_CRASH("Not Implemented."); if (IsContextLost())
return;
if (!sampler || sampler->IsDeleted())
return ErrorInvalidOperation("samplerParameteri: invalid sampler");
if (!ValidateSamplerParameterParams(pname, WebGLIntOrFloat(param), "samplerParameteri"))
return;
WebGLContextUnchecked::SamplerParameteri(sampler, pname, param);
} }
void void
WebGL2Context::SamplerParameteriv(WebGLSampler* sampler, GLenum pname, const dom::Int32Array& param) WebGL2Context::SamplerParameteriv(WebGLSampler* sampler, GLenum pname, const dom::Int32Array& param)
{ {
MOZ_CRASH("Not Implemented."); if (IsContextLost())
return;
if (!sampler || sampler->IsDeleted())
return ErrorInvalidOperation("samplerParameteriv: invalid sampler");
param.ComputeLengthAndData();
if (param.Length() < 1)
return /* TODO(djg): Error message */;
/* TODO(djg): All of these calls in ES3 only take 1 param */
if (!ValidateSamplerParameterParams(pname, WebGLIntOrFloat(param.Data()[0]), "samplerParameteriv"))
return;
WebGLContextUnchecked::SamplerParameteriv(sampler, pname, param.Data());
} }
void void
WebGL2Context::SamplerParameteriv(WebGLSampler* sampler, GLenum pname, const dom::Sequence<GLint>& param) WebGL2Context::SamplerParameteriv(WebGLSampler* sampler, GLenum pname, const dom::Sequence<GLint>& param)
{ {
MOZ_CRASH("Not Implemented."); if (IsContextLost())
return;
if (!sampler || sampler->IsDeleted())
return ErrorInvalidOperation("samplerParameteriv: invalid sampler");
if (param.Length() < 1)
return /* TODO(djg): Error message */;
/* TODO(djg): All of these calls in ES3 only take 1 param */
if (!ValidateSamplerParameterParams(pname, WebGLIntOrFloat(param[0]), "samplerParameteriv"))
return;
WebGLContextUnchecked::SamplerParameteriv(sampler, pname, param.Elements());
} }
void void
WebGL2Context::SamplerParameterf(WebGLSampler* sampler, GLenum pname, GLfloat param) WebGL2Context::SamplerParameterf(WebGLSampler* sampler, GLenum pname, GLfloat param)
{ {
MOZ_CRASH("Not Implemented."); if (IsContextLost())
return;
if (!sampler || sampler->IsDeleted())
return ErrorInvalidOperation("samplerParameterf: invalid sampler");
if (!ValidateSamplerParameterParams(pname, WebGLIntOrFloat(param), "samplerParameterf"))
return;
WebGLContextUnchecked::SamplerParameterf(sampler, pname, param);
} }
void void
WebGL2Context::SamplerParameterfv(WebGLSampler* sampler, GLenum pname, const dom::Float32Array& param) WebGL2Context::SamplerParameterfv(WebGLSampler* sampler, GLenum pname, const dom::Float32Array& param)
{ {
MOZ_CRASH("Not Implemented."); if (IsContextLost())
return;
if (!sampler || sampler->IsDeleted())
return ErrorInvalidOperation("samplerParameterfv: invalid sampler");
param.ComputeLengthAndData();
if (param.Length() < 1)
return /* TODO(djg): Error message */;
/* TODO(djg): All of these calls in ES3 only take 1 param */
if (!ValidateSamplerParameterParams(pname, WebGLIntOrFloat(param.Data()[0]), "samplerParameterfv"))
return;
WebGLContextUnchecked::SamplerParameterfv(sampler, pname, param.Data());
} }
void void
WebGL2Context::SamplerParameterfv(WebGLSampler* sampler, GLenum pname, const dom::Sequence<GLfloat>& param) WebGL2Context::SamplerParameterfv(WebGLSampler* sampler, GLenum pname, const dom::Sequence<GLfloat>& param)
{ {
MOZ_CRASH("Not Implemented."); if (IsContextLost())
return;
if (!sampler || sampler->IsDeleted())
return ErrorInvalidOperation("samplerParameterfv: invalid sampler");
if (param.Length() < 1)
return /* TODO(djg): Error message */;
/* TODO(djg): All of these calls in ES3 only take 1 param */
if (!ValidateSamplerParameterParams(pname, WebGLIntOrFloat(param[0]), "samplerParameterfv"))
return;
WebGLContextUnchecked::SamplerParameterfv(sampler, pname, param.Elements());
} }
void void
WebGL2Context::GetSamplerParameter(JSContext*, WebGLSampler* sampler, GLenum pname, JS::MutableHandleValue retval) WebGL2Context::GetSamplerParameter(JSContext*, WebGLSampler* sampler, GLenum pname, JS::MutableHandleValue retval)
{ {
MOZ_CRASH("Not Implemented."); if (IsContextLost())
return;
if (!sampler || sampler->IsDeleted())
return ErrorInvalidOperation("getSamplerParameter: invalid sampler");
if (!ValidateSamplerParameterName(pname, "getSamplerParameter"))
return;
retval.set(JS::NullValue());
switch (pname) {
case LOCAL_GL_TEXTURE_MIN_FILTER:
case LOCAL_GL_TEXTURE_MAG_FILTER:
case LOCAL_GL_TEXTURE_WRAP_S:
case LOCAL_GL_TEXTURE_WRAP_T:
case LOCAL_GL_TEXTURE_WRAP_R:
case LOCAL_GL_TEXTURE_COMPARE_MODE:
case LOCAL_GL_TEXTURE_COMPARE_FUNC:
retval.set(JS::Int32Value(
WebGLContextUnchecked::GetSamplerParameteriv(sampler, pname)));
return;
case LOCAL_GL_TEXTURE_MIN_LOD:
case LOCAL_GL_TEXTURE_MAX_LOD:
retval.set(JS::Float32Value(
WebGLContextUnchecked::GetSamplerParameterfv(sampler, pname)));
return;
}
} }

View File

@ -7,15 +7,16 @@
#include "WebGLContextLossHandler.h" #include "WebGLContextLossHandler.h"
#include "WebGL1Context.h" #include "WebGL1Context.h"
#include "WebGLObjectModel.h"
#include "WebGLExtensions.h"
#include "WebGLContextUtils.h"
#include "WebGLBuffer.h" #include "WebGLBuffer.h"
#include "WebGLVertexAttribData.h" #include "WebGLContextUtils.h"
#include "WebGLMemoryTracker.h" #include "WebGLExtensions.h"
#include "WebGLFramebuffer.h" #include "WebGLFramebuffer.h"
#include "WebGLVertexArray.h" #include "WebGLMemoryTracker.h"
#include "WebGLObjectModel.h"
#include "WebGLQuery.h" #include "WebGLQuery.h"
#include "WebGLSampler.h"
#include "WebGLVertexArray.h"
#include "WebGLVertexAttribData.h"
#include "GLBlitHelper.h" #include "GLBlitHelper.h"
#include "AccessCheck.h" #include "AccessCheck.h"
@ -226,7 +227,7 @@ WebGLContextOptions::WebGLContextOptions()
} }
WebGLContext::WebGLContext() WebGLContext::WebGLContext()
: gl(nullptr) : WebGLContextUnchecked(nullptr)
, mNeedsFakeNoAlpha(false) , mNeedsFakeNoAlpha(false)
{ {
mGeneration = 0; mGeneration = 0;
@ -371,6 +372,8 @@ WebGLContext::DestroyResourcesAndContext()
mPrograms.getLast()->DeleteOnce(); mPrograms.getLast()->DeleteOnce();
while (!mQueries.isEmpty()) while (!mQueries.isEmpty())
mQueries.getLast()->DeleteOnce(); mQueries.getLast()->DeleteOnce();
while (!mSamplers.isEmpty())
mSamplers.getLast()->DeleteOnce();
mBlackOpaqueTexture2D = nullptr; mBlackOpaqueTexture2D = nullptr;
mBlackOpaqueTextureCubeMap = nullptr; mBlackOpaqueTextureCubeMap = nullptr;

View File

@ -15,6 +15,7 @@
#include "GLDefs.h" #include "GLDefs.h"
#include "WebGLActiveInfo.h" #include "WebGLActiveInfo.h"
#include "WebGLContextUnchecked.h"
#include "WebGLObjectModel.h" #include "WebGLObjectModel.h"
#include "WebGLRenderbuffer.h" #include "WebGLRenderbuffer.h"
#include "WebGLTexture.h" #include "WebGLTexture.h"
@ -78,10 +79,12 @@ class WebGLQuery;
class WebGLUniformLocation; class WebGLUniformLocation;
class WebGLFramebuffer; class WebGLFramebuffer;
class WebGLRenderbuffer; class WebGLRenderbuffer;
class WebGLSampler;
class WebGLShaderPrecisionFormat; class WebGLShaderPrecisionFormat;
class WebGLTexture; class WebGLTexture;
class WebGLVertexArray; class WebGLVertexArray;
namespace dom { namespace dom {
class ImageData; class ImageData;
class Element; class Element;
@ -127,10 +130,29 @@ struct WebGLContextOptions {
// From WebGLContextUtils // From WebGLContextUtils
TexTarget TexImageTargetToTexTarget(TexImageTarget texImageTarget); TexTarget TexImageTargetToTexTarget(TexImageTarget texImageTarget);
class WebGLIntOrFloat {
enum {
Int,
Float
} mType;
union {
GLint i;
GLfloat f;
} mValue;
public:
explicit WebGLIntOrFloat(GLint i) : mType(Int) { mValue.i = i; }
explicit WebGLIntOrFloat(GLfloat f) : mType(Float) { mValue.f = f; }
GLint AsInt() const { return (mType == Int) ? mValue.i : NS_lroundf(mValue.f); }
GLfloat AsFloat() const { return (mType == Float) ? mValue.f : GLfloat(mValue.i); }
};
class WebGLContext : class WebGLContext :
public nsIDOMWebGLRenderingContext, public nsIDOMWebGLRenderingContext,
public nsICanvasRenderingContextInternal, public nsICanvasRenderingContextInternal,
public nsSupportsWeakReference, public nsSupportsWeakReference,
public WebGLContextUnchecked,
public WebGLRectangleObject, public WebGLRectangleObject,
public nsWrapperCache, public nsWrapperCache,
public SupportsWeakPtr<WebGLContext> public SupportsWeakPtr<WebGLContext>
@ -1005,8 +1027,6 @@ protected:
return ((x + y - 1) / y) * y; return ((x + y - 1) / y) * y;
} }
nsRefPtr<gl::GLContext> gl;
CheckedUint32 mGeneration; CheckedUint32 mGeneration;
WebGLContextOptions mOptions; WebGLContextOptions mOptions;
@ -1138,6 +1158,10 @@ protected:
bool ValidateCopyTexImage(GLenum internalformat, bool ValidateCopyTexImage(GLenum internalformat,
WebGLTexImageFunc func, WebGLTexImageFunc func,
WebGLTexDimensions dims); WebGLTexDimensions dims);
bool ValidateSamplerParameterName(GLenum pname, const char* info);
bool ValidateSamplerParameterParams(GLenum pname, const WebGLIntOrFloat& param, const char* info);
bool ValidateTexImage(TexImageTarget texImageTarget, bool ValidateTexImage(TexImageTarget texImageTarget,
GLint level, GLenum internalFormat, GLint level, GLenum internalFormat,
GLint xoffset, GLint yoffset, GLint zoffset, GLint xoffset, GLint yoffset, GLint zoffset,
@ -1325,6 +1349,9 @@ protected:
LinkedList<WebGLFramebuffer> mFramebuffers; LinkedList<WebGLFramebuffer> mFramebuffers;
LinkedList<WebGLVertexArray> mVertexArrays; LinkedList<WebGLVertexArray> mVertexArrays;
// TODO(djg): Does this need a rethink? Should it be WebGL2Context?
LinkedList<WebGLSampler> mSamplers;
WebGLRefPtr<WebGLVertexArray> mDefaultVertexArray; WebGLRefPtr<WebGLVertexArray> mDefaultVertexArray;
// PixelStore parameters // PixelStore parameters
@ -1440,6 +1467,7 @@ public:
friend class WebGLProgram; friend class WebGLProgram;
friend class WebGLQuery; friend class WebGLQuery;
friend class WebGLBuffer; friend class WebGLBuffer;
friend class WebGLSampler;
friend class WebGLShader; friend class WebGLShader;
friend class WebGLUniformLocation; friend class WebGLUniformLocation;
friend class WebGLVertexArray; friend class WebGLVertexArray;

View File

@ -0,0 +1,96 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* vim: set ts=8 sts=4 et sw=4 tw=80: */
/* 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 "WebGLContextUnchecked.h"
#include "GLContext.h"
#include "WebGLSampler.h"
namespace mozilla {
WebGLContextUnchecked::WebGLContextUnchecked(gl::GLContext* gl)
: gl(gl)
{ }
// -----------------------------------------------------------------------------
// Sampler Objects
void
WebGLContextUnchecked::BindSampler(GLuint unit, WebGLSampler* sampler)
{
gl->MakeCurrent();
gl->fBindSampler(unit, sampler ? sampler->GLName() : 0);
if (sampler)
sampler->BindTo(LOCAL_GL_SAMPLER_BINDING);
}
GLint
WebGLContextUnchecked::GetSamplerParameteriv(WebGLSampler* sampler,
GLenum pname)
{
MOZ_ASSERT(sampler, "Did you validate?");
GLint param = 0;
gl->MakeCurrent();
gl->fGetSamplerParameteriv(sampler->GLName(), pname, &param);
return param;
}
GLfloat
WebGLContextUnchecked::GetSamplerParameterfv(WebGLSampler* sampler,
GLenum pname)
{
MOZ_ASSERT(sampler, "Did you validate?");
GLfloat param = 0.0f;
gl->MakeCurrent();
gl->fGetSamplerParameterfv(sampler->GLName(), pname, &param);
return param;
}
void
WebGLContextUnchecked::SamplerParameteri(WebGLSampler* sampler,
GLenum pname,
GLint param)
{
MOZ_ASSERT(sampler, "Did you validate?");
gl->MakeCurrent();
gl->fSamplerParameteri(sampler->GLName(), pname, param);
}
void
WebGLContextUnchecked::SamplerParameteriv(WebGLSampler* sampler,
GLenum pname,
const GLint* param)
{
MOZ_ASSERT(sampler, "Did you validate?");
gl->MakeCurrent();
gl->fSamplerParameteriv(sampler->GLName(), pname, param);
}
void
WebGLContextUnchecked::SamplerParameterf(WebGLSampler* sampler,
GLenum pname,
GLfloat param)
{
MOZ_ASSERT(sampler, "Did you validate?");
gl->MakeCurrent();
gl->fSamplerParameterf(sampler->GLName(), pname, param);
}
void
WebGLContextUnchecked::SamplerParameterfv(WebGLSampler* sampler,
GLenum pname,
const GLfloat* param)
{
MOZ_ASSERT(sampler, "Did you validate?");
gl->MakeCurrent();
gl->fSamplerParameterfv(sampler->GLName(), pname, param);
}
} // namespace mozilla

View File

@ -0,0 +1,45 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* vim: set ts=8 sts=4 et sw=4 tw=80: */
/* 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/. */
#ifndef WEBGLCONTEXTUNCHECKED_H
#define WEBGLCONTEXTUNCHECKED_H
#include "GLDefs.h"
#include "WebGLTypes.h"
#include "nsAutoPtr.h"
#include "nsTArray.h"
namespace mozilla {
class WebGLSampler;
namespace gl {
class GLContext;
}
class WebGLContextUnchecked
{
public:
explicit WebGLContextUnchecked(gl::GLContext* gl);
// -------------------------------------------------------------------------
// Sampler Objects
void BindSampler(GLuint unit, WebGLSampler* sampler);
GLint GetSamplerParameteriv(WebGLSampler* sampler, GLenum pname);
GLfloat GetSamplerParameterfv(WebGLSampler* sampler, GLenum pname);
void SamplerParameteri(WebGLSampler* sampler, GLenum pname, GLint param);
void SamplerParameteriv(WebGLSampler* sampler, GLenum pname, const GLint* param);
void SamplerParameterf(WebGLSampler* sampler, GLenum pname, GLfloat param);
void SamplerParameterfv(WebGLSampler* sampler, GLenum pname, const GLfloat* param);
protected: // data
nsRefPtr<gl::GLContext> gl;
};
} // namespace mozilla
#endif // !WEBGLCONTEXTUNCHECKED_H

View File

@ -378,6 +378,118 @@ WebGLContext::ValidateFramebufferAttachment(GLenum attachment, const char* funcN
return false; return false;
} }
/**
* Return true if pname is valid for GetSamplerParameter calls.
*/
bool
WebGLContext::ValidateSamplerParameterName(GLenum pname, const char* info)
{
switch (pname) {
case LOCAL_GL_TEXTURE_MIN_FILTER:
case LOCAL_GL_TEXTURE_MAG_FILTER:
case LOCAL_GL_TEXTURE_WRAP_S:
case LOCAL_GL_TEXTURE_WRAP_T:
case LOCAL_GL_TEXTURE_WRAP_R:
case LOCAL_GL_TEXTURE_MIN_LOD:
case LOCAL_GL_TEXTURE_MAX_LOD:
case LOCAL_GL_TEXTURE_COMPARE_MODE:
case LOCAL_GL_TEXTURE_COMPARE_FUNC:
return true;
default:
ErrorInvalidEnum("%s: invalid pname: %s", info, EnumName(pname));
return false;
}
}
/**
* Return true if pname and param are valid combination for SamplerParameter calls.
*/
bool
WebGLContext::ValidateSamplerParameterParams(GLenum pname, const WebGLIntOrFloat& param, const char* info)
{
const GLenum p = param.AsInt();
switch (pname) {
case LOCAL_GL_TEXTURE_MIN_FILTER:
switch (p) {
case LOCAL_GL_NEAREST:
case LOCAL_GL_LINEAR:
case LOCAL_GL_NEAREST_MIPMAP_NEAREST:
case LOCAL_GL_NEAREST_MIPMAP_LINEAR:
case LOCAL_GL_LINEAR_MIPMAP_NEAREST:
case LOCAL_GL_LINEAR_MIPMAP_LINEAR:
return true;
default:
ErrorInvalidEnum("%s: invalid param: %s", info, EnumName(p));
return false;
}
case LOCAL_GL_TEXTURE_MAG_FILTER:
switch (p) {
case LOCAL_GL_NEAREST:
case LOCAL_GL_LINEAR:
return true;
default:
ErrorInvalidEnum("%s: invalid param: %s", info, EnumName(p));
return false;
}
case LOCAL_GL_TEXTURE_WRAP_S:
case LOCAL_GL_TEXTURE_WRAP_T:
case LOCAL_GL_TEXTURE_WRAP_R:
switch (p) {
case LOCAL_GL_CLAMP_TO_EDGE:
case LOCAL_GL_REPEAT:
case LOCAL_GL_MIRRORED_REPEAT:
return true;
default:
ErrorInvalidEnum("%s: invalid param: %s", info, EnumName(p));
return false;
}
case LOCAL_GL_TEXTURE_MIN_LOD:
case LOCAL_GL_TEXTURE_MAX_LOD:
return true;
case LOCAL_GL_TEXTURE_COMPARE_MODE:
switch (param.AsInt()) {
case LOCAL_GL_NONE:
case LOCAL_GL_COMPARE_REF_TO_TEXTURE:
return true;
default:
ErrorInvalidEnum("%s: invalid param: %s", info, EnumName(p));
return false;
}
case LOCAL_GL_TEXTURE_COMPARE_FUNC:
switch (p) {
case LOCAL_GL_LEQUAL:
case LOCAL_GL_GEQUAL:
case LOCAL_GL_LESS:
case LOCAL_GL_GREATER:
case LOCAL_GL_EQUAL:
case LOCAL_GL_NOTEQUAL:
case LOCAL_GL_ALWAYS:
case LOCAL_GL_NEVER:
return true;
default:
ErrorInvalidEnum("%s: invalid param: %s", info, EnumName(p));
return false;
}
default:
ErrorInvalidEnum("%s: invalid pname: %s", info, EnumName(pname));
return false;
}
}
/** /**
* Return true if format is a valid texture image format for source, * Return true if format is a valid texture image format for source,
* taking into account enabled WebGL extensions. * taking into account enabled WebGL extensions.
@ -1718,8 +1830,7 @@ WebGLContext::InitAndValidateGL()
#ifdef XP_MACOSX #ifdef XP_MACOSX
if (gl->WorkAroundDriverBugs() && if (gl->WorkAroundDriverBugs() &&
gl->Vendor() == gl::GLVendor::ATI && gl->Vendor() == gl::GLVendor::ATI &&
nsCocoaFeatures::OSXVersionMajor() == 10 && !nsCocoaFeatures::IsAtLeastVersion(10,9))
nsCocoaFeatures::OSXVersionMinor() < 9)
{ {
// The Mac ATI driver, in all known OSX version up to and including 10.8, // The Mac ATI driver, in all known OSX version up to and including 10.8,
// renders points sprites upside-down. Apple bug 11778921 // renders points sprites upside-down. Apple bug 11778921

View File

@ -373,7 +373,7 @@ WebGLFramebuffer::Attachment::FinalizeAttachment(GLContext* gl, FBAttachment att
MOZ_ASSERT(HasImage()); MOZ_ASSERT(HasImage());
if (Texture()) { if (Texture()) {
MOZ_ASSERT(gl == Texture()->Context()->gl); MOZ_ASSERT(gl == Texture()->Context()->GL());
const GLenum imageTarget = ImageTarget().get(); const GLenum imageTarget = ImageTarget().get();
const GLint mipLevel = MipLevel(); const GLint mipLevel = MipLevel();

View File

@ -12,33 +12,36 @@
using namespace mozilla; using namespace mozilla;
WebGLSampler::WebGLSampler(WebGLContext* context) WebGLSampler::WebGLSampler(WebGLContext* context, GLuint sampler)
: WebGLBindableName<GLenum>(0), : WebGLBindableName<GLenum>(sampler),
WebGLContextBoundObject(context) WebGLContextBoundObject(context)
{ {
MOZ_CRASH("Not Implemented."); mContext->mSamplers.insertBack(this);
} }
WebGLSampler::~WebGLSampler() WebGLSampler::~WebGLSampler()
{} {
DeleteOnce();
}
void void
WebGLSampler::Delete() WebGLSampler::Delete()
{ {
MOZ_CRASH("Not Implemented."); mContext->MakeContextCurrent();
mContext->gl->fDeleteSamplers(1, &mGLName);
removeFrom(mContext->mSamplers);
} }
WebGLContext* WebGLContext*
WebGLSampler::GetParentObject() const WebGLSampler::GetParentObject() const
{ {
MOZ_CRASH("Not Implemented."); return Context();
return nullptr;
} }
JSObject* JSObject*
WebGLSampler::WrapObject(JSContext* cx) WebGLSampler::WrapObject(JSContext* cx)
{ {
MOZ_CRASH("Not Implemented.");
return dom::WebGLSamplerBinding::Wrap(cx, this); return dom::WebGLSamplerBinding::Wrap(cx, this);
} }

View File

@ -3,8 +3,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef WEBGL2SAMPLER_H_ #ifndef WEBGLSAMPLER_H_
#define WEBGL2SAMPLER_H_ #define WEBGLSAMPLER_H_
#include "WebGLBindableName.h" #include "WebGLBindableName.h"
#include "WebGLObjectModel.h" #include "WebGLObjectModel.h"
@ -26,13 +26,15 @@ class WebGLSampler MOZ_FINAL
public: public:
explicit WebGLSampler(WebGLContext* aContext); explicit WebGLSampler(WebGLContext* aContext, GLuint sampler);
void Delete(); void Delete();
WebGLContext* GetParentObject() const; WebGLContext* GetParentObject() const;
virtual JSObject* WrapObject(JSContext* cx) MOZ_OVERRIDE; virtual JSObject* WrapObject(JSContext* cx) MOZ_OVERRIDE;
private:
NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(WebGLSampler) NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(WebGLSampler)
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(WebGLSampler) NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(WebGLSampler)
@ -43,4 +45,4 @@ private:
} // namespace mozilla } // namespace mozilla
#endif // !WEBGL2SAMPLER_H_ #endif // !WEBGLSAMPLER_H_

View File

@ -64,6 +64,7 @@ UNIFIED_SOURCES += [
'WebGLContextLossHandler.cpp', 'WebGLContextLossHandler.cpp',
'WebGLContextReporter.cpp', 'WebGLContextReporter.cpp',
'WebGLContextState.cpp', 'WebGLContextState.cpp',
'WebGLContextUnchecked.cpp',
'WebGLContextUtils.cpp', 'WebGLContextUtils.cpp',
'WebGLContextValidate.cpp', 'WebGLContextValidate.cpp',
'WebGLContextVertexArray.cpp', 'WebGLContextVertexArray.cpp',

View File

@ -1,35 +1,90 @@
<!DOCTYPE HTML> <!DOCTYPE HTML>
<title>WebGL test: Mismatched 'webgl' and 'experimental-webgl' context requests</title> <html>
<head>
<script src="/tests/SimpleTest/SimpleTest.js"></script> <script src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" href="/tests/SimpleTest/test.css"> <link rel="stylesheet" href="/tests/SimpleTest/test.css">
</head>
<body> <body>
<canvas id="c1"></canvas>
<canvas id="c2"></canvas>
<canvas id="c3"></canvas>
<canvas id="c4"></canvas>
<script> <script>
function testContextRetrieval(canvasId, creationId, requestId) { WEBGL_TYPES = {};
var canvas = document.getElementById(canvasId); WEBGL_TYPES['experimental-webgl'] = true;
ok(canvas, 'Invalid `canvasId`: ' + canvasId); WEBGL_TYPES['webgl'] = true;
var createdGL = canvas.getContext(creationId); function AreBothIn(a, b, set) {
if (!createdGL) return (a in set) && (b in set);
return; // No WebGL on this machine?
var requestedGL = canvas.getContext(requestId);
if (creationId == requestId) {
ok(requestedGL, 'Request for \'' + requestId + '\' on from \'' + creationId + '\' should succeed.');
ok(requestedGL == createdGL, 'Request for \'' + requestId + '\' on from \'' + creationId + '\' should match.');
} else {
ok(!requestedGL, 'Request for \'' + requestId + '\' on from \'' + creationId + '\' should fail.');
}
} }
testContextRetrieval('c1', 'experimental-webgl', 'webgl'); function IsAlias(typeA, typeB) {
testContextRetrieval('c2', 'webgl', 'experimental-webgl'); if (typeA == typeB)
testContextRetrieval('c3', 'experimental-webgl', 'experimental-webgl'); return true;
testContextRetrieval('c4', 'webgl', 'webgl');
if (AreBothIn(typeA, typeB, WEBGL_TYPES))
return true;
return false;
}
function TestContextRetrieval(creationType, requestType, functionalTypeSet) {
var canvas = document.createElement('canvas');
var createdGL = canvas.getContext(creationType);
var didCreationSucceed = (createdGL != null);
if (creationType in functionalTypeSet) {
ok(createdGL, 'Context creation should succeed for type \'' +
creationType + '\'');
} else {
ok(!createdGL, 'Context creation should fail for type \'' +
creationType + '\'');
return;
}
var requestedGL = canvas.getContext(requestType);
if (requestType in functionalTypeSet &&
IsAlias(creationType, requestType))
{
ok(requestedGL, 'Request for \'' + requestType + '\' from \'' +
creationType + '\' should succeed.');
ok(requestedGL == createdGL, 'Request for \'' + requestType +
'\' from \'' + creationType +
'\' should match.');
} else {
ok(!requestedGL, 'Request for \'' + requestType + '\' from \'' +
creationType + '\' should fail.');
}
}
function IsWebGLFunctional() {
var canvas = document.createElement('canvas');
return canvas.getContext('experimental-webgl') != null;
}
function IsWebGLConformant() {
var canvas = document.createElement('canvas');
return canvas.getContext('webgl') != null;
}
var typeList = ['2d', 'experimental-webgl', 'webgl'];
var functionalTypeSet = {};
functionalTypeSet['2d'] = true;
if (IsWebGLFunctional())
functionalTypeSet['experimental-webgl'] = true;
if (IsWebGLConformant())
functionalTypeSet['webgl'] = true;
for (var i in typeList) {
var creationType = typeList[i];
for (var j in typeList) {
var requestType = typeList[j];
TestContextRetrieval(creationType, requestType, functionalTypeSet);
}
}
</script> </script>
</body>
</html>

View File

@ -34,6 +34,7 @@
#include "nsNetUtil.h" #include "nsNetUtil.h"
#include "nsStreamUtils.h" #include "nsStreamUtils.h"
#include "ActiveLayerTracker.h" #include "ActiveLayerTracker.h"
#include "WebGL1Context.h"
#include "WebGL2Context.h" #include "WebGL2Context.h"
using namespace mozilla::layers; using namespace mozilla::layers;
@ -648,71 +649,71 @@ HTMLCanvasElement::MozGetAsFileImpl(const nsAString& aName,
return NS_OK; return NS_OK;
} }
nsresult static bool
HTMLCanvasElement::GetContextHelper(const nsAString& aContextId, GetCanvasContextType(const nsAString& str, CanvasContextType* const out_type)
nsICanvasRenderingContextInternal **aContext)
{ {
NS_ENSURE_ARG(aContext); if (str.EqualsLiteral("2d")) {
*out_type = CanvasContextType::Canvas2D;
return true;
}
if (aContextId.EqualsLiteral("2d")) { if (str.EqualsLiteral("experimental-webgl")) {
*out_type = CanvasContextType::WebGL1;
return true;
}
#ifdef MOZ_WEBGL_CONFORMANT
if (str.EqualsLiteral("webgl")) {
/* WebGL 1.0, $2.1 "Context Creation":
* If the user agent supports both the webgl and experimental-webgl
* canvas context types, they shall be treated as aliases.
*/
*out_type = CanvasContextType::WebGL1;
return true;
}
#endif
if (WebGL2Context::IsSupported()) {
if (str.EqualsLiteral("experimental-webgl2")) {
*out_type = CanvasContextType::WebGL2;
return true;
}
}
return false;
}
static already_AddRefed<nsICanvasRenderingContextInternal>
CreateContextForCanvas(CanvasContextType contextType, HTMLCanvasElement* canvas)
{
nsRefPtr<nsICanvasRenderingContextInternal> ret;
switch (contextType) {
case CanvasContextType::Canvas2D:
Telemetry::Accumulate(Telemetry::CANVAS_2D_USED, 1); Telemetry::Accumulate(Telemetry::CANVAS_2D_USED, 1);
nsRefPtr<CanvasRenderingContext2D> ctx = ret = new CanvasRenderingContext2D();
new CanvasRenderingContext2D(); break;
ctx->SetCanvasElement(this); case CanvasContextType::WebGL1:
ctx.forget(aContext);
return NS_OK;
}
if (WebGL2Context::IsSupported() &&
aContextId.EqualsLiteral("experimental-webgl2"))
{
Telemetry::Accumulate(Telemetry::CANVAS_WEBGL_USED, 1); Telemetry::Accumulate(Telemetry::CANVAS_WEBGL_USED, 1);
nsRefPtr<WebGL2Context> ctx = WebGL2Context::Create();
if (ctx == nullptr) { ret = WebGL1Context::Create();
return NS_ERROR_NOT_IMPLEMENTED; if (!ret)
} return nullptr;
break;
ctx->SetCanvasElement(this); case CanvasContextType::WebGL2:
ctx.forget(aContext); Telemetry::Accumulate(Telemetry::CANVAS_WEBGL_USED, 1);
return NS_OK;
ret = WebGL2Context::Create();
if (!ret)
return nullptr;
break;
} }
MOZ_ASSERT(ret);
NS_ConvertUTF16toUTF8 ctxId(aContextId); ret->SetCanvasElement(canvas);
return ret.forget();
// check that ctxId is clamped to A-Za-z0-9_-
for (uint32_t i = 0; i < ctxId.Length(); i++) {
if ((ctxId[i] < 'A' || ctxId[i] > 'Z') &&
(ctxId[i] < 'a' || ctxId[i] > 'z') &&
(ctxId[i] < '0' || ctxId[i] > '9') &&
(ctxId[i] != '-') &&
(ctxId[i] != '_'))
{
// XXX ERRMSG we need to report an error to developers here! (bug 329026)
return NS_OK;
}
}
nsCString ctxString("@mozilla.org/content/canvas-rendering-context;1?id=");
ctxString.Append(ctxId);
nsresult rv;
nsCOMPtr<nsICanvasRenderingContextInternal> ctx =
do_CreateInstance(ctxString.get(), &rv);
if (rv == NS_ERROR_OUT_OF_MEMORY) {
*aContext = nullptr;
return NS_ERROR_OUT_OF_MEMORY;
}
if (NS_FAILED(rv)) {
*aContext = nullptr;
// XXX ERRMSG we need to report an error to developers here! (bug 329026)
return NS_OK;
}
ctx->SetCanvasElement(this);
ctx.forget(aContext);
return NS_OK;
} }
nsresult nsresult
@ -720,65 +721,49 @@ HTMLCanvasElement::GetContext(const nsAString& aContextId,
nsISupports** aContext) nsISupports** aContext)
{ {
ErrorResult rv; ErrorResult rv;
*aContext = *aContext = GetContext(nullptr, aContextId, JS::NullHandleValue, rv).take();
GetContext(nullptr, aContextId, JS::NullHandleValue, rv).take();
return rv.ErrorCode(); return rv.ErrorCode();
} }
static bool
IsContextIdWebGL(const nsAString& str)
{
return str.EqualsLiteral("webgl") ||
str.EqualsLiteral("experimental-webgl");
}
already_AddRefed<nsISupports> already_AddRefed<nsISupports>
HTMLCanvasElement::GetContext(JSContext* aCx, HTMLCanvasElement::GetContext(JSContext* aCx,
const nsAString& aContextId, const nsAString& aContextId,
JS::Handle<JS::Value> aContextOptions, JS::Handle<JS::Value> aContextOptions,
ErrorResult& rv) ErrorResult& rv)
{ {
if (mCurrentContextId.IsEmpty()) { CanvasContextType contextType;
rv = GetContextHelper(aContextId, getter_AddRefs(mCurrentContext)); if (!GetCanvasContextType(aContextId, &contextType))
if (rv.Failed() || !mCurrentContext) { return nullptr;
if (!mCurrentContext) {
// This canvas doesn't have a context yet.
nsRefPtr<nsICanvasRenderingContextInternal> context;
context = CreateContextForCanvas(contextType, this);
if (!context)
return nullptr; return nullptr;
}
// Ensure that the context participates in CC. Note that returning a // Ensure that the context participates in CC. Note that returning a
// CC participant from QI doesn't addref. // CC participant from QI doesn't addref.
nsXPCOMCycleCollectionParticipant *cp = nullptr; nsXPCOMCycleCollectionParticipant* cp = nullptr;
CallQueryInterface(mCurrentContext, &cp); CallQueryInterface(context, &cp);
if (!cp) { if (!cp) {
mCurrentContext = nullptr;
rv.Throw(NS_ERROR_FAILURE); rv.Throw(NS_ERROR_FAILURE);
return nullptr; return nullptr;
} }
mCurrentContext = context.forget();
mCurrentContextType = contextType;
rv = UpdateContext(aCx, aContextOptions); rv = UpdateContext(aCx, aContextOptions);
if (rv.Failed()) { if (rv.Failed()) {
rv = NS_OK; // See bug 645792 rv = NS_OK; // See bug 645792
return nullptr; return nullptr;
} }
mCurrentContextId.Assign(aContextId); } else {
} // We already have a context of some type.
if (contextType != mCurrentContextType)
if (!mCurrentContextId.Equals(aContextId)) { return nullptr;
if (IsContextIdWebGL(aContextId) &&
IsContextIdWebGL(mCurrentContextId))
{
// Warn when we get a request for a webgl context with an id that differs
// from the id it was created with.
nsCString creationId = NS_LossyConvertUTF16toASCII(mCurrentContextId);
nsCString requestId = NS_LossyConvertUTF16toASCII(aContextId);
JS_ReportWarning(aCx, "WebGL: Retrieving a WebGL context from a canvas "
"via a request id ('%s') different from the id used "
"to create the context ('%s') is not allowed.",
requestId.get(),
creationId.get());
}
//XXX eventually allow for more than one active context on a given canvas
return nullptr;
} }
nsCOMPtr<nsICanvasRenderingContextInternal> context = mCurrentContext; nsCOMPtr<nsICanvasRenderingContextInternal> context = mCurrentContext;
@ -798,22 +783,28 @@ HTMLCanvasElement::MozGetIPCContext(const nsAString& aContextId,
if (!aContextId.EqualsLiteral("2d")) if (!aContextId.EqualsLiteral("2d"))
return NS_ERROR_INVALID_ARG; return NS_ERROR_INVALID_ARG;
if (mCurrentContextId.IsEmpty()) { CanvasContextType contextType = CanvasContextType::Canvas2D;
nsresult rv = GetContextHelper(aContextId, getter_AddRefs(mCurrentContext));
NS_ENSURE_SUCCESS(rv, rv); if (!mCurrentContext) {
if (!mCurrentContext) { // This canvas doesn't have a context yet.
nsRefPtr<nsICanvasRenderingContextInternal> context;
context = CreateContextForCanvas(contextType, this);
if (!context) {
*aContext = nullptr;
return NS_OK; return NS_OK;
} }
mCurrentContext = context;
mCurrentContext->SetIsIPC(true); mCurrentContext->SetIsIPC(true);
mCurrentContextType = contextType;
rv = UpdateContext(nullptr, JS::NullHandleValue); nsresult rv = UpdateContext(nullptr, JS::NullHandleValue);
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
} else {
mCurrentContextId.Assign(aContextId); // We already have a context of some type.
} else if (!mCurrentContextId.Equals(aContextId)) { if (contextType != mCurrentContextType)
//XXX eventually allow for more than one active context on a given canvas return NS_ERROR_INVALID_ARG;
return NS_ERROR_INVALID_ARG;
} }
NS_ADDREF (*aContext = mCurrentContext); NS_ADDREF (*aContext = mCurrentContext);
@ -831,21 +822,18 @@ HTMLCanvasElement::UpdateContext(JSContext* aCx, JS::Handle<JS::Value> aNewConte
nsresult rv = mCurrentContext->SetIsOpaque(HasAttr(kNameSpaceID_None, nsGkAtoms::moz_opaque)); nsresult rv = mCurrentContext->SetIsOpaque(HasAttr(kNameSpaceID_None, nsGkAtoms::moz_opaque));
if (NS_FAILED(rv)) { if (NS_FAILED(rv)) {
mCurrentContext = nullptr; mCurrentContext = nullptr;
mCurrentContextId.Truncate();
return rv; return rv;
} }
rv = mCurrentContext->SetContextOptions(aCx, aNewContextOptions); rv = mCurrentContext->SetContextOptions(aCx, aNewContextOptions);
if (NS_FAILED(rv)) { if (NS_FAILED(rv)) {
mCurrentContext = nullptr; mCurrentContext = nullptr;
mCurrentContextId.Truncate();
return rv; return rv;
} }
rv = mCurrentContext->SetDimensions(sz.width, sz.height); rv = mCurrentContext->SetDimensions(sz.width, sz.height);
if (NS_FAILED(rv)) { if (NS_FAILED(rv)) {
mCurrentContext = nullptr; mCurrentContext = nullptr;
mCurrentContextId.Truncate();
return rv; return rv;
} }

View File

@ -7,6 +7,7 @@
#define mozilla_dom_HTMLCanvasElement_h #define mozilla_dom_HTMLCanvasElement_h
#include "mozilla/Attributes.h" #include "mozilla/Attributes.h"
#include "mozilla/TypedEnum.h"
#include "nsIDOMHTMLCanvasElement.h" #include "nsIDOMHTMLCanvasElement.h"
#include "nsGenericHTMLElement.h" #include "nsGenericHTMLElement.h"
#include "nsGkAtoms.h" #include "nsGkAtoms.h"
@ -35,6 +36,12 @@ class FileCallback;
class HTMLCanvasPrintState; class HTMLCanvasPrintState;
class PrintCallback; class PrintCallback;
MOZ_BEGIN_ENUM_CLASS(CanvasContextType, uint8_t)
Canvas2D,
WebGL1,
WebGL2
MOZ_END_ENUM_CLASS(CanvasContextType)
class HTMLCanvasElement MOZ_FINAL : public nsGenericHTMLElement, class HTMLCanvasElement MOZ_FINAL : public nsGenericHTMLElement,
public nsIDOMHTMLCanvasElement public nsIDOMHTMLCanvasElement
{ {
@ -229,11 +236,9 @@ protected:
nsresult MozGetAsFileImpl(const nsAString& aName, nsresult MozGetAsFileImpl(const nsAString& aName,
const nsAString& aType, const nsAString& aType,
nsIDOMFile** aResult); nsIDOMFile** aResult);
nsresult GetContextHelper(const nsAString& aContextId,
nsICanvasRenderingContextInternal **aContext);
void CallPrintCallback(); void CallPrintCallback();
nsString mCurrentContextId; CanvasContextType mCurrentContextType;
nsRefPtr<HTMLCanvasElement> mOriginalCanvas; nsRefPtr<HTMLCanvasElement> mOriginalCanvas;
nsRefPtr<PrintCallback> mPrintCallback; nsRefPtr<PrintCallback> mPrintCallback;
nsCOMPtr<nsICanvasRenderingContextInternal> mCurrentContext; nsCOMPtr<nsICanvasRenderingContextInternal> mCurrentContext;

View File

@ -459,20 +459,14 @@ ImageDocument::Notify(imgIRequest* aRequest, int32_t aType, const nsIntRect* aDa
if (aType == imgINotificationObserver::SIZE_AVAILABLE) { if (aType == imgINotificationObserver::SIZE_AVAILABLE) {
nsCOMPtr<imgIContainer> image; nsCOMPtr<imgIContainer> image;
aRequest->GetImage(getter_AddRefs(image)); aRequest->GetImage(getter_AddRefs(image));
return OnStartContainer(aRequest, image); return OnSizeAvailable(aRequest, image);
} }
// Do these two off a script runner because decode complete notifications often // Run this using a script runner because HAS_TRANSPARENCY notifications can
// come during painting and these will trigger invalidation. // come during painting and this will trigger invalidation.
if (aType == imgINotificationObserver::DECODE_COMPLETE) { if (aType == imgINotificationObserver::HAS_TRANSPARENCY) {
nsCOMPtr<nsIRunnable> runnable = nsCOMPtr<nsIRunnable> runnable =
NS_NewRunnableMethod(this, &ImageDocument::AddDecodedClass); NS_NewRunnableMethod(this, &ImageDocument::OnHasTransparency);
nsContentUtils::AddScriptRunner(runnable);
}
if (aType == imgINotificationObserver::DISCARD) {
nsCOMPtr<nsIRunnable> runnable =
NS_NewRunnableMethod(this, &ImageDocument::RemoveDecodedClass);
nsContentUtils::AddScriptRunner(runnable); nsContentUtils::AddScriptRunner(runnable);
} }
@ -481,14 +475,14 @@ ImageDocument::Notify(imgIRequest* aRequest, int32_t aType, const nsIntRect* aDa
aRequest->GetImageStatus(&reqStatus); aRequest->GetImageStatus(&reqStatus);
nsresult status = nsresult status =
reqStatus & imgIRequest::STATUS_ERROR ? NS_ERROR_FAILURE : NS_OK; reqStatus & imgIRequest::STATUS_ERROR ? NS_ERROR_FAILURE : NS_OK;
return OnStopRequest(aRequest, status); return OnLoadComplete(aRequest, status);
} }
return NS_OK; return NS_OK;
} }
void void
ImageDocument::AddDecodedClass() ImageDocument::OnHasTransparency()
{ {
if (!mImageContent || nsContentUtils::IsChildOfSameType(this)) { if (!mImageContent || nsContentUtils::IsChildOfSameType(this)) {
return; return;
@ -496,23 +490,7 @@ ImageDocument::AddDecodedClass()
nsDOMTokenList* classList = mImageContent->AsElement()->ClassList(); nsDOMTokenList* classList = mImageContent->AsElement()->ClassList();
mozilla::ErrorResult rv; mozilla::ErrorResult rv;
// Update the background-color of the image only after the classList->Add(NS_LITERAL_STRING("transparent"), rv);
// image has been decoded to prevent flashes of just the
// background-color.
classList->Add(NS_LITERAL_STRING("decoded"), rv);
}
void
ImageDocument::RemoveDecodedClass()
{
if (!mImageContent || nsContentUtils::IsChildOfSameType(this)) {
return;
}
nsDOMTokenList* classList = mImageContent->AsElement()->ClassList();
mozilla::ErrorResult rv;
// Remove any decoded-related styling when the image is unloaded.
classList->Remove(NS_LITERAL_STRING("decoded"), rv);
} }
void void
@ -535,7 +513,7 @@ ImageDocument::SetModeClass(eModeClasses mode)
} }
nsresult nsresult
ImageDocument::OnStartContainer(imgIRequest* aRequest, imgIContainer* aImage) ImageDocument::OnSizeAvailable(imgIRequest* aRequest, imgIContainer* aImage)
{ {
// Styles have not yet been applied, so we don't know the final size. For now, // Styles have not yet been applied, so we don't know the final size. For now,
// default to the image's intrinsic size. // default to the image's intrinsic size.
@ -551,8 +529,7 @@ ImageDocument::OnStartContainer(imgIRequest* aRequest, imgIContainer* aImage)
} }
nsresult nsresult
ImageDocument::OnStopRequest(imgIRequest *aRequest, ImageDocument::OnLoadComplete(imgIRequest* aRequest, nsresult aStatus)
nsresult aStatus)
{ {
UpdateTitleAndCharset(); UpdateTitleAndCharset();

View File

@ -51,9 +51,6 @@ public:
void DefaultCheckOverflowing() { CheckOverflowing(mResizeImageByDefault); } void DefaultCheckOverflowing() { CheckOverflowing(mResizeImageByDefault); }
void AddDecodedClass();
void RemoveDecodedClass();
// WebIDL API // WebIDL API
virtual JSObject* WrapNode(JSContext* aCx) virtual JSObject* WrapNode(JSContext* aCx)
MOZ_OVERRIDE; MOZ_OVERRIDE;
@ -107,8 +104,9 @@ protected:
}; };
void SetModeClass(eModeClasses mode); void SetModeClass(eModeClasses mode);
nsresult OnStartContainer(imgIRequest* aRequest, imgIContainer* aImage); nsresult OnSizeAvailable(imgIRequest* aRequest, imgIContainer* aImage);
nsresult OnStopRequest(imgIRequest *aRequest, nsresult aStatus); nsresult OnLoadComplete(imgIRequest* aRequest, nsresult aStatus);
void OnHasTransparency();
nsCOMPtr<nsIContent> mImageContent; nsCOMPtr<nsIContent> mImageContent;

View File

@ -1973,9 +1973,9 @@ function isSimpleModifiableElement(node) {
&& (node.style.length == 1 && (node.style.length == 1
|| (node.style.length == 4 || (node.style.length == 4
&& "MozTextBlink" in node.style && "MozTextBlink" in node.style
&& "MozTextDecorationColor" in node.style && "textDecorationColor" in node.style
&& "MozTextDecorationLine" in node.style && "textDecorationLine" in node.style
&& "MozTextDecorationStyle" in node.style) && "textDecorationStyle" in node.style)
) )
&& (node.style.textDecoration == "line-through" && (node.style.textDecoration == "line-through"
|| node.style.textDecoration == "underline" || node.style.textDecoration == "underline"

View File

@ -121,6 +121,11 @@ ScreenManagerParent::RecvScreenForBrowser(PBrowserParent* aBrowser,
bool* aSuccess) bool* aSuccess)
{ {
*aSuccess = false; *aSuccess = false;
#ifdef MOZ_VALGRIND
// Zero this so that Valgrind doesn't complain when we send it to another
// process.
memset(aRetVal, 0, sizeof(ScreenDetails));
#endif
// Find the mWidget associated with the tabparent, and then return // Find the mWidget associated with the tabparent, and then return
// the nsIScreen it's on. // the nsIScreen it's on.

View File

@ -179,9 +179,6 @@ class MediaRecorder::Session: public nsIObserver
return NS_OK; return NS_OK;
} }
if (mSession->IsEncoderError()) {
recorder->NotifyError(NS_ERROR_UNEXPECTED);
}
nsresult rv = recorder->CreateAndDispatchBlobEvent(mSession->GetEncodedData()); nsresult rv = recorder->CreateAndDispatchBlobEvent(mSession->GetEncodedData());
if (NS_FAILED(rv)) { if (NS_FAILED(rv)) {
recorder->NotifyError(rv); recorder->NotifyError(rv);
@ -194,6 +191,34 @@ class MediaRecorder::Session: public nsIObserver
nsRefPtr<Session> mSession; nsRefPtr<Session> mSession;
}; };
// Notify encoder error, run in main thread task. (Bug 1095381)
class EncoderErrorNotifierRunnable : public nsRunnable
{
public:
explicit EncoderErrorNotifierRunnable(Session* aSession)
: mSession(aSession)
{ }
NS_IMETHODIMP Run()
{
LOG(PR_LOG_DEBUG, ("Session.ErrorNotifyRunnable s=(%p)", mSession.get()));
MOZ_ASSERT(NS_IsMainThread());
nsRefPtr<MediaRecorder> recorder = mSession->mRecorder;
if (!recorder) {
return NS_OK;
}
if (mSession->IsEncoderError()) {
recorder->NotifyError(NS_ERROR_UNEXPECTED);
}
return NS_OK;
}
private:
nsRefPtr<Session> mSession;
};
// Fire start event and set mimeType, run in main thread task. // Fire start event and set mimeType, run in main thread task.
class DispatchStartEventRunnable : public nsRunnable class DispatchStartEventRunnable : public nsRunnable
{ {
@ -336,6 +361,7 @@ class MediaRecorder::Session: public nsIObserver
nsRefPtr<Session> mSession; nsRefPtr<Session> mSession;
}; };
friend class EncoderErrorNotifierRunnable;
friend class PushBlobRunnable; friend class PushBlobRunnable;
friend class ExtractRunnable; friend class ExtractRunnable;
friend class DestroyRunnable; friend class DestroyRunnable;
@ -399,7 +425,8 @@ public:
LOG(PR_LOG_DEBUG, ("Session.RequestData")); LOG(PR_LOG_DEBUG, ("Session.RequestData"));
MOZ_ASSERT(NS_IsMainThread()); MOZ_ASSERT(NS_IsMainThread());
if (NS_FAILED(NS_DispatchToMainThread(new PushBlobRunnable(this)))) { if (NS_FAILED(NS_DispatchToMainThread(new EncoderErrorNotifierRunnable(this))) ||
NS_FAILED(NS_DispatchToMainThread(new PushBlobRunnable(this)))) {
MOZ_ASSERT(false, "RequestData NS_DispatchToMainThread failed"); MOZ_ASSERT(false, "RequestData NS_DispatchToMainThread failed");
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
} }
@ -480,6 +507,9 @@ private:
pushBlob = true; pushBlob = true;
} }
if (pushBlob || aForceFlush) { if (pushBlob || aForceFlush) {
if (NS_FAILED(NS_DispatchToMainThread(new EncoderErrorNotifierRunnable(this)))) {
MOZ_ASSERT(false, "NS_DispatchToMainThread EncoderErrorNotifierRunnable failed");
}
if (NS_FAILED(NS_DispatchToMainThread(new PushBlobRunnable(this)))) { if (NS_FAILED(NS_DispatchToMainThread(new PushBlobRunnable(this)))) {
MOZ_ASSERT(false, "NS_DispatchToMainThread PushBlobRunnable failed"); MOZ_ASSERT(false, "NS_DispatchToMainThread PushBlobRunnable failed");
} else { } else {
@ -576,6 +606,9 @@ private:
} }
CleanupStreams(); CleanupStreams();
if (NS_FAILED(NS_DispatchToMainThread(new EncoderErrorNotifierRunnable(this)))) {
MOZ_ASSERT(false, "NS_DispatchToMainThread EncoderErrorNotifierRunnable failed");
}
if (NS_FAILED(NS_DispatchToMainThread(new PushBlobRunnable(this)))) { if (NS_FAILED(NS_DispatchToMainThread(new PushBlobRunnable(this)))) {
MOZ_ASSERT(false, "NS_DispatchToMainThread PushBlobRunnable failed"); MOZ_ASSERT(false, "NS_DispatchToMainThread PushBlobRunnable failed");
} }

View File

@ -65,7 +65,7 @@ PRLogModuleInfo* gMediaStreamGraphLog;
/** /**
* The singleton graph instance. * The singleton graph instance.
*/ */
static MediaStreamGraphImpl* gGraph; static nsDataHashtable<nsUint32HashKey, MediaStreamGraphImpl*> gGraphs;
MediaStreamGraphImpl::~MediaStreamGraphImpl() MediaStreamGraphImpl::~MediaStreamGraphImpl()
{ {
@ -1636,9 +1636,10 @@ MediaStreamGraphImpl::RunInStableState(bool aSourceIsMSG)
NS_DispatchToMainThread(event); NS_DispatchToMainThread(event);
LIFECYCLE_LOG("Disconnecting MediaStreamGraph %p", this); LIFECYCLE_LOG("Disconnecting MediaStreamGraph %p", this);
if (this == gGraph) { MediaStreamGraphImpl* graph;
if (gGraphs.Get(mAudioChannel, &graph) && graph == this) {
// null out gGraph if that's the graph being shut down // null out gGraph if that's the graph being shut down
gGraph = nullptr; gGraphs.Remove(mAudioChannel);
} }
} }
} else { } else {
@ -1789,9 +1790,12 @@ MediaStreamGraphImpl::AppendMessage(ControlMessage* aMessage)
delete aMessage; delete aMessage;
if (IsEmpty() && if (IsEmpty() &&
mLifecycleState >= LIFECYCLE_WAITING_FOR_STREAM_DESTRUCTION) { mLifecycleState >= LIFECYCLE_WAITING_FOR_STREAM_DESTRUCTION) {
if (gGraph == this) {
gGraph = nullptr; MediaStreamGraphImpl* graph;
if (gGraphs.Get(mAudioChannel, &graph) && graph == this) {
gGraphs.Remove(mAudioChannel);
} }
Destroy(); Destroy();
} }
return; return;
@ -2741,6 +2745,7 @@ MediaStreamGraphImpl::MediaStreamGraphImpl(bool aRealtime,
#ifdef DEBUG #ifdef DEBUG
, mCanRunMessagesSynchronously(false) , mCanRunMessagesSynchronously(false)
#endif #endif
, mAudioChannel(static_cast<uint32_t>(aChannel))
{ {
#ifdef PR_LOGGING #ifdef PR_LOGGING
if (!gMediaStreamGraphLog) { if (!gMediaStreamGraphLog) {
@ -2779,15 +2784,26 @@ NS_IMPL_ISUPPORTS(MediaStreamGraphShutdownObserver, nsIObserver)
static bool gShutdownObserverRegistered = false; static bool gShutdownObserverRegistered = false;
namespace {
PLDHashOperator
ForceShutdownEnumerator(const uint32_t& /* aAudioChannel */,
MediaStreamGraphImpl* aGraph,
void* /* aUnused */)
{
aGraph->ForceShutDown();
return PL_DHASH_NEXT;
}
} // anonymous namespace
NS_IMETHODIMP NS_IMETHODIMP
MediaStreamGraphShutdownObserver::Observe(nsISupports *aSubject, MediaStreamGraphShutdownObserver::Observe(nsISupports *aSubject,
const char *aTopic, const char *aTopic,
const char16_t *aData) const char16_t *aData)
{ {
if (strcmp(aTopic, NS_XPCOM_SHUTDOWN_OBSERVER_ID) == 0) { if (strcmp(aTopic, NS_XPCOM_SHUTDOWN_OBSERVER_ID) == 0) {
if (gGraph) { gGraphs.EnumerateRead(ForceShutdownEnumerator, nullptr);
gGraph->ForceShutDown();
}
nsContentUtils::UnregisterShutdownObserver(this); nsContentUtils::UnregisterShutdownObserver(this);
gShutdownObserverRegistered = false; gShutdownObserverRegistered = false;
} }
@ -2799,7 +2815,10 @@ MediaStreamGraph::GetInstance(DOMMediaStream::TrackTypeHints aHint, dom::AudioCh
{ {
NS_ASSERTION(NS_IsMainThread(), "Main thread only"); NS_ASSERTION(NS_IsMainThread(), "Main thread only");
if (!gGraph) { uint32_t channel = static_cast<uint32_t>(aChannel);
MediaStreamGraphImpl* graph = nullptr;
if (!gGraphs.Get(channel, &graph)) {
if (!gShutdownObserverRegistered) { if (!gShutdownObserverRegistered) {
gShutdownObserverRegistered = true; gShutdownObserverRegistered = true;
nsContentUtils::RegisterShutdownObserver(new MediaStreamGraphShutdownObserver()); nsContentUtils::RegisterShutdownObserver(new MediaStreamGraphShutdownObserver());
@ -2807,12 +2826,13 @@ MediaStreamGraph::GetInstance(DOMMediaStream::TrackTypeHints aHint, dom::AudioCh
CubebUtils::InitPreferredSampleRate(); CubebUtils::InitPreferredSampleRate();
gGraph = new MediaStreamGraphImpl(true, CubebUtils::PreferredSampleRate(), aHint, aChannel); graph = new MediaStreamGraphImpl(true, CubebUtils::PreferredSampleRate(), aHint, aChannel);
gGraphs.Put(channel, graph);
STREAM_LOG(PR_LOG_DEBUG, ("Starting up MediaStreamGraph %p", gGraph)); STREAM_LOG(PR_LOG_DEBUG, ("Starting up MediaStreamGraph %p", graph));
} }
return gGraph; return graph;
} }
MediaStreamGraph* MediaStreamGraph*
@ -2995,7 +3015,10 @@ MediaStreamGraph::CreateAudioNodeStream(AudioNodeEngine* aEngine,
bool bool
MediaStreamGraph::IsNonRealtime() const MediaStreamGraph::IsNonRealtime() const
{ {
return this != gGraph; const MediaStreamGraphImpl* impl = static_cast<const MediaStreamGraphImpl*>(this);
MediaStreamGraphImpl* graph;
return !gGraphs.Get(impl->AudioChannel(), &graph) || graph != impl;
} }
void void

View File

@ -661,6 +661,8 @@ public:
nsRefPtr<AudioOutputObserver> mFarendObserverRef; nsRefPtr<AudioOutputObserver> mFarendObserverRef;
#endif #endif
uint32_t AudioChannel() const { return mAudioChannel; }
private: private:
virtual ~MediaStreamGraphImpl(); virtual ~MediaStreamGraphImpl();
@ -694,6 +696,9 @@ private:
bool mCanRunMessagesSynchronously; bool mCanRunMessagesSynchronously;
#endif #endif
// We use uint32_t instead AudioChannel because this is just used as key for
// the hashtable gGraphs.
uint32_t mAudioChannel;
}; };
} }

View File

@ -58,7 +58,7 @@ public:
} }
virtual nsresult Input(mp4_demuxer::MP4Sample* aSample) MOZ_OVERRIDE { virtual nsresult Input(mp4_demuxer::MP4Sample* aSample) MOZ_OVERRIDE {
mp4_demuxer::AnnexB::ConvertSample(aSample, mConfig.annex_b); mp4_demuxer::AnnexB::ConvertSample(aSample);
return MediaCodecDataDecoder::Input(aSample); return MediaCodecDataDecoder::Input(aSample);
} }

View File

@ -53,7 +53,6 @@ GonkVideoDecoderManager::GonkVideoDecoderManager(
mozilla::layers::ImageContainer* aImageContainer, mozilla::layers::ImageContainer* aImageContainer,
const mp4_demuxer::VideoDecoderConfig& aConfig) const mp4_demuxer::VideoDecoderConfig& aConfig)
: mImageContainer(aImageContainer) : mImageContainer(aImageContainer)
, mConfig(aConfig)
, mReaderCallback(nullptr) , mReaderCallback(nullptr)
, mColorConverterBufferSize(0) , mColorConverterBufferSize(0)
, mNativeWindow(nullptr) , mNativeWindow(nullptr)
@ -396,7 +395,7 @@ GonkVideoDecoderManager::Input(mp4_demuxer::MP4Sample* aSample)
status_t rv; status_t rv;
if (aSample != nullptr) { if (aSample != nullptr) {
// We must prepare samples in AVC Annex B. // We must prepare samples in AVC Annex B.
mp4_demuxer::AnnexB::ConvertSample(aSample, mConfig.annex_b); mp4_demuxer::AnnexB::ConvertSample(aSample);
// Forward sample data to the decoder. // Forward sample data to the decoder.
const uint8_t* data = reinterpret_cast<const uint8_t*>(aSample->data); const uint8_t* data = reinterpret_cast<const uint8_t*>(aSample->data);

View File

@ -115,7 +115,6 @@ private:
void ReleaseAllPendingVideoBuffersLocked(); void ReleaseAllPendingVideoBuffersLocked();
void PostReleaseVideoBuffer(android::MediaBuffer *aBuffer); void PostReleaseVideoBuffer(android::MediaBuffer *aBuffer);
const mp4_demuxer::VideoDecoderConfig& mConfig;
uint32_t mVideoWidth; uint32_t mVideoWidth;
uint32_t mVideoHeight; uint32_t mVideoHeight;
uint32_t mDisplayWidth; uint32_t mDisplayWidth;

View File

@ -40,7 +40,6 @@ WMFVideoMFTManager::WMFVideoMFTManager(
: mVideoStride(0) : mVideoStride(0)
, mVideoWidth(0) , mVideoWidth(0)
, mVideoHeight(0) , mVideoHeight(0)
, mConfig(aConfig)
, mImageContainer(aImageContainer) , mImageContainer(aImageContainer)
, mDXVAEnabled(aDXVAEnabled) , mDXVAEnabled(aDXVAEnabled)
, mLayersBackend(aLayersBackend) , mLayersBackend(aLayersBackend)
@ -147,7 +146,7 @@ HRESULT
WMFVideoMFTManager::Input(mp4_demuxer::MP4Sample* aSample) WMFVideoMFTManager::Input(mp4_demuxer::MP4Sample* aSample)
{ {
// We must prepare samples in AVC Annex B. // We must prepare samples in AVC Annex B.
mp4_demuxer::AnnexB::ConvertSample(aSample, mConfig.annex_b); mp4_demuxer::AnnexB::ConvertSample(aSample);
// Forward sample data to the decoder. // Forward sample data to the decoder.
const uint8_t* data = reinterpret_cast<const uint8_t*>(aSample->data); const uint8_t* data = reinterpret_cast<const uint8_t*>(aSample->data);
uint32_t length = aSample->size; uint32_t length = aSample->size;

View File

@ -56,8 +56,6 @@ private:
uint32_t mVideoHeight; uint32_t mVideoHeight;
nsIntRect mPictureRegion; nsIntRect mPictureRegion;
const mp4_demuxer::VideoDecoderConfig& mConfig;
RefPtr<MFTDecoder> mDecoder; RefPtr<MFTDecoder> mDecoder;
RefPtr<layers::ImageContainer> mImageContainer; RefPtr<layers::ImageContainer> mImageContainer;
nsAutoPtr<DXVA2Manager> mDXVA2Manager; nsAutoPtr<DXVA2Manager> mDXVA2Manager;

View File

@ -282,10 +282,6 @@ void
MediaCodecReader::ProcessCachedDataTask::Run() MediaCodecReader::ProcessCachedDataTask::Run()
{ {
mReader->ProcessCachedData(mOffset, nullptr); mReader->ProcessCachedData(mOffset, nullptr);
nsRefPtr<ReferenceKeeperRunnable<MediaCodecReader>> runnable(
new ReferenceKeeperRunnable<MediaCodecReader>(mReader));
mReader = nullptr;
NS_DispatchToMainThread(runnable.get());
} }
MediaCodecReader::MediaCodecReader(AbstractMediaDecoder* aDecoder) MediaCodecReader::MediaCodecReader(AbstractMediaDecoder* aDecoder)
@ -305,7 +301,6 @@ MediaCodecReader::MediaCodecReader(AbstractMediaDecoder* aDecoder)
MediaCodecReader::~MediaCodecReader() MediaCodecReader::~MediaCodecReader()
{ {
MOZ_ASSERT(NS_IsMainThread(), "Should be on main thread.");
} }
nsresult nsresult

View File

@ -338,37 +338,6 @@ private:
}; };
friend class ProcessCachedDataTask; friend class ProcessCachedDataTask;
// This class is used to keep one reference count of T in it. And this class
// can make sure the stored reference count will be released on the dispatched
// thread. By using this class properly (ex. passing the pointer into this
// runnable first, then releasing the original pointer held by ourselves, and
// then dispatching this runnable onto the desired thread), we can avoid
// running the destructor of the referenced object on any other threads
// unexpectedly before this runnable has been executed.
template<class T>
class ReferenceKeeperRunnable : public nsRunnable
{
public:
ReferenceKeeperRunnable(nsRefPtr<T> aPointer)
: mPointer(aPointer)
{
}
NS_IMETHOD Run() MOZ_OVERRIDE
{
mPointer = nullptr;
return NS_OK;
}
private:
// Forbidden
ReferenceKeeperRunnable() MOZ_DELETE;
ReferenceKeeperRunnable(const ReferenceKeeperRunnable &rhs) MOZ_DELETE;
const ReferenceKeeperRunnable &operator=(const ReferenceKeeperRunnable &rhs) MOZ_DELETE;
nsRefPtr<T> mPointer;
};
// Forbidden // Forbidden
MediaCodecReader() MOZ_DELETE; MediaCodecReader() MOZ_DELETE;
const MediaCodecReader& operator=(const MediaCodecReader& rhs) MOZ_DELETE; const MediaCodecReader& operator=(const MediaCodecReader& rhs) MOZ_DELETE;

View File

@ -2582,6 +2582,48 @@ PeerConnectionWrapper.prototype = {
} }
}, },
/**
* Compares the Ice server configured for this PeerConnectionWrapper
* with the ICE candidates received in the RTCP stats.
*
* @param {object} stats
* The stats to be verified for relayed vs. direct connection.
*/
checkStatsIceConnectionType : function PCW_checkStatsIceConnectionType(stats)
{
var lId;
var rId;
Object.keys(stats).forEach(function(name) {
if ((stats[name].type === "candidatepair") &&
(stats[name].selected)) {
lId = stats[name].localCandidateId;
rId = stats[name].remoteCandidateId;
}
});
info("checkStatsIceConnectionType verifying: local=" +
JSON.stringify(stats[lId]) + " remote=" + JSON.stringify(stats[rId]));
if ((typeof stats[lId] === 'undefined') ||
(typeof stats[rId] === 'undefined')) {
info("checkStatsIceConnectionType failed to find candidatepair IDs");
return;
}
var lType = stats[lId].candidateType;
var rType = stats[rId].candidateType;
var lIp = stats[lId].ipAddress;
var rIp = stats[rId].ipAddress;
if ((this.configuration) && (typeof this.configuration.iceServers !== 'undefined')) {
info("Ice Server configured");
// Note: the IP comparising is a workaround for bug 1097333
// And this will fail if a TURN server address is a DNS name!
var serverIp = this.configuration.iceServers[0].url.split(':')[1];
ok((lType === "relayed" || rType === "relayed") ||
(lIp === serverIp || rIp === serverIp), "One peer uses a relay");
} else {
info("P2P configured");
ok(((lType !== "relayed") && (rType !== "relayed")), "Pure peer to peer call without a relay");
}
},
/** /**
* Property-matching function for finding a certain stat in passed-in stats * Property-matching function for finding a certain stat in passed-in stats
* *

View File

@ -24,6 +24,17 @@ function dumpSdp(test) {
dump("ERROR: SDP answer: " + test._remote_answer.sdp.replace(/[\r]/g, '')); dump("ERROR: SDP answer: " + test._remote_answer.sdp.replace(/[\r]/g, ''));
} }
if ((test.pcLocal) && (typeof test.pcLocal._local_ice_candidates !== 'undefined')) {
dump("pcLocal._local_ice_candidates: " + JSON.stringify(test.pcLocal._local_ice_candidates) + "\n");
dump("pcLocal._remote_ice_candidates: " + JSON.stringify(test.pcLocal._remote_ice_candidates) + "\n");
dump("pcLocal._ice_candidates_to_add: " + JSON.stringify(test.pcLocal._ice_candidates_to_add) + "\n");
}
if ((test.pcRemote) && (typeof test.pcRemote._local_ice_candidates !== 'undefined')) {
dump("pcRemote._local_ice_candidates: " + JSON.stringify(test.pcRemote._local_ice_candidates) + "\n");
dump("pcRemote._remote_ice_candidates: " + JSON.stringify(test.pcRemote._remote_ice_candidates) + "\n");
dump("pcRemote._ice_candidates_to_add: " + JSON.stringify(test.pcRemote._ice_candidates_to_add) + "\n");
}
if ((test.pcLocal) && (typeof test.pcLocal.iceConnectionLog !== 'undefined')) { if ((test.pcLocal) && (typeof test.pcLocal.iceConnectionLog !== 'undefined')) {
dump("pcLocal ICE connection state log: " + test.pcLocal.iceConnectionLog + "\n"); dump("pcLocal ICE connection state log: " + test.pcLocal.iceConnectionLog + "\n");
} }
@ -492,6 +503,24 @@ var commandsPeerConnection = [
}); });
} }
], ],
[
'PC_LOCAL_CHECK_ICE_CONNECTION_TYPE',
function (test) {
test.pcLocal.getStats(null, function(stats) {
test.pcLocal.checkStatsIceConnectionType(stats);
test.next();
});
}
],
[
'PC_REMOTE_CHECK_ICE_CONNECTION_TYPE',
function (test) {
test.pcRemote.getStats(null, function(stats) {
test.pcRemote.checkStatsIceConnectionType(stats);
test.next();
});
}
],
[ [
'PC_LOCAL_CHECK_GETSTATS_AUDIOTRACK_OUTBOUND', 'PC_LOCAL_CHECK_GETSTATS_AUDIOTRACK_OUTBOUND',
function (test) { function (test) {

View File

@ -3,6 +3,10 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* An example of how to specify two TURN server configs: /* An example of how to specify two TURN server configs:
*
* Note: If turn URL uses FQDN rather then an IP address the TURN relay
* verification step in checkStatsIceConnectionType might fail.
*
* var turnServers = { * var turnServers = {
* local: { iceServers: [{"username":"mozilla","credential":"mozilla","url":"turn:10.0.0.1"}] }, * local: { iceServers: [{"username":"mozilla","credential":"mozilla","url":"turn:10.0.0.1"}] },
* remote: { iceServers: [{"username":"firefox","credential":"firefox","url":"turn:10.0.0.2"}] } * remote: { iceServers: [{"username":"firefox","credential":"firefox","url":"turn:10.0.0.2"}] }

View File

@ -669,12 +669,6 @@ AudioContext::MozAudioChannelType() const
return mDestination->MozAudioChannelType(); return mDestination->MozAudioChannelType();
} }
void
AudioContext::SetMozAudioChannelType(AudioChannel aValue, ErrorResult& aRv)
{
mDestination->SetMozAudioChannelType(aValue, aRv);
}
AudioChannel AudioChannel
AudioContext::TestAudioChannelInAudioNodeStream() AudioContext::TestAudioChannelInAudioNodeStream()
{ {

View File

@ -224,7 +224,6 @@ public:
JSObject* GetGlobalJSObject() const; JSObject* GetGlobalJSObject() const;
AudioChannel MozAudioChannelType() const; AudioChannel MozAudioChannelType() const;
void SetMozAudioChannelType(AudioChannel aValue, ErrorResult& aRv);
AudioChannel TestAudioChannelInAudioNodeStream(); AudioChannel TestAudioChannelInAudioNodeStream();

View File

@ -18,27 +18,23 @@ function test_basic() {
// Default // Default
is(ac.mozAudioChannelType, "normal", "Default ac channel == 'normal'"); is(ac.mozAudioChannelType, "normal", "Default ac channel == 'normal'");
// random wrong channel
ac.mozAudioChannelType = "foo";
is(ac.mozAudioChannelType, "normal", "Default ac channel == 'normal'");
// Unpermitted channels // Unpermitted channels
ac.mozAudioChannelType = "content"; ac = new AudioContext("content");
is(ac.mozAudioChannelType, "normal", "Default ac channel == 'normal'"); is(ac.mozAudioChannelType, "normal", "Default ac channel == 'normal'");
ac.mozAudioChannelType = "notification"; ac = new AudioContext("notification");
is(ac.mozAudioChannelType, "normal", "Default ac channel == 'normal'"); is(ac.mozAudioChannelType, "normal", "Default ac channel == 'normal'");
ac.mozAudioChannelType = "alarm"; ac = new AudioContext("alarm");
is(ac.mozAudioChannelType, "normal", "Default ac channel == 'normal'"); is(ac.mozAudioChannelType, "normal", "Default ac channel == 'normal'");
ac.mozAudioChannelType = "telephony"; ac = new AudioContext("telephony");
is(ac.mozAudioChannelType, "normal", "Default ac channel == 'normal'"); is(ac.mozAudioChannelType, "normal", "Default ac channel == 'normal'");
ac.mozAudioChannelType = "ringer"; ac = new AudioContext("ringer");
is(ac.mozAudioChannelType, "normal", "Default ac channel == 'normal'"); is(ac.mozAudioChannelType, "normal", "Default ac channel == 'normal'");
ac.mozAudioChannelType = "publicnotification"; ac = new AudioContext("publicnotification");
is(ac.mozAudioChannelType, "normal", "Default ac channel == 'normal'"); is(ac.mozAudioChannelType, "normal", "Default ac channel == 'normal'");
runTest(); runTest();
@ -56,7 +52,7 @@ function test_permission(aChannel) {
SpecialPowers.pushPermissions( SpecialPowers.pushPermissions(
[{ "type": "audio-channel-" + aChannel, "allow": true, "context": document }], [{ "type": "audio-channel-" + aChannel, "allow": true, "context": document }],
function() { function() {
ac.mozAudioChannelType = aChannel; var ac = new AudioContext(aChannel);
is(ac.mozAudioChannelType, aChannel, "Default ac channel == '" + aChannel + "'"); is(ac.mozAudioChannelType, aChannel, "Default ac channel == '" + aChannel + "'");
var channel = SpecialPowers.wrap(ac).testAudioChannelInAudioNodeStream(); var channel = SpecialPowers.wrap(ac).testAudioChannelInAudioNodeStream();
@ -147,6 +143,7 @@ function runTest() {
SpecialPowers.pushPrefEnv({"set": [["media.useAudioChannelService", true ]]}, runTest); SpecialPowers.pushPrefEnv({"set": [["media.useAudioChannelService", true ]]}, runTest);
SimpleTest.waitForExplicitFinish(); SimpleTest.waitForExplicitFinish();
SimpleTest.requestLongerTimeout(5);
</script> </script>
</pre> </pre>

View File

@ -7,6 +7,7 @@
#include "mozilla/dom/Promise.h" #include "mozilla/dom/Promise.h"
#include "jsfriendapi.h" #include "jsfriendapi.h"
#include "js/Debug.h"
#include "mozilla/dom/BindingUtils.h" #include "mozilla/dom/BindingUtils.h"
#include "mozilla/dom/DOMError.h" #include "mozilla/dom/DOMError.h"
#include "mozilla/dom/OwningNonNull.h" #include "mozilla/dom/OwningNonNull.h"
@ -324,8 +325,8 @@ Promise::CreateWrapper(ErrorResult& aRv)
} }
JSContext* cx = jsapi.cx(); JSContext* cx = jsapi.cx();
JS::Rooted<JS::Value> ignored(cx); JS::Rooted<JS::Value> wrapper(cx);
if (!WrapNewBindingObject(cx, this, &ignored)) { if (!WrapNewBindingObject(cx, this, &wrapper)) {
JS_ClearPendingException(cx); JS_ClearPendingException(cx);
aRv.Throw(NS_ERROR_OUT_OF_MEMORY); aRv.Throw(NS_ERROR_OUT_OF_MEMORY);
return; return;
@ -339,6 +340,9 @@ Promise::CreateWrapper(ErrorResult& aRv)
aRv.Throw(NS_ERROR_OUT_OF_MEMORY); aRv.Throw(NS_ERROR_OUT_OF_MEMORY);
return; return;
} }
JS::RootedObject obj(cx, &wrapper.toObject());
JS::dbg::onNewPromise(cx, obj);
} }
void void
@ -1113,19 +1117,19 @@ Promise::RejectInternal(JSContext* aCx,
} }
void void
Promise::MaybeSettle(JS::Handle<JS::Value> aValue, Promise::Settle(JS::Handle<JS::Value> aValue, PromiseState aState)
PromiseState aState)
{ {
// Promise.all() or Promise.race() implementations will repeatedly call mSettlementTimestamp = TimeStamp::Now();
// Resolve/RejectInternal rather than using the Maybe... forms. Stop SetState
// from asserting.
if (mState != Pending) {
return;
}
SetResult(aValue); SetResult(aValue);
SetState(aState); SetState(aState);
mSettlementTimestamp = TimeStamp::Now();
AutoJSAPI jsapi;
jsapi.Init();
JSContext* cx = jsapi.cx();
JS::RootedObject wrapper(cx, GetWrapper());
MOZ_ASSERT(wrapper); // We preserved it
JSAutoCompartment ac(cx, wrapper);
JS::dbg::onPromiseSettled(cx, wrapper);
// If the Promise was rejected, and there is no reject handler already setup, // If the Promise was rejected, and there is no reject handler already setup,
// watch for thread shutdown. // watch for thread shutdown.
@ -1149,6 +1153,20 @@ Promise::MaybeSettle(JS::Handle<JS::Value> aValue,
EnqueueCallbackTasks(); EnqueueCallbackTasks();
} }
void
Promise::MaybeSettle(JS::Handle<JS::Value> aValue,
PromiseState aState)
{
// Promise.all() or Promise.race() implementations will repeatedly call
// Resolve/RejectInternal rather than using the Maybe... forms. Stop SetState
// from asserting.
if (mState != Pending) {
return;
}
Settle(aValue, aState);
}
void void
Promise::EnqueueCallbackTasks() Promise::EnqueueCallbackTasks()
{ {

View File

@ -225,8 +225,8 @@ private:
// appended by then(), catch() or done(). // appended by then(), catch() or done().
void EnqueueCallbackTasks(); void EnqueueCallbackTasks();
void MaybeSettle(JS::Handle<JS::Value> aValue, void Settle(JS::Handle<JS::Value> aValue, Promise::PromiseState aState);
Promise::PromiseState aState); void MaybeSettle(JS::Handle<JS::Value> aValue, Promise::PromiseState aState);
void AppendCallbacks(PromiseCallback* aResolveCallback, void AppendCallbacks(PromiseCallback* aResolveCallback,
PromiseCallback* aRejectCallback); PromiseCallback* aRejectCallback);

View File

@ -1,3 +1,6 @@
[DEFAULT] [DEFAULT]
[test_dependentPromises.html] [test_dependentPromises.html]
[test_on_new_promise.html]
[test_on_promise_settled.html]
[test_on_promise_settled_duplicates.html]

View File

@ -0,0 +1,45 @@
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<!--
Bug 1083210 - Sanity test for interaction between DOM promises and
Debugger.prototype.onNewPromise.
-->
<html>
<head>
<title>Test for interaction with SpiderMonkey's Debugger.prototype.onNewPromise</title>
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css">
</head>
<body>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script type="application/javascript">
is(Object.prototype.toString.call(new Promise(function () {})),
"[object Promise]",
"We should have the native DOM promise implementation.");
var Cu = Components.utils;
Cu.import("resource://gre/modules/jsdebugger.jsm");
var dbgGlobal = new Cu.Sandbox(document.nodePrincipal);
addDebuggerToGlobal(dbgGlobal);
var dbg = new dbgGlobal.Debugger(this);
var wrappedPromise;
dbg.onNewPromise = function (wp) { wrappedPromise = wp; };
var promise = new Promise(function () {});
debugger;
ok(wrappedPromise);
is(wrappedPromise.unsafeDereference(), promise);
</script>
</pre>
</body>
</html>

View File

@ -0,0 +1,54 @@
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<!--
Bug 1084065 - Sanity test for interaction between DOM promises and
Debugger.prototype.onPromiseResolved.
-->
<html>
<head>
<title>Test for interaction with SpiderMonkey's Debugger.prototype.onNewPromise</title>
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css">
</head>
<body>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script type="application/javascript">
SimpleTest.waitForExplicitFinish();
is(Object.prototype.toString.call(new Promise(function () {})),
"[object Promise]",
"We should have the native DOM promise implementation.");
var Cu = Components.utils;
Cu.import("resource://gre/modules/jsdebugger.jsm");
var dbgGlobal = new Cu.Sandbox(document.nodePrincipal);
addDebuggerToGlobal(dbgGlobal);
var dbg = new dbgGlobal.Debugger(this);
var wrappedPromise;
dbg.onPromiseSettled = function (wp) { wrappedPromise = wp; };
var promise = Promise.resolve();
promise
.then(function () {
ok(wrappedPromise);
is(wrappedPromise.unsafeDereference(), promise);
dbg.onPromiseSettled = undefined;
})
.then(null, function (e) {
ok(false, "Got an unexpected error: " + e);
})
.then(SimpleTest.finish);
</script>
</pre>
</body>
</html>

View File

@ -0,0 +1,59 @@
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<!--
Bug 1084065 - Test that Debugger.prototype.onPromiseResolved doesn't get dupes.
-->
<html>
<head>
<title>Test for interaction with SpiderMonkey's Debugger.prototype.onNewPromise</title>
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css">
</head>
<body>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script type="application/javascript">
SimpleTest.waitForExplicitFinish();
is(Object.prototype.toString.call(new Promise(function () {})),
"[object Promise]",
"We should have the native DOM promise implementation.");
var Cu = Components.utils;
Cu.import("resource://gre/modules/jsdebugger.jsm");
var dbgGlobal = new Cu.Sandbox(document.nodePrincipal);
addDebuggerToGlobal(dbgGlobal);
var dbg = new dbgGlobal.Debugger(this);
var seen = new Set();
dbg.onPromiseSettled = function (wp) {
is(seen.has(wp), false);
seen.add(wp);
};
var promise = new Promise(function (fulfill, reject) {
fulfill(1);
fulfill(2);
fulfill(3);
});
promise
.then(function () {
dbg.onPromiseSettled = undefined;
})
.then(null, function (e) {
ok(false, "Got an unexpected error: " + e);
})
.then(SimpleTest.finish);
</script>
</pre>
</body>
</html>

View File

@ -78,8 +78,8 @@ interface AudioContext : EventTarget {
// Mozilla extensions // Mozilla extensions
partial interface AudioContext { partial interface AudioContext {
// Read AudioChannel.webidl for more information about this attribute. // Read AudioChannel.webidl for more information about this attribute.
[Pref="media.useAudioChannelService", SetterThrows] [Pref="media.useAudioChannelService"]
attribute AudioChannel mozAudioChannelType; readonly attribute AudioChannel mozAudioChannelType;
// These 2 events are dispatched when the AudioContext object is muted by // These 2 events are dispatched when the AudioContext object is muted by
// the AudioChannelService. It's call 'interrupt' because when this event is // the AudioChannelService. It's call 'interrupt' because when this event is

View File

@ -98,12 +98,12 @@ skip-if(Android||B2G) needs-focus == 462758-grabbers-resizers.html 462758-grabbe
== 388980-1.html 388980-1-ref.html == 388980-1.html 388980-1-ref.html
needs-focus == spellcheck-superscript-1.html spellcheck-superscript-1-ref.html needs-focus == spellcheck-superscript-1.html spellcheck-superscript-1-ref.html
skip-if(B2G) fails-if(Android) needs-focus != spellcheck-superscript-2.html spellcheck-superscript-2-ref.html # bug 783658 skip-if(B2G) fails-if(Android) needs-focus != spellcheck-superscript-2.html spellcheck-superscript-2-ref.html # bug 783658
needs-focus == 824080-1.html 824080-1-ref.html needs-focus pref(selectioncaret.enabled,false) == 824080-1.html 824080-1-ref.html
needs-focus == 824080-2.html 824080-2-ref.html needs-focus == 824080-2.html 824080-2-ref.html
needs-focus test-pref(selectioncaret.enabled,false) == 824080-3.html 824080-3-ref.html needs-focus pref(selectioncaret.enabled,false) == 824080-3.html 824080-3-ref.html
needs-focus != 824080-2.html 824080-3.html needs-focus != 824080-2.html 824080-3.html
needs-focus == 824080-4.html 824080-4-ref.html needs-focus pref(selectioncaret.enabled,false) == 824080-4.html 824080-4-ref.html
needs-focus test-pref(selectioncaret.enabled,false) == 824080-5.html 824080-5-ref.html needs-focus pref(selectioncaret.enabled,false) == 824080-5.html 824080-5-ref.html
needs-focus != 824080-4.html 824080-5.html needs-focus != 824080-4.html 824080-5.html
needs-focus == 824080-6.html 824080-6-ref.html needs-focus == 824080-6.html 824080-6-ref.html
needs-focus pref(selectioncaret.enabled,false) == 824080-7.html 824080-7-ref.html needs-focus pref(selectioncaret.enabled,false) == 824080-7.html 824080-7-ref.html

View File

@ -683,11 +683,12 @@ GLContext::InitWithPrefix(const char *prefix, bool trygl)
} }
#ifdef XP_MACOSX #ifdef XP_MACOSX
// The Mac Nvidia driver, for versions up to and including 10.8, don't seem // The Mac Nvidia driver, for versions up to and including 10.8,
// to properly support this. See 814839 // don't seem to properly support this. See 814839
// this has been fixed in Mac OS X 10.9. See 907946 // this has been fixed in Mac OS X 10.9. See 907946
// and it also works in 10.8.3 and higher. See 1094338.
if (Vendor() == gl::GLVendor::NVIDIA && if (Vendor() == gl::GLVendor::NVIDIA &&
!nsCocoaFeatures::OnMavericksOrLater()) !nsCocoaFeatures::IsAtLeastVersion(10,8,3))
{ {
MarkUnsupported(GLFeature::depth_texture); MarkUnsupported(GLFeature::depth_texture);
} }

View File

@ -394,10 +394,10 @@ struct ParamTraits<nsIntPoint>
} }
}; };
template<> template<typename T>
struct ParamTraits<mozilla::gfx::IntSize> struct ParamTraits<mozilla::gfx::IntSizeTyped<T> >
{ {
typedef mozilla::gfx::IntSize paramType; typedef mozilla::gfx::IntSizeTyped<T> paramType;
static void Write(Message* msg, const paramType& param) static void Write(Message* msg, const paramType& param)
{ {
@ -756,6 +756,7 @@ struct ParamTraits<mozilla::layers::FrameMetrics>
WriteParam(aMsg, aParam.mBackgroundColor); WriteParam(aMsg, aParam.mBackgroundColor);
WriteParam(aMsg, aParam.mDoSmoothScroll); WriteParam(aMsg, aParam.mDoSmoothScroll);
WriteParam(aMsg, aParam.mSmoothScrollOffset); WriteParam(aMsg, aParam.mSmoothScrollOffset);
WriteParam(aMsg, aParam.GetLineScrollAmount());
WriteParam(aMsg, aParam.GetContentDescription()); WriteParam(aMsg, aParam.GetContentDescription());
} }
@ -797,6 +798,7 @@ struct ParamTraits<mozilla::layers::FrameMetrics>
ReadParam(aMsg, aIter, &aResult->mBackgroundColor) && ReadParam(aMsg, aIter, &aResult->mBackgroundColor) &&
ReadParam(aMsg, aIter, &aResult->mDoSmoothScroll) && ReadParam(aMsg, aIter, &aResult->mDoSmoothScroll) &&
ReadParam(aMsg, aIter, &aResult->mSmoothScrollOffset) && ReadParam(aMsg, aIter, &aResult->mSmoothScrollOffset) &&
ReadParam(aMsg, aIter, &aResult->mLineScrollAmount) &&
ReadContentDescription(aMsg, aIter, aResult)); ReadContentDescription(aMsg, aIter, aResult));
} }
}; };

View File

@ -65,6 +65,7 @@ public:
, mViewport(0, 0, 0, 0) , mViewport(0, 0, 0, 0)
, mExtraResolution(1) , mExtraResolution(1)
, mBackgroundColor(0, 0, 0, 0) , mBackgroundColor(0, 0, 0, 0)
, mLineScrollAmount(0, 0)
{ {
} }
@ -95,7 +96,8 @@ public:
mUpdateScrollOffset == aOther.mUpdateScrollOffset && mUpdateScrollOffset == aOther.mUpdateScrollOffset &&
mExtraResolution == aOther.mExtraResolution && mExtraResolution == aOther.mExtraResolution &&
mBackgroundColor == aOther.mBackgroundColor && mBackgroundColor == aOther.mBackgroundColor &&
mDoSmoothScroll == aOther.mDoSmoothScroll; mDoSmoothScroll == aOther.mDoSmoothScroll &&
mLineScrollAmount == aOther.mLineScrollAmount;
} }
bool operator!=(const FrameMetrics& aOther) const bool operator!=(const FrameMetrics& aOther) const
{ {
@ -514,6 +516,16 @@ public:
mMayHaveTouchListeners = aMayHaveTouchListeners; mMayHaveTouchListeners = aMayHaveTouchListeners;
} }
const LayoutDeviceIntSize& GetLineScrollAmount() const
{
return mLineScrollAmount;
}
void SetLineScrollAmount(const LayoutDeviceIntSize& size)
{
mLineScrollAmount = size;
}
private: private:
// New fields from now on should be made private and old fields should // New fields from now on should be made private and old fields should
// be refactored to be private. // be refactored to be private.
@ -605,6 +617,9 @@ private:
// This is empty unless this is a scrollable layer and the // This is empty unless this is a scrollable layer and the
// apz.printtree pref is turned on. // apz.printtree pref is turned on.
nsCString mContentDescription; nsCString mContentDescription;
// The value of GetLineScrollAmount(), for scroll frames.
LayoutDeviceIntSize mLineScrollAmount;
}; };
/** /**

View File

@ -611,6 +611,29 @@ APZCTreeManager::ReceiveInputEvent(InputData& aEvent,
MultiTouchInput& touchInput = aEvent.AsMultiTouchInput(); MultiTouchInput& touchInput = aEvent.AsMultiTouchInput();
result = ProcessTouchInput(touchInput, aOutTargetGuid, aOutInputBlockId); result = ProcessTouchInput(touchInput, aOutTargetGuid, aOutInputBlockId);
break; break;
} case SCROLLWHEEL_INPUT: {
ScrollWheelInput& wheelInput = aEvent.AsScrollWheelInput();
nsRefPtr<AsyncPanZoomController> apzc = GetTargetAPZC(wheelInput.mOrigin,
&hitResult);
if (apzc) {
MOZ_ASSERT(hitResult == ApzcHitRegion || hitResult == ApzcContentRegion);
transformToApzc = GetScreenToApzcTransform(apzc);
wheelInput.mLocalOrigin =
TransformTo<ParentLayerPixel>(transformToApzc, wheelInput.mOrigin);
result = mInputQueue->ReceiveInputEvent(
apzc,
/* aTargetConfirmed = */ hitResult,
wheelInput, aOutInputBlockId);
// Update the out-parameters so they are what the caller expects.
apzc->GetGuid(aOutTargetGuid);
Matrix4x4 transformToGecko = transformToApzc * GetApzcToGeckoTransform(apzc);
wheelInput.mOrigin =
TransformTo<ScreenPixel>(transformToGecko, wheelInput.mLocalOrigin);
}
break;
} case PANGESTURE_INPUT: { } case PANGESTURE_INPUT: {
PanGestureInput& panInput = aEvent.AsPanGestureInput(); PanGestureInput& panInput = aEvent.AsPanGestureInput();
nsRefPtr<AsyncPanZoomController> apzc = GetTargetAPZC(panInput.mPanStartPoint, nsRefPtr<AsyncPanZoomController> apzc = GetTargetAPZC(panInput.mPanStartPoint,

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