зеркало из https://github.com/mozilla/gecko-dev.git
Merge m-c and birch.
This commit is contained in:
Коммит
7ec088f396
|
@ -116,6 +116,7 @@ this.AccessFu = {
|
|||
Services.obs.addObserver(this, 'Accessibility:PreviousObject', false);
|
||||
Services.obs.addObserver(this, 'Accessibility:Focus', false);
|
||||
Services.obs.addObserver(this, 'Accessibility:ActivateObject', false);
|
||||
Services.obs.addObserver(this, 'Accessibility:MoveCaret', false);
|
||||
Utils.win.addEventListener('TabOpen', this);
|
||||
Utils.win.addEventListener('TabClose', this);
|
||||
Utils.win.addEventListener('TabSelect', this);
|
||||
|
@ -158,6 +159,7 @@ this.AccessFu = {
|
|||
Services.obs.removeObserver(this, 'Accessibility:PreviousObject');
|
||||
Services.obs.removeObserver(this, 'Accessibility:Focus');
|
||||
Services.obs.removeObserver(this, 'Accessibility:ActivateObject');
|
||||
Services.obs.removeObserver(this, 'Accessibility:MoveCaret');
|
||||
|
||||
if (this.doneCallback) {
|
||||
this.doneCallback();
|
||||
|
@ -277,6 +279,9 @@ this.AccessFu = {
|
|||
{action: 'whereIsIt', move: true});
|
||||
}
|
||||
break;
|
||||
case 'Accessibility:MoveCaret':
|
||||
this.Input.moveCaret(JSON.parse(aData));
|
||||
break;
|
||||
case 'remote-browser-frame-shown':
|
||||
case 'in-process-browser-or-app-frame-shown':
|
||||
{
|
||||
|
@ -667,6 +672,18 @@ var Input = {
|
|||
inputType: aInputType});
|
||||
},
|
||||
|
||||
moveCaret: function moveCaret(aDetails) {
|
||||
if (!this.editState.editing) {
|
||||
return;
|
||||
}
|
||||
|
||||
aDetails.atStart = this.editState.atStart;
|
||||
aDetails.atEnd = this.editState.atEnd;
|
||||
|
||||
let mm = Utils.getMessageManager(Utils.CurrentBrowser);
|
||||
mm.sendAsyncMessage('AccessFu:MoveCaret', aDetails);
|
||||
},
|
||||
|
||||
activateCurrent: function activateCurrent() {
|
||||
let mm = Utils.getMessageManager(Utils.CurrentBrowser);
|
||||
mm.sendAsyncMessage('AccessFu:Activate', {});
|
||||
|
|
|
@ -61,7 +61,7 @@ Presenter.prototype = {
|
|||
/**
|
||||
* Text selection has changed. TODO.
|
||||
*/
|
||||
textSelectionChanged: function textSelectionChanged() {},
|
||||
textSelectionChanged: function textSelectionChanged(aText, aStart, aEnd, aOldStart, aOldEnd) {},
|
||||
|
||||
/**
|
||||
* Selection has changed. TODO.
|
||||
|
@ -205,8 +205,10 @@ AndroidPresenter.prototype = {
|
|||
ANDROID_VIEW_HOVER_ENTER: 0x80,
|
||||
ANDROID_VIEW_HOVER_EXIT: 0x100,
|
||||
ANDROID_VIEW_SCROLLED: 0x1000,
|
||||
ANDROID_VIEW_TEXT_SELECTION_CHANGED: 0x2000,
|
||||
ANDROID_ANNOUNCEMENT: 0x4000,
|
||||
ANDROID_VIEW_ACCESSIBILITY_FOCUSED: 0x8000,
|
||||
ANDROID_VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY: 0x20000,
|
||||
|
||||
pivotChanged: function AndroidPresenter_pivotChanged(aContext, aReason) {
|
||||
if (!aContext.accessible)
|
||||
|
@ -302,6 +304,37 @@ AndroidPresenter.prototype = {
|
|||
return {type: this.type, details: [eventDetails]};
|
||||
},
|
||||
|
||||
textSelectionChanged: function AndroidPresenter_textSelectionChanged(aText, aStart,
|
||||
aEnd, aOldStart,
|
||||
aOldEnd) {
|
||||
let androidEvents = [];
|
||||
|
||||
if (Utils.AndroidSdkVersion >= 14) {
|
||||
androidEvents.push({
|
||||
eventType: this.ANDROID_VIEW_TEXT_SELECTION_CHANGED,
|
||||
text: [aText],
|
||||
fromIndex: aStart,
|
||||
toIndex: aEnd,
|
||||
itemCount: aText.length
|
||||
});
|
||||
}
|
||||
|
||||
if (Utils.AndroidSdkVersion >= 16) {
|
||||
let [from, to] = aOldStart < aStart ? [aOldStart, aStart] : [aStart, aOldStart];
|
||||
androidEvents.push({
|
||||
eventType: this.ANDROID_VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY,
|
||||
text: [aText],
|
||||
fromIndex: from,
|
||||
toIndex: to
|
||||
});
|
||||
}
|
||||
|
||||
return {
|
||||
type: this.type,
|
||||
details: androidEvents
|
||||
};
|
||||
},
|
||||
|
||||
viewportChanged: function AndroidPresenter_viewportChanged(aWindow) {
|
||||
if (Utils.AndroidSdkVersion < 14)
|
||||
return null;
|
||||
|
@ -445,6 +478,11 @@ this.Presentation = {
|
|||
for each (p in this.presenters)];
|
||||
},
|
||||
|
||||
textSelectionChanged: function textSelectionChanged(aText, aStart, aEnd, aOldStart, aOldEnd) {
|
||||
return [p.textSelectionChanged(aText, aStart, aEnd, aOldStart, aOldEnd)
|
||||
for each (p in this.presenters)];
|
||||
},
|
||||
|
||||
tabStateChanged: function Presentation_tabStateChanged(aDocObj, aPageState) {
|
||||
return [p.tabStateChanged(aDocObj, aPageState)
|
||||
for each (p in this.presenters)];
|
||||
|
|
|
@ -172,6 +172,58 @@ function activateContextMenu(aMessage) {
|
|||
sendContextMenuCoordinates(vc.position);
|
||||
}
|
||||
|
||||
function moveCaret(aMessage) {
|
||||
const MOVEMENT_GRANULARITY_CHARACTER = 1;
|
||||
const MOVEMENT_GRANULARITY_WORD = 2;
|
||||
const MOVEMENT_GRANULARITY_PARAGRAPH = 8;
|
||||
|
||||
let direction = aMessage.json.direction;
|
||||
let granularity = aMessage.json.granularity;
|
||||
let accessible = Utils.getVirtualCursor(content.document).position;
|
||||
let accText = accessible.QueryInterface(Ci.nsIAccessibleText);
|
||||
let oldOffset = accText.caretOffset;
|
||||
let text = accText.getText(0, accText.characterCount);
|
||||
|
||||
let start = {}, end = {};
|
||||
if (direction === 'Previous' && !aMessage.json.atStart) {
|
||||
switch (granularity) {
|
||||
case MOVEMENT_GRANULARITY_CHARACTER:
|
||||
accText.caretOffset--;
|
||||
break;
|
||||
case MOVEMENT_GRANULARITY_WORD:
|
||||
accText.getTextBeforeOffset(accText.caretOffset,
|
||||
Ci.nsIAccessibleText.BOUNDARY_WORD_START, start, end);
|
||||
accText.caretOffset = end.value === accText.caretOffset ? start.value : end.value;
|
||||
break;
|
||||
case MOVEMENT_GRANULARITY_PARAGRAPH:
|
||||
let startOfParagraph = text.lastIndexOf('\n', accText.caretOffset - 1);
|
||||
accText.caretOffset = startOfParagraph !== -1 ? startOfParagraph : 0;
|
||||
break;
|
||||
}
|
||||
} else if (direction === 'Next' && !aMessage.json.atEnd) {
|
||||
switch (granularity) {
|
||||
case MOVEMENT_GRANULARITY_CHARACTER:
|
||||
accText.caretOffset++;
|
||||
break;
|
||||
case MOVEMENT_GRANULARITY_WORD:
|
||||
accText.getTextAtOffset(accText.caretOffset,
|
||||
Ci.nsIAccessibleText.BOUNDARY_WORD_END, start, end);
|
||||
accText.caretOffset = end.value;
|
||||
break;
|
||||
case MOVEMENT_GRANULARITY_PARAGRAPH:
|
||||
accText.caretOffset = text.indexOf('\n', accText.caretOffset + 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
let newOffset = accText.caretOffset;
|
||||
if (oldOffset !== newOffset) {
|
||||
let msg = Presentation.textSelectionChanged(text, newOffset, newOffset,
|
||||
oldOffset, oldOffset);
|
||||
sendAsyncMessage('AccessFu:Present', msg);
|
||||
}
|
||||
}
|
||||
|
||||
function scroll(aMessage) {
|
||||
let vc = Utils.getVirtualCursor(content.document);
|
||||
|
||||
|
@ -262,6 +314,7 @@ addMessageListener(
|
|||
addMessageListener('AccessFu:Activate', activateCurrent);
|
||||
addMessageListener('AccessFu:ContextMenu', activateContextMenu);
|
||||
addMessageListener('AccessFu:Scroll', scroll);
|
||||
addMessageListener('AccessFu:MoveCaret', moveCaret);
|
||||
|
||||
if (!eventManager) {
|
||||
eventManager = new EventManager(this);
|
||||
|
@ -278,6 +331,7 @@ addMessageListener(
|
|||
removeMessageListener('AccessFu:Activate', activateCurrent);
|
||||
removeMessageListener('AccessFu:ContextMenu', activateContextMenu);
|
||||
removeMessageListener('AccessFu:Scroll', scroll);
|
||||
removeMessageListener('AccessFu:MoveCaret', moveCaret);
|
||||
|
||||
eventManager.stop();
|
||||
});
|
||||
|
|
|
@ -4052,13 +4052,14 @@ let SessionStoreInternal = {
|
|||
* @returns boolean
|
||||
*/
|
||||
_shouldSaveTabState: function ssi_shouldSaveTabState(aTabState) {
|
||||
// If the tab has only the transient about:blank history entry, no other
|
||||
// If the tab has only a transient about: history entry, no other
|
||||
// session history, and no userTypedValue, then we don't actually want to
|
||||
// store this tab's data.
|
||||
return aTabState.entries.length &&
|
||||
!(aTabState.entries.length == 1 &&
|
||||
aTabState.entries[0].url == "about:blank" &&
|
||||
!aTabState.userTypedValue);
|
||||
(aTabState.entries[0].url == "about:blank" ||
|
||||
aTabState.entries[0].url == "about:newtab") &&
|
||||
!aTabState.userTypedValue);
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
|
@ -68,7 +68,8 @@ gcli.addCommand({
|
|||
params: [
|
||||
{
|
||||
name: "name",
|
||||
type: "string"
|
||||
type: "string",
|
||||
manual: gcli.lookup("profilerStartManual")
|
||||
}
|
||||
],
|
||||
|
||||
|
@ -114,7 +115,8 @@ gcli.addCommand({
|
|||
params: [
|
||||
{
|
||||
name: "name",
|
||||
type: "string"
|
||||
type: "string",
|
||||
manual: gcli.lookup("profilerStopManual")
|
||||
}
|
||||
],
|
||||
|
||||
|
@ -196,7 +198,8 @@ gcli.addCommand({
|
|||
params: [
|
||||
{
|
||||
name: "name",
|
||||
type: "string"
|
||||
type: "string",
|
||||
manual: gcli.lookup("profilerShowManual")
|
||||
}
|
||||
],
|
||||
|
||||
|
|
|
@ -1209,10 +1209,19 @@ profilerCloseDesc=Close the profiler
|
|||
# of the profiler start command.
|
||||
profilerStartDesc=Start profiling
|
||||
|
||||
# LOCALIZATION NOTE (profilerStartManual) A fuller description of the 'profile name'
|
||||
# parameter. This parameter is used to name a newly created profile or to lookup
|
||||
# an existing profile by its name.
|
||||
profilerStartManual=Name of a profile you wish to start.
|
||||
|
||||
# LOCALIZATION NOTE (profilerStop) A very short string used to describe the function
|
||||
# of the profiler stop command.
|
||||
profilerStopDesc=Stop profiling
|
||||
|
||||
# LOCALIZATION NOTE (profilerStopManual) A fuller description of the 'profile name'
|
||||
# parameter. This parameter is used to lookup an existing profile by its name.
|
||||
profilerStopManual=Name of a profile you wish to stop.
|
||||
|
||||
# LOCALIZATION NOTE (profilerList) A very short string used to describe the function
|
||||
# of the profiler list command.
|
||||
profilerListDesc=List all profiles
|
||||
|
@ -1221,6 +1230,11 @@ profilerListDesc=List all profiles
|
|||
# of the profiler show command.
|
||||
profilerShowDesc=Show individual profile
|
||||
|
||||
# LOCALIZATION NOTE (profilerShowManual) A fuller description of the 'profile name'
|
||||
# parameter. This parameter is used to name a newly created profile or to lookup
|
||||
# an existing profile by its name.
|
||||
profilerShowManual=Name of a profile.
|
||||
|
||||
# LOCALIZATION NOTE (profilerAlreadyStarted) A message that is displayed whenever
|
||||
# an operation cannot be completed because the profile in question has already
|
||||
# been started.
|
||||
|
|
|
@ -991,7 +991,6 @@ var SelectionHelperUI = {
|
|||
if (aEvent.touches.length != 1)
|
||||
break;
|
||||
let touch = aEvent.touches[0];
|
||||
this._movement.x = this._movement.y = 0;
|
||||
this._movement.x = touch.clientX;
|
||||
this._movement.y = touch.clientY;
|
||||
this._movement.active = true;
|
||||
|
@ -1007,10 +1006,10 @@ var SelectionHelperUI = {
|
|||
if (aEvent.touches.length != 1)
|
||||
break;
|
||||
let touch = aEvent.touches[0];
|
||||
// Clear our selection overlay when the user starts to pan the page
|
||||
// Clear selection when the user pans the page
|
||||
if (!this._checkForActiveDrag() && this._movement.active) {
|
||||
let distanceY = touch.clientY - this._movement.y;
|
||||
if (Math.abs(distanceY) > kDisableOnScrollDistance) {
|
||||
if (Math.abs(touch.clientX - this._movement.x) > kDisableOnScrollDistance ||
|
||||
Math.abs(touch.clientY - this._movement.y) > kDisableOnScrollDistance) {
|
||||
this.closeEditSession(true);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2089,7 +2089,7 @@ window[tabsontop="false"] richlistitem[type~="action"][actiontype="switchtab"][s
|
|||
}
|
||||
|
||||
#historySwipeAnimationContainer {
|
||||
background: url("chrome://browser/skin/linen-pattern.png") #B3B9C1;
|
||||
background: url("chrome://browser/skin/subtle-pattern.png") #B3B9C1;
|
||||
}
|
||||
|
||||
/* ----- SIDEBAR ELEMENTS ----- */
|
||||
|
|
|
@ -39,7 +39,7 @@ browser.jar:
|
|||
skin/classic/browser/Info.png
|
||||
skin/classic/browser/keyhole-circle.png
|
||||
skin/classic/browser/KUI-background.png
|
||||
skin/classic/browser/linen-pattern.png
|
||||
skin/classic/browser/subtle-pattern.png
|
||||
skin/classic/browser/menu-back.png
|
||||
skin/classic/browser/menu-forward.png
|
||||
skin/classic/browser/notification-16.png
|
||||
|
|
Двоичные данные
browser/themes/osx/linen-pattern.png
Двоичные данные
browser/themes/osx/linen-pattern.png
Двоичный файл не отображается.
До Ширина: | Высота: | Размер: 42 KiB |
Двоичный файл не отображается.
После Ширина: | Высота: | Размер: 14 KiB |
|
@ -13,6 +13,8 @@ dir-tests := $(DEPTH)/$(mobile-tests)
|
|||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
ANDROID_APK_NAME := robocop-debug
|
||||
|
||||
ROBOTIUM_PATH = $(srcdir)/robotium-solo-3.6.jar
|
||||
|
||||
JAVAFILES = \
|
||||
|
@ -81,9 +83,10 @@ GARBAGE += \
|
|||
$(java-tests-dep) \
|
||||
$(_JAVA_HARNESS) \
|
||||
classes.dex \
|
||||
robocop.ap_ \
|
||||
robocop-debug-signed.apk \
|
||||
robocop-debug-signed-unaligned.apk \
|
||||
$(ANDROID_APK_NAME).ap_ \
|
||||
$(ANDROID_APK_NAME)-unsigned-unaligned.apk \
|
||||
$(ANDROID_APK_NAME)-unaligned.apk \
|
||||
$(ANDROID_APK_NAME).apk \
|
||||
$(robocop-deps) \
|
||||
$(NULL)
|
||||
|
||||
|
@ -100,23 +103,28 @@ include $(topsrcdir)/config/android-common.mk
|
|||
|
||||
GENERATED_DIRS_tools = classes $(dir-tests)
|
||||
|
||||
libs:: robocop-debug-signed.apk
|
||||
tools:: $(ANDROID_APK_NAME).apk
|
||||
|
||||
classes.dex: robocop.ap_
|
||||
classes.dex: $(ANDROID_APK_NAME).ap_
|
||||
classes.dex: $(robocop-deps)
|
||||
classes.dex: $(java-harness-dep)
|
||||
classes.dex: $(java-tests-dep)
|
||||
$(JAVAC) $(JAVAC_FLAGS) -d classes $(JAVAFILES) $(_JAVA_HARNESS) $(java-tests-dep)
|
||||
$(DX) --dex --output=$@ classes $(ROBOTIUM_PATH) $(ANDROID_COMPT_LIB)
|
||||
|
||||
robocop.ap_: AndroidManifest.xml $(TESTPATH)/assets/*
|
||||
$(ANDROID_APK_NAME).ap_: AndroidManifest.xml $(TESTPATH)/assets/*
|
||||
$(AAPT) package -f -M $< -I $(ANDROID_SDK)/android.jar -I . -S res -A $(TESTPATH)/assets -F $@ -J ./
|
||||
|
||||
robocop-debug-signed-unaligned.apk: robocop.ap_ classes.dex
|
||||
$(APKBUILDER) $@ -v $(APKBUILDER_FLAGS) -z robocop.ap_ -f classes.dex
|
||||
$(ANDROID_APK_NAME)-unsigned-unaligned.apk: $(ANDROID_APK_NAME).ap_ classes.dex
|
||||
cp $< $@
|
||||
$(ZIP) -0 $@ classes.dex
|
||||
|
||||
robocop-debug-signed.apk: robocop-debug-signed-unaligned.apk
|
||||
$(ZIPALIGN) -f -v 4 $^ $@
|
||||
$(ANDROID_APK_NAME)-unaligned.apk: $(ANDROID_APK_NAME)-unsigned-unaligned.apk
|
||||
cp $< $@
|
||||
$(DEBUG_JARSIGNER) $@
|
||||
|
||||
$(ANDROID_APK_NAME).apk: $(ANDROID_APK_NAME)-unaligned.apk
|
||||
$(ZIPALIGN) -f -v 4 $< $@
|
||||
|
||||
# PP_java-tests not fully usable here
|
||||
# Intermediate step toward a library rule.
|
||||
|
|
|
@ -9,6 +9,8 @@ VPATH = @srcdir@
|
|||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
ANDROID_APK_NAME := sutAgentAndroid
|
||||
|
||||
JAVAFILES = \
|
||||
AlertLooperThread.java \
|
||||
ASMozStub.java \
|
||||
|
@ -39,10 +41,10 @@ RES_FILES = \
|
|||
GARBAGE += \
|
||||
AndroidManifest.xml \
|
||||
classes.dex \
|
||||
sutAgentAndroid.apk \
|
||||
sutAgentAndroid.ap_ \
|
||||
sutAgentAndroid-unsigned-unaligned.apk \
|
||||
sutAgentAndroid-unaligned.apk \
|
||||
$(ANDROID_APK_NAME).ap_ \
|
||||
$(ANDROID_APK_NAME)-unsigned-unaligned.apk \
|
||||
$(ANDROID_APK_NAME)-unaligned.apk \
|
||||
$(ANDROID_APK_NAME).apk \
|
||||
$(NULL)
|
||||
|
||||
GARBAGE_DIRS += network-libs
|
||||
|
@ -56,23 +58,22 @@ include $(topsrcdir)/config/rules.mk
|
|||
# include Android specific java flags - using these instead of what's in rules.mk
|
||||
include $(topsrcdir)/config/android-common.mk
|
||||
|
||||
tools:: sutAgentAndroid.apk
|
||||
tools:: $(ANDROID_APK_NAME).apk
|
||||
|
||||
classes.dex: $(JAVAFILES)
|
||||
$(JAVAC) $(JAVAC_FLAGS) -d classes $(addprefix $(srcdir)/,$(JAVAFILES))
|
||||
$(DX) --dex --output=$@ classes $(subst :, ,$(EXTRA_JARS))
|
||||
|
||||
sutAgentAndroid.ap_: $(srcdir)/AndroidManifest.xml
|
||||
$(ANDROID_APK_NAME).ap_: AndroidManifest.xml
|
||||
$(AAPT) package -f -M $< -I $(ANDROID_SDK)/android.jar -S res -F $@
|
||||
|
||||
sutAgentAndroid-unsigned-unaligned.apk: sutAgentAndroid.ap_ classes.dex
|
||||
$(APKBUILDER) $@ -v $(APKBUILDER_FLAGS) -z sutAgentAndroid.ap_ -f classes.dex
|
||||
|
||||
sutAgentAndroid-unaligned.apk: sutAgentAndroid-unsigned-unaligned.apk
|
||||
$(ANDROID_APK_NAME)-unsigned-unaligned.apk: $(ANDROID_APK_NAME).ap_ classes.dex
|
||||
cp $< $@
|
||||
ifdef JARSIGNER
|
||||
$(JARSIGNER) $@
|
||||
endif
|
||||
$(ZIP) -0 $@ classes.dex
|
||||
|
||||
sutAgentAndroid.apk: sutAgentAndroid-unaligned.apk
|
||||
$(ZIPALIGN) -f -v 4 sutAgentAndroid-unaligned.apk $@
|
||||
$(ANDROID_APK_NAME)-unaligned.apk: $(ANDROID_APK_NAME)-unsigned-unaligned.apk
|
||||
cp $< $@
|
||||
$(DEBUG_JARSIGNER) $@
|
||||
|
||||
$(ANDROID_APK_NAME).apk: $(ANDROID_APK_NAME)-unaligned.apk
|
||||
$(ZIPALIGN) -f -v 4 $< $@
|
||||
|
|
|
@ -9,6 +9,8 @@ VPATH = @srcdir@
|
|||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
ANDROID_APK_NAME := FenCP
|
||||
|
||||
JAVAFILES = \
|
||||
DirCursor.java \
|
||||
FenCP.java \
|
||||
|
@ -28,7 +30,10 @@ RES_FILES = \
|
|||
GARBAGE += \
|
||||
AndroidManifest.xml \
|
||||
classes.dex \
|
||||
FenCP.apk \
|
||||
$(ANDROID_APK_NAME).ap_ \
|
||||
$(ANDROID_APK_NAME)-unsigned-unaligned.apk \
|
||||
$(ANDROID_APK_NAME)-unaligned.apk \
|
||||
$(ANDROID_APK_NAME).apk \
|
||||
$(NULL)
|
||||
|
||||
GARBAGE_DIRS += network-libs
|
||||
|
@ -40,23 +45,22 @@ include $(topsrcdir)/config/rules.mk
|
|||
# include Android specific java flags - using these instead of what's in rules.mk
|
||||
include $(topsrcdir)/config/android-common.mk
|
||||
|
||||
tools:: FenCP.apk
|
||||
tools:: $(ANDROID_APK_NAME).apk
|
||||
|
||||
classes.dex: $(JAVAFILES)
|
||||
$(JAVAC) $(JAVAC_FLAGS) -d classes $(addprefix $(srcdir)/,$(JAVAFILES))
|
||||
$(DX) --dex --output=$@ classes
|
||||
|
||||
FenCP.ap_: $(srcdir)/AndroidManifest.xml
|
||||
$(AAPT) package -f -M $(srcdir)/AndroidManifest.xml -I $(ANDROID_SDK)/android.jar -S res -F $@
|
||||
$(ANDROID_APK_NAME).ap_: AndroidManifest.xml
|
||||
$(AAPT) package -f -M $< -I $(ANDROID_SDK)/android.jar -S res -F $@
|
||||
|
||||
FenCP-unsigned-unaligned.apk: FenCP.ap_ classes.dex
|
||||
$(APKBUILDER) $@ -v $(APKBUILDER_FLAGS) -z FenCP.ap_ -f classes.dex
|
||||
$(ANDROID_APK_NAME)-unsigned-unaligned.apk: $(ANDROID_APK_NAME).ap_ classes.dex
|
||||
cp $< $@
|
||||
$(ZIP) -0 $@ classes.dex
|
||||
|
||||
FenCP-unaligned.apk: FenCP-unsigned-unaligned.apk
|
||||
cp FenCP-unsigned-unaligned.apk $@
|
||||
ifdef JARSIGNER
|
||||
$(JARSIGNER) $@
|
||||
endif
|
||||
$(ANDROID_APK_NAME)-unaligned.apk: $(ANDROID_APK_NAME)-unsigned-unaligned.apk
|
||||
cp $< $@
|
||||
$(DEBUG_JARSIGNER) $@
|
||||
|
||||
FenCP.apk: FenCP-unaligned.apk
|
||||
$(ZIPALIGN) -f -v 4 FenCP-unaligned.apk $@
|
||||
$(ANDROID_APK_NAME).apk: $(ANDROID_APK_NAME)-unaligned.apk
|
||||
$(ZIPALIGN) -f -v 4 $< $@
|
||||
|
|
|
@ -9,6 +9,8 @@ VPATH = @srcdir@
|
|||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
ANDROID_APK_NAME := FfxCP
|
||||
|
||||
JAVAFILES = \
|
||||
DirCursor.java \
|
||||
ffxcp.java \
|
||||
|
@ -28,7 +30,10 @@ RES_FILES = \
|
|||
GARBAGE += \
|
||||
AndroidManifest.xml \
|
||||
classes.dex \
|
||||
FfxCP.apk \
|
||||
$(ANDROID_APK_NAME).ap_ \
|
||||
$(ANDROID_APK_NAME)-unsigned-unaligned.apk \
|
||||
$(ANDROID_APK_NAME)-unaligned.apk \
|
||||
$(ANDROID_APK_NAME).apk \
|
||||
$(NULL)
|
||||
|
||||
GARBAGE_DIRS += network-libs
|
||||
|
@ -40,23 +45,22 @@ include $(topsrcdir)/config/rules.mk
|
|||
# include Android specific java flags - using these instead of what's in rules.mk
|
||||
include $(topsrcdir)/config/android-common.mk
|
||||
|
||||
tools:: FfxCP.apk
|
||||
tools:: $(ANDROID_APK_NAME).apk
|
||||
|
||||
classes.dex: $(JAVAFILES)
|
||||
$(JAVAC) $(JAVAC_FLAGS) -d classes $(addprefix $(srcdir)/,$(JAVAFILES))
|
||||
$(DX) --dex --output=$@ classes
|
||||
|
||||
FfxCP.ap_: $(srcdir)/AndroidManifest.xml
|
||||
$(AAPT) package -f -M $(srcdir)/AndroidManifest.xml -I $(ANDROID_SDK)/android.jar -S res -F $@
|
||||
$(ANDROID_APK_NAME).ap_: AndroidManifest.xml
|
||||
$(AAPT) package -f -M $< -I $(ANDROID_SDK)/android.jar -S res -F $@
|
||||
|
||||
FfxCP-unsigned-unaligned.apk: FfxCP.ap_ classes.dex
|
||||
$(APKBUILDER) $@ -v $(APKBUILDER_FLAGS) -z FfxCP.ap_ -f classes.dex
|
||||
$(ANDROID_APK_NAME)-unsigned-unaligned.apk: $(ANDROID_APK_NAME).ap_ classes.dex
|
||||
cp $< $@
|
||||
$(ZIP) -0 $@ classes.dex
|
||||
|
||||
FfxCP-unaligned.apk: FfxCP-unsigned-unaligned.apk
|
||||
cp FfxCP-unsigned-unaligned.apk $@
|
||||
ifdef JARSIGNER
|
||||
$(JARSIGNER) $@
|
||||
endif
|
||||
$(ANDROID_APK_NAME)-unaligned.apk: $(ANDROID_APK_NAME)-unsigned-unaligned.apk
|
||||
cp $< $@
|
||||
$(DEBUG_JARSIGNER) $@
|
||||
|
||||
FfxCP.apk: FfxCP-unaligned.apk
|
||||
$(ZIPALIGN) -f -v 4 FfxCP-unaligned.apk $@
|
||||
$(ANDROID_APK_NAME).apk: $(ANDROID_APK_NAME)-unaligned.apk
|
||||
$(ZIPALIGN) -f -v 4 $< $@
|
||||
|
|
|
@ -9,6 +9,8 @@ VPATH = @srcdir@
|
|||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
ANDROID_APK_NAME := Watcher
|
||||
|
||||
JAVAFILES = \
|
||||
IWatcherService.java \
|
||||
RedirOutputThread.java \
|
||||
|
@ -32,7 +34,10 @@ RES_FILES = \
|
|||
GARBAGE += \
|
||||
AndroidManifest.xml \
|
||||
classes.dex \
|
||||
Watcher.apk \
|
||||
$(ANDROID_APK_NAME).ap_ \
|
||||
$(ANDROID_APK_NAME)-unsigned-unaligned.apk \
|
||||
$(ANDROID_APK_NAME)-unaligned.apk \
|
||||
$(ANDROID_APK_NAME).apk \
|
||||
$(NULL)
|
||||
|
||||
GARBAGE_DIRS += res classes network-libs
|
||||
|
@ -44,29 +49,23 @@ include $(topsrcdir)/config/rules.mk
|
|||
# include Android specific java flags - using these instead of what's in rules.mk
|
||||
include $(topsrcdir)/config/android-common.mk
|
||||
|
||||
tools:: Watcher.apk
|
||||
tools:: $(ANDROID_APK_NAME).apk
|
||||
|
||||
classes.dex: $(JAVAFILES)
|
||||
$(NSINSTALL) -D classes
|
||||
$(JAVAC) $(JAVAC_FLAGS) -d classes $(addprefix $(srcdir)/,$(JAVAFILES))
|
||||
$(DX) --dex --output=$@ classes
|
||||
|
||||
Watcher.ap_: $(srcdir)/AndroidManifest.xml
|
||||
$(AAPT) package -f -M $(srcdir)/AndroidManifest.xml -I $(ANDROID_SDK)/android.jar -S res -F $@
|
||||
$(ANDROID_APK_NAME).ap_: AndroidManifest.xml
|
||||
$(AAPT) package -f -M $< -I $(ANDROID_SDK)/android.jar -S res -F $@
|
||||
|
||||
Watcher-unsigned-unaligned.apk: Watcher.ap_ classes.dex
|
||||
$(APKBUILDER) $@ -v $(APKBUILDER_FLAGS) -z Watcher.ap_ -f classes.dex
|
||||
$(ANDROID_APK_NAME)-unsigned-unaligned.apk: $(ANDROID_APK_NAME).ap_ classes.dex
|
||||
cp $< $@
|
||||
$(ZIP) -0 $@ classes.dex
|
||||
|
||||
Watcher-unaligned.apk: Watcher-unsigned-unaligned.apk
|
||||
cp Watcher-unsigned-unaligned.apk $@
|
||||
ifdef JARSIGNER
|
||||
$(JARSIGNER) $@
|
||||
endif
|
||||
|
||||
Watcher.apk: Watcher-unaligned.apk
|
||||
$(ZIPALIGN) -f -v 4 Watcher-unaligned.apk $@
|
||||
|
||||
export::
|
||||
$(NSINSTALL) -D res
|
||||
@(cd $(srcdir)/res && tar $(TAR_CREATE_FLAGS) - *) | (cd $(DEPTH)/build/mobile/sutagent/android/watcher/res && tar -xf -)
|
||||
$(ANDROID_APK_NAME)-unaligned.apk: $(ANDROID_APK_NAME)-unsigned-unaligned.apk
|
||||
cp $< $@
|
||||
$(DEBUG_JARSIGNER) $@
|
||||
|
||||
$(ANDROID_APK_NAME).apk: $(ANDROID_APK_NAME)-unaligned.apk
|
||||
$(ZIPALIGN) -f -v 4 $< $@
|
||||
|
|
|
@ -409,8 +409,7 @@ private:
|
|||
uint32_t aAction);
|
||||
|
||||
nsresult
|
||||
LookupPolicy(JSContext* cx,
|
||||
nsIPrincipal* principal,
|
||||
LookupPolicy(nsIPrincipal* principal,
|
||||
ClassInfoData& aClassData, jsid aProperty,
|
||||
uint32_t aAction,
|
||||
ClassPolicy** aCachedClassPolicy,
|
||||
|
|
|
@ -626,7 +626,7 @@ nsScriptSecurityManager::CheckPropertyAccessImpl(uint32_t aAction,
|
|||
|
||||
//-- Look up the security policy for this class and subject domain
|
||||
SecurityLevel securityLevel;
|
||||
rv = LookupPolicy(cx, subjectPrincipal, classInfoData, property, aAction,
|
||||
rv = LookupPolicy(subjectPrincipal, classInfoData, property, aAction,
|
||||
(ClassPolicy**)aCachedClassPolicy, &securityLevel);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
@ -969,14 +969,14 @@ nsScriptSecurityManager::CheckSameOriginDOMProp(nsIPrincipal* aSubject,
|
|||
}
|
||||
|
||||
nsresult
|
||||
nsScriptSecurityManager::LookupPolicy(JSContext* cx,
|
||||
nsIPrincipal* aPrincipal,
|
||||
nsScriptSecurityManager::LookupPolicy(nsIPrincipal* aPrincipal,
|
||||
ClassInfoData& aClassData,
|
||||
jsid aProperty,
|
||||
uint32_t aAction,
|
||||
ClassPolicy** aCachedClassPolicy,
|
||||
SecurityLevel* result)
|
||||
{
|
||||
AutoJSContext cx;
|
||||
nsresult rv;
|
||||
JS::RootedId property(cx, aProperty);
|
||||
result->level = SCRIPT_SECURITY_UNDEFINED_ACCESS;
|
||||
|
@ -1445,8 +1445,7 @@ nsScriptSecurityManager::CheckLoadURIWithPrincipal(nsIPrincipal* aPrincipal,
|
|||
ClassInfoData nameData(nullptr, loadURIPrefGroup);
|
||||
|
||||
SecurityLevel secLevel;
|
||||
rv = LookupPolicy(GetCurrentJSContext(),
|
||||
aPrincipal, nameData, sEnabledID,
|
||||
rv = LookupPolicy(aPrincipal, nameData, sEnabledID,
|
||||
nsIXPCSecurityManager::ACCESS_GET_PROPERTY,
|
||||
nullptr, &secLevel);
|
||||
if (NS_SUCCEEDED(rv) && secLevel.level == SCRIPT_SECURITY_ALL_ACCESS)
|
||||
|
@ -1751,7 +1750,7 @@ nsScriptSecurityManager::CanExecuteScripts(JSContext* cx,
|
|||
ClassInfoData nameData(nullptr, jsPrefGroupName);
|
||||
|
||||
SecurityLevel secLevel;
|
||||
rv = LookupPolicy(cx, aPrincipal, nameData, sEnabledID,
|
||||
rv = LookupPolicy(aPrincipal, nameData, sEnabledID,
|
||||
nsIXPCSecurityManager::ACCESS_GET_PROPERTY,
|
||||
nullptr, &secLevel);
|
||||
if (NS_FAILED(rv) || secLevel.level == SCRIPT_SECURITY_NO_ACCESS)
|
||||
|
|
|
@ -14,12 +14,11 @@ endif
|
|||
|
||||
DX=$(ANDROID_BUILD_TOOLS)/dx
|
||||
AAPT=$(ANDROID_BUILD_TOOLS)/aapt
|
||||
APKBUILDER=$(ANDROID_SDK)/../../tools/apkbuilder
|
||||
AIDL=$(ANDROID_BUILD_TOOLS)/aidl
|
||||
ADB=$(ANDROID_PLATFORM_TOOLS)/adb
|
||||
ZIPALIGN=$(ANDROID_SDK)/../../tools/zipalign
|
||||
|
||||
ifdef JARSIGNER
|
||||
APKBUILDER_FLAGS += -u
|
||||
endif
|
||||
# DEBUG_JARSIGNER always debug signs.
|
||||
DEBUG_JARSIGNER=$(PYTHON) $(call core_abspath,$(topsrcdir)/mobile/android/debug_sign_tool.py)
|
||||
|
||||
# For Android, this defaults to $(ANDROID_SDK)/android.jar
|
||||
ifndef JAVA_BOOTCLASSPATH
|
||||
|
|
56
configure.in
56
configure.in
|
@ -4708,15 +4708,34 @@ then
|
|||
[ QTDIR=$withval])
|
||||
|
||||
if test -z "$QTDIR"; then
|
||||
PKG_CHECK_MODULES(MOZ_QT, QtGui QtNetwork QtCore QtOpenGL)
|
||||
PKG_CHECK_MODULES(MOZ_QT5, Qt5Widgets Qt5Multimedia Qt5PrintSupport,
|
||||
MOZ_ENABLE_QT5=1,
|
||||
MOZ_ENABLE_QT5=)
|
||||
if test "$MOZ_ENABLE_QT5"; then
|
||||
echo "Using qt5"
|
||||
MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $MOZ_QT5_CFLAGS"
|
||||
MOZ_QT_LIBS="$MOZ_QT_LIBS $MOZ_QT5_LIBS"
|
||||
fi
|
||||
AC_CHECK_PROGS(HOST_QMAKE, $HOST_QMAKE qmake, "")
|
||||
else
|
||||
HOST_QMAKE="$QTDIR/bin/qmake"
|
||||
fi
|
||||
QT_VERSION=`$HOST_QMAKE -v | grep 'Using Qt version' | grep -oP '\d+\.\d+\.\d+'`
|
||||
|
||||
if test -z "$QTDIR"; then
|
||||
case $QT_VERSION in
|
||||
5.*)
|
||||
AC_MSG_RESULT("Using qt5: $QT_VERSION")
|
||||
PKG_CHECK_MODULES(MOZ_QT, Qt5Gui Qt5Network Qt5Core Qt5OpenGL Qt5Widgets Qt5PrintSupport, ,
|
||||
[
|
||||
AC_MSG_ERROR([$MOZ_QT_PKG_ERRORS Need qtbase development packages, (On Ubuntu, you might try installing the packages qtbase5-dev libqt5opengl5-dev.)])
|
||||
])
|
||||
QT5INCDIR=`pkg-config --variable=includedir Qt5Gui`
|
||||
MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QT5INCDIR/QtGui/$QT_VERSION/QtGui"
|
||||
;;
|
||||
4.*)
|
||||
AC_MSG_RESULT("Using qt4: $QT_VERSION")
|
||||
PKG_CHECK_MODULES(MOZ_QT, QtGui QtNetwork QtCore QtOpenGL, ,
|
||||
[
|
||||
AC_MSG_ERROR([$MOZ_QT_PKG_ERRORS Need qt4 development package, (On Ubuntu, you might try installing the packages libqt4-dev libqt4-opengl-dev.)])
|
||||
])
|
||||
;;
|
||||
*)
|
||||
AC_MSG_ERROR([* * * Unsupported Qt Version: $QT_VERSION])
|
||||
;;
|
||||
esac
|
||||
|
||||
AC_CHECK_PROGS(HOST_MOC, $MOC moc, "")
|
||||
AC_CHECK_PROGS(HOST_RCC, $RCC rcc, "")
|
||||
|
@ -4729,18 +4748,25 @@ then
|
|||
MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtXml"
|
||||
MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtDeclarative"
|
||||
|
||||
# QtWidgets was introduced only in Qt5
|
||||
if test -d $QTDIR/include/QtWidgets; then
|
||||
echo "Using qt5"
|
||||
case $QT_VERSION in
|
||||
5.*)
|
||||
AC_MSG_RESULT("Using qt5: $QT_VERSION")
|
||||
MOZ_QT_LIBS="-L$QTDIR/lib/ -lQt5Gui -lQt5Network -lQt5Core -lQt5Xml -lQt5OpenGL"
|
||||
MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtGui/5.0.1/QtGui"
|
||||
MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtGui/$QT_VERSION/QtGui"
|
||||
MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtWidgets"
|
||||
MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtPrintSupport"
|
||||
MOZ_QT_LIBS="$MOZ_QT_LIBS -lQt5Widgets -lQt5PrintSupport"
|
||||
else
|
||||
;;
|
||||
4.*)
|
||||
AC_MSG_RESULT("Using qt4: $QT_VERSION")
|
||||
MOZ_QT_LIBS="-L$QTDIR/lib/ -lQtGui -lQtNetwork -lQtCore -lQtXml -lQtOpenGL"
|
||||
MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/Qt"
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
AC_MSG_ERROR([* * * Unsupported Qt Version: $QT_VERSION])
|
||||
;;
|
||||
esac
|
||||
|
||||
HOST_MOC="$QTDIR/bin/moc"
|
||||
HOST_RCC="$QTDIR/bin/rcc"
|
||||
fi
|
||||
|
|
|
@ -1671,15 +1671,10 @@ nsContentUtils::GetWindowFromCaller()
|
|||
nsIDocument*
|
||||
nsContentUtils::GetDocumentFromCaller()
|
||||
{
|
||||
JSContext *cx = nullptr;
|
||||
JS::Rooted<JSObject*> obj(cx);
|
||||
sXPConnect->GetCaller(&cx, obj.address());
|
||||
NS_ASSERTION(cx && obj, "Caller ensures something is running");
|
||||
|
||||
JSAutoCompartment ac(cx, obj);
|
||||
AutoJSContext cx;
|
||||
|
||||
nsCOMPtr<nsPIDOMWindow> win =
|
||||
do_QueryInterface(nsJSUtils::GetStaticScriptGlobal(obj));
|
||||
do_QueryInterface(nsJSUtils::GetStaticScriptGlobal(JS_GetGlobalForScopeChain(cx)));
|
||||
if (!win) {
|
||||
return nullptr;
|
||||
}
|
||||
|
|
|
@ -620,8 +620,8 @@ nsFrameMessageManager::ReceiveMessage(nsISupports* aTarget,
|
|||
JSContext *cxToUse = mContext ? mContext
|
||||
: (aContext ? aContext
|
||||
: nsContentUtils::GetSafeJSContext());
|
||||
JS::Rooted<JSObject*> objectsArray(cxToUse, aObjectsArray);
|
||||
AutoPushJSContext ctx(cxToUse);
|
||||
JS::Rooted<JSObject*> objectsArray(cxToUse, aObjectsArray);
|
||||
if (mListeners.Length()) {
|
||||
nsCOMPtr<nsIAtom> name = do_GetAtom(aMessage);
|
||||
MMListenerRemover lr(this);
|
||||
|
|
|
@ -28,7 +28,6 @@ DOMWheelEvent::DOMWheelEvent(EventTarget* aOwner,
|
|||
static_cast<widget::WheelEvent*>(mEvent)->inputSource =
|
||||
nsIDOMMouseEvent::MOZ_SOURCE_UNKNOWN;
|
||||
}
|
||||
SetIsDOMBinding();
|
||||
}
|
||||
|
||||
DOMWheelEvent::~DOMWheelEvent()
|
||||
|
|
|
@ -22,7 +22,6 @@ nsDOMAnimationEvent::nsDOMAnimationEvent(mozilla::dom::EventTarget* aOwner,
|
|||
mEventIsInternal = true;
|
||||
mEvent->time = PR_Now();
|
||||
}
|
||||
SetIsDOMBinding();
|
||||
}
|
||||
|
||||
nsDOMAnimationEvent::~nsDOMAnimationEvent()
|
||||
|
|
|
@ -18,7 +18,6 @@ public:
|
|||
nsPresContext* aPresContext, nsEvent* aEvent)
|
||||
: nsDOMEvent(aOwner, aPresContext, aEvent)
|
||||
{
|
||||
SetIsDOMBinding();
|
||||
}
|
||||
|
||||
virtual JSObject* WrapObject(JSContext* aCx,
|
||||
|
|
|
@ -20,7 +20,6 @@ nsDOMClipboardEvent::nsDOMClipboardEvent(mozilla::dom::EventTarget* aOwner,
|
|||
mEventIsInternal = true;
|
||||
mEvent->time = PR_Now();
|
||||
}
|
||||
SetIsDOMBinding();
|
||||
}
|
||||
|
||||
nsDOMClipboardEvent::~nsDOMClipboardEvent()
|
||||
|
|
|
@ -17,7 +17,6 @@ nsDOMCommandEvent::nsDOMCommandEvent(mozilla::dom::EventTarget* aOwner,
|
|||
} else {
|
||||
mEventIsInternal = true;
|
||||
}
|
||||
SetIsDOMBinding();
|
||||
}
|
||||
|
||||
nsDOMCommandEvent::~nsDOMCommandEvent()
|
||||
|
|
|
@ -29,8 +29,6 @@ nsDOMCompositionEvent::nsDOMCompositionEvent(mozilla::dom::EventTarget* aOwner,
|
|||
|
||||
mData = static_cast<nsCompositionEvent*>(mEvent)->data;
|
||||
// TODO: Native event should have locale information.
|
||||
|
||||
SetIsDOMBinding();
|
||||
}
|
||||
|
||||
nsDOMCompositionEvent::~nsDOMCompositionEvent()
|
||||
|
|
|
@ -14,7 +14,6 @@ nsDOMDataContainerEvent::nsDOMDataContainerEvent(
|
|||
: nsDOMEvent(aOwner, aPresContext, aEvent)
|
||||
{
|
||||
mData.Init();
|
||||
SetIsDOMBinding();
|
||||
}
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(nsDOMDataContainerEvent,
|
||||
|
|
|
@ -49,7 +49,6 @@ public:
|
|||
nsPresContext* aPresContext, nsEvent* aEvent)
|
||||
: nsDOMEvent(aOwner, aPresContext, aEvent)
|
||||
{
|
||||
SetIsDOMBinding();
|
||||
}
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
|
|
@ -25,7 +25,6 @@ nsDOMDragEvent::nsDOMDragEvent(mozilla::dom::EventTarget* aOwner,
|
|||
mEvent->refPoint.x = mEvent->refPoint.y = 0;
|
||||
static_cast<nsMouseEvent*>(mEvent)->inputSource = nsIDOMMouseEvent::MOZ_SOURCE_UNKNOWN;
|
||||
}
|
||||
SetIsDOMBinding();
|
||||
}
|
||||
|
||||
nsDOMDragEvent::~nsDOMDragEvent()
|
||||
|
|
|
@ -51,12 +51,13 @@ nsDOMEvent::nsDOMEvent(mozilla::dom::EventTarget* aOwner,
|
|||
nsDOMEvent::nsDOMEvent(nsPIDOMWindow* aParent)
|
||||
{
|
||||
ConstructorInit(static_cast<nsGlobalWindow *>(aParent), nullptr, nullptr);
|
||||
SetIsDOMBinding();
|
||||
}
|
||||
|
||||
void nsDOMEvent::ConstructorInit(mozilla::dom::EventTarget* aOwner,
|
||||
nsPresContext* aPresContext, nsEvent* aEvent)
|
||||
void
|
||||
nsDOMEvent::ConstructorInit(mozilla::dom::EventTarget* aOwner,
|
||||
nsPresContext* aPresContext, nsEvent* aEvent)
|
||||
{
|
||||
SetIsDOMBinding();
|
||||
SetOwner(aOwner);
|
||||
|
||||
mPrivateDataDuplicated = false;
|
||||
|
@ -122,14 +123,10 @@ nsDOMEvent::~nsDOMEvent()
|
|||
}
|
||||
}
|
||||
|
||||
DOMCI_DATA(Event, nsDOMEvent)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsDOMEvent)
|
||||
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMEvent)
|
||||
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMEvent)
|
||||
NS_INTERFACE_MAP_ENTRY_CONDITIONAL(nsIJSNativeInitializer, !IsDOMBinding())
|
||||
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(Event)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsDOMEvent)
|
||||
|
@ -333,57 +330,6 @@ nsDOMEvent::SetTrusted(bool aTrusted)
|
|||
mEvent->mFlags.mIsTrusted = aTrusted;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMEvent::Initialize(nsISupports* aOwner, JSContext* aCx, JSObject* aObj,
|
||||
const JS::CallArgs& aArgs)
|
||||
{
|
||||
MOZ_ASSERT(!IsDOMBinding());
|
||||
NS_ENSURE_TRUE(aArgs.length() >= 1, NS_ERROR_XPC_NOT_ENOUGH_ARGS);
|
||||
|
||||
bool trusted = false;
|
||||
nsCOMPtr<nsPIDOMWindow> w = do_QueryInterface(aOwner);
|
||||
if (w) {
|
||||
nsCOMPtr<nsIDocument> d = w->GetExtantDoc();
|
||||
if (d) {
|
||||
trusted = nsContentUtils::IsChromeDoc(d);
|
||||
nsIPresShell* s = d->GetShell();
|
||||
if (s) {
|
||||
InitPresContextData(s->GetPresContext());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!mOwner) {
|
||||
mOwner = w;
|
||||
}
|
||||
|
||||
JSString* jsstr = JS_ValueToString(aCx, aArgs[0]);
|
||||
if (!jsstr) {
|
||||
return NS_ERROR_DOM_SYNTAX_ERR;
|
||||
}
|
||||
|
||||
JS::Anchor<JSString*> deleteProtector(jsstr);
|
||||
|
||||
nsDependentJSString type;
|
||||
NS_ENSURE_STATE(type.init(aCx, jsstr));
|
||||
|
||||
nsresult rv = InitFromCtor(type, aCx, aArgs.length() >= 2 ? &(aArgs[1]) : nullptr);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
SetTrusted(trusted);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsDOMEvent::InitFromCtor(const nsAString& aType,
|
||||
JSContext* aCx, JS::Value* aVal)
|
||||
{
|
||||
mozilla::idl::EventInit d;
|
||||
nsresult rv = d.Init(aCx, aVal);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
return InitEvent(aType, d.bubbles, d.cancelable);
|
||||
}
|
||||
|
||||
bool
|
||||
nsDOMEvent::Init(mozilla::dom::EventTarget* aGlobal)
|
||||
{
|
||||
|
@ -410,7 +356,7 @@ nsDOMEvent::Constructor(const mozilla::dom::GlobalObject& aGlobal,
|
|||
mozilla::ErrorResult& aRv)
|
||||
{
|
||||
nsCOMPtr<mozilla::dom::EventTarget> t = do_QueryInterface(aGlobal.Get());
|
||||
nsRefPtr<nsDOMEvent> e = nsDOMEvent::CreateEvent(t, nullptr, nullptr);
|
||||
nsRefPtr<nsDOMEvent> e = new nsDOMEvent(t, nullptr, nullptr);
|
||||
bool trusted = e->Init(t);
|
||||
aRv = e->InitEvent(aType, aParam.mBubbles, aParam.mCancelable);
|
||||
e->SetTrusted(trusted);
|
||||
|
@ -1338,6 +1284,6 @@ nsresult NS_NewDOMEvent(nsIDOMEvent** aInstancePtrResult,
|
|||
nsEvent *aEvent)
|
||||
{
|
||||
nsRefPtr<nsDOMEvent> it =
|
||||
nsDOMEvent::CreateEvent(aOwner, aPresContext, aEvent);
|
||||
new nsDOMEvent(aOwner, aPresContext, aEvent);
|
||||
return CallQueryInterface(it, aInstancePtrResult);
|
||||
}
|
||||
|
|
|
@ -33,10 +33,9 @@ class nsDOMEventBase : public nsIDOMEvent
|
|||
};
|
||||
|
||||
class nsDOMEvent : public nsDOMEventBase,
|
||||
public nsIJSNativeInitializer,
|
||||
public nsWrapperCache
|
||||
{
|
||||
protected:
|
||||
public:
|
||||
nsDOMEvent(mozilla::dom::EventTarget* aOwner, nsPresContext* aPresContext,
|
||||
nsEvent* aEvent);
|
||||
nsDOMEvent(nsPIDOMWindow* aWindow);
|
||||
|
@ -72,17 +71,8 @@ public:
|
|||
return static_cast<nsDOMEvent*>(event);
|
||||
}
|
||||
|
||||
static already_AddRefed<nsDOMEvent> CreateEvent(mozilla::dom::EventTarget* aOwner,
|
||||
nsPresContext* aPresContext,
|
||||
nsEvent* aEvent)
|
||||
{
|
||||
nsRefPtr<nsDOMEvent> e = new nsDOMEvent(aOwner, aPresContext, aEvent);
|
||||
e->SetIsDOMBinding();
|
||||
return e.forget();
|
||||
}
|
||||
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_AMBIGUOUS(nsDOMEvent, nsIDOMEvent)
|
||||
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(nsDOMEvent)
|
||||
|
||||
nsISupports* GetParentObject()
|
||||
{
|
||||
|
@ -98,13 +88,6 @@ public:
|
|||
// nsIDOMEvent Interface
|
||||
NS_DECL_NSIDOMEVENT
|
||||
|
||||
// nsIJSNativeInitializer
|
||||
NS_IMETHOD Initialize(nsISupports* aOwner, JSContext* aCx, JSObject* aObj,
|
||||
const JS::CallArgs& aArgs) MOZ_OVERRIDE;
|
||||
|
||||
virtual nsresult InitFromCtor(const nsAString& aType,
|
||||
JSContext* aCx, JS::Value* aVal);
|
||||
|
||||
void InitPresContextData(nsPresContext* aPresContext);
|
||||
|
||||
// Returns true if the event should be trusted.
|
||||
|
|
|
@ -22,7 +22,6 @@ nsDOMFocusEvent::nsDOMFocusEvent(mozilla::dom::EventTarget* aOwner,
|
|||
mEventIsInternal = true;
|
||||
mEvent->time = PR_Now();
|
||||
}
|
||||
SetIsDOMBinding();
|
||||
}
|
||||
|
||||
nsDOMFocusEvent::~nsDOMFocusEvent()
|
||||
|
|
|
@ -20,7 +20,6 @@ nsDOMKeyboardEvent::nsDOMKeyboardEvent(mozilla::dom::EventTarget* aOwner,
|
|||
mEventIsInternal = true;
|
||||
mEvent->time = PR_Now();
|
||||
}
|
||||
SetIsDOMBinding();
|
||||
}
|
||||
|
||||
nsDOMKeyboardEvent::~nsDOMKeyboardEvent()
|
||||
|
|
|
@ -36,7 +36,6 @@ nsDOMMessageEvent::nsDOMMessageEvent(mozilla::dom::EventTarget* aOwner,
|
|||
: nsDOMEvent(aOwner, aPresContext, aEvent),
|
||||
mData(JSVAL_VOID)
|
||||
{
|
||||
SetIsDOMBinding();
|
||||
}
|
||||
|
||||
nsDOMMessageEvent::~nsDOMMessageEvent()
|
||||
|
|
|
@ -154,7 +154,6 @@ nsDOMMouseEvent::Constructor(const mozilla::dom::GlobalObject& aGlobal,
|
|||
{
|
||||
nsCOMPtr<mozilla::dom::EventTarget> t = do_QueryInterface(aGlobal.Get());
|
||||
nsRefPtr<nsDOMMouseEvent> e = new nsDOMMouseEvent(t, nullptr, nullptr);
|
||||
e->SetIsDOMBinding();
|
||||
bool trusted = e->Init(t);
|
||||
e->InitMouseEvent(aType, aParam.mBubbles, aParam.mCancelable,
|
||||
aParam.mView, aParam.mDetail, aParam.mScreenX,
|
||||
|
@ -435,6 +434,5 @@ nsresult NS_NewDOMMouseEvent(nsIDOMEvent** aInstancePtrResult,
|
|||
nsInputEvent *aEvent)
|
||||
{
|
||||
nsDOMMouseEvent* it = new nsDOMMouseEvent(aOwner, aPresContext, aEvent);
|
||||
it->SetIsDOMBinding();
|
||||
return CallQueryInterface(it, aInstancePtrResult);
|
||||
}
|
||||
|
|
|
@ -23,7 +23,6 @@ nsDOMMouseScrollEvent::nsDOMMouseScrollEvent(mozilla::dom::EventTarget* aOwner,
|
|||
if(mEvent->eventStructType == NS_MOUSE_SCROLL_EVENT) {
|
||||
mDetail = static_cast<nsMouseScrollEvent*>(mEvent)->delta;
|
||||
}
|
||||
SetIsDOMBinding();
|
||||
}
|
||||
|
||||
nsDOMMouseScrollEvent::~nsDOMMouseScrollEvent()
|
||||
|
|
|
@ -15,7 +15,6 @@ nsDOMMutationEvent::nsDOMMutationEvent(mozilla::dom::EventTarget* aOwner,
|
|||
aEvent ? aEvent : new nsMutationEvent(false, 0))
|
||||
{
|
||||
mEventIsInternal = (aEvent == nullptr);
|
||||
SetIsDOMBinding();
|
||||
}
|
||||
|
||||
nsDOMMutationEvent::~nsDOMMutationEvent()
|
||||
|
|
|
@ -30,7 +30,6 @@ nsDOMNotifyAudioAvailableEvent::nsDOMNotifyAudioAvailableEvent(EventTarget* aOwn
|
|||
if (mEvent) {
|
||||
mEvent->message = aEventType;
|
||||
}
|
||||
SetIsDOMBinding();
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(nsDOMNotifyAudioAvailableEvent, nsDOMEvent)
|
||||
|
|
|
@ -24,7 +24,6 @@ nsDOMNotifyPaintEvent::nsDOMNotifyPaintEvent(mozilla::dom::EventTarget* aOwner,
|
|||
if (aInvalidateRequests) {
|
||||
mInvalidateRequests.MoveElementsFrom(aInvalidateRequests->mRequests);
|
||||
}
|
||||
SetIsDOMBinding();
|
||||
}
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(nsDOMNotifyPaintEvent)
|
||||
|
|
|
@ -17,7 +17,6 @@ nsDOMScrollAreaEvent::nsDOMScrollAreaEvent(mozilla::dom::EventTarget* aOwner,
|
|||
, mClientArea(nullptr)
|
||||
{
|
||||
mClientArea.SetLayoutRect(aEvent ? aEvent->mArea : nsRect());
|
||||
SetIsDOMBinding();
|
||||
}
|
||||
|
||||
nsDOMScrollAreaEvent::~nsDOMScrollAreaEvent()
|
||||
|
|
|
@ -21,7 +21,6 @@ nsDOMSimpleGestureEvent::nsDOMSimpleGestureEvent(mozilla::dom::EventTarget* aOwn
|
|||
mEvent->refPoint.x = mEvent->refPoint.y = 0;
|
||||
static_cast<nsMouseEvent*>(mEvent)->inputSource = nsIDOMMouseEvent::MOZ_SOURCE_UNKNOWN;
|
||||
}
|
||||
SetIsDOMBinding();
|
||||
}
|
||||
|
||||
nsDOMSimpleGestureEvent::~nsDOMSimpleGestureEvent()
|
||||
|
|
|
@ -47,7 +47,6 @@ nsDOMTextEvent::nsDOMTextEvent(mozilla::dom::EventTarget* aOwner,
|
|||
}
|
||||
}
|
||||
}
|
||||
SetIsDOMBinding();
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(nsDOMTextEvent, nsDOMUIEvent)
|
||||
|
|
|
@ -84,7 +84,6 @@ nsDOMTouchEvent::nsDOMTouchEvent(mozilla::dom::EventTarget* aOwner,
|
|||
mEventIsInternal = true;
|
||||
mEvent->time = PR_Now();
|
||||
}
|
||||
SetIsDOMBinding();
|
||||
}
|
||||
|
||||
nsDOMTouchEvent::~nsDOMTouchEvent()
|
||||
|
|
|
@ -22,7 +22,6 @@ nsDOMTransitionEvent::nsDOMTransitionEvent(mozilla::dom::EventTarget* aOwner,
|
|||
mEventIsInternal = true;
|
||||
mEvent->time = PR_Now();
|
||||
}
|
||||
SetIsDOMBinding();
|
||||
}
|
||||
|
||||
nsDOMTransitionEvent::~nsDOMTransitionEvent()
|
||||
|
|
|
@ -83,7 +83,6 @@ nsDOMUIEvent::Constructor(const mozilla::dom::GlobalObject& aGlobal,
|
|||
{
|
||||
nsCOMPtr<mozilla::dom::EventTarget> t = do_QueryInterface(aGlobal.Get());
|
||||
nsRefPtr<nsDOMUIEvent> e = new nsDOMUIEvent(t, nullptr, nullptr);
|
||||
e->SetIsDOMBinding();
|
||||
bool trusted = e->Init(t);
|
||||
aRv = e->InitUIEvent(aType, aParam.mBubbles, aParam.mCancelable, aParam.mView,
|
||||
aParam.mDetail);
|
||||
|
@ -518,6 +517,5 @@ nsresult NS_NewDOMUIEvent(nsIDOMEvent** aInstancePtrResult,
|
|||
nsGUIEvent *aEvent)
|
||||
{
|
||||
nsDOMUIEvent* it = new nsDOMUIEvent(aOwner, aPresContext, aEvent);
|
||||
it->SetIsDOMBinding();
|
||||
return CallQueryInterface(it, aInstancePtrResult);
|
||||
}
|
||||
|
|
|
@ -19,7 +19,6 @@ nsDOMXULCommandEvent::nsDOMXULCommandEvent(mozilla::dom::EventTarget* aOwner,
|
|||
mEventIsInternal = true;
|
||||
mEvent->time = PR_Now();
|
||||
}
|
||||
SetIsDOMBinding();
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(nsDOMXULCommandEvent, nsDOMUIEvent)
|
||||
|
|
|
@ -731,6 +731,7 @@ nsEventListenerManager::SetEventHandler(nsIAtom *aName,
|
|||
nsIScriptContext* context = global->GetScriptContext();
|
||||
NS_ENSURE_TRUE(context, NS_ERROR_FAILURE);
|
||||
|
||||
JSAutoRequest ar(context->GetNativeContext());
|
||||
JS::Rooted<JSObject*> scope(context->GetNativeContext(),
|
||||
global->GetGlobalJSObject());
|
||||
|
||||
|
|
|
@ -93,7 +93,6 @@ NS_IMPL_CYCLE_COLLECTION_INHERITED_4(HTMLTrackElement, nsGenericHTMLElement,
|
|||
mLoadListener)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(HTMLTrackElement)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMHTMLElement)
|
||||
NS_HTML_CONTENT_INTERFACES(nsGenericHTMLElement)
|
||||
NS_ELEMENT_INTERFACE_MAP_END
|
||||
|
||||
|
|
|
@ -654,7 +654,8 @@ nsGenericHTMLElement::UnbindFromTree(bool aDeep, bool aNullParent)
|
|||
HTMLFormElement*
|
||||
nsGenericHTMLElement::FindAncestorForm(HTMLFormElement* aCurrentForm)
|
||||
{
|
||||
NS_ASSERTION(!HasAttr(kNameSpaceID_None, nsGkAtoms::form),
|
||||
NS_ASSERTION(!HasAttr(kNameSpaceID_None, nsGkAtoms::form) ||
|
||||
IsHTML(nsGkAtoms::img),
|
||||
"FindAncestorForm should not be called if @form is set!");
|
||||
|
||||
// Make sure we don't end up finding a form that's anonymous from
|
||||
|
|
|
@ -383,6 +383,7 @@ MOCHITEST_FILES = \
|
|||
test_bug879319.html \
|
||||
allowMedia.sjs \
|
||||
test_bug874758.html \
|
||||
test_bug885024.html \
|
||||
$(NULL)
|
||||
|
||||
MOCHITEST_CHROME_FILES = \
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html data-expando-prop="xyz">
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=885024
|
||||
-->
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Test for Bug 885024</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=885024">Mozilla Bug 885024</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
</div>
|
||||
|
||||
<img form="t">
|
||||
|
||||
<form id="form">
|
||||
<div id="div"></div>
|
||||
</form>
|
||||
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
var img = document.createElement('img');
|
||||
img.setAttribute('id', 'img');
|
||||
|
||||
var div = document.getElementById('div');
|
||||
div.appendChild(img);
|
||||
|
||||
var form = document.getElementById('form');
|
||||
ok(form, "form exists");
|
||||
ok(form.img, "form.img exists");
|
||||
|
||||
var img2 = document.createElement('img');
|
||||
img2.setAttribute('id', 'img2');
|
||||
img2.setAttribute('form', 'blabla');
|
||||
ok(form, "form exists2");
|
||||
div.appendChild(img2);
|
||||
ok(form.img2, "form.img2 exists");
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
|
@ -85,9 +85,17 @@ TextTrackCue::~TextTrackCue()
|
|||
void
|
||||
TextTrackCue::CreateCueOverlay()
|
||||
{
|
||||
mTrackElement->OwnerDoc()->CreateElem(NS_LITERAL_STRING("div"), nullptr,
|
||||
kNameSpaceID_XHTML,
|
||||
getter_AddRefs(mCueDiv));
|
||||
nsCOMPtr<nsPIDOMWindow> window(do_QueryInterface(mGlobal));
|
||||
if(!window) {
|
||||
return;
|
||||
}
|
||||
nsIDocument* document = window->GetDoc();
|
||||
if(!document) {
|
||||
return;
|
||||
}
|
||||
document->CreateElem(NS_LITERAL_STRING("div"), nullptr,
|
||||
kNameSpaceID_XHTML,
|
||||
getter_AddRefs(mCueDiv));
|
||||
nsGenericHTMLElement* cueDiv =
|
||||
static_cast<nsGenericHTMLElement*>(mCueDiv.get());
|
||||
cueDiv->SetClassName(NS_LITERAL_STRING("caption-text"));
|
||||
|
@ -136,8 +144,16 @@ TextTrackCue::RenderCue()
|
|||
already_AddRefed<DocumentFragment>
|
||||
TextTrackCue::GetCueAsHTML()
|
||||
{
|
||||
nsCOMPtr<nsPIDOMWindow> window(do_QueryInterface(mGlobal));
|
||||
if(!window) {
|
||||
return nullptr;
|
||||
}
|
||||
nsIDocument* document = window->GetDoc();
|
||||
if(!document){
|
||||
return nullptr;
|
||||
}
|
||||
nsRefPtr<DocumentFragment> frag =
|
||||
mTrackElement->OwnerDoc()->CreateDocumentFragment();
|
||||
document->CreateDocumentFragment();
|
||||
|
||||
ConvertNodeTreeToDOMTree(frag);
|
||||
|
||||
|
@ -183,7 +199,7 @@ TextTrackCue::ConvertNodeTreeToDOMTree(nsIContent* aParentContent)
|
|||
nsTArray<WebVTTNodeParentPair> nodeParentPairStack;
|
||||
|
||||
// mHead should actually be the head of a node tree.
|
||||
if (mHead->kind != WEBVTT_HEAD_NODE) {
|
||||
if (!mHead || mHead->kind != WEBVTT_HEAD_NODE) {
|
||||
return;
|
||||
}
|
||||
// Seed the stack for traversal.
|
||||
|
@ -239,9 +255,17 @@ TextTrackCue::ConvertInternalNodeToContent(const webvtt_node* aWebVTTNode)
|
|||
}
|
||||
|
||||
nsCOMPtr<nsIContent> cueTextContent;
|
||||
mTrackElement->OwnerDoc()->CreateElem(nsDependentAtomString(atom), nullptr,
|
||||
kNameSpaceID_XHTML,
|
||||
getter_AddRefs(cueTextContent));
|
||||
nsCOMPtr<nsPIDOMWindow> window(do_QueryInterface(mGlobal));
|
||||
if(!window) {
|
||||
return nullptr;
|
||||
}
|
||||
nsIDocument* document = window->GetDoc();
|
||||
if(!document){
|
||||
return nullptr;
|
||||
}
|
||||
document->CreateElem(nsDependentAtomString(atom), nullptr,
|
||||
kNameSpaceID_XHTML,
|
||||
getter_AddRefs(cueTextContent));
|
||||
|
||||
if (aWebVTTNode->kind == WEBVTT_VOICE) {
|
||||
const char* text =
|
||||
|
@ -280,7 +304,15 @@ already_AddRefed<nsIContent>
|
|||
TextTrackCue::ConvertLeafNodeToContent(const webvtt_node* aWebVTTNode)
|
||||
{
|
||||
nsCOMPtr<nsIContent> cueTextContent;
|
||||
nsNodeInfoManager* nimgr = mTrackElement->NodeInfo()->NodeInfoManager();
|
||||
nsCOMPtr<nsPIDOMWindow> window(do_QueryInterface(mGlobal));
|
||||
if(!window) {
|
||||
return nullptr;
|
||||
}
|
||||
nsIDocument* document = window->GetDoc();
|
||||
if(!document) {
|
||||
return nullptr;
|
||||
}
|
||||
nsNodeInfoManager* nimgr = document->NodeInfoManager();
|
||||
switch (aWebVTTNode->kind) {
|
||||
case WEBVTT_TEXT:
|
||||
{
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<script>
|
||||
var o0 = new TextTrackCue(0.000, 1.000, 'Bug882549');
|
||||
var o1 = o0.getCueAsHTML(0);
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
</body>
|
||||
</html>
|
||||
<script>
|
||||
</script>
|
|
@ -47,3 +47,4 @@ load 880404.html
|
|||
load 880724.html
|
||||
load 881775.html
|
||||
load 882956.html
|
||||
test-pref(media.webvtt.enabled,true) load 882549.html
|
||||
|
|
|
@ -54,7 +54,8 @@ WMFReader::WMFReader(AbstractMediaDecoder* aDecoder)
|
|||
mHasVideo(false),
|
||||
mUseHwAccel(false),
|
||||
mMustRecaptureAudioPosition(true),
|
||||
mIsMP3Enabled(WMFDecoder::IsMP3Supported())
|
||||
mIsMP3Enabled(WMFDecoder::IsMP3Supported()),
|
||||
mCOMInitialized(false)
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Must be on main thread.");
|
||||
MOZ_COUNT_CTOR(WMFReader);
|
||||
|
@ -79,15 +80,22 @@ void
|
|||
WMFReader::OnDecodeThreadStart()
|
||||
{
|
||||
NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread.");
|
||||
HRESULT hr = CoInitializeEx(0, COINIT_MULTITHREADED);
|
||||
NS_ENSURE_TRUE_VOID(SUCCEEDED(hr));
|
||||
|
||||
// XXX WebAudio will call this on the main thread so CoInit will definitely
|
||||
// fail. You cannot change the concurrency model once already set.
|
||||
// The main thread will continue to be STA, which seems to work, but MSDN
|
||||
// recommends that MTA be used.
|
||||
mCOMInitialized = SUCCEEDED(CoInitializeEx(0, COINIT_MULTITHREADED));
|
||||
NS_ENSURE_TRUE_VOID(mCOMInitialized);
|
||||
}
|
||||
|
||||
void
|
||||
WMFReader::OnDecodeThreadFinish()
|
||||
{
|
||||
NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread.");
|
||||
CoUninitialize();
|
||||
if (mCOMInitialized) {
|
||||
CoUninitialize();
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
|
@ -115,6 +115,8 @@ private:
|
|||
// checks a pref, so we cache its value in mIsMP3Enabled and use that on
|
||||
// the decode thread.
|
||||
const bool mIsMP3Enabled;
|
||||
|
||||
bool mCOMInitialized;
|
||||
};
|
||||
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -24,8 +24,6 @@ SVGZoomEvent::SVGZoomEvent(EventTarget* aOwner,
|
|||
, mPreviousScale(0)
|
||||
, mNewScale(0)
|
||||
{
|
||||
SetIsDOMBinding();
|
||||
|
||||
if (aEvent) {
|
||||
mEventIsInternal = false;
|
||||
}
|
||||
|
|
|
@ -68,6 +68,7 @@ nsXBLProtoImpl::InstallImplementation(nsXBLPrototypeBinding* aPrototypeBinding,
|
|||
// This function also has the side effect of building up the prototype implementation if it has
|
||||
// not been built already.
|
||||
nsCOMPtr<nsIXPConnectJSObjectHolder> holder;
|
||||
JSAutoRequest ar(context->GetNativeContext());
|
||||
JS::Rooted<JSObject*> targetClassObject(context->GetNativeContext(), nullptr);
|
||||
bool targetObjectIsNew = false;
|
||||
nsresult rv = InitTargetObjects(aPrototypeBinding, context,
|
||||
|
|
|
@ -2456,6 +2456,7 @@ nsXULPrototypeScript::Deserialize(nsIObjectInputStream* aStream,
|
|||
nsIScriptContext *context = aGlobal->GetScriptContext();
|
||||
NS_ASSERTION(context != nullptr, "Have no context for deserialization");
|
||||
NS_ENSURE_TRUE(context, NS_ERROR_UNEXPECTED);
|
||||
JSAutoRequest ar(context->GetNativeContext());
|
||||
JS::Rooted<JSScript*> newScriptObject(context->GetNativeContext());
|
||||
rv = context->Deserialize(aStream, &newScriptObject);
|
||||
if (NS_FAILED(rv)) {
|
||||
|
@ -2571,6 +2572,7 @@ nsXULPrototypeScript::Compile(const PRUnichar* aText,
|
|||
|
||||
// Ok, compile it to create a prototype script object!
|
||||
|
||||
JSAutoRequest ar(context->GetNativeContext());
|
||||
JS::Rooted<JSScript*> newScriptObject(context->GetNativeContext());
|
||||
|
||||
// If the script was inline, tell the JS parser to save source for
|
||||
|
|
|
@ -100,7 +100,7 @@ Navigator::Init()
|
|||
}
|
||||
|
||||
Navigator::Navigator(nsPIDOMWindow* aWindow)
|
||||
: mWindow(do_GetWeakReference(aWindow))
|
||||
: mWindow(aWindow)
|
||||
{
|
||||
NS_ASSERTION(aWindow->IsInnerWindow(),
|
||||
"Navigator must get an inner window!");
|
||||
|
@ -111,7 +111,8 @@ Navigator::~Navigator()
|
|||
Invalidate();
|
||||
}
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(Navigator)
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(Navigator)
|
||||
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMNavigator)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMNavigator)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMClientInformation)
|
||||
|
@ -152,13 +153,19 @@ NS_INTERFACE_MAP_BEGIN(Navigator)
|
|||
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(Navigator)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
NS_IMPL_ADDREF(Navigator)
|
||||
NS_IMPL_RELEASE(Navigator)
|
||||
NS_IMPL_CYCLE_COLLECTING_ADDREF(Navigator)
|
||||
NS_IMPL_CYCLE_COLLECTING_RELEASE(Navigator)
|
||||
|
||||
// We seem to manually break cycles through most of our members in Invalidate.
|
||||
// That said, if those members get set _after_ the window calls Invalidate on
|
||||
// us, then what?
|
||||
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_1(Navigator, mWindow)
|
||||
|
||||
void
|
||||
Navigator::Invalidate()
|
||||
{
|
||||
mWindow = nullptr;
|
||||
// Don't clear mWindow here so we know we've got a non-null mWindow
|
||||
// until we're unlinked.
|
||||
|
||||
if (mPlugins) {
|
||||
mPlugins->Invalidate();
|
||||
|
@ -256,14 +263,6 @@ Navigator::Invalidate()
|
|||
}
|
||||
}
|
||||
|
||||
nsPIDOMWindow *
|
||||
Navigator::GetWindow()
|
||||
{
|
||||
nsCOMPtr<nsPIDOMWindow> win(do_QueryReferent(mWindow));
|
||||
|
||||
return win;
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
// Navigator::nsIDOMNavigator
|
||||
//*****************************************************************************
|
||||
|
@ -274,12 +273,11 @@ Navigator::GetUserAgent(nsAString& aUserAgent)
|
|||
nsresult rv = NS_GetNavigatorUserAgent(aUserAgent);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsPIDOMWindow> win(do_QueryReferent(mWindow));
|
||||
if (!win || !win->GetDocShell()) {
|
||||
if (!mWindow || !mWindow->GetDocShell()) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsIDocument* doc = win->GetExtantDoc();
|
||||
nsIDocument* doc = mWindow->GetExtantDoc();
|
||||
if (!doc) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -294,7 +292,8 @@ Navigator::GetUserAgent(nsAString& aUserAgent)
|
|||
do_GetService("@mozilla.org/dom/site-specific-user-agent;1");
|
||||
NS_ENSURE_TRUE(siteSpecificUA, NS_OK);
|
||||
|
||||
return siteSpecificUA->GetUserAgentForURIAndWindow(codebaseURI, win, aUserAgent);
|
||||
return siteSpecificUA->GetUserAgentForURIAndWindow(codebaseURI, mWindow,
|
||||
aUserAgent);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -446,6 +445,7 @@ NS_IMETHODIMP
|
|||
Navigator::GetMimeTypes(nsIDOMMimeTypeArray** aMimeTypes)
|
||||
{
|
||||
if (!mMimeTypes) {
|
||||
NS_ENSURE_STATE(mWindow);
|
||||
mMimeTypes = new nsMimeTypeArray(this);
|
||||
}
|
||||
|
||||
|
@ -458,9 +458,9 @@ NS_IMETHODIMP
|
|||
Navigator::GetPlugins(nsIDOMPluginArray** aPlugins)
|
||||
{
|
||||
if (!mPlugins) {
|
||||
nsCOMPtr<nsPIDOMWindow> win(do_QueryReferent(mWindow));
|
||||
NS_ENSURE_STATE(mWindow);
|
||||
|
||||
mPlugins = new nsPluginArray(this, win ? win->GetDocShell() : nullptr);
|
||||
mPlugins = new nsPluginArray(this, mWindow->GetDocShell());
|
||||
mPlugins->Init();
|
||||
}
|
||||
|
||||
|
@ -483,13 +483,11 @@ Navigator::GetCookieEnabled(bool* aCookieEnabled)
|
|||
// Check whether an exception overrides the global cookie behavior
|
||||
// Note that the code for getting the URI here matches that in
|
||||
// nsHTMLDocument::SetCookie.
|
||||
nsCOMPtr<nsPIDOMWindow> win(do_QueryReferent(mWindow));
|
||||
|
||||
if (!win || !win->GetDocShell()) {
|
||||
if (!mWindow || !mWindow->GetDocShell()) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDocument> doc = win->GetExtantDoc();
|
||||
nsCOMPtr<nsIDocument> doc = mWindow->GetExtantDoc();
|
||||
if (!doc) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -579,6 +577,7 @@ Navigator::JavaEnabled(bool* aReturn)
|
|||
*aReturn = false;
|
||||
|
||||
if (!mMimeTypes) {
|
||||
NS_ENSURE_STATE(mWindow);
|
||||
mMimeTypes = new nsMimeTypeArray(this);
|
||||
}
|
||||
|
||||
|
@ -716,6 +715,8 @@ GetVibrationDurationFromJsval(const JS::Value& aJSVal, JSContext* cx,
|
|||
NS_IMETHODIMP
|
||||
Navigator::AddIdleObserver(nsIIdleObserver* aIdleObserver)
|
||||
{
|
||||
NS_ENSURE_STATE(mWindow);
|
||||
|
||||
if (!nsContentUtils::IsIdleObserverAPIEnabled()) {
|
||||
NS_WARNING("The IdleObserver API has been disabled.");
|
||||
return NS_OK;
|
||||
|
@ -723,14 +724,11 @@ Navigator::AddIdleObserver(nsIIdleObserver* aIdleObserver)
|
|||
|
||||
NS_ENSURE_ARG_POINTER(aIdleObserver);
|
||||
|
||||
nsCOMPtr<nsPIDOMWindow> win = do_QueryReferent(mWindow);
|
||||
NS_ENSURE_TRUE(win, NS_ERROR_UNEXPECTED);
|
||||
|
||||
if (!CheckPermission("idle")) {
|
||||
return NS_ERROR_DOM_SECURITY_ERR;
|
||||
}
|
||||
|
||||
if (NS_FAILED(win->RegisterIdleObserver(aIdleObserver))) {
|
||||
if (NS_FAILED(mWindow->RegisterIdleObserver(aIdleObserver))) {
|
||||
NS_WARNING("Failed to add idle observer.");
|
||||
}
|
||||
|
||||
|
@ -740,6 +738,8 @@ Navigator::AddIdleObserver(nsIIdleObserver* aIdleObserver)
|
|||
NS_IMETHODIMP
|
||||
Navigator::RemoveIdleObserver(nsIIdleObserver* aIdleObserver)
|
||||
{
|
||||
NS_ENSURE_STATE(mWindow);
|
||||
|
||||
if (!nsContentUtils::IsIdleObserverAPIEnabled()) {
|
||||
NS_WARNING("The IdleObserver API has been disabled");
|
||||
return NS_OK;
|
||||
|
@ -747,9 +747,7 @@ Navigator::RemoveIdleObserver(nsIIdleObserver* aIdleObserver)
|
|||
|
||||
NS_ENSURE_ARG_POINTER(aIdleObserver);
|
||||
|
||||
nsCOMPtr<nsPIDOMWindow> win = do_QueryReferent(mWindow);
|
||||
NS_ENSURE_TRUE(win, NS_ERROR_UNEXPECTED);
|
||||
if (NS_FAILED(win->UnregisterIdleObserver(aIdleObserver))) {
|
||||
if (NS_FAILED(mWindow->UnregisterIdleObserver(aIdleObserver))) {
|
||||
NS_WARNING("Failed to remove idle observer.");
|
||||
}
|
||||
return NS_OK;
|
||||
|
@ -758,10 +756,9 @@ Navigator::RemoveIdleObserver(nsIIdleObserver* aIdleObserver)
|
|||
NS_IMETHODIMP
|
||||
Navigator::Vibrate(const JS::Value& aPattern, JSContext* cx)
|
||||
{
|
||||
nsCOMPtr<nsPIDOMWindow> win = do_QueryReferent(mWindow);
|
||||
NS_ENSURE_TRUE(win, NS_OK);
|
||||
NS_ENSURE_STATE(mWindow);
|
||||
|
||||
nsCOMPtr<nsIDocument> doc = win->GetExtantDoc();
|
||||
nsCOMPtr<nsIDocument> doc = mWindow->GetExtantDoc();
|
||||
NS_ENSURE_TRUE(doc, NS_ERROR_FAILURE);
|
||||
if (doc->Hidden()) {
|
||||
// Hidden documents cannot start or stop a vibration.
|
||||
|
@ -823,9 +820,9 @@ Navigator::Vibrate(const JS::Value& aPattern, JSContext* cx)
|
|||
else {
|
||||
gVibrateWindowListener->RemoveListener();
|
||||
}
|
||||
gVibrateWindowListener = new VibrateWindowListener(win, doc);
|
||||
gVibrateWindowListener = new VibrateWindowListener(mWindow, doc);
|
||||
|
||||
hal::Vibrate(pattern, win);
|
||||
hal::Vibrate(pattern, mWindow);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -838,9 +835,7 @@ Navigator::RegisterContentHandler(const nsAString& aMIMEType,
|
|||
const nsAString& aURI,
|
||||
const nsAString& aTitle)
|
||||
{
|
||||
nsCOMPtr<nsPIDOMWindow> win(do_QueryReferent(mWindow));
|
||||
|
||||
if (!win || !win->GetOuterWindow() || !win->GetDocShell()) {
|
||||
if (!mWindow || !mWindow->GetOuterWindow() || !mWindow->GetDocShell()) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -851,7 +846,7 @@ Navigator::RegisterContentHandler(const nsAString& aMIMEType,
|
|||
}
|
||||
|
||||
return registrar->RegisterContentHandler(aMIMEType, aURI, aTitle,
|
||||
win->GetOuterWindow());
|
||||
mWindow->GetOuterWindow());
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -859,9 +854,7 @@ Navigator::RegisterProtocolHandler(const nsAString& aProtocol,
|
|||
const nsAString& aURI,
|
||||
const nsAString& aTitle)
|
||||
{
|
||||
nsCOMPtr<nsPIDOMWindow> win(do_QueryReferent(mWindow));
|
||||
|
||||
if (!win || !win->GetOuterWindow() || !win->GetDocShell()) {
|
||||
if (!mWindow || !mWindow->GetOuterWindow() || !mWindow->GetDocShell()) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -872,7 +865,7 @@ Navigator::RegisterProtocolHandler(const nsAString& aProtocol,
|
|||
}
|
||||
|
||||
return registrar->RegisterProtocolHandler(aProtocol, aURI, aTitle,
|
||||
win->GetOuterWindow());
|
||||
mWindow->GetOuterWindow());
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -919,12 +912,10 @@ Navigator::MozIsLocallyAvailable(const nsAString &aURI,
|
|||
nsIRequest::LOAD_FROM_CACHE;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsPIDOMWindow> win(do_QueryReferent(mWindow));
|
||||
if (!win) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
NS_ENSURE_STATE(mWindow);
|
||||
|
||||
nsCOMPtr<nsILoadGroup> loadGroup;
|
||||
nsCOMPtr<nsIDocument> doc = win->GetDoc();
|
||||
nsCOMPtr<nsIDocument> doc = mWindow->GetDoc();
|
||||
if (doc) {
|
||||
loadGroup = doc->GetDocumentLoadGroup();
|
||||
}
|
||||
|
@ -966,14 +957,13 @@ NS_IMETHODIMP Navigator::GetDeviceStorage(const nsAString &aType, nsIDOMDeviceSt
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsPIDOMWindow> win(do_QueryReferent(mWindow));
|
||||
|
||||
if (!win || !win->GetOuterWindow() || !win->GetDocShell()) {
|
||||
if (!mWindow || !mWindow->GetOuterWindow() || !mWindow->GetDocShell()) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsRefPtr<nsDOMDeviceStorage> storage;
|
||||
nsDOMDeviceStorage::CreateDeviceStorageFor(win, aType, getter_AddRefs(storage));
|
||||
nsDOMDeviceStorage::CreateDeviceStorageFor(mWindow, aType,
|
||||
getter_AddRefs(storage));
|
||||
|
||||
if (!storage) {
|
||||
return NS_OK;
|
||||
|
@ -993,14 +983,12 @@ NS_IMETHODIMP Navigator::GetDeviceStorages(const nsAString &aType, nsIVariant**
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsPIDOMWindow> win(do_QueryReferent(mWindow));
|
||||
|
||||
if (!win || !win->GetOuterWindow() || !win->GetDocShell()) {
|
||||
if (!mWindow || !mWindow->GetOuterWindow() || !mWindow->GetDocShell()) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsTArray<nsRefPtr<nsDOMDeviceStorage> > stores;
|
||||
nsDOMDeviceStorage::CreateDeviceStoragesFor(win, aType, stores, false);
|
||||
nsDOMDeviceStorage::CreateDeviceStoragesFor(mWindow, aType, stores, false);
|
||||
|
||||
nsCOMPtr<nsIWritableVariant> result = do_CreateInstance("@mozilla.org/variant;1");
|
||||
NS_ENSURE_TRUE(result, NS_ERROR_FAILURE);
|
||||
|
@ -1037,9 +1025,7 @@ NS_IMETHODIMP Navigator::GetGeolocation(nsIDOMGeoGeolocation** _retval)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsPIDOMWindow> win(do_QueryReferent(mWindow));
|
||||
|
||||
if (!win || !win->GetOuterWindow() || !win->GetDocShell()) {
|
||||
if (!mWindow || !mWindow->GetOuterWindow() || !mWindow->GetDocShell()) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
|
@ -1048,7 +1034,7 @@ NS_IMETHODIMP Navigator::GetGeolocation(nsIDOMGeoGeolocation** _retval)
|
|||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
if (NS_FAILED(mGeolocation->Init(win->GetOuterWindow()))) {
|
||||
if (NS_FAILED(mGeolocation->Init(mWindow->GetOuterWindow()))) {
|
||||
mGeolocation = nullptr;
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
@ -1072,16 +1058,16 @@ Navigator::MozGetUserMedia(nsIMediaStreamOptions* aParams,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsPIDOMWindow> win = do_QueryReferent(mWindow);
|
||||
if (!win || !win->GetOuterWindow() ||
|
||||
win->GetOuterWindow()->GetCurrentInnerWindow() != win) {
|
||||
if (!mWindow || !mWindow->GetOuterWindow() ||
|
||||
mWindow->GetOuterWindow()->GetCurrentInnerWindow() != mWindow) {
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
bool privileged = nsContentUtils::IsChromeDoc(win->GetExtantDoc());
|
||||
bool privileged = nsContentUtils::IsChromeDoc(mWindow->GetExtantDoc());
|
||||
|
||||
MediaManager* manager = MediaManager::Get();
|
||||
return manager->GetUserMedia(privileged, win, aParams, aOnSuccess, aOnError);
|
||||
return manager->GetUserMedia(privileged, mWindow, aParams, aOnSuccess,
|
||||
aOnError);
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
|
@ -1091,9 +1077,8 @@ NS_IMETHODIMP
|
|||
Navigator::MozGetUserMediaDevices(nsIGetUserMediaDevicesSuccessCallback* aOnSuccess,
|
||||
nsIDOMGetUserMediaErrorCallback* aOnError)
|
||||
{
|
||||
nsCOMPtr<nsPIDOMWindow> win = do_QueryReferent(mWindow);
|
||||
if (!win || !win->GetOuterWindow() ||
|
||||
win->GetOuterWindow()->GetCurrentInnerWindow() != win) {
|
||||
if (!mWindow || !mWindow->GetOuterWindow() ||
|
||||
mWindow->GetOuterWindow()->GetCurrentInnerWindow() != mWindow) {
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
|
@ -1103,7 +1088,7 @@ Navigator::MozGetUserMediaDevices(nsIGetUserMediaDevicesSuccessCallback* aOnSucc
|
|||
}
|
||||
|
||||
MediaManager* manager = MediaManager::Get();
|
||||
return manager->GetUserMediaDevices(win, aOnSuccess, aOnError);
|
||||
return manager->GetUserMediaDevices(mWindow, aOnSuccess, aOnError);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -1121,10 +1106,9 @@ NS_IMETHODIMP Navigator::GetMozNotification(nsISupports** aRetVal)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsPIDOMWindow> win(do_QueryReferent(mWindow));
|
||||
NS_ENSURE_TRUE(win && win->GetDocShell(), NS_ERROR_FAILURE);
|
||||
NS_ENSURE_TRUE(mWindow && mWindow->GetDocShell(), NS_ERROR_FAILURE);
|
||||
|
||||
mNotification = new DesktopNotificationCenter(win);
|
||||
mNotification = new DesktopNotificationCenter(mWindow);
|
||||
|
||||
NS_ADDREF(*aRetVal = mNotification);
|
||||
return NS_OK;
|
||||
|
@ -1140,11 +1124,11 @@ Navigator::GetBattery(nsISupports** aBattery)
|
|||
if (!mBatteryManager) {
|
||||
*aBattery = nullptr;
|
||||
|
||||
nsCOMPtr<nsPIDOMWindow> win(do_QueryReferent(mWindow));
|
||||
NS_ENSURE_TRUE(win && win->GetDocShell(), NS_OK);
|
||||
NS_ENSURE_STATE(mWindow);
|
||||
NS_ENSURE_TRUE(mWindow->GetDocShell(), NS_OK);
|
||||
|
||||
mBatteryManager = new battery::BatteryManager();
|
||||
mBatteryManager->Init(win);
|
||||
mBatteryManager->Init(mWindow);
|
||||
}
|
||||
|
||||
NS_ADDREF(*aBattery = mBatteryManager);
|
||||
|
@ -1158,10 +1142,8 @@ Navigator::GetMozPower(nsIDOMMozPowerManager** aPower)
|
|||
*aPower = nullptr;
|
||||
|
||||
if (!mPowerManager) {
|
||||
nsCOMPtr<nsPIDOMWindow> window = do_QueryReferent(mWindow);
|
||||
NS_ENSURE_TRUE(window, NS_OK);
|
||||
|
||||
mPowerManager = PowerManager::CheckPermissionAndCreateInstance(window);
|
||||
NS_ENSURE_STATE(mWindow);
|
||||
mPowerManager = PowerManager::CheckPermissionAndCreateInstance(mWindow);
|
||||
NS_ENSURE_TRUE(mPowerManager, NS_OK);
|
||||
}
|
||||
|
||||
|
@ -1174,16 +1156,15 @@ Navigator::GetMozPower(nsIDOMMozPowerManager** aPower)
|
|||
NS_IMETHODIMP
|
||||
Navigator::RequestWakeLock(const nsAString &aTopic, nsIDOMMozWakeLock **aWakeLock)
|
||||
{
|
||||
*aWakeLock = nullptr;
|
||||
NS_ENSURE_STATE(mWindow);
|
||||
|
||||
nsCOMPtr<nsPIDOMWindow> win = do_QueryReferent(mWindow);
|
||||
NS_ENSURE_TRUE(win, NS_OK);
|
||||
*aWakeLock = nullptr;
|
||||
|
||||
nsCOMPtr<nsIPowerManagerService> pmService =
|
||||
do_GetService(POWERMANAGERSERVICE_CONTRACTID);
|
||||
NS_ENSURE_TRUE(pmService, NS_OK);
|
||||
|
||||
return pmService->NewWakeLock(aTopic, win, aWakeLock);
|
||||
return pmService->NewWakeLock(aTopic, mWindow, aWakeLock);
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
|
@ -1196,10 +1177,10 @@ Navigator::GetMozSms(nsIDOMMozSmsManager** aSmsManager)
|
|||
*aSmsManager = nullptr;
|
||||
|
||||
if (!mSmsManager) {
|
||||
nsCOMPtr<nsPIDOMWindow> window = do_QueryReferent(mWindow);
|
||||
NS_ENSURE_TRUE(window && window->GetDocShell(), NS_OK);
|
||||
NS_ENSURE_STATE(mWindow);
|
||||
NS_ENSURE_TRUE(mWindow->GetDocShell(), NS_OK);
|
||||
|
||||
mSmsManager = SmsManager::CreateInstanceIfAllowed(window);
|
||||
mSmsManager = SmsManager::CreateInstanceIfAllowed(mWindow);
|
||||
NS_ENSURE_TRUE(mSmsManager, NS_OK);
|
||||
}
|
||||
|
||||
|
@ -1227,15 +1208,15 @@ Navigator::GetMozMobileMessage(nsIDOMMozMobileMessageManager** aMobileMessageMan
|
|||
NS_ENSURE_TRUE(enabled, NS_OK);
|
||||
|
||||
if (!mMobileMessageManager) {
|
||||
nsCOMPtr<nsPIDOMWindow> window = do_QueryReferent(mWindow);
|
||||
NS_ENSURE_TRUE(window && window->GetDocShell(), NS_OK);
|
||||
NS_ENSURE_STATE(mWindow);
|
||||
NS_ENSURE_TRUE(mWindow->GetDocShell(), NS_OK);
|
||||
|
||||
if (!CheckPermission("sms")) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
mMobileMessageManager = new MobileMessageManager();
|
||||
mMobileMessageManager->Init(window);
|
||||
mMobileMessageManager->Init(mWindow);
|
||||
}
|
||||
|
||||
NS_ADDREF(*aMobileMessageManager = mMobileMessageManager);
|
||||
|
@ -1255,14 +1236,13 @@ Navigator::GetMozCellBroadcast(nsIDOMMozCellBroadcast** aCellBroadcast)
|
|||
*aCellBroadcast = nullptr;
|
||||
|
||||
if (!mCellBroadcast) {
|
||||
nsCOMPtr<nsPIDOMWindow> window = do_QueryReferent(mWindow);
|
||||
NS_ENSURE_TRUE(window, NS_OK);
|
||||
NS_ENSURE_STATE(mWindow);
|
||||
|
||||
if (!CheckPermission("cellbroadcast")) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult rv = NS_NewCellBroadcast(window, getter_AddRefs(mCellBroadcast));
|
||||
nsresult rv = NS_NewCellBroadcast(mWindow, getter_AddRefs(mCellBroadcast));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
|
@ -1280,10 +1260,8 @@ Navigator::GetMozTelephony(nsIDOMTelephony** aTelephony)
|
|||
nsCOMPtr<nsIDOMTelephony> telephony = mTelephony;
|
||||
|
||||
if (!telephony) {
|
||||
nsCOMPtr<nsPIDOMWindow> window = do_QueryReferent(mWindow);
|
||||
NS_ENSURE_TRUE(window, NS_ERROR_FAILURE);
|
||||
|
||||
nsresult rv = NS_NewTelephony(window, getter_AddRefs(mTelephony));
|
||||
NS_ENSURE_STATE(mWindow);
|
||||
nsresult rv = NS_NewTelephony(mWindow, getter_AddRefs(mTelephony));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// mTelephony may be null here!
|
||||
|
@ -1304,14 +1282,12 @@ Navigator::GetMozVoicemail(nsIDOMMozVoicemail** aVoicemail)
|
|||
*aVoicemail = nullptr;
|
||||
|
||||
if (!mVoicemail) {
|
||||
nsCOMPtr<nsPIDOMWindow> window = do_QueryReferent(mWindow);
|
||||
NS_ENSURE_TRUE(window, NS_OK);
|
||||
|
||||
NS_ENSURE_STATE(mWindow);
|
||||
if (!CheckPermission("voicemail")) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult rv = NS_NewVoicemail(window, getter_AddRefs(mVoicemail));
|
||||
nsresult rv = NS_NewVoicemail(mWindow, getter_AddRefs(mVoicemail));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
|
@ -1329,15 +1305,15 @@ Navigator::GetMozIccManager(nsIDOMMozIccManager** aIccManager)
|
|||
*aIccManager = nullptr;
|
||||
|
||||
if (!mIccManager) {
|
||||
nsCOMPtr<nsPIDOMWindow> window = do_QueryReferent(mWindow);
|
||||
NS_ENSURE_TRUE(window && window->GetDocShell(), NS_OK);
|
||||
NS_ENSURE_STATE(mWindow);
|
||||
NS_ENSURE_TRUE(mWindow->GetDocShell(), NS_OK);
|
||||
|
||||
if (!CheckPermission("mobileconnection")) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
mIccManager = new icc::IccManager();
|
||||
mIccManager->Init(window);
|
||||
mIccManager->Init(mWindow);
|
||||
}
|
||||
|
||||
NS_ADDREF(*aIccManager = mIccManager);
|
||||
|
@ -1357,9 +1333,9 @@ Navigator::GetGamepads(nsIVariant** aRetVal)
|
|||
NS_ENSURE_ARG_POINTER(aRetVal);
|
||||
*aRetVal = nullptr;
|
||||
|
||||
nsCOMPtr<nsPIDOMWindow> pwin(do_QueryReferent(mWindow));
|
||||
NS_ENSURE_TRUE(pwin && pwin->GetDocShell(), NS_OK);
|
||||
nsGlobalWindow* win = static_cast<nsGlobalWindow*>(pwin.get());
|
||||
NS_ENSURE_STATE(mWindow);
|
||||
NS_ENSURE_TRUE(mWindow->GetDocShell(), NS_OK);
|
||||
nsGlobalWindow* win = static_cast<nsGlobalWindow*>(mWindow.get());
|
||||
|
||||
nsAutoTArray<nsRefPtr<Gamepad>, 2> gamepads;
|
||||
win->GetGamepads(gamepads);
|
||||
|
@ -1392,11 +1368,11 @@ Navigator::GetMozConnection(nsIDOMMozConnection** aConnection)
|
|||
*aConnection = nullptr;
|
||||
|
||||
if (!mConnection) {
|
||||
nsCOMPtr<nsPIDOMWindow> window = do_QueryReferent(mWindow);
|
||||
NS_ENSURE_TRUE(window && window->GetDocShell(), NS_OK);
|
||||
NS_ENSURE_STATE(mWindow);
|
||||
NS_ENSURE_TRUE(mWindow->GetDocShell(), NS_OK);
|
||||
|
||||
mConnection = new network::Connection();
|
||||
mConnection->Init(window);
|
||||
mConnection->Init(mWindow);
|
||||
}
|
||||
|
||||
NS_ADDREF(*aConnection = mConnection);
|
||||
|
@ -1413,16 +1389,14 @@ Navigator::GetMozMobileConnection(nsIDOMMozMobileConnection** aMobileConnection)
|
|||
*aMobileConnection = nullptr;
|
||||
|
||||
if (!mMobileConnection) {
|
||||
nsCOMPtr<nsPIDOMWindow> window = do_QueryReferent(mWindow);
|
||||
NS_ENSURE_TRUE(window, NS_OK);
|
||||
|
||||
NS_ENSURE_STATE(mWindow);
|
||||
if (!CheckPermission("mobileconnection") &&
|
||||
!CheckPermission("mobilenetwork")) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
mMobileConnection = new network::MobileConnection();
|
||||
mMobileConnection->Init(window);
|
||||
mMobileConnection->Init(mWindow);
|
||||
}
|
||||
|
||||
NS_ADDREF(*aMobileConnection = mMobileConnection);
|
||||
|
@ -1441,10 +1415,8 @@ Navigator::GetMozBluetooth(nsIDOMBluetoothManager** aBluetooth)
|
|||
nsCOMPtr<nsIDOMBluetoothManager> bluetooth = mBluetooth;
|
||||
|
||||
if (!bluetooth) {
|
||||
nsCOMPtr<nsPIDOMWindow> window = do_QueryReferent(mWindow);
|
||||
NS_ENSURE_TRUE(window, NS_ERROR_FAILURE);
|
||||
|
||||
nsresult rv = NS_NewBluetoothManager(window, getter_AddRefs(mBluetooth));
|
||||
NS_ENSURE_STATE(mWindow);
|
||||
nsresult rv = NS_NewBluetoothManager(mWindow, getter_AddRefs(mBluetooth));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
bluetooth = mBluetooth;
|
||||
|
@ -1465,8 +1437,7 @@ Navigator::EnsureMessagesManager()
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsPIDOMWindow> window = do_QueryReferent(mWindow);
|
||||
NS_ENSURE_TRUE(window, NS_ERROR_FAILURE);
|
||||
NS_ENSURE_STATE(mWindow);
|
||||
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIDOMNavigatorSystemMessages> messageManager =
|
||||
|
@ -1479,7 +1450,7 @@ Navigator::EnsureMessagesManager()
|
|||
// We don't do anything with the return value.
|
||||
AutoJSContext cx;
|
||||
JS::Rooted<JS::Value> prop_val(cx);
|
||||
rv = gpi->Init(window, prop_val.address());
|
||||
rv = gpi->Init(mWindow, prop_val.address());
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
mMessagesManager = messageManager.forget();
|
||||
|
@ -1524,12 +1495,13 @@ Navigator::GetMozTime(nsISupports** aTime)
|
|||
{
|
||||
*aTime = nullptr;
|
||||
|
||||
NS_ENSURE_STATE(mWindow);
|
||||
if (!CheckPermission("time")) {
|
||||
return NS_ERROR_DOM_SECURITY_ERR;
|
||||
}
|
||||
|
||||
if (!mTimeManager) {
|
||||
mTimeManager = new time::TimeManager(GetWindow());
|
||||
mTimeManager = new time::TimeManager(mWindow);
|
||||
}
|
||||
|
||||
NS_ADDREF(*aTime = mTimeManager);
|
||||
|
@ -1545,14 +1517,14 @@ NS_IMETHODIMP
|
|||
Navigator::GetMozCameras(nsISupports** aCameraManager)
|
||||
{
|
||||
if (!mCameraManager) {
|
||||
nsCOMPtr<nsPIDOMWindow> win = do_QueryReferent(mWindow);
|
||||
NS_ENSURE_TRUE(win, NS_ERROR_FAILURE);
|
||||
|
||||
if (!win->GetOuterWindow() || win->GetOuterWindow()->GetCurrentInnerWindow() != win) {
|
||||
if (!mWindow ||
|
||||
!mWindow->GetOuterWindow() ||
|
||||
mWindow->GetOuterWindow()->GetCurrentInnerWindow() != mWindow) {
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
mCameraManager = nsDOMCameraManager::CheckPermissionAndCreateInstance(win);
|
||||
mCameraManager =
|
||||
nsDOMCameraManager::CheckPermissionAndCreateInstance(mWindow);
|
||||
NS_ENSURE_TRUE(mCameraManager, NS_OK);
|
||||
}
|
||||
|
||||
|
@ -1580,14 +1552,13 @@ Navigator::SetWindow(nsPIDOMWindow *aInnerWindow)
|
|||
{
|
||||
NS_ASSERTION(aInnerWindow->IsInnerWindow(),
|
||||
"Navigator must get an inner window!");
|
||||
mWindow = do_GetWeakReference(aInnerWindow);
|
||||
mWindow = aInnerWindow;
|
||||
}
|
||||
|
||||
void
|
||||
Navigator::OnNavigation()
|
||||
{
|
||||
nsCOMPtr<nsPIDOMWindow> win = do_QueryReferent(mWindow);
|
||||
if (!win) {
|
||||
if (!mWindow) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1595,26 +1566,27 @@ Navigator::OnNavigation()
|
|||
// Inform MediaManager in case there are live streams or pending callbacks.
|
||||
MediaManager *manager = MediaManager::Get();
|
||||
if (manager) {
|
||||
manager->OnNavigation(win->WindowID());
|
||||
manager->OnNavigation(mWindow->WindowID());
|
||||
}
|
||||
#endif
|
||||
if (mCameraManager) {
|
||||
mCameraManager->OnNavigation(win->WindowID());
|
||||
mCameraManager->OnNavigation(mWindow->WindowID());
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
Navigator::CheckPermission(const char* type)
|
||||
{
|
||||
nsCOMPtr<nsPIDOMWindow> window = do_QueryReferent(mWindow);
|
||||
NS_ENSURE_TRUE(window, false);
|
||||
if (!mWindow) {
|
||||
return false;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIPermissionManager> permMgr =
|
||||
do_GetService(NS_PERMISSIONMANAGER_CONTRACTID);
|
||||
NS_ENSURE_TRUE(permMgr, false);
|
||||
|
||||
uint32_t permission = nsIPermissionManager::DENY_ACTION;
|
||||
permMgr->TestPermissionFromWindow(window, type, &permission);
|
||||
permMgr->TestPermissionFromWindow(mWindow, type, &permission);
|
||||
return permission == nsIPermissionManager::ALLOW_ACTION;
|
||||
}
|
||||
|
||||
|
@ -1628,10 +1600,9 @@ Navigator::GetMozAudioChannelManager(nsISupports** aAudioChannelManager)
|
|||
*aAudioChannelManager = nullptr;
|
||||
|
||||
if (!mAudioChannelManager) {
|
||||
nsCOMPtr<nsPIDOMWindow> window = do_QueryReferent(mWindow);
|
||||
NS_ENSURE_TRUE(window, NS_OK);
|
||||
NS_ENSURE_STATE(mWindow);
|
||||
mAudioChannelManager = new system::AudioChannelManager();
|
||||
mAudioChannelManager->Init(window);
|
||||
mAudioChannelManager->Init(mWindow);
|
||||
}
|
||||
|
||||
NS_ADDREF(*aAudioChannelManager = mAudioChannelManager);
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include "nsIDOMNavigatorTime.h"
|
||||
#include "nsWeakReference.h"
|
||||
#include "DeviceStorage.h"
|
||||
#include "nsWrapperCache.h"
|
||||
|
||||
class nsPluginArray;
|
||||
class nsMimeTypeArray;
|
||||
|
@ -141,12 +142,15 @@ class Navigator : public nsIDOMNavigator
|
|||
#ifdef MOZ_AUDIO_CHANNEL_MANAGER
|
||||
, public nsIMozNavigatorAudioChannelManager
|
||||
#endif
|
||||
, public nsWrapperCache
|
||||
{
|
||||
public:
|
||||
Navigator(nsPIDOMWindow *aInnerWindow);
|
||||
virtual ~Navigator();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_AMBIGUOUS(Navigator,
|
||||
nsIDOMNavigator)
|
||||
NS_DECL_NSIDOMNAVIGATOR
|
||||
NS_DECL_NSIDOMCLIENTINFORMATION
|
||||
NS_DECL_NSIDOMNAVIGATORDEVICESTORAGE
|
||||
|
@ -187,7 +191,10 @@ public:
|
|||
static void Init();
|
||||
|
||||
void Invalidate();
|
||||
nsPIDOMWindow *GetWindow();
|
||||
nsPIDOMWindow *GetWindow()
|
||||
{
|
||||
return mWindow;
|
||||
}
|
||||
|
||||
void RefreshMIMEArray();
|
||||
|
||||
|
@ -241,7 +248,7 @@ private:
|
|||
nsCOMPtr<nsIDOMNavigatorSystemMessages> mMessagesManager;
|
||||
nsTArray<nsRefPtr<nsDOMDeviceStorage> > mDeviceStorageStores;
|
||||
nsRefPtr<time::TimeManager> mTimeManager;
|
||||
nsWeakPtr mWindow;
|
||||
nsCOMPtr<nsPIDOMWindow> mWindow;
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
|
|
|
@ -161,9 +161,6 @@
|
|||
#include "nsIDOMCSSPageRule.h"
|
||||
#include "nsIDOMCSSStyleRule.h"
|
||||
#include "nsIDOMCSSStyleSheet.h"
|
||||
#define MOZ_GENERATED_EVENTS_INCLUDES
|
||||
#include "GeneratedEvents.h"
|
||||
#undef MOZ_GENERATED_EVENTS_INCLUDES
|
||||
#include "nsIDOMDeviceMotionEvent.h" //nsIDOMDeviceAcceleration
|
||||
#include "nsIDOMXULCommandDispatcher.h"
|
||||
#ifndef MOZ_DISABLE_CRYPTOLEGACY
|
||||
|
@ -294,7 +291,6 @@ using mozilla::dom::workers::ResolveWorkerClasses;
|
|||
#include "nsIDOMGlobalObjectConstructor.h"
|
||||
#include "nsIDOMCanvasRenderingContext2D.h"
|
||||
#include "LockedFile.h"
|
||||
#include "GeneratedEvents.h"
|
||||
#include "nsDebug.h"
|
||||
|
||||
#include "mozilla/dom/BindingUtils.h"
|
||||
|
@ -513,17 +509,6 @@ static nsDOMClassInfoData sClassInfoData[] = {
|
|||
|
||||
// Misc Core related classes
|
||||
|
||||
// Event
|
||||
NS_DEFINE_CLASSINFO_DATA(Event, nsEventSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
|
||||
#define MOZ_GENERATED_EVENT_LIST
|
||||
#define MOZ_GENERATED_EVENT(_event_interface) \
|
||||
NS_DEFINE_CLASSINFO_DATA(_event_interface, nsEventSH, \
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
#include "GeneratedEvents.h"
|
||||
#undef MOZ_GENERATED_EVENT_LIST
|
||||
|
||||
NS_DEFINE_CLASSINFO_DATA(DeviceAcceleration, nsDOMGenericSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
NS_DEFINE_CLASSINFO_DATA(DeviceRotationRate, nsDOMGenericSH,
|
||||
|
@ -815,22 +800,6 @@ NS_DEFINE_CONTRACT_CTOR(XSLTProcessor,
|
|||
|
||||
#undef NS_DEFINE_CONTRACT_CTOR
|
||||
|
||||
#define NS_DEFINE_EVENT_CTOR(_class) \
|
||||
static nsresult \
|
||||
NS_DOM##_class##Ctor(nsISupports** aInstancePtrResult) \
|
||||
{ \
|
||||
nsIDOMEvent* e = nullptr; \
|
||||
nsresult rv = NS_NewDOM##_class(&e, nullptr, nullptr, nullptr); \
|
||||
*aInstancePtrResult = e; \
|
||||
return rv; \
|
||||
}
|
||||
|
||||
#define MOZ_GENERATED_EVENT_LIST
|
||||
#define MOZ_GENERATED_EVENT(_event_interface) \
|
||||
NS_DEFINE_EVENT_CTOR(_event_interface)
|
||||
#include "GeneratedEvents.h"
|
||||
#undef MOZ_GENERATED_EVENT_LIST
|
||||
|
||||
struct nsConstructorFuncMapData
|
||||
{
|
||||
int32_t mDOMClassInfoID;
|
||||
|
@ -840,23 +809,14 @@ struct nsConstructorFuncMapData
|
|||
#define NS_DEFINE_CONSTRUCTOR_FUNC_DATA(_class, _func) \
|
||||
{ eDOMClassInfo_##_class##_id, _func },
|
||||
|
||||
#define NS_DEFINE_EVENT_CONSTRUCTOR_FUNC_DATA(_class) \
|
||||
{ eDOMClassInfo_##_class##_id, NS_DOM##_class##Ctor },
|
||||
|
||||
static const nsConstructorFuncMapData kConstructorFuncMap[] =
|
||||
{
|
||||
NS_DEFINE_CONSTRUCTOR_FUNC_DATA(Blob, nsDOMMultipartFile::NewBlob)
|
||||
NS_DEFINE_CONSTRUCTOR_FUNC_DATA(File, nsDOMMultipartFile::NewFile)
|
||||
#define MOZ_GENERATED_EVENT_LIST
|
||||
#define MOZ_GENERATED_EVENT(_event_interface) \
|
||||
NS_DEFINE_EVENT_CONSTRUCTOR_FUNC_DATA(_event_interface)
|
||||
#include "GeneratedEvents.h"
|
||||
#undef MOZ_GENERATED_EVENT_LIST
|
||||
NS_DEFINE_CONSTRUCTOR_FUNC_DATA(MozSmsFilter, SmsFilter::NewSmsFilter)
|
||||
NS_DEFINE_CONSTRUCTOR_FUNC_DATA(XSLTProcessor, XSLTProcessorCtor)
|
||||
};
|
||||
#undef NS_DEFINE_CONSTRUCTOR_FUNC_DATA
|
||||
#undef NS_DEFINE_EVENT_CONSTRUCTOR_FUNC_DATA
|
||||
|
||||
nsIXPConnect *nsDOMClassInfo::sXPConnect = nullptr;
|
||||
nsIScriptSecurityManager *nsDOMClassInfo::sSecMan = nullptr;
|
||||
|
@ -1321,9 +1281,6 @@ nsDOMClassInfo::RegisterExternalClasses()
|
|||
DOM_CLASSINFO_MAP_CONDITIONAL_ENTRY(nsITouchEventReceiver, \
|
||||
nsDOMTouchEvent::PrefEnabled())
|
||||
|
||||
#define DOM_CLASSINFO_EVENT_MAP_ENTRIES \
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMEvent) \
|
||||
|
||||
#ifdef MOZ_B2G
|
||||
#define DOM_CLASSINFO_WINDOW_MAP_ENTRIES(_support_indexed_db) \
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindow) \
|
||||
|
@ -1480,27 +1437,12 @@ nsDOMClassInfo::Init()
|
|||
nsDOMTouchEvent::PrefEnabled())
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN(Event, nsIDOMEvent)
|
||||
DOM_CLASSINFO_EVENT_MAP_ENTRIES
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
#define MOZ_GENERATED_EVENT_LIST
|
||||
#define MOZ_GENERATED_EVENT(_event_interface) \
|
||||
DOM_CLASSINFO_MAP_BEGIN(_event_interface, nsIDOM##_event_interface) \
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOM##_event_interface) \
|
||||
DOM_CLASSINFO_EVENT_MAP_ENTRIES \
|
||||
DOM_CLASSINFO_MAP_END
|
||||
#include "GeneratedEvents.h"
|
||||
#undef MOZ_GENERATED_EVENT_LIST
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN(DeviceAcceleration, nsIDOMDeviceAcceleration)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMDeviceAcceleration)
|
||||
DOM_CLASSINFO_EVENT_MAP_ENTRIES
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN(DeviceRotationRate, nsIDOMDeviceRotationRate)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMDeviceRotationRate)
|
||||
DOM_CLASSINFO_EVENT_MAP_ENTRIES
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN(HTMLFormElement, nsIDOMHTMLFormElement)
|
||||
|
@ -5182,40 +5124,6 @@ nsEventTargetSH::PreserveWrapper(nsISupports *aNative)
|
|||
nsContentUtils::PreserveWrapper(aNative, target);
|
||||
}
|
||||
|
||||
// Event helper
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsEventSH::PreCreate(nsISupports* aNativeObj, JSContext* aCx,
|
||||
JSObject* aGlobalObj, JSObject** aParentObj)
|
||||
{
|
||||
JS::Rooted<JSObject*> globalObj(aCx, aGlobalObj);
|
||||
nsDOMEvent* event =
|
||||
nsDOMEvent::FromSupports(aNativeObj);
|
||||
|
||||
nsCOMPtr<nsIScriptGlobalObject> native_parent;
|
||||
event->GetParentObject(getter_AddRefs(native_parent));
|
||||
|
||||
*aParentObj = native_parent ? native_parent->GetGlobalJSObject() : globalObj;
|
||||
|
||||
return *aParentObj ? NS_OK : NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsEventSH::AddProperty(nsIXPConnectWrappedNative* aWrapper, JSContext* aCx,
|
||||
JSObject* aObj, jsid Id, jsval* aVp, bool* aRetval)
|
||||
{
|
||||
nsEventSH::PreserveWrapper(GetNative(aWrapper, aObj));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
nsEventSH::PreserveWrapper(nsISupports* aNative)
|
||||
{
|
||||
nsDOMEvent* event =
|
||||
nsDOMEvent::FromSupports(aNative);
|
||||
nsContentUtils::PreserveWrapper(aNative, event);
|
||||
}
|
||||
|
||||
// IDBEventTarget helper
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
|
|
@ -296,31 +296,6 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
// Makes sure that the wrapper is preserved if new properties are added.
|
||||
class nsEventSH : public nsDOMGenericSH
|
||||
{
|
||||
protected:
|
||||
nsEventSH(nsDOMClassInfoData* aData) : nsDOMGenericSH(aData)
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~nsEventSH()
|
||||
{
|
||||
}
|
||||
public:
|
||||
NS_IMETHOD PreCreate(nsISupports* aNativeObj, JSContext* aCx,
|
||||
JSObject* aGlobalObj, JSObject** aParentObj) MOZ_OVERRIDE;
|
||||
NS_IMETHOD AddProperty(nsIXPConnectWrappedNative* aWrapper, JSContext* aCx,
|
||||
JSObject* aObj, jsid Id, jsval* aVp, bool* aRetval) MOZ_OVERRIDE;
|
||||
|
||||
virtual void PreserveWrapper(nsISupports *aNative) MOZ_OVERRIDE;
|
||||
|
||||
static nsIClassInfo *doCreate(nsDOMClassInfoData* aData)
|
||||
{
|
||||
return new nsEventSH(aData);
|
||||
}
|
||||
};
|
||||
|
||||
// Window scriptable helper
|
||||
|
||||
class nsWindowSH : public nsDOMGenericSH
|
||||
|
|
|
@ -18,12 +18,6 @@ DOMCI_CLASS(DOMConstructor)
|
|||
DOMCI_CLASS(DOMException)
|
||||
DOMCI_CLASS(Element)
|
||||
|
||||
// Event classes
|
||||
DOMCI_CLASS(Event)
|
||||
#define MOZ_GENERATED_EVENT_LIST
|
||||
#define MOZ_GENERATED_EVENT(_event_interface) DOMCI_CLASS(_event_interface)
|
||||
#include "GeneratedEvents.h"
|
||||
#undef MOZ_GENERATED_EVENT_LIST
|
||||
DOMCI_CLASS(DeviceAcceleration)
|
||||
DOMCI_CLASS(DeviceRotationRate)
|
||||
|
||||
|
|
|
@ -1364,6 +1364,7 @@ nsresult
|
|||
nsJSContext::ExecuteScript(JSScript* aScriptObject_,
|
||||
JSObject* aScopeObject_)
|
||||
{
|
||||
JSAutoRequest ar(mContext);
|
||||
JS::Rooted<JSObject*> aScopeObject(mContext, aScopeObject_);
|
||||
JS::Rooted<JSScript*> aScriptObject(mContext, aScriptObject_);
|
||||
NS_ENSURE_TRUE(mIsInitialized, NS_ERROR_NOT_INITIALIZED);
|
||||
|
|
|
@ -556,8 +556,6 @@ DOMInterfaces = {
|
|||
|
||||
'IDBFactory': {
|
||||
'nativeType': 'mozilla::dom::indexedDB::IDBFactory',
|
||||
'implicitJSContext': [ 'open', 'deleteDatabase', 'openForPrincipal',
|
||||
'deleteForPrincipal' ],
|
||||
},
|
||||
|
||||
'IDBVersionChangeEvent': {
|
||||
|
|
|
@ -43,8 +43,6 @@ CallbackObject::CallSetup::CallSetup(JS::Handle<JSObject*> aCallback,
|
|||
, mErrorResult(aRv)
|
||||
, mExceptionHandling(aExceptionHandling)
|
||||
{
|
||||
xpc_UnmarkGrayObject(aCallback);
|
||||
|
||||
// We need to produce a useful JSContext here. Ideally one that the callback
|
||||
// is in some sense associated with, so that we can sort of treat it as a
|
||||
// "script entry point". Though once we actually have script entry points,
|
||||
|
@ -90,14 +88,20 @@ CallbackObject::CallSetup::CallSetup(JS::Handle<JSObject*> aCallback,
|
|||
cx = nsContentUtils::GetSafeJSContext();
|
||||
}
|
||||
|
||||
// Go ahead and stick our callable in a Rooted, to make sure it can't go
|
||||
// gray again. We can do this even though we're not in the right compartment
|
||||
// yet, because Rooted<> does not care about compartments.
|
||||
mRootedCallable.construct(cx, aCallback);
|
||||
|
||||
// Make sure our JSContext is pushed on the stack.
|
||||
mCxPusher.Push(cx);
|
||||
|
||||
// Unmark the callable, and stick it in a Rooted before it can go gray again.
|
||||
// Nothing before us in this function can trigger a CC, so it's safe to wait
|
||||
// until here it do the unmark. This allows us to order the following two
|
||||
// operations _after_ the Push() above, which lets us take advantage of the
|
||||
// JSAutoRequest embedded in the pusher.
|
||||
//
|
||||
// We can do this even though we're not in the right compartment yet, because
|
||||
// Rooted<> does not care about compartments.
|
||||
xpc_UnmarkGrayObject(aCallback);
|
||||
mRootedCallable.construct(cx, aCallback);
|
||||
|
||||
// After this point we guarantee calling ScriptEvaluated() if we
|
||||
// have an nsIScriptContext.
|
||||
// XXXbz Why, if, say CheckFunctionAccess fails? I know that's how
|
||||
|
|
|
@ -145,13 +145,12 @@ protected:
|
|||
// is gone
|
||||
nsAutoMicroTask mMt;
|
||||
|
||||
// We construct our JS::Rooted right after our JSAutoRequest; let's just
|
||||
// hope that the change in ordering wrt the mCxPusher constructor here is
|
||||
// ok.
|
||||
Maybe<JS::Rooted<JSObject*> > mRootedCallable;
|
||||
|
||||
nsCxPusher mCxPusher;
|
||||
|
||||
// Constructed the rooter within the scope of mCxPusher above, so that it's
|
||||
// always within a request during its lifetime.
|
||||
Maybe<JS::Rooted<JSObject*> > mRootedCallable;
|
||||
|
||||
// Can't construct a JSAutoCompartment without a JSContext either. Also,
|
||||
// Put mAc after mCxPusher so that we exit the compartment before we pop the
|
||||
// JSContext. Though in practice we'll often manually order those two
|
||||
|
|
|
@ -7789,8 +7789,12 @@ class CGDictionary(CGThing):
|
|||
for m in self.memberInfo]
|
||||
if memberInits:
|
||||
body += (
|
||||
"JS::Rooted<JS::Value> temp(cx);\n"
|
||||
"bool isNull = val.isNullOrUndefined();\n")
|
||||
"bool isNull = val.isNullOrUndefined();\n"
|
||||
"// We only need |temp| if !isNull, in which case we have |cx|.\n"
|
||||
"Maybe<JS::Rooted<JS::Value> > temp;\n"
|
||||
"if (!isNull) {\n"
|
||||
" temp.construct(cx);\n"
|
||||
"}\n")
|
||||
body += "\n\n".join(memberInits) + "\n"
|
||||
|
||||
body += "return true;"
|
||||
|
@ -7959,8 +7963,8 @@ class CGDictionary(CGThing):
|
|||
|
||||
def getMemberConversion(self, memberInfo):
|
||||
(member, conversionInfo) = memberInfo
|
||||
replacements = { "val": "temp",
|
||||
"mutableVal": "&temp",
|
||||
replacements = { "val": "temp.ref()",
|
||||
"mutableVal": "&temp.ref()",
|
||||
"declName": self.makeMemberName(member.identifier.name),
|
||||
# We need a holder name for external interfaces, but
|
||||
# it's scoped down to the conversion so we can just use
|
||||
|
@ -7971,16 +7975,16 @@ class CGDictionary(CGThing):
|
|||
if conversionInfo.dealWithOptional:
|
||||
replacements["declName"] = "(" + replacements["declName"] + ".Value())"
|
||||
if member.defaultValue:
|
||||
replacements["haveValue"] = "!temp.isUndefined()"
|
||||
replacements["haveValue"] = "!isNull && !temp.ref().isUndefined()"
|
||||
|
||||
# NOTE: jsids are per-runtime, so don't use them in workers
|
||||
if self.workers:
|
||||
propName = member.identifier.name
|
||||
propGet = ('JS_GetProperty(cx, &val.toObject(), "%s", temp.address())' %
|
||||
propGet = ('JS_GetProperty(cx, &val.toObject(), "%s", temp.ref().address())' %
|
||||
propName)
|
||||
else:
|
||||
propId = self.makeIdName(member.identifier.name);
|
||||
propGet = ("JS_GetPropertyById(cx, &val.toObject(), %s, temp.address())" %
|
||||
propGet = ("JS_GetPropertyById(cx, &val.toObject(), %s, temp.ref().address())" %
|
||||
propId)
|
||||
|
||||
conversionReplacements = {
|
||||
|
@ -7988,9 +7992,7 @@ class CGDictionary(CGThing):
|
|||
"convert": string.Template(conversionInfo.template).substitute(replacements),
|
||||
"propGet": propGet
|
||||
}
|
||||
conversion = ("if (isNull) {\n"
|
||||
" temp.setUndefined();\n"
|
||||
"} else if (!${propGet}) {\n"
|
||||
conversion = ("if (!isNull && !${propGet}) {\n"
|
||||
" return false;\n"
|
||||
"}\n")
|
||||
if member.defaultValue:
|
||||
|
@ -7998,7 +8000,7 @@ class CGDictionary(CGThing):
|
|||
"${convert}")
|
||||
else:
|
||||
conversion += (
|
||||
"if (!temp.isUndefined()) {\n"
|
||||
"if (!isNull && !temp.ref().isUndefined()) {\n"
|
||||
" ${prop}.Construct();\n"
|
||||
"${convert}\n"
|
||||
"}")
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
<div id="log"></div>
|
||||
<script>
|
||||
|
||||
SimpleTest.expectAssertions(0, 2);
|
||||
//SimpleTest.expectAssertions(0, 2);
|
||||
|
||||
setup({explicit_done: true});
|
||||
runTest();
|
||||
|
|
|
@ -43,6 +43,7 @@ function runTextDecoderOptions()
|
|||
testDecodeABVOption(data, expectedString);
|
||||
}, "testDecodeABVOption");
|
||||
test(testDecoderForThaiEncoding, "testDecoderForThaiEncoding");
|
||||
test(testInvalid2022JP, "testInvalid2022JP");
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -401,3 +402,50 @@ function testCharset(test)
|
|||
}
|
||||
assert_true(!test.error, test.msg);
|
||||
}
|
||||
|
||||
function testInvalid2022JP()
|
||||
{
|
||||
var inputs = [
|
||||
[0x80],
|
||||
[0x1b, 0xFF],
|
||||
[0x1b, 0x28, 0xFF],
|
||||
[0x1b, 0x24, 0x80],
|
||||
[0x1b, 0x24, 0x28, 0x80],
|
||||
[0x1b, 0x28, 0x4a, 0xFF],
|
||||
[0x1b, 0x28, 0x49, 0xFF],
|
||||
[0x1b, 0x24, 0x40, 0x20],
|
||||
[0x1b, 0x24, 0x41, 0x20],
|
||||
[0x1b, 0x24, 0x42, 0x20],
|
||||
[0x1b, 0x24, 0x28, 0x43, 0x20],
|
||||
[0x1b, 0x24, 0x28, 0x44, 0x20],
|
||||
[0x1b, 0x24, 0x40, 0x80, 0x21],
|
||||
[0x1b, 0x24, 0x41, 0xFF, 0x21],
|
||||
[0x1b, 0x24, 0x42, 0x80, 0x21],
|
||||
[0x1b, 0x24, 0x28, 0x43, 0xFF, 0x21],
|
||||
[0x1b, 0x24, 0x28, 0x44, 0x80, 0x21],
|
||||
[0x1b, 0x24, 0x40, 0x21, 0x20],
|
||||
[0x1b, 0x24, 0x41, 0x21, 0x20],
|
||||
[0x1b, 0x24, 0x42, 0x21, 0x20],
|
||||
[0x1b, 0x24, 0x28, 0x43, 0x21, 0x20],
|
||||
[0x1b, 0x24, 0x28, 0x44, 0x21, 0x20],
|
||||
[0x1b, 0x2e, 0xFF],
|
||||
[0x1b, 0x4e, 0x20],
|
||||
[0x1b, 0x4e, 0x7F],
|
||||
[0x1b, 0x2e, 0x41, 0x1b, 0x4e, 0x80],
|
||||
[0x1b, 0x2e, 0x41, 0x1b, 0x4e, 0xFF],
|
||||
];
|
||||
|
||||
var failureCount = 0;
|
||||
inputs.forEach(function(input) {
|
||||
try {
|
||||
// decode() should never throw unless {fatal: true} is specified
|
||||
new TextDecoder("iso-2022-jp").decode(new Uint8Array(input));
|
||||
} catch (e) {
|
||||
if (e.name !== "EncodingError") {
|
||||
throw e;
|
||||
}
|
||||
failureCount++;
|
||||
}
|
||||
});
|
||||
assert_equals(failureCount, 0, failureCount + " of " + inputs.length + " tests failed");
|
||||
}
|
||||
|
|
|
@ -252,8 +252,8 @@ Future::RunTask()
|
|||
mResolveCallbacks.Clear();
|
||||
mRejectCallbacks.Clear();
|
||||
|
||||
Optional<JS::Handle<JS::Value> > value(nsContentUtils::GetSafeJSContext(),
|
||||
mResult);
|
||||
JSAutoRequest ar(nsContentUtils::GetSafeJSContext());
|
||||
Optional<JS::Handle<JS::Value> > value(nsContentUtils::GetSafeJSContext(), mResult);
|
||||
|
||||
for (uint32_t i = 0; i < callbacks.Length(); ++i) {
|
||||
callbacks[i]->Call(value);
|
||||
|
|
|
@ -25,10 +25,12 @@ NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_1(Gamepad, mParent)
|
|||
|
||||
Gamepad::Gamepad(nsISupports* aParent,
|
||||
const nsAString& aID, uint32_t aIndex,
|
||||
GamepadMappingType aMapping,
|
||||
uint32_t aNumButtons, uint32_t aNumAxes)
|
||||
: mParent(aParent),
|
||||
mID(aID),
|
||||
mIndex(aIndex),
|
||||
mMapping(aMapping),
|
||||
mConnected(true)
|
||||
{
|
||||
SetIsDOMBinding();
|
||||
|
@ -146,7 +148,8 @@ already_AddRefed<Gamepad>
|
|||
Gamepad::Clone(nsISupports* aParent)
|
||||
{
|
||||
nsRefPtr<Gamepad> out =
|
||||
new Gamepad(aParent, mID, mIndex, mButtons.Length(), mAxes.Length());
|
||||
new Gamepad(aParent, mID, mIndex, mMapping,
|
||||
mButtons.Length(), mAxes.Length());
|
||||
out->SyncState(this);
|
||||
return out.forget();
|
||||
}
|
||||
|
|
|
@ -17,6 +17,12 @@
|
|||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
enum GamepadMappingType
|
||||
{
|
||||
NoMapping = 0,
|
||||
StandardMapping = 1
|
||||
};
|
||||
|
||||
// TODO: fix the spec to expose both pressed and value:
|
||||
// https://www.w3.org/Bugs/Public/show_bug.cgi?id=21388
|
||||
struct GamepadButton
|
||||
|
@ -33,6 +39,7 @@ class Gamepad : public nsIDOMGamepad
|
|||
public:
|
||||
Gamepad(nsISupports* aParent,
|
||||
const nsAString& aID, uint32_t aIndex,
|
||||
GamepadMappingType aMapping,
|
||||
uint32_t aNumButtons, uint32_t aNumAxes);
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(Gamepad)
|
||||
|
@ -62,6 +69,15 @@ public:
|
|||
aID = mID;
|
||||
}
|
||||
|
||||
void GetMapping(nsAString& aMapping) const
|
||||
{
|
||||
if (mMapping == StandardMapping) {
|
||||
aMapping = NS_LITERAL_STRING("standard");
|
||||
} else {
|
||||
aMapping = NS_LITERAL_STRING("");
|
||||
}
|
||||
}
|
||||
|
||||
bool Connected() const
|
||||
{
|
||||
return mConnected;
|
||||
|
@ -97,6 +113,9 @@ protected:
|
|||
nsString mID;
|
||||
uint32_t mIndex;
|
||||
|
||||
// The mapping in use.
|
||||
GamepadMappingType mMapping;
|
||||
|
||||
// true if this gamepad is currently connected.
|
||||
bool mConnected;
|
||||
|
||||
|
|
|
@ -31,6 +31,8 @@ namespace dom {
|
|||
|
||||
namespace {
|
||||
const char* kGamepadEnabledPref = "dom.gamepad.enabled";
|
||||
const char* kGamepadEventsEnabledPref =
|
||||
"dom.gamepad.non_standard_events.enabled";
|
||||
// Amount of time to wait before cleaning up gamepad resources
|
||||
// when no pages are listening for events.
|
||||
const int kCleanupDelayMS = 2000;
|
||||
|
@ -50,6 +52,8 @@ GamepadService::GamepadService()
|
|||
mShuttingDown(false)
|
||||
{
|
||||
mEnabled = IsAPIEnabled();
|
||||
mNonstandardEventsEnabled =
|
||||
Preferences::GetBool(kGamepadEventsEnabledPref, false);
|
||||
nsCOMPtr<nsIObserverService> observerService =
|
||||
mozilla::services::GetObserverService();
|
||||
observerService->AddObserver(this,
|
||||
|
@ -131,6 +135,7 @@ GamepadService::RemoveListener(nsGlobalWindow* aWindow)
|
|||
|
||||
uint32_t
|
||||
GamepadService::AddGamepad(const char* aId,
|
||||
GamepadMappingType aMapping,
|
||||
uint32_t aNumButtons,
|
||||
uint32_t aNumAxes)
|
||||
{
|
||||
|
@ -139,6 +144,7 @@ GamepadService::AddGamepad(const char* aId,
|
|||
new Gamepad(nullptr,
|
||||
NS_ConvertUTF8toUTF16(nsDependentCString(aId)),
|
||||
0,
|
||||
aMapping,
|
||||
aNumButtons,
|
||||
aNumAxes);
|
||||
int index = -1;
|
||||
|
@ -217,8 +223,10 @@ GamepadService::NewButtonEvent(uint32_t aIndex, uint32_t aButton, bool aPressed,
|
|||
nsRefPtr<Gamepad> gamepad = listeners[i]->GetGamepad(aIndex);
|
||||
if (gamepad) {
|
||||
gamepad->SetButton(aButton, aPressed, aValue);
|
||||
// Fire event
|
||||
FireButtonEvent(listeners[i], gamepad, aButton, aValue);
|
||||
if (mNonstandardEventsEnabled) {
|
||||
// Fire event
|
||||
FireButtonEvent(listeners[i], gamepad, aButton, aValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -275,8 +283,10 @@ GamepadService::NewAxisMoveEvent(uint32_t aIndex, uint32_t aAxis, double aValue)
|
|||
nsRefPtr<Gamepad> gamepad = listeners[i]->GetGamepad(aIndex);
|
||||
if (gamepad) {
|
||||
gamepad->SetAxis(aAxis, aValue);
|
||||
// Fire event
|
||||
FireAxisMoveEvent(listeners[i], gamepad, aAxis, aValue);
|
||||
if (mNonstandardEventsEnabled) {
|
||||
// Fire event
|
||||
FireAxisMoveEvent(listeners[i], gamepad, aAxis, aValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -505,13 +515,15 @@ GamepadServiceTest::GamepadServiceTest()
|
|||
/* member initializers and constructor code */
|
||||
}
|
||||
|
||||
/* uint32_t addGamepad (in string id, in uint32_t numButtons, in uint32_t numAxes); */
|
||||
/* uint32_t addGamepad (in string id, in unsigned long mapping, in unsigned long numButtons, in unsigned long numAxes); */
|
||||
NS_IMETHODIMP GamepadServiceTest::AddGamepad(const char* aID,
|
||||
uint32_t aMapping,
|
||||
uint32_t aNumButtons,
|
||||
uint32_t aNumAxes,
|
||||
uint32_t* aRetval)
|
||||
{
|
||||
*aRetval = gGamepadServiceSingleton->AddGamepad(aID,
|
||||
static_cast<GamepadMappingType>(aMapping),
|
||||
aNumButtons,
|
||||
aNumAxes);
|
||||
return NS_OK;
|
||||
|
|
|
@ -42,7 +42,8 @@ class GamepadService : public nsIObserver
|
|||
void RemoveListener(nsGlobalWindow* aWindow);
|
||||
|
||||
// Add a gamepad to the list of known gamepads, and return its index.
|
||||
uint32_t AddGamepad(const char* aID, uint32_t aNumButtons, uint32_t aNumAxes);
|
||||
uint32_t AddGamepad(const char* aID, GamepadMappingType aMapping,
|
||||
uint32_t aNumButtons, uint32_t aNumAxes);
|
||||
// Remove the gamepad at |aIndex| from the list of known gamepads.
|
||||
void RemoveGamepad(uint32_t aIndex);
|
||||
|
||||
|
@ -76,6 +77,8 @@ class GamepadService : public nsIObserver
|
|||
|
||||
// true if this feature is enabled in preferences
|
||||
bool mEnabled;
|
||||
// true if non-standard events are enabled in preferences
|
||||
bool mNonstandardEventsEnabled;
|
||||
// true if the platform-specific backend has started work
|
||||
bool mStarted;
|
||||
// true when shutdown has begun
|
||||
|
|
|
@ -777,7 +777,7 @@ IDBDatabase::MozCreateFileHandle(const nsAString& aName,
|
|||
return NS_ERROR_DOM_INDEXEDDB_NOT_ALLOWED_ERR;
|
||||
}
|
||||
|
||||
nsRefPtr<IDBRequest> request = IDBRequest::Create(nullptr, this, nullptr, aCx);
|
||||
nsRefPtr<IDBRequest> request = IDBRequest::Create(nullptr, this, nullptr);
|
||||
|
||||
nsRefPtr<CreateFileHelper> helper =
|
||||
new CreateFileHelper(this, request, aName, aType);
|
||||
|
|
|
@ -526,14 +526,14 @@ IDBFactory::OpenInternal(const nsAString& aName,
|
|||
int64_t aVersion,
|
||||
const nsACString& aASCIIOrigin,
|
||||
bool aDeleting,
|
||||
JSContext* aCallingCx,
|
||||
IDBOpenDBRequest** _retval)
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
|
||||
NS_ASSERTION(mWindow || mOwningObject, "Must have one of these!");
|
||||
|
||||
AutoJSContext cx;
|
||||
nsCOMPtr<nsPIDOMWindow> window;
|
||||
JS::Rooted<JSObject*> scriptOwner(aCallingCx);
|
||||
JS::Rooted<JSObject*> scriptOwner(cx);
|
||||
StoragePrivilege privilege;
|
||||
|
||||
if (mWindow) {
|
||||
|
@ -548,7 +548,7 @@ IDBFactory::OpenInternal(const nsAString& aName,
|
|||
}
|
||||
|
||||
nsRefPtr<IDBOpenDBRequest> request =
|
||||
IDBOpenDBRequest::Create(this, window, scriptOwner, aCallingCx);
|
||||
IDBOpenDBRequest::Create(this, window, scriptOwner);
|
||||
NS_ENSURE_TRUE(request, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
nsresult rv;
|
||||
|
@ -646,7 +646,7 @@ IDBFactory::Cmp(JSContext* aCx, JS::Handle<JS::Value> aFirst,
|
|||
}
|
||||
|
||||
already_AddRefed<nsIIDBOpenDBRequest>
|
||||
IDBFactory::OpenForPrincipal(JSContext* aCx, nsIPrincipal* aPrincipal,
|
||||
IDBFactory::OpenForPrincipal(nsIPrincipal* aPrincipal,
|
||||
const NonNull<nsAString>& aName,
|
||||
const Optional<uint64_t>& aVersion,
|
||||
ErrorResult& aRv)
|
||||
|
@ -656,11 +656,11 @@ IDBFactory::OpenForPrincipal(JSContext* aCx, nsIPrincipal* aPrincipal,
|
|||
MOZ_CRASH();
|
||||
}
|
||||
|
||||
return Open(aCx, aPrincipal, aName, aVersion, false, aRv);
|
||||
return Open(aPrincipal, aName, aVersion, false, aRv);
|
||||
}
|
||||
|
||||
already_AddRefed<nsIIDBOpenDBRequest>
|
||||
IDBFactory::DeleteForPrincipal(JSContext* aCx, nsIPrincipal* aPrincipal,
|
||||
IDBFactory::DeleteForPrincipal(nsIPrincipal* aPrincipal,
|
||||
const NonNull<nsAString>& aName,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
|
@ -669,11 +669,11 @@ IDBFactory::DeleteForPrincipal(JSContext* aCx, nsIPrincipal* aPrincipal,
|
|||
MOZ_CRASH();
|
||||
}
|
||||
|
||||
return Open(aCx, aPrincipal, aName, Optional<uint64_t>(), true, aRv);
|
||||
return Open(aPrincipal, aName, Optional<uint64_t>(), true, aRv);
|
||||
}
|
||||
|
||||
already_AddRefed<nsIIDBOpenDBRequest>
|
||||
IDBFactory::Open(JSContext* aCx, nsIPrincipal* aPrincipal,
|
||||
IDBFactory::Open(nsIPrincipal* aPrincipal,
|
||||
const nsAString& aName, const Optional<uint64_t>& aVersion,
|
||||
bool aDelete, ErrorResult& aRv)
|
||||
{
|
||||
|
@ -704,7 +704,7 @@ IDBFactory::Open(JSContext* aCx, nsIPrincipal* aPrincipal,
|
|||
}
|
||||
|
||||
nsRefPtr<IDBOpenDBRequest> request;
|
||||
rv = OpenInternal(aName, version, origin, aDelete, aCx,
|
||||
rv = OpenInternal(aName, version, origin, aDelete,
|
||||
getter_AddRefs(request));
|
||||
if (NS_FAILED(rv)) {
|
||||
aRv.Throw(rv);
|
||||
|
|
|
@ -99,18 +99,15 @@ public:
|
|||
int64_t aVersion,
|
||||
const nsACString& aASCIIOrigin,
|
||||
bool aDeleting,
|
||||
JSContext* aCallingCx,
|
||||
IDBOpenDBRequest** _retval);
|
||||
|
||||
nsresult
|
||||
OpenInternal(const nsAString& aName,
|
||||
int64_t aVersion,
|
||||
bool aDeleting,
|
||||
JSContext* aCallingCx,
|
||||
IDBOpenDBRequest** _retval)
|
||||
{
|
||||
return OpenInternal(aName, aVersion, mASCIIOrigin, aDeleting, aCallingCx,
|
||||
_retval);
|
||||
return OpenInternal(aName, aVersion, mASCIIOrigin, aDeleting, _retval);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -144,17 +141,16 @@ public:
|
|||
|
||||
// WebIDL
|
||||
already_AddRefed<nsIIDBOpenDBRequest>
|
||||
Open(JSContext* aCx, const NonNull<nsAString>& aName,
|
||||
const Optional<uint64_t>& aVersion, ErrorResult& aRv)
|
||||
Open(const NonNull<nsAString>& aName, const Optional<uint64_t>& aVersion,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
return Open(aCx, nullptr, aName, aVersion, false, aRv);
|
||||
return Open(nullptr, aName, aVersion, false, aRv);
|
||||
}
|
||||
|
||||
already_AddRefed<nsIIDBOpenDBRequest>
|
||||
DeleteDatabase(JSContext* aCx, const NonNull<nsAString>& aName,
|
||||
ErrorResult& aRv)
|
||||
DeleteDatabase(const NonNull<nsAString>& aName, ErrorResult& aRv)
|
||||
{
|
||||
return Open(aCx, nullptr, aName, Optional<uint64_t>(), true, aRv);
|
||||
return Open(nullptr, aName, Optional<uint64_t>(), true, aRv);
|
||||
}
|
||||
|
||||
int16_t
|
||||
|
@ -162,20 +158,19 @@ public:
|
|||
JS::Handle<JS::Value> aSecond, ErrorResult& aRv);
|
||||
|
||||
already_AddRefed<nsIIDBOpenDBRequest>
|
||||
OpenForPrincipal(JSContext* aCx, nsIPrincipal* aPrincipal,
|
||||
const NonNull<nsAString>& aName,
|
||||
OpenForPrincipal(nsIPrincipal* aPrincipal, const NonNull<nsAString>& aName,
|
||||
const Optional<uint64_t>& aVersion, ErrorResult& aRv);
|
||||
|
||||
already_AddRefed<nsIIDBOpenDBRequest>
|
||||
DeleteForPrincipal(JSContext* aCx, nsIPrincipal* aPrincipal,
|
||||
const NonNull<nsAString>& aName, ErrorResult& aRv);
|
||||
DeleteForPrincipal(nsIPrincipal* aPrincipal, const NonNull<nsAString>& aName,
|
||||
ErrorResult& aRv);
|
||||
|
||||
private:
|
||||
IDBFactory();
|
||||
~IDBFactory();
|
||||
|
||||
already_AddRefed<nsIIDBOpenDBRequest>
|
||||
Open(JSContext* aCx, nsIPrincipal* aPrincipal, const nsAString& aName,
|
||||
Open(nsIPrincipal* aPrincipal, const nsAString& aName,
|
||||
const Optional<uint64_t>& aVersion, bool aDelete, ErrorResult& aRv);
|
||||
|
||||
nsCString mASCIIOrigin;
|
||||
|
|
|
@ -341,12 +341,12 @@ private:
|
|||
|
||||
inline
|
||||
already_AddRefed<IDBRequest>
|
||||
GenerateRequest(IDBIndex* aIndex, JSContext* aCx)
|
||||
GenerateRequest(IDBIndex* aIndex)
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
|
||||
IDBTransaction* transaction = aIndex->ObjectStore()->Transaction();
|
||||
IDBDatabase* database = transaction->Database();
|
||||
return IDBRequest::Create(aIndex, database, transaction, aCx);
|
||||
return IDBRequest::Create(aIndex, database, transaction);
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
||||
|
@ -437,7 +437,7 @@ IDBIndex::GetInternal(IDBKeyRange* aKeyRange,
|
|||
return NS_ERROR_DOM_INDEXEDDB_TRANSACTION_INACTIVE_ERR;
|
||||
}
|
||||
|
||||
nsRefPtr<IDBRequest> request = GenerateRequest(this, aCx);
|
||||
nsRefPtr<IDBRequest> request = GenerateRequest(this);
|
||||
NS_ENSURE_TRUE(request, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
nsRefPtr<GetHelper> helper =
|
||||
|
@ -473,7 +473,7 @@ IDBIndex::GetKeyInternal(IDBKeyRange* aKeyRange,
|
|||
return NS_ERROR_DOM_INDEXEDDB_TRANSACTION_INACTIVE_ERR;
|
||||
}
|
||||
|
||||
nsRefPtr<IDBRequest> request = GenerateRequest(this, aCx);
|
||||
nsRefPtr<IDBRequest> request = GenerateRequest(this);
|
||||
NS_ENSURE_TRUE(request, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
nsRefPtr<GetKeyHelper> helper =
|
||||
|
@ -510,7 +510,7 @@ IDBIndex::GetAllInternal(IDBKeyRange* aKeyRange,
|
|||
return NS_ERROR_DOM_INDEXEDDB_TRANSACTION_INACTIVE_ERR;
|
||||
}
|
||||
|
||||
nsRefPtr<IDBRequest> request = GenerateRequest(this, aCx);
|
||||
nsRefPtr<IDBRequest> request = GenerateRequest(this);
|
||||
NS_ENSURE_TRUE(request, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
nsRefPtr<GetAllHelper> helper =
|
||||
|
@ -548,7 +548,7 @@ IDBIndex::GetAllKeysInternal(IDBKeyRange* aKeyRange,
|
|||
return NS_ERROR_DOM_INDEXEDDB_TRANSACTION_INACTIVE_ERR;
|
||||
}
|
||||
|
||||
nsRefPtr<IDBRequest> request = GenerateRequest(this, aCx);
|
||||
nsRefPtr<IDBRequest> request = GenerateRequest(this);
|
||||
NS_ENSURE_TRUE(request, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
nsRefPtr<GetAllKeysHelper> helper =
|
||||
|
@ -585,7 +585,7 @@ IDBIndex::CountInternal(IDBKeyRange* aKeyRange,
|
|||
return NS_ERROR_DOM_INDEXEDDB_TRANSACTION_INACTIVE_ERR;
|
||||
}
|
||||
|
||||
nsRefPtr<IDBRequest> request = GenerateRequest(this, aCx);
|
||||
nsRefPtr<IDBRequest> request = GenerateRequest(this);
|
||||
NS_ENSURE_TRUE(request, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
nsRefPtr<CountHelper> helper =
|
||||
|
@ -625,7 +625,7 @@ IDBIndex::OpenKeyCursorInternal(IDBKeyRange* aKeyRange,
|
|||
IDBCursor::Direction direction =
|
||||
static_cast<IDBCursor::Direction>(aDirection);
|
||||
|
||||
nsRefPtr<IDBRequest> request = GenerateRequest(this, aCx);
|
||||
nsRefPtr<IDBRequest> request = GenerateRequest(this);
|
||||
NS_ENSURE_TRUE(request, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
nsRefPtr<OpenKeyCursorHelper> helper =
|
||||
|
@ -653,7 +653,6 @@ IDBIndex::OpenKeyCursorInternal(IDBKeyRange* aKeyRange,
|
|||
nsresult
|
||||
IDBIndex::OpenCursorInternal(IDBKeyRange* aKeyRange,
|
||||
size_t aDirection,
|
||||
JSContext* aCx,
|
||||
IDBRequest** _retval)
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
|
||||
|
@ -666,7 +665,7 @@ IDBIndex::OpenCursorInternal(IDBKeyRange* aKeyRange,
|
|||
IDBCursor::Direction direction =
|
||||
static_cast<IDBCursor::Direction>(aDirection);
|
||||
|
||||
nsRefPtr<IDBRequest> request = GenerateRequest(this, aCx);
|
||||
nsRefPtr<IDBRequest> request = GenerateRequest(this);
|
||||
NS_ENSURE_TRUE(request, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
nsRefPtr<OpenCursorHelper> helper =
|
||||
|
@ -1005,7 +1004,7 @@ IDBIndex::OpenCursor(const jsval& aKey,
|
|||
}
|
||||
}
|
||||
|
||||
nsRefPtr<IDBRequest> request = GenerateRequest(this, aCx);
|
||||
nsRefPtr<IDBRequest> request = GenerateRequest(this);
|
||||
NS_ENSURE_TRUE(request, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
nsRefPtr<OpenCursorHelper> helper =
|
||||
|
|
|
@ -136,7 +136,6 @@ public:
|
|||
|
||||
nsresult OpenCursorInternal(IDBKeyRange* aKeyRange,
|
||||
size_t aDirection,
|
||||
JSContext* aCx,
|
||||
IDBRequest** _retval);
|
||||
|
||||
nsresult OpenCursorFromChildProcess(
|
||||
|
|
|
@ -583,12 +583,12 @@ JSClass ThreadLocalJSRuntime::sGlobalClass = {
|
|||
|
||||
inline
|
||||
already_AddRefed<IDBRequest>
|
||||
GenerateRequest(IDBObjectStore* aObjectStore, JSContext* aCx)
|
||||
GenerateRequest(IDBObjectStore* aObjectStore)
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
|
||||
IDBDatabase* database = aObjectStore->Transaction()->Database();
|
||||
return IDBRequest::Create(aObjectStore, database,
|
||||
aObjectStore->Transaction(), aCx);
|
||||
aObjectStore->Transaction());
|
||||
}
|
||||
|
||||
struct MOZ_STACK_CLASS GetAddInfoClosure
|
||||
|
@ -1840,7 +1840,7 @@ IDBObjectStore::AddOrPut(const jsval& aValue,
|
|||
return rv;
|
||||
}
|
||||
|
||||
nsRefPtr<IDBRequest> request = GenerateRequest(this, aCx);
|
||||
nsRefPtr<IDBRequest> request = GenerateRequest(this);
|
||||
NS_ENSURE_TRUE(request, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
nsRefPtr<AddHelper> helper =
|
||||
|
@ -1897,7 +1897,7 @@ IDBObjectStore::AddOrPutInternal(
|
|||
return NS_ERROR_DOM_INDEXEDDB_READ_ONLY_ERR;
|
||||
}
|
||||
|
||||
nsRefPtr<IDBRequest> request = GenerateRequest(this, nullptr);
|
||||
nsRefPtr<IDBRequest> request = GenerateRequest(this);
|
||||
NS_ENSURE_TRUE(request, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
StructuredCloneWriteInfo cloneWriteInfo;
|
||||
|
@ -1998,7 +1998,7 @@ IDBObjectStore::GetInternal(IDBKeyRange* aKeyRange,
|
|||
return NS_ERROR_DOM_INDEXEDDB_TRANSACTION_INACTIVE_ERR;
|
||||
}
|
||||
|
||||
nsRefPtr<IDBRequest> request = GenerateRequest(this, aCx);
|
||||
nsRefPtr<IDBRequest> request = GenerateRequest(this);
|
||||
NS_ENSURE_TRUE(request, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
nsRefPtr<GetHelper> helper =
|
||||
|
@ -2031,7 +2031,7 @@ IDBObjectStore::GetAllInternal(IDBKeyRange* aKeyRange,
|
|||
return NS_ERROR_DOM_INDEXEDDB_TRANSACTION_INACTIVE_ERR;
|
||||
}
|
||||
|
||||
nsRefPtr<IDBRequest> request = GenerateRequest(this, aCx);
|
||||
nsRefPtr<IDBRequest> request = GenerateRequest(this);
|
||||
NS_ENSURE_TRUE(request, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
nsRefPtr<GetAllHelper> helper =
|
||||
|
@ -2070,7 +2070,7 @@ IDBObjectStore::DeleteInternal(IDBKeyRange* aKeyRange,
|
|||
return NS_ERROR_DOM_INDEXEDDB_READ_ONLY_ERR;
|
||||
}
|
||||
|
||||
nsRefPtr<IDBRequest> request = GenerateRequest(this, aCx);
|
||||
nsRefPtr<IDBRequest> request = GenerateRequest(this);
|
||||
NS_ENSURE_TRUE(request, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
nsRefPtr<DeleteHelper> helper =
|
||||
|
@ -2105,7 +2105,7 @@ IDBObjectStore::ClearInternal(JSContext* aCx,
|
|||
return NS_ERROR_DOM_INDEXEDDB_READ_ONLY_ERR;
|
||||
}
|
||||
|
||||
nsRefPtr<IDBRequest> request = GenerateRequest(this, aCx);
|
||||
nsRefPtr<IDBRequest> request = GenerateRequest(this);
|
||||
NS_ENSURE_TRUE(request, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
nsRefPtr<ClearHelper> helper(new ClearHelper(mTransaction, request, this));
|
||||
|
@ -2136,7 +2136,7 @@ IDBObjectStore::CountInternal(IDBKeyRange* aKeyRange,
|
|||
return NS_ERROR_DOM_INDEXEDDB_TRANSACTION_INACTIVE_ERR;
|
||||
}
|
||||
|
||||
nsRefPtr<IDBRequest> request = GenerateRequest(this, aCx);
|
||||
nsRefPtr<IDBRequest> request = GenerateRequest(this);
|
||||
NS_ENSURE_TRUE(request, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
nsRefPtr<CountHelper> helper =
|
||||
|
@ -2171,7 +2171,7 @@ IDBObjectStore::OpenCursorInternal(IDBKeyRange* aKeyRange,
|
|||
IDBCursor::Direction direction =
|
||||
static_cast<IDBCursor::Direction>(aDirection);
|
||||
|
||||
nsRefPtr<IDBRequest> request = GenerateRequest(this, aCx);
|
||||
nsRefPtr<IDBRequest> request = GenerateRequest(this);
|
||||
NS_ENSURE_TRUE(request, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
nsRefPtr<OpenCursorHelper> helper =
|
||||
|
|
|
@ -58,8 +58,7 @@ IDBRequest::~IDBRequest()
|
|||
already_AddRefed<IDBRequest>
|
||||
IDBRequest::Create(nsISupports* aSource,
|
||||
IDBWrapperCache* aOwnerCache,
|
||||
IDBTransaction* aTransaction,
|
||||
JSContext* aCallingCx)
|
||||
IDBTransaction* aTransaction)
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
|
||||
nsRefPtr<IDBRequest> request(new IDBRequest());
|
||||
|
@ -68,7 +67,7 @@ IDBRequest::Create(nsISupports* aSource,
|
|||
request->mTransaction = aTransaction;
|
||||
request->BindToOwner(aOwnerCache);
|
||||
request->SetScriptOwner(aOwnerCache->GetScriptOwner());
|
||||
request->CaptureCaller(aCallingCx);
|
||||
request->CaptureCaller();
|
||||
|
||||
return request.forget();
|
||||
}
|
||||
|
@ -204,17 +203,17 @@ IDBRequest::GetJSContext()
|
|||
}
|
||||
|
||||
void
|
||||
IDBRequest::CaptureCaller(JSContext* aCx)
|
||||
IDBRequest::CaptureCaller()
|
||||
{
|
||||
if (!aCx) {
|
||||
// We may not have a JSContext. This happens if our caller is in another
|
||||
// process.
|
||||
return;
|
||||
}
|
||||
AutoJSContext cx;
|
||||
|
||||
const char* filename = nullptr;
|
||||
uint32_t lineNo = 0;
|
||||
if (!nsJSUtils::GetCallingLocation(aCx, &filename, &lineNo)) {
|
||||
if (!nsJSUtils::GetCallingLocation(cx, &filename, &lineNo)) {
|
||||
// If our caller is in another process, we won't have a JSContext on the
|
||||
// stack, and AutoJSContext will push the SafeJSContext. But that won't have
|
||||
// any script on it (certainly not after the push), so GetCallingLocation
|
||||
// will fail when it calls JS_DescribeScriptedCaller. That's fine.
|
||||
NS_WARNING("Failed to get caller.");
|
||||
return;
|
||||
}
|
||||
|
@ -354,8 +353,7 @@ IDBOpenDBRequest::~IDBOpenDBRequest()
|
|||
already_AddRefed<IDBOpenDBRequest>
|
||||
IDBOpenDBRequest::Create(IDBFactory* aFactory,
|
||||
nsPIDOMWindow* aOwner,
|
||||
JS::Handle<JSObject*> aScriptOwner,
|
||||
JSContext* aCallingCx)
|
||||
JS::Handle<JSObject*> aScriptOwner)
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
|
||||
NS_ASSERTION(aFactory, "Null pointer!");
|
||||
|
@ -364,7 +362,7 @@ IDBOpenDBRequest::Create(IDBFactory* aFactory,
|
|||
|
||||
request->BindToOwner(aOwner);
|
||||
request->SetScriptOwner(aScriptOwner);
|
||||
request->CaptureCaller(aCallingCx);
|
||||
request->CaptureCaller();
|
||||
request->mFactory = aFactory;
|
||||
|
||||
return request.forget();
|
||||
|
|
|
@ -38,8 +38,7 @@ public:
|
|||
static
|
||||
already_AddRefed<IDBRequest> Create(nsISupports* aSource,
|
||||
IDBWrapperCache* aOwnerCache,
|
||||
IDBTransaction* aTransaction,
|
||||
JSContext* aCallingCx);
|
||||
IDBTransaction* aTransaction);
|
||||
|
||||
// nsIDOMEventTarget
|
||||
virtual nsresult PreHandleEvent(nsEventChainPreVisitor& aVisitor) MOZ_OVERRIDE;
|
||||
|
@ -84,7 +83,7 @@ public:
|
|||
return mActorParent;
|
||||
}
|
||||
|
||||
void CaptureCaller(JSContext* aCx);
|
||||
void CaptureCaller();
|
||||
|
||||
void FillScriptErrorEvent(nsScriptErrorEvent* aEvent) const;
|
||||
|
||||
|
@ -134,8 +133,7 @@ public:
|
|||
already_AddRefed<IDBOpenDBRequest>
|
||||
Create(IDBFactory* aFactory,
|
||||
nsPIDOMWindow* aOwner,
|
||||
JS::Handle<JSObject*> aScriptOwner,
|
||||
JSContext* aCallingCx);
|
||||
JS::Handle<JSObject*> aScriptOwner);
|
||||
|
||||
void SetTransaction(IDBTransaction* aTransaction);
|
||||
|
||||
|
|
|
@ -162,8 +162,7 @@ IndexedDBParent::RecvPIndexedDBDatabaseConstructor(
|
|||
|
||||
nsRefPtr<IDBOpenDBRequest> request;
|
||||
nsresult rv =
|
||||
mFactory->OpenInternal(aName, aVersion, false, nullptr,
|
||||
getter_AddRefs(request));
|
||||
mFactory->OpenInternal(aName, aVersion, false, getter_AddRefs(request));
|
||||
NS_ENSURE_SUCCESS(rv, false);
|
||||
|
||||
IndexedDBDatabaseParent* actor =
|
||||
|
@ -199,7 +198,7 @@ IndexedDBParent::RecvPIndexedDBDeleteDatabaseRequestConstructor(
|
|||
nsRefPtr<IDBOpenDBRequest> request;
|
||||
|
||||
nsresult rv =
|
||||
mFactory->OpenInternal(aName, 0, true, nullptr, getter_AddRefs(request));
|
||||
mFactory->OpenInternal(aName, 0, true, getter_AddRefs(request));
|
||||
NS_ENSURE_SUCCESS(rv, false);
|
||||
|
||||
rv = actor->SetOpenRequest(request);
|
||||
|
@ -2006,8 +2005,7 @@ IndexedDBIndexRequestParent::OpenCursor(const OpenCursorParams& aParams)
|
|||
AutoSetCurrentTransaction asct(mIndex->ObjectStore()->Transaction());
|
||||
|
||||
nsresult rv =
|
||||
mIndex->OpenCursorInternal(keyRange, direction, nullptr,
|
||||
getter_AddRefs(request));
|
||||
mIndex->OpenCursorInternal(keyRange, direction, getter_AddRefs(request));
|
||||
NS_ENSURE_SUCCESS(rv, false);
|
||||
}
|
||||
|
||||
|
|
|
@ -9,10 +9,14 @@ interface nsIVariant;
|
|||
/*
|
||||
* This interface is intended only for use in tests.
|
||||
*/
|
||||
[scriptable, uuid(7edf77a2-6b3e-4bbb-9100-4452d425feaa)]
|
||||
[scriptable, uuid(b6ed093c-6ea0-4141-a8eb-f99645162651)]
|
||||
interface nsIGamepadServiceTest : nsISupports
|
||||
{
|
||||
unsigned long addGamepad(in string id, in unsigned long numButtons,
|
||||
const unsigned long NO_MAPPING = 0;
|
||||
const unsigned long STANDARD_MAPPING = 1;
|
||||
|
||||
unsigned long addGamepad(in string id, in unsigned long mapping,
|
||||
in unsigned long numButtons,
|
||||
in unsigned long numAxes);
|
||||
void removeGamepad(in unsigned long index);
|
||||
void newButtonEvent(in unsigned long index, in unsigned long button,
|
||||
|
|
|
@ -601,11 +601,11 @@ doInvoke(NPObject *npobj, NPIdentifier method, const NPVariant *args,
|
|||
VOID_TO_NPVARIANT(*result);
|
||||
|
||||
nsJSObjWrapper *npjsobj = (nsJSObjWrapper *)npobj;
|
||||
JS::Rooted<JS::Value> fv(cx);
|
||||
|
||||
nsCxPusher pusher;
|
||||
pusher.Push(cx);
|
||||
JSAutoCompartment ac(cx, npjsobj->mJSObj);
|
||||
JS::Rooted<JS::Value> fv(cx);
|
||||
|
||||
AutoJSExceptionReporter reporter(cx);
|
||||
|
||||
|
|
|
@ -14,12 +14,14 @@ SimpleTest.waitForExplicitFinish();
|
|||
window.addEventListener("gamepadconnected", connecthandler);
|
||||
// Add a gamepad
|
||||
var index = GamepadService.addGamepad("test gamepad", // id
|
||||
SpecialPowers.Ci.nsIGamepadServiceTest.STANDARD_MAPPING,
|
||||
4, // buttons
|
||||
2);// axes
|
||||
// Press a button
|
||||
GamepadService.newButtonEvent(index, 0, true);
|
||||
function connecthandler(e) {
|
||||
is(e.gamepad.id, "test gamepad", "correct gamepad name");
|
||||
is(e.gamepad.id, "test gamepad", "correct gamepad name");
|
||||
is(e.gamepad.mapping, "standard", "standard mapping");
|
||||
is(e.gamepad.buttons.length, 4, "correct number of buttons");
|
||||
is(e.gamepad.axes.length, 2, "correct number of axes");
|
||||
SimpleTest.executeSoon(function() {
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
<script class="testbody" type="text/javascript">
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
var index = GamepadService.addGamepad("test gamepad", // id
|
||||
SpecialPowers.Ci.nsIGamepadServiceTest.NO_MAPPING,
|
||||
4, // buttons
|
||||
2);// axes
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
<script class="testbody" type="text/javascript">
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
var index = GamepadService.addGamepad("test gamepad", // id
|
||||
SpecialPowers.Ci.nsIGamepadServiceTest.NO_MAPPING,
|
||||
4, // buttons
|
||||
2);// axes
|
||||
|
||||
|
|
|
@ -38,6 +38,7 @@ window.addEventListener("gamepadconnected", connecthandler);
|
|||
window.addEventListener("gamepaddisconnected", disconnecthandler);
|
||||
// Add a gamepad
|
||||
var index1 = GamepadService.addGamepad("test gamepad 1", // id
|
||||
SpecialPowers.Ci.nsIGamepadServiceTest.NO_MAPPING,
|
||||
4, // buttons
|
||||
2);// axes
|
||||
var index2;
|
||||
|
@ -53,6 +54,7 @@ function check_first_gamepad(e) {
|
|||
is(gamepads[e.gamepad.index], e.gamepad, "right gamepad exposed at index");
|
||||
// Add a second gamepad, should automatically show up.
|
||||
index2 = GamepadService.addGamepad("test gamepad 2", // id
|
||||
SpecialPowers.Ci.nsIGamepadServiceTest.NO_MAPPING,
|
||||
4, // buttons
|
||||
2);// axes
|
||||
}
|
||||
|
|
|
@ -18,6 +18,12 @@ interface Gamepad {
|
|||
*/
|
||||
readonly attribute unsigned long index;
|
||||
|
||||
/**
|
||||
* The mapping in use for this device. The empty string
|
||||
* indicates that no mapping is in use.
|
||||
*/
|
||||
readonly attribute DOMString mapping;
|
||||
|
||||
/**
|
||||
* true if this gamepad is currently connected to the system.
|
||||
*/
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
[Pref="dom.gamepad.enabled",
|
||||
[Pref="dom.gamepad.non_standard_events.enabled",
|
||||
Constructor(DOMString type, optional GamepadAxisMoveEventInit eventInitDict),
|
||||
HeaderFile="GeneratedEventClasses.h"]
|
||||
interface GamepadAxisMoveEvent : GamepadEvent
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
[Pref="dom.gamepad.enabled",
|
||||
[Pref="dom.gamepad.non_standard_events.enabled",
|
||||
Constructor(DOMString type, optional GamepadButtonEventInit eventInitDict),
|
||||
HeaderFile="GeneratedEventClasses.h"]
|
||||
interface GamepadButtonEvent : GamepadEvent
|
||||
|
|
|
@ -313,8 +313,6 @@ NS_IMETHODIMP nsWebBrowser::UnBindListener(nsISupports *aListener, const nsIID&
|
|||
|
||||
NS_IMETHODIMP nsWebBrowser::EnableGlobalHistory(bool aEnable)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
NS_ENSURE_STATE(mDocShell);
|
||||
|
||||
return mDocShell->SetUseGlobalHistory(aEnable);
|
||||
|
|
|
@ -224,6 +224,9 @@ ClientLayerManager::EndEmptyTransaction(EndTransactionFlags aFlags)
|
|||
// EndTransaction will complete it.
|
||||
return false;
|
||||
}
|
||||
if (mWidget) {
|
||||
mWidget->PrepareWindowEffects();
|
||||
}
|
||||
ForwardTransaction();
|
||||
MakeSnapshotIfRequired();
|
||||
return true;
|
||||
|
|
|
@ -170,6 +170,7 @@ ShadowLayerForwarder::ShadowLayerForwarder()
|
|||
: mShadowManager(NULL)
|
||||
, mIsFirstPaint(false)
|
||||
, mDrawColoredBorders(false)
|
||||
, mWindowOverlayChanged(false)
|
||||
{
|
||||
mTxn = new Transaction();
|
||||
}
|
||||
|
@ -391,7 +392,7 @@ ShadowLayerForwarder::EndTransaction(InfallibleTArray<EditReply>* aReplies)
|
|||
|
||||
AutoTxnEnd _(mTxn);
|
||||
|
||||
if (mTxn->Empty() && !mTxn->RotationChanged()) {
|
||||
if (mTxn->Empty() && !mTxn->RotationChanged() && !mWindowOverlayChanged) {
|
||||
MOZ_LAYERS_LOG(("[LayersForwarder] 0-length cset (?) and no rotation event, skipping Update()"));
|
||||
return true;
|
||||
}
|
||||
|
@ -446,7 +447,7 @@ ShadowLayerForwarder::EndTransaction(InfallibleTArray<EditReply>* aReplies)
|
|||
|
||||
AutoInfallibleTArray<Edit, 10> cset;
|
||||
size_t nCsets = mTxn->mCset.size() + mTxn->mPaints.size();
|
||||
NS_ABORT_IF_FALSE(nCsets > 0, "should have bailed by now");
|
||||
NS_ABORT_IF_FALSE(nCsets > 0 || mWindowOverlayChanged, "should have bailed by now");
|
||||
|
||||
cset.SetCapacity(nCsets);
|
||||
if (!mTxn->mCset.empty()) {
|
||||
|
@ -458,6 +459,8 @@ ShadowLayerForwarder::EndTransaction(InfallibleTArray<EditReply>* aReplies)
|
|||
cset.AppendElements(&mTxn->mPaints.front(), mTxn->mPaints.size());
|
||||
}
|
||||
|
||||
mWindowOverlayChanged = false;
|
||||
|
||||
TargetConfig targetConfig(mTxn->mTargetBounds, mTxn->mTargetRotation, mTxn->mClientBounds, mTxn->mTargetOrientation);
|
||||
|
||||
MOZ_LAYERS_LOG(("[LayersForwarder] syncing before send..."));
|
||||
|
|
|
@ -324,6 +324,8 @@ public:
|
|||
bool HasShadowManager() const { return !!mShadowManager; }
|
||||
PLayerTransactionChild* GetShadowManager() const { return mShadowManager; }
|
||||
|
||||
virtual void WindowOverlayChanged() { mWindowOverlayChanged = true; }
|
||||
|
||||
/**
|
||||
* The following Alloc/Open/Destroy interfaces abstract over the
|
||||
* details of working with surfaces that are shared across
|
||||
|
@ -444,6 +446,7 @@ private:
|
|||
|
||||
bool mIsFirstPaint;
|
||||
bool mDrawColoredBorders;
|
||||
bool mWindowOverlayChanged;
|
||||
};
|
||||
|
||||
class CompositableClient;
|
||||
|
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче