зеркало из https://github.com/mozilla/gecko-dev.git
Merge m-c to fx-team.
This commit is contained in:
Коммит
d6b66b2d53
|
@ -197,6 +197,8 @@ let FormAssistant = {
|
|||
addMessageListener("Forms:GetText", this);
|
||||
addMessageListener("Forms:Input:SendKey", this);
|
||||
addMessageListener("Forms:GetContext", this);
|
||||
addMessageListener("Forms:SetComposition", this);
|
||||
addMessageListener("Forms:EndComposition", this);
|
||||
},
|
||||
|
||||
ignoredInputTypes: new Set([
|
||||
|
@ -239,6 +241,7 @@ let FormAssistant = {
|
|||
if (this.focusedElement) {
|
||||
this.focusedElement.removeEventListener('mousedown', this);
|
||||
this.focusedElement.removeEventListener('mouseup', this);
|
||||
this.focusedElement.removeEventListener('compositionend', this);
|
||||
if (this._observer) {
|
||||
this._observer.disconnect();
|
||||
this._observer = null;
|
||||
|
@ -263,6 +266,7 @@ let FormAssistant = {
|
|||
if (element) {
|
||||
element.addEventListener('mousedown', this);
|
||||
element.addEventListener('mouseup', this);
|
||||
element.addEventListener('compositionend', this);
|
||||
if (isContentEditable(element)) {
|
||||
this._documentEncoder = getDocumentEncoder(element);
|
||||
}
|
||||
|
@ -423,6 +427,8 @@ let FormAssistant = {
|
|||
break;
|
||||
}
|
||||
|
||||
CompositionManager.endComposition('');
|
||||
|
||||
// Don't monitor the text change resulting from key event.
|
||||
this._ignoreEditActionOnce = true;
|
||||
|
||||
|
@ -438,8 +444,18 @@ let FormAssistant = {
|
|||
break;
|
||||
}
|
||||
|
||||
CompositionManager.endComposition('');
|
||||
|
||||
this._ignoreEditActionOnce = false;
|
||||
break;
|
||||
|
||||
case "compositionend":
|
||||
if (!this.focusedElement) {
|
||||
break;
|
||||
}
|
||||
|
||||
CompositionManager.onCompositionEnd();
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -475,6 +491,8 @@ let FormAssistant = {
|
|||
this._editing = true;
|
||||
switch (msg.name) {
|
||||
case "Forms:Input:Value": {
|
||||
CompositionManager.endComposition('');
|
||||
|
||||
target.value = json.value;
|
||||
|
||||
let event = target.ownerDocument.createEvent('HTMLEvents');
|
||||
|
@ -484,6 +502,8 @@ let FormAssistant = {
|
|||
}
|
||||
|
||||
case "Forms:Input:SendKey":
|
||||
CompositionManager.endComposition('');
|
||||
|
||||
["keydown", "keypress", "keyup"].forEach(function(type) {
|
||||
domWindowUtils.sendKeyEvent(type, json.keyCode, json.charCode,
|
||||
json.modifiers);
|
||||
|
@ -528,6 +548,8 @@ let FormAssistant = {
|
|||
}
|
||||
|
||||
case "Forms:SetSelectionRange": {
|
||||
CompositionManager.endComposition('');
|
||||
|
||||
let start = json.selectionStart;
|
||||
let end = json.selectionEnd;
|
||||
setSelectionRange(target, start, end);
|
||||
|
@ -543,6 +565,8 @@ let FormAssistant = {
|
|||
}
|
||||
|
||||
case "Forms:ReplaceSurroundingText": {
|
||||
CompositionManager.endComposition('');
|
||||
|
||||
let text = json.text;
|
||||
let beforeLength = json.beforeLength;
|
||||
let afterLength = json.afterLength;
|
||||
|
@ -583,6 +607,23 @@ let FormAssistant = {
|
|||
sendAsyncMessage("Forms:GetContext:Result:OK", obj);
|
||||
break;
|
||||
}
|
||||
|
||||
case "Forms:SetComposition": {
|
||||
CompositionManager.setComposition(target, json.text, json.cursor,
|
||||
json.clauses);
|
||||
sendAsyncMessage("Forms:SetComposition:Result:OK", {
|
||||
requestId: json.requestId,
|
||||
});
|
||||
break;
|
||||
}
|
||||
|
||||
case "Forms:EndComposition": {
|
||||
CompositionManager.endComposition(json.text);
|
||||
sendAsyncMessage("Forms:EndComposition:Result:OK", {
|
||||
requestId: json.requestId,
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
this._editing = false;
|
||||
|
||||
|
@ -1015,3 +1056,97 @@ function replaceSurroundingText(element, text, selectionStart, beforeLength,
|
|||
editor.insertText(text);
|
||||
}
|
||||
}
|
||||
|
||||
let CompositionManager = {
|
||||
_isStarted: false,
|
||||
_text: '',
|
||||
_clauseAttrMap: {
|
||||
'raw-input': domWindowUtils.COMPOSITION_ATTR_RAWINPUT,
|
||||
'selected-raw-text': domWindowUtils.COMPOSITION_ATTR_SELECTEDRAWTEXT,
|
||||
'converted-text': domWindowUtils.COMPOSITION_ATTR_CONVERTEDTEXT,
|
||||
'selected-converted-text': domWindowUtils.COMPOSITION_ATTR_SELECTEDCONVERTEDTEXT
|
||||
},
|
||||
|
||||
setComposition: function cm_setComposition(element, text, cursor, clauses) {
|
||||
// Check parameters.
|
||||
if (!element) {
|
||||
return;
|
||||
}
|
||||
let len = text.length;
|
||||
if (cursor < 0) {
|
||||
cursor = 0;
|
||||
} else if (cursor > len) {
|
||||
cursor = len;
|
||||
}
|
||||
let clauseLens = [len, 0, 0];
|
||||
let clauseAttrs = [domWindowUtils.COMPOSITION_ATTR_RAWINPUT,
|
||||
domWindowUtils.COMPOSITION_ATTR_RAWINPUT,
|
||||
domWindowUtils.COMPOSITION_ATTR_RAWINPUT];
|
||||
if (clauses) {
|
||||
let remainingLength = len;
|
||||
// Currently we don't support 4 or more clauses composition string.
|
||||
let clauseNum = Math.min(3, clauses.length);
|
||||
for (let i = 0; i < clauseNum; i++) {
|
||||
if (clauses[i]) {
|
||||
let clauseLength = clauses[i].length || 0;
|
||||
// Make sure the total clauses length is not bigger than that of the
|
||||
// composition string.
|
||||
if (clauseLength > remainingLength) {
|
||||
clauseLength = remainingLength;
|
||||
}
|
||||
remainingLength -= clauseLength;
|
||||
clauseLens[i] = clauseLength;
|
||||
clauseAttrs[i] = this._clauseAttrMap[clauses[i].selectionType] ||
|
||||
domWindowUtils.COMPOSITION_ATTR_RAWINPUT;
|
||||
}
|
||||
}
|
||||
// If the total clauses length is less than that of the composition
|
||||
// string, extend the last clause to the end of the composition string.
|
||||
if (remainingLength > 0) {
|
||||
clauseLens[2] += remainingLength;
|
||||
}
|
||||
}
|
||||
|
||||
// Start composition if need to.
|
||||
if (!this._isStarted) {
|
||||
this._isStarted = true;
|
||||
domWindowUtils.sendCompositionEvent('compositionstart', '', '');
|
||||
this._text = '';
|
||||
}
|
||||
|
||||
// Update the composing text.
|
||||
if (this._text !== text) {
|
||||
this._text = text;
|
||||
domWindowUtils.sendCompositionEvent('compositionupdate', text, '');
|
||||
}
|
||||
domWindowUtils.sendTextEvent(text,
|
||||
clauseLens[0], clauseAttrs[0],
|
||||
clauseLens[1], clauseAttrs[1],
|
||||
clauseLens[2], clauseAttrs[2],
|
||||
cursor, 0);
|
||||
},
|
||||
|
||||
endComposition: function cm_endComposition(text) {
|
||||
if (!this._isStarted) {
|
||||
return;
|
||||
}
|
||||
// Update the composing text.
|
||||
if (this._text !== text) {
|
||||
domWindowUtils.sendCompositionEvent('compositionupdate', text, '');
|
||||
}
|
||||
domWindowUtils.sendTextEvent(text, 0, 0, 0, 0, 0, 0, 0, 0);
|
||||
domWindowUtils.sendCompositionEvent('compositionend', text, '');
|
||||
this._text = '';
|
||||
this._isStarted = false;
|
||||
},
|
||||
|
||||
// Composition ends due to external actions.
|
||||
onCompositionEnd: function cm_onCompositionEnd() {
|
||||
if (!this._isStarted) {
|
||||
return;
|
||||
}
|
||||
|
||||
this._text = '';
|
||||
this._isStarted = false;
|
||||
}
|
||||
};
|
||||
|
|
|
@ -23,7 +23,8 @@ let Keyboard = {
|
|||
'SetValue', 'RemoveFocus', 'SetSelectedOption', 'SetSelectedOptions',
|
||||
'SetSelectionRange', 'ReplaceSurroundingText', 'ShowInputMethodPicker',
|
||||
'SwitchToNextInputMethod', 'HideInputMethod',
|
||||
'GetText', 'SendKey', 'GetContext'
|
||||
'GetText', 'SendKey', 'GetContext',
|
||||
'SetComposition', 'EndComposition'
|
||||
],
|
||||
|
||||
get messageManager() {
|
||||
|
@ -66,6 +67,8 @@ let Keyboard = {
|
|||
mm.addMessageListener('Forms:SendKey:Result:OK', this);
|
||||
mm.addMessageListener('Forms:SequenceError', this);
|
||||
mm.addMessageListener('Forms:GetContext:Result:OK', this);
|
||||
mm.addMessageListener('Forms:SetComposition:Result:OK', this);
|
||||
mm.addMessageListener('Forms:EndComposition:Result:OK', this);
|
||||
|
||||
// When not running apps OOP, we need to load forms.js here since this
|
||||
// won't happen from dom/ipc/preload.js
|
||||
|
@ -116,6 +119,8 @@ let Keyboard = {
|
|||
case 'Forms:SendKey:Result:OK':
|
||||
case 'Forms:SequenceError':
|
||||
case 'Forms:GetContext:Result:OK':
|
||||
case 'Forms:SetComposition:Result:OK':
|
||||
case 'Forms:EndComposition:Result:OK':
|
||||
let name = msg.name.replace(/^Forms/, 'Keyboard');
|
||||
this.forwardEvent(name, msg);
|
||||
break;
|
||||
|
@ -153,6 +158,12 @@ let Keyboard = {
|
|||
case 'Keyboard:GetContext':
|
||||
this.getContext(msg);
|
||||
break;
|
||||
case 'Keyboard:SetComposition':
|
||||
this.setComposition(msg);
|
||||
break;
|
||||
case 'Keyboard:EndComposition':
|
||||
this.endComposition(msg);
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -223,6 +234,14 @@ let Keyboard = {
|
|||
|
||||
getContext: function keyboardGetContext(msg) {
|
||||
this.messageManager.sendAsyncMessage('Forms:GetContext', msg.data);
|
||||
},
|
||||
|
||||
setComposition: function keyboardSetComposition(msg) {
|
||||
this.messageManager.sendAsyncMessage('Forms:SetComposition', msg.data);
|
||||
},
|
||||
|
||||
endComposition: function keyboardEndComposition(msg) {
|
||||
this.messageManager.sendAsyncMessage('Forms:EndComposition', msg.data);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -415,6 +415,8 @@ MozInputContext.prototype = {
|
|||
"Keyboard:SetSelectionRange:Result:OK",
|
||||
"Keyboard:ReplaceSurroundingText:Result:OK",
|
||||
"Keyboard:SendKey:Result:OK",
|
||||
"Keyboard:SetComposition:Result:OK",
|
||||
"Keyboard:EndComposition:Result:OK",
|
||||
"Keyboard:SequenceError"]);
|
||||
},
|
||||
|
||||
|
@ -472,6 +474,10 @@ MozInputContext.prototype = {
|
|||
// not invalidated yet...
|
||||
resolver.reject("InputContext has expired");
|
||||
break;
|
||||
case "Keyboard:SetComposition:Result:OK": // Fall through.
|
||||
case "Keyboard:EndComposition:Result:OK":
|
||||
resolver.resolve();
|
||||
break;
|
||||
default:
|
||||
dump("Could not find a handler for " + msg.name);
|
||||
resolver.reject();
|
||||
|
@ -627,12 +633,30 @@ MozInputContext.prototype = {
|
|||
});
|
||||
},
|
||||
|
||||
setComposition: function ic_setComposition(text, cursor) {
|
||||
throw new this._window.DOMError("NotSupportedError", "Not implemented");
|
||||
setComposition: function ic_setComposition(text, cursor, clauses) {
|
||||
let self = this;
|
||||
return this.createPromise(function(resolver) {
|
||||
let resolverId = self.getPromiseResolverId(resolver);
|
||||
cpmm.sendAsyncMessage('Keyboard:SetComposition', {
|
||||
contextId: self._contextId,
|
||||
requestId: resolverId,
|
||||
text: text,
|
||||
cursor: cursor || text.length,
|
||||
clauses: clauses || null
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
endComposition: function ic_endComposition(text) {
|
||||
throw new this._window.DOMError("NotSupportedError", "Not implemented");
|
||||
let self = this;
|
||||
return this.createPromise(function(resolver) {
|
||||
let resolverId = self.getPromiseResolverId(resolver);
|
||||
cpmm.sendAsyncMessage('Keyboard:EndComposition', {
|
||||
contextId: self._contextId,
|
||||
requestId: resolverId,
|
||||
text: text || ''
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{
|
||||
"revision": "9adc8de2a121d92d43a4669c4326695fe703eb71",
|
||||
"revision": "b3e578bc32cefba0e0ee997a945898a7c7b9024d",
|
||||
"repo_path": "/integration/gaia-central"
|
||||
}
|
||||
|
|
|
@ -192,6 +192,7 @@ MOCHITEST_BROWSER_FILES = \
|
|||
browser_bug882977.js \
|
||||
browser_bug887515.js \
|
||||
browser_canonizeURL.js \
|
||||
browser_mixedcontent_securityflags.js \
|
||||
browser_clearplugindata_noage.html \
|
||||
browser_clearplugindata.html \
|
||||
browser_clearplugindata.js \
|
||||
|
@ -337,6 +338,7 @@ MOCHITEST_BROWSER_FILES = \
|
|||
test_bug628179.html \
|
||||
test_bug839103.html \
|
||||
test_wyciwyg_copying.html \
|
||||
test-mixedcontent-securityerrors.html \
|
||||
title_test.svg \
|
||||
video.ogg \
|
||||
zoom_test.html \
|
||||
|
|
|
@ -0,0 +1,57 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
// The test loads a web page with mixed active and display content
|
||||
// on it while the "block mixed content" settings are _on_.
|
||||
// It then checks that the mixed content flags have been set correctly.
|
||||
// The test then overrides the MCB settings and checks that the flags
|
||||
// have been set correctly again.
|
||||
// Bug 838396 - Not setting hasMixedDisplayContentLoaded and
|
||||
// hasMixedDisplayContentBlocked flag in nsMixedContentBlocker.cpp
|
||||
|
||||
const TEST_URI = "https://example.com/browser/browser/base/content/test/test-mixedcontent-securityerrors.html";
|
||||
let gTestBrowser = null;
|
||||
|
||||
function test()
|
||||
{
|
||||
waitForExplicitFinish();
|
||||
SpecialPowers.pushPrefEnv({"set": [["security.mixed_content.block_active_content", true],
|
||||
["security.mixed_content.block_display_content", true]]}, blockMixedContentTest);
|
||||
}
|
||||
|
||||
function blockMixedContentTest()
|
||||
{
|
||||
gBrowser.selectedTab = gBrowser.addTab(TEST_URI);
|
||||
let tab = gBrowser.selectedTab;
|
||||
gTestBrowser = gBrowser.getBrowserForTab(tab);
|
||||
|
||||
gTestBrowser.addEventListener("load", function onLoad(aEvent) {
|
||||
gTestBrowser.removeEventListener(aEvent.type, onLoad, true);
|
||||
is(gTestBrowser.docShell.hasMixedDisplayContentBlocked, true, "hasMixedDisplayContentBlocked flag has been set");
|
||||
is(gTestBrowser.docShell.hasMixedActiveContentBlocked, true, "hasMixedActiveContentBlocked flag has been set");
|
||||
is(gTestBrowser.docShell.hasMixedDisplayContentLoaded, false, "hasMixedDisplayContentLoaded flag has been set");
|
||||
is(gTestBrowser.docShell.hasMixedActiveContentLoaded, false, "hasMixedActiveContentLoaded flag has been set");
|
||||
overrideMCB();
|
||||
}, true);
|
||||
}
|
||||
|
||||
function overrideMCB()
|
||||
{
|
||||
gTestBrowser.addEventListener("load", mixedContentOverrideTest, true);
|
||||
var notification = PopupNotifications.getNotification("mixed-content-blocked", gTestBrowser);
|
||||
ok(notification, "Mixed Content Doorhanger didn't appear");
|
||||
// Click on the doorhanger to allow mixed content.
|
||||
notification.secondaryActions[0].callback(mixedContentOverrideTest);
|
||||
}
|
||||
|
||||
function mixedContentOverrideTest()
|
||||
{
|
||||
gTestBrowser.removeEventListener("load", mixedContentOverrideTest, true);
|
||||
|
||||
is(gTestBrowser.docShell.hasMixedDisplayContentLoaded, true, "hasMixedDisplayContentLoaded flag has not been set");
|
||||
is(gTestBrowser.docShell.hasMixedActiveContentLoaded, true, "hasMixedActiveContentLoaded flag has not been set");
|
||||
is(gTestBrowser.docShell.hasMixedDisplayContentBlocked, false, "second hasMixedDisplayContentBlocked flag has been set");
|
||||
is(gTestBrowser.docShell.hasMixedActiveContentBlocked, false, "second hasMixedActiveContentBlocked flag has been set");
|
||||
gBrowser.removeCurrentTab();
|
||||
finish();
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
<!--
|
||||
Bug 875456 - Log mixed content messages from the Mixed Content Blocker to the
|
||||
Security Pane in the Web Console
|
||||
-->
|
||||
|
||||
<!DOCTYPE HTML>
|
||||
<html dir="ltr" xml:lang="en-US" lang="en-US">
|
||||
<head>
|
||||
<meta charset="utf8">
|
||||
<title>Mixed Content test - http on https</title>
|
||||
<script src="testscript.js"></script>
|
||||
<!--
|
||||
Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/
|
||||
-->
|
||||
</head>
|
||||
<body>
|
||||
<iframe src="http://example.com"></iframe>
|
||||
<img src="http://example.com/tests/image/test/mochitest/blue.png"></img>
|
||||
</body>
|
||||
</html>
|
|
@ -101,8 +101,6 @@ ifndef LIBXUL_SDK
|
|||
INSTALL_SDK = 1
|
||||
endif
|
||||
|
||||
GENERATE_CACHE = 1
|
||||
|
||||
include $(topsrcdir)/toolkit/mozapps/installer/signing.mk
|
||||
include $(topsrcdir)/toolkit/mozapps/installer/packager.mk
|
||||
|
||||
|
|
|
@ -57,8 +57,8 @@ ifdef MOZ_APP_PROFILE
|
|||
DEFINES += -DMOZ_APP_PROFILE="$(MOZ_APP_PROFILE)"
|
||||
endif
|
||||
|
||||
ifdef MOZILLA_OFFICIAL
|
||||
DEFINES += -DMOZILLA_OFFICIAL
|
||||
ifdef MOZ_CRASHREPORTER
|
||||
DEFINES += -DMOZ_CRASHREPORTER
|
||||
endif
|
||||
|
||||
ifdef MOZ_PROFILE_MIGRATOR
|
||||
|
|
|
@ -37,8 +37,8 @@ EnableProfileMigrator=1
|
|||
EnableExtensionManager=1
|
||||
#endif
|
||||
|
||||
#if MOZ_CRASHREPORTER
|
||||
[Crash Reporter]
|
||||
#if MOZILLA_OFFICIAL
|
||||
Enabled=1
|
||||
#endif
|
||||
ServerURL=https://crash-reports.mozilla.com/submit?id=@MOZ_APP_ID@&version=@MOZ_APP_VERSION@&buildid=@APP_BUILDID@
|
||||
#endif
|
||||
|
|
|
@ -37,16 +37,6 @@ if test -z "$MOZ_ARCH"; then
|
|||
MOZ_ARCH=toolchain-default
|
||||
MOZ_THUMB=yes
|
||||
;;
|
||||
arm-*)
|
||||
if test -n "$MOZ_PLATFORM_MAEMO"; then
|
||||
MOZ_THUMB=no
|
||||
MOZ_ARCH=armv7-a
|
||||
MOZ_FLOAT_ABI=softfp
|
||||
fi
|
||||
if test "$MOZ_PLATFORM_MAEMO" = 6; then
|
||||
MOZ_THUMB=yes
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
|
|
|
@ -78,6 +78,85 @@ if test -z "$_MOZ_USE_RTTI"; then
|
|||
fi
|
||||
])
|
||||
|
||||
dnl ========================================================
|
||||
dnl =
|
||||
dnl = Debugging Options
|
||||
dnl =
|
||||
dnl ========================================================
|
||||
AC_DEFUN([MOZ_DEBUGGING_OPTS],
|
||||
[
|
||||
dnl Debug info is ON by default.
|
||||
if test -z "$MOZ_DEBUG_FLAGS"; then
|
||||
MOZ_DEBUG_FLAGS="-g"
|
||||
fi
|
||||
|
||||
MOZ_ARG_ENABLE_STRING(debug,
|
||||
[ --enable-debug[=DBG] Enable building with developer debug info
|
||||
(using compiler flags DBG)],
|
||||
[ if test "$enableval" != "no"; then
|
||||
MOZ_DEBUG=1
|
||||
if test -n "$enableval" -a "$enableval" != "yes"; then
|
||||
MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
|
||||
_MOZ_DEBUG_FLAGS_SET=1
|
||||
fi
|
||||
else
|
||||
MOZ_DEBUG=
|
||||
fi ],
|
||||
MOZ_DEBUG=)
|
||||
|
||||
MOZ_DEBUG_ENABLE_DEFS="-DDEBUG -D_DEBUG -DTRACING"
|
||||
MOZ_ARG_WITH_STRING(debug-label,
|
||||
[ --with-debug-label=LABELS
|
||||
Define DEBUG_<value> for each comma-separated
|
||||
value given.],
|
||||
[ for option in `echo $withval | sed 's/,/ /g'`; do
|
||||
MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_${option}"
|
||||
done])
|
||||
|
||||
MOZ_DEBUG_DISABLE_DEFS="-DNDEBUG -DTRIMMED"
|
||||
|
||||
if test -n "$MOZ_DEBUG"; then
|
||||
AC_MSG_CHECKING([for valid debug flags])
|
||||
_SAVE_CFLAGS=$CFLAGS
|
||||
CFLAGS="$CFLAGS $MOZ_DEBUG_FLAGS"
|
||||
AC_TRY_COMPILE([#include <stdio.h>],
|
||||
[printf("Hello World\n");],
|
||||
_results=yes,
|
||||
_results=no)
|
||||
AC_MSG_RESULT([$_results])
|
||||
if test "$_results" = "no"; then
|
||||
AC_MSG_ERROR([These compiler flags are invalid: $MOZ_DEBUG_FLAGS])
|
||||
fi
|
||||
CFLAGS=$_SAVE_CFLAGS
|
||||
fi
|
||||
|
||||
dnl ========================================================
|
||||
dnl = Enable generation of debug symbols
|
||||
dnl ========================================================
|
||||
MOZ_ARG_ENABLE_STRING(debug-symbols,
|
||||
[ --enable-debug-symbols[=DBG]
|
||||
Enable debugging symbols (using compiler flags DBG)],
|
||||
[ if test "$enableval" != "no"; then
|
||||
MOZ_DEBUG_SYMBOLS=1
|
||||
if test -n "$enableval" -a "$enableval" != "yes"; then
|
||||
if test -z "$_MOZ_DEBUG_FLAGS_SET"; then
|
||||
MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
|
||||
else
|
||||
AC_MSG_ERROR([--enable-debug-symbols flags cannot be used with --enable-debug flags])
|
||||
fi
|
||||
fi
|
||||
else
|
||||
MOZ_DEBUG_SYMBOLS=
|
||||
fi ],
|
||||
MOZ_DEBUG_SYMBOLS=1)
|
||||
|
||||
if test -n "$MOZ_DEBUG" -o -n "$MOZ_DEBUG_SYMBOLS"; then
|
||||
AC_DEFINE(MOZ_DEBUG_SYMBOLS)
|
||||
export MOZ_DEBUG_SYMBOLS
|
||||
fi
|
||||
|
||||
])
|
||||
|
||||
dnl A high level macro for selecting compiler options.
|
||||
AC_DEFUN([MOZ_COMPILER_OPTS],
|
||||
[
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
|
||||
#include "nsChromeRegistry.h"
|
||||
#include "nsVoidArray.h"
|
||||
#include "mozilla/Move.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
@ -126,8 +127,8 @@ class nsChromeRegistryChrome : public nsChromeRegistry
|
|||
typedef nsURIHashKey::KeyTypePointer KeyTypePointer;
|
||||
|
||||
OverlayListEntry(KeyTypePointer aKey) : nsURIHashKey(aKey) { }
|
||||
OverlayListEntry(OverlayListEntry& toCopy) : nsURIHashKey(toCopy),
|
||||
mArray(toCopy.mArray) { }
|
||||
OverlayListEntry(OverlayListEntry&& toMove) : nsURIHashKey(mozilla::Move(toMove)),
|
||||
mArray(mozilla::Move(toMove.mArray)) { }
|
||||
~OverlayListEntry() { }
|
||||
|
||||
void AddURI(nsIURI* aURI);
|
||||
|
|
|
@ -494,8 +494,8 @@ OS_COMPILE_CMMFLAGS += -fobjc-abi-version=2 -fobjc-legacy-dispatch
|
|||
endif
|
||||
endif
|
||||
|
||||
COMPILE_CFLAGS = $(VISIBILITY_FLAGS) $(DEFINES) $(INCLUDES) $(DSO_CFLAGS) $(DSO_PIC_CFLAGS) $(CFLAGS) $(RTL_FLAGS) $(OS_CPPFLAGS) $(OS_COMPILE_CFLAGS)
|
||||
COMPILE_CXXFLAGS = $(STL_FLAGS) $(VISIBILITY_FLAGS) $(DEFINES) $(INCLUDES) $(DSO_CFLAGS) $(DSO_PIC_CFLAGS) $(CXXFLAGS) $(RTL_FLAGS) $(OS_CPPFLAGS) $(OS_COMPILE_CXXFLAGS)
|
||||
COMPILE_CFLAGS = $(VISIBILITY_FLAGS) $(DEFINES) $(INCLUDES) $(DSO_CFLAGS) $(DSO_PIC_CFLAGS) $(RTL_FLAGS) $(OS_CPPFLAGS) $(OS_COMPILE_CFLAGS) $(CFLAGS)
|
||||
COMPILE_CXXFLAGS = $(STL_FLAGS) $(VISIBILITY_FLAGS) $(DEFINES) $(INCLUDES) $(DSO_CFLAGS) $(DSO_PIC_CFLAGS) $(RTL_FLAGS) $(OS_CPPFLAGS) $(OS_COMPILE_CXXFLAGS) $(CXXFLAGS)
|
||||
COMPILE_CMFLAGS = $(OS_COMPILE_CMFLAGS)
|
||||
COMPILE_CMMFLAGS = $(OS_COMPILE_CMMFLAGS)
|
||||
|
||||
|
|
|
@ -3,5 +3,5 @@
|
|||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
add_tier_dir('js', 'js/src', static=True)
|
||||
add_tier_dir('js', 'js/src', external=True)
|
||||
|
||||
|
|
|
@ -683,9 +683,6 @@ SUBMAKEFILES += $(addsuffix /Makefile, $(DIRS) $(TOOL_DIRS) $(PARALLEL_DIRS))
|
|||
ifndef SUPPRESS_DEFAULT_RULES
|
||||
ifndef TIERS
|
||||
default all::
|
||||
ifneq (,$(strip $(STATIC_DIRS)))
|
||||
$(foreach dir,$(STATIC_DIRS),$(call SUBMAKE,,$(dir),1))
|
||||
endif
|
||||
$(MAKE) export
|
||||
$(MAKE) libs
|
||||
$(MAKE) tools
|
||||
|
@ -830,10 +827,21 @@ checkout:
|
|||
clean clobber realclean clobber_all:: $(SUBMAKEFILES)
|
||||
-$(RM) $(ALL_TRASH)
|
||||
-$(RM) -r $(ALL_TRASH_DIRS)
|
||||
$(foreach dir,$(PARALLEL_DIRS) $(DIRS) $(STATIC_DIRS) $(TOOL_DIRS),-$(call SUBMAKE,$@,$(dir)))
|
||||
|
||||
ifdef TIERS
|
||||
clean clobber realclean clobber_all distclean::
|
||||
$(foreach dir, \
|
||||
$(foreach tier, $(TIERS), $(tier_$(tier)_staticdirs) $(tier_$(tier)_dirs)), \
|
||||
-$(call SUBMAKE,$@,$(dir)))
|
||||
else
|
||||
clean clobber realclean clobber_all distclean::
|
||||
$(foreach dir,$(PARALLEL_DIRS) $(DIRS) $(TOOL_DIRS),-$(call SUBMAKE,$@,$(dir)))
|
||||
|
||||
distclean:: $(SUBMAKEFILES)
|
||||
$(foreach dir,$(PARALLEL_DIRS) $(DIRS) $(STATIC_DIRS) $(TOOL_DIRS),-$(call SUBMAKE,$@,$(dir)))
|
||||
$(foreach dir,$(PARALLEL_DIRS) $(DIRS) $(TOOL_DIRS),-$(call SUBMAKE,$@,$(dir)))
|
||||
endif
|
||||
|
||||
distclean::
|
||||
-$(RM) -r $(ALL_TRASH_DIRS)
|
||||
-$(RM) $(ALL_TRASH) \
|
||||
Makefile .HSancillary \
|
||||
|
|
|
@ -1059,21 +1059,9 @@ hunspell.hxx
|
|||
#if MOZ_NATIVE_BZ2==1
|
||||
bzlib.h
|
||||
#endif
|
||||
#if MOZ_PLATFORM_MAEMO==5
|
||||
hildon-uri.h
|
||||
hildon-mime.h
|
||||
hildon-file-chooser-dialog.h
|
||||
libosso.h
|
||||
osso-mem.h
|
||||
#endif
|
||||
#ifdef MOZ_ENABLE_GIO
|
||||
gio/gio.h
|
||||
#endif
|
||||
#ifdef MOZ_ENABLE_LIBCONIC
|
||||
conic/conicconnection.h
|
||||
conic/conicconnectionevent.h
|
||||
conic/conicstatisticsevent.h
|
||||
#endif
|
||||
#if MOZ_NATIVE_LIBEVENT==1
|
||||
event.h
|
||||
#else
|
||||
|
@ -1082,9 +1070,6 @@ sys/event.h
|
|||
#ifdef MOZ_ENABLE_LIBPROXY
|
||||
proxy.h
|
||||
#endif
|
||||
#if MOZ_PLATFORM_MAEMO==6
|
||||
contentaction/contentaction.h
|
||||
#endif
|
||||
#ifdef MOZ_ENABLE_CONTENTMANAGER
|
||||
SelectSingleContentItemPage.h
|
||||
SelectMultipleContentItemsPage.h
|
||||
|
|
280
configure.in
280
configure.in
|
@ -2464,88 +2464,6 @@ if test -z "$COMPILE_ENVIRONMENT"; then
|
|||
SKIP_LIBRARY_CHECKS=1
|
||||
fi
|
||||
|
||||
dnl ========================================================
|
||||
dnl =
|
||||
dnl = Debugging Options
|
||||
dnl =
|
||||
dnl = These must come before MOZ_COMPILER_OPTS so that MOZ_COMPILER_OPTS
|
||||
dnl = sees any debug flags set by the user.
|
||||
dnl =
|
||||
dnl ========================================================
|
||||
MOZ_ARG_HEADER(Debugging)
|
||||
|
||||
dnl ========================================================
|
||||
dnl = Debug info is ON by default.
|
||||
dnl ========================================================
|
||||
if test -z "$MOZ_DEBUG_FLAGS"; then
|
||||
MOZ_DEBUG_FLAGS="-g"
|
||||
fi
|
||||
|
||||
MOZ_ARG_ENABLE_STRING(debug,
|
||||
[ --enable-debug[=DBG] Enable building with developer debug info
|
||||
(using compiler flags DBG)],
|
||||
[ if test "$enableval" != "no"; then
|
||||
MOZ_DEBUG=1
|
||||
if test -n "$enableval" -a "$enableval" != "yes"; then
|
||||
MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
|
||||
_MOZ_DEBUG_FLAGS_SET=1
|
||||
fi
|
||||
else
|
||||
MOZ_DEBUG=
|
||||
fi ],
|
||||
MOZ_DEBUG=)
|
||||
|
||||
MOZ_DEBUG_ENABLE_DEFS="-DDEBUG -D_DEBUG -DTRACING"
|
||||
MOZ_ARG_WITH_STRING(debug-label,
|
||||
[ --with-debug-label=LABELS
|
||||
Define DEBUG_<value> for each comma-separated
|
||||
value given.],
|
||||
[ for option in `echo $withval | sed 's/,/ /g'`; do
|
||||
MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_${option}"
|
||||
done])
|
||||
|
||||
MOZ_DEBUG_DISABLE_DEFS="-DNDEBUG -DTRIMMED"
|
||||
|
||||
if test -n "$MOZ_DEBUG"; then
|
||||
AC_MSG_CHECKING([for valid debug flags])
|
||||
_SAVE_CFLAGS=$CFLAGS
|
||||
CFLAGS="$CFLAGS $MOZ_DEBUG_FLAGS"
|
||||
AC_TRY_COMPILE([#include <stdio.h>],
|
||||
[printf("Hello World\n");],
|
||||
_results=yes,
|
||||
_results=no)
|
||||
AC_MSG_RESULT([$_results])
|
||||
if test "$_results" = "no"; then
|
||||
AC_MSG_ERROR([These compiler flags are invalid: $MOZ_DEBUG_FLAGS])
|
||||
fi
|
||||
CFLAGS=$_SAVE_CFLAGS
|
||||
fi
|
||||
|
||||
dnl ========================================================
|
||||
dnl = Enable generation of debug symbols
|
||||
dnl ========================================================
|
||||
MOZ_ARG_ENABLE_STRING(debug-symbols,
|
||||
[ --enable-debug-symbols[=DBG]
|
||||
Enable debugging symbols (using compiler flags DBG)],
|
||||
[ if test "$enableval" != "no"; then
|
||||
MOZ_DEBUG_SYMBOLS=1
|
||||
if test -n "$enableval" -a "$enableval" != "yes"; then
|
||||
if test -z "$_MOZ_DEBUG_FLAGS_SET"; then
|
||||
MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
|
||||
else
|
||||
AC_MSG_ERROR([--enable-debug-symbols flags cannot be used with --enable-debug flags])
|
||||
fi
|
||||
fi
|
||||
else
|
||||
MOZ_DEBUG_SYMBOLS=
|
||||
fi ],
|
||||
MOZ_DEBUG_SYMBOLS=1)
|
||||
|
||||
if test -n "$MOZ_DEBUG" -o -n "$MOZ_DEBUG_SYMBOLS"; then
|
||||
AC_DEFINE(MOZ_DEBUG_SYMBOLS)
|
||||
export MOZ_DEBUG_SYMBOLS
|
||||
fi
|
||||
|
||||
MOZ_COMPILER_OPTS
|
||||
if test -z "$SKIP_COMPILER_CHECKS"; then
|
||||
dnl Checks for typedefs, structures, and compiler characteristics.
|
||||
|
@ -4818,6 +4736,8 @@ incorrect])
|
|||
MOZ_ENABLE_QTMOBILITY=1
|
||||
MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_QTMOBILITY_CFLAGS"
|
||||
MOZ_QT_LIBS="$MOZ_QT_LIBS $_QTMOBILITY_LIBS"
|
||||
AC_DEFINE(MOZ_ENABLE_QTMOBILITY)
|
||||
AC_SUBST(MOZ_ENABLE_QTMOBILITY)
|
||||
else
|
||||
AC_CHECK_LIB(QtSensors, main, [
|
||||
MOZ_ENABLE_QTMOBILITY=1
|
||||
|
@ -4828,8 +4748,20 @@ incorrect])
|
|||
MOZ_QT_LIBS="$MOZ_QT_LIBS -lQtSensors -lQtFeedback -lQtLocation"
|
||||
])
|
||||
fi
|
||||
if test "$MOZ_ENABLE_QTMOBILITY"; then
|
||||
AC_DEFINE(MOZ_ENABLE_QTMOBILITY)
|
||||
|
||||
if test "$MOZ_ENABLE_CONTENTACTION"; then
|
||||
MOZ_ENABLE_CONTENTACTION=1
|
||||
AC_DEFINE(MOZ_ENABLE_CONTENTACTION)
|
||||
fi
|
||||
|
||||
MOZ_ENABLE_CONTENTACTION=
|
||||
PKG_CHECK_MODULES(LIBCONTENTACTION, contentaction-0.1, _LIB_FOUND=1, _LIB_FOUND=)
|
||||
if test "$MOZ_ENABLE_CONTENTACTION"; then
|
||||
MOZ_ENABLE_CONTENTACTION=1
|
||||
MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_CONTENTACTION_CFLAGS"
|
||||
MOZ_QT_LIBS="$MOZ_QT_LIBS $_CONTENTACTION_LIBS"
|
||||
AC_DEFINE(MOZ_ENABLE_CONTENTACTION)
|
||||
AC_SUBST(MOZ_ENABLE_CONTENTACTION)
|
||||
fi
|
||||
fi
|
||||
|
||||
|
@ -6765,185 +6697,6 @@ MOZ_ARG_DISABLE_BOOL(zipwriter,
|
|||
MOZ_ZIPWRITER=1 )
|
||||
AC_SUBST(MOZ_ZIPWRITER)
|
||||
|
||||
dnl ========================================================
|
||||
dnl = libconic
|
||||
dnl ========================================================
|
||||
dnl superseded by QtNetwork starting from 4.7
|
||||
MOZ_ENABLE_LIBCONIC=1
|
||||
|
||||
if test -n "$MOZ_ENABLE_QT"; then
|
||||
if test "$MOZ_ENABLE_QTNETWORK"; then
|
||||
MOZ_ENABLE_LIBCONIC=
|
||||
fi
|
||||
fi
|
||||
|
||||
MOZ_ARG_DISABLE_BOOL(libconic,
|
||||
[ --disable-libconic Disable libconic],
|
||||
MOZ_ENABLE_LIBCONIC=,
|
||||
MOZ_ENABLE_LIBCONIC=1 )
|
||||
|
||||
if test -n "$MOZ_ENABLE_LIBCONIC"; then
|
||||
PKG_CHECK_MODULES(LIBCONIC, conic,
|
||||
MOZ_ENABLE_LIBCONIC=1,
|
||||
MOZ_ENABLE_LIBCONIC=)
|
||||
fi
|
||||
if test "$MOZ_ENABLE_LIBCONIC"; then
|
||||
AC_DEFINE(MOZ_ENABLE_LIBCONIC)
|
||||
fi
|
||||
|
||||
AC_SUBST(MOZ_ENABLE_LIBCONIC)
|
||||
AC_SUBST(LIBCONIC_CFLAGS)
|
||||
AC_SUBST(LIBCONIC_LIBS)
|
||||
|
||||
dnl ========================================================
|
||||
dnl = Maemo checks
|
||||
dnl ========================================================
|
||||
|
||||
MAEMO_SDK_TARGET_VER=-1
|
||||
|
||||
MOZ_ARG_WITH_STRING(maemo-version,
|
||||
[ --with-maemo-version=MAEMO_SDK_TARGET_VER
|
||||
Maemo SDK Version],
|
||||
MAEMO_SDK_TARGET_VER=$withval)
|
||||
|
||||
case "$MAEMO_SDK_TARGET_VER" in
|
||||
5)
|
||||
MOZ_PLATFORM_MAEMO=5
|
||||
;;
|
||||
|
||||
6)
|
||||
MOZ_PLATFORM_MAEMO=6
|
||||
;;
|
||||
|
||||
-1)
|
||||
dnl We aren't compiling for Maemo, move on.
|
||||
;;
|
||||
*)
|
||||
AC_MSG_ERROR([Unknown Maemo Version. Try setting --with-maemo-version to 5 or 6.])
|
||||
;;
|
||||
esac
|
||||
|
||||
if test $MOZ_PLATFORM_MAEMO; then
|
||||
AC_DEFINE_UNQUOTED([MOZ_PLATFORM_MAEMO], $MOZ_PLATFORM_MAEMO)
|
||||
|
||||
if test -z "$MOZ_ENABLE_DBUS"; then
|
||||
AC_MSG_ERROR([DBus is required when building for Maemo])
|
||||
fi
|
||||
|
||||
MOZ_GFX_OPTIMIZE_MOBILE=1
|
||||
MOZ_GL_DEFAULT_PROVIDER=EGL
|
||||
MOZ_MAEMO_LIBLOCATION=
|
||||
|
||||
if test $MOZ_PLATFORM_MAEMO = 5; then
|
||||
dnl if we have Xcomposite we should also have Xdamage and Xfixes
|
||||
MOZ_CHECK_HEADERS([X11/extensions/Xdamage.h], [],
|
||||
[AC_MSG_ERROR([Couldn't find X11/extensions/Xdamage.h which is required for composited plugins.])])
|
||||
AC_CHECK_LIB(Xcomposite, XCompositeRedirectWindow, [XCOMPOSITE_LIBS="-lXcomposite -lXdamage -lXfixes"],
|
||||
[MISSING_X="$MISSING_X -lXcomposite"], $XLIBS)
|
||||
|
||||
AC_SUBST(XCOMPOSITE_LIBS)
|
||||
|
||||
PKG_CHECK_MODULES(LIBHILDONMIME,libhildonmime, _LIB_FOUND=1, _LIB_FOUND=)
|
||||
MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBHILDONMIME_LIBS"
|
||||
MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBHILDONMIME_CFLAGS"
|
||||
if test -z "$_LIB_FOUND"; then
|
||||
AC_MSG_ERROR([Hildon Mime is required when building for Maemo])
|
||||
fi
|
||||
|
||||
|
||||
PKG_CHECK_MODULES(LIBOSSO,libosso, _LIB_FOUND=1, _LIB_FOUND=)
|
||||
MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBOSSO_LIBS"
|
||||
MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBOSSO_CFLAGS"
|
||||
if test -z "$_LIB_FOUND"; then
|
||||
AC_MSG_ERROR([LibOSSO is required when building for Maemo])
|
||||
fi
|
||||
|
||||
PKG_CHECK_MODULES(LIBHILDONFM,hildon-fm-2, _LIB_FOUND=1, _LIB_FOUND=)
|
||||
MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBHILDONFM_LIBS"
|
||||
MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBHILDONFM_CFLAGS"
|
||||
if test -z "$_LIB_FOUND"; then
|
||||
AC_MSG_ERROR([Hildon FM-2 is required when building for Maemo])
|
||||
fi
|
||||
|
||||
fi
|
||||
if test $MOZ_PLATFORM_MAEMO = 6; then
|
||||
|
||||
PKG_CHECK_MODULES(LIBCONTENTMANAGER, ContentManager QtSparql,
|
||||
_LIB_FOUND=1,
|
||||
_LIB_FOUND=)
|
||||
if test "$_LIB_FOUND"; then
|
||||
MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBCONTENTMANAGER_LIBS"
|
||||
MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBCONTENTMANAGER_CFLAGS"
|
||||
MOZ_ENABLE_CONTENTMANAGER=1
|
||||
AC_DEFINE(MOZ_ENABLE_CONTENTMANAGER)
|
||||
else
|
||||
AC_MSG_WARN([Cannot find libcontentmanager and or QtSparql building for Maemo 6])
|
||||
fi
|
||||
AC_SUBST(MOZ_ENABLE_CONTENTMANAGER)
|
||||
|
||||
dnl ========================================================
|
||||
dnl = Enable meego libcontentaction
|
||||
dnl ========================================================
|
||||
MOZ_ARG_ENABLE_BOOL(meegocontentaction,
|
||||
[ --enable-meegocontentaction Enable meegocontentaction support],
|
||||
MOZ_MEEGOCONTENTACTION=1,
|
||||
MOZ_MEEGOCONTENTACTION=)
|
||||
|
||||
if test -n "$MOZ_MEEGOCONTENTACTION"; then
|
||||
|
||||
PKG_CHECK_MODULES(LIBCONTENTACTION, contentaction-0.1, _LIB_FOUND=1, _LIB_FOUND=)
|
||||
if test "$_LIB_FOUND"; then
|
||||
MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBCONTENTACTION_LIBS"
|
||||
MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBCONTENTACTION_CFLAGS"
|
||||
MOZ_ENABLE_CONTENTACTION=1
|
||||
AC_DEFINE(MOZ_ENABLE_CONTENTACTION)
|
||||
AC_SUBST(MOZ_ENABLE_CONTENTACTION)
|
||||
fi
|
||||
fi
|
||||
|
||||
MOZ_ARG_ENABLE_BOOL(meegotouch,
|
||||
[ --enable-meegotouch Enable meegotouch support],
|
||||
MOZ_MEEGOTOUCHENABLED=1,
|
||||
MOZ_MEEGOTOUCHENABLED=)
|
||||
|
||||
if test -n "$MOZ_MEEGOTOUCHENABLED"; then
|
||||
PKG_CHECK_MODULES(MOZ_MEEGOTOUCH, meegotouchcore, _LIB_FOUND=1, _LIB_FOUND=)
|
||||
if test "$_LIB_FOUND"; then
|
||||
MOZ_QT_CFLAGS="$MOZ_MEEGOTOUCH_CFLAGS $MOZ_QT_CFLAGS"
|
||||
MOZ_QT_LIBS="$MOZ_MEEGOTOUCH_LIBS $MOZ_QT_LIBS"
|
||||
AC_DEFINE(MOZ_ENABLE_MEEGOTOUCH)
|
||||
else
|
||||
AC_MSG_WARN([Cannot meegotouchcore-dev. Disabling Meegotouch support.])
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
PKG_CHECK_MODULES(LIBLOCATION,liblocation, _LIB_FOUND=1, _LIB_FOUND=)
|
||||
MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBLOCATION_LIBS"
|
||||
MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBLOCATION_CFLAGS"
|
||||
if test "$_LIB_FOUND"; then
|
||||
MOZ_MAEMO_LIBLOCATION=1
|
||||
AC_DEFINE(MOZ_MAEMO_LIBLOCATION)
|
||||
else
|
||||
AC_MSG_WARN([Cannot liblocation-dev. Disabling Maemo geolocation.])
|
||||
fi
|
||||
AC_SUBST(MOZ_MAEMO_LIBLOCATION)
|
||||
|
||||
PKG_CHECK_MODULES(LIBMEEGOTOUCHSHARE, ShareUiInterface-maemo-meegotouch >= 0.3.31 mdatauri, _LIB_FOUND=1, _LIB_FOUND=)
|
||||
MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBMEEGOTOUCHSHARE_LIBS"
|
||||
MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBMEEGOTOUCHSHARE_CFLAGS"
|
||||
if test "$_LIB_FOUND"; then
|
||||
MOZ_ENABLE_MEEGOTOUCHSHARE=1
|
||||
AC_DEFINE(MOZ_ENABLE_MEEGOTOUCHSHARE)
|
||||
else
|
||||
AC_MSG_WARN([Cannot find maemo-meegotouch-interfaces-dev or libmdatauri-dev. Disabling meegotouch share ui.])
|
||||
fi
|
||||
AC_SUBST(MOZ_ENABLE_MEEGOTOUCHSHARE)
|
||||
|
||||
AC_SUBST(MOZ_PLATFORM_MAEMO_LIBS)
|
||||
AC_SUBST(MOZ_PLATFORM_MAEMO_CFLAGS)
|
||||
fi
|
||||
|
||||
dnl ========================================================
|
||||
dnl GL provider
|
||||
dnl ========================================================
|
||||
|
@ -8614,7 +8367,6 @@ AC_SUBST(FILTER)
|
|||
AC_SUBST(BIN_FLAGS)
|
||||
AC_SUBST(MOZ_WIDGET_TOOLKIT)
|
||||
AC_SUBST(MOZ_UPDATE_XTERM)
|
||||
AC_SUBST(MOZ_PLATFORM_MAEMO)
|
||||
AC_SUBST(MOZ_AUTH_EXTENSION)
|
||||
AC_SUBST(MOZ_PERMISSIONS)
|
||||
AC_SUBST(MOZ_PREF_EXTENSIONS)
|
||||
|
|
|
@ -189,6 +189,7 @@ public:
|
|||
static JSContext* GetContextFromDocument(nsIDocument *aDocument);
|
||||
|
||||
static bool IsCallerChrome();
|
||||
static bool ThreadsafeIsCallerChrome();
|
||||
static bool IsCallerXBL();
|
||||
|
||||
static bool IsImageSrcSetDisabled();
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
#include "nsPropertyTable.h" // for typedefs
|
||||
#include "nsTObserverArray.h" // for member
|
||||
#include "nsWindowMemoryReporter.h" // for NS_DECL_SIZEOF_EXCLUDING_THIS
|
||||
#include "mozilla/ErrorResult.h"
|
||||
#include "mozilla/MemoryReporting.h"
|
||||
#include "mozilla/dom/EventTarget.h" // for base class
|
||||
|
||||
|
|
|
@ -1746,6 +1746,7 @@ nsContentUtils::GetDocumentFromContext()
|
|||
bool
|
||||
nsContentUtils::IsCallerChrome()
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
bool is_caller_chrome = false;
|
||||
nsresult rv = sSecurityManager->SubjectPrincipalIsSystem(&is_caller_chrome);
|
||||
if (NS_FAILED(rv)) {
|
||||
|
@ -1759,6 +1760,22 @@ nsContentUtils::IsCallerChrome()
|
|||
return xpc::IsUniversalXPConnectEnabled(GetCurrentJSContext());
|
||||
}
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
namespace workers {
|
||||
extern bool IsCurrentThreadRunningChromeWorker();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
nsContentUtils::ThreadsafeIsCallerChrome()
|
||||
{
|
||||
return NS_IsMainThread() ?
|
||||
IsCallerChrome() :
|
||||
mozilla::dom::workers::IsCurrentThreadRunningChromeWorker();
|
||||
}
|
||||
|
||||
bool
|
||||
nsContentUtils::IsCallerXBL()
|
||||
{
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
#include "nsIAsyncVerifyRedirectCallback.h"
|
||||
#include "nsCharSeparatedTokenizer.h"
|
||||
#include "nsAsyncRedirectVerifyHelper.h"
|
||||
#include "prtime.h"
|
||||
#include "nsClassHashtable.h"
|
||||
#include "nsHashKeys.h"
|
||||
#include "nsStreamUtils.h"
|
||||
|
@ -45,7 +44,7 @@ public:
|
|||
struct TokenTime
|
||||
{
|
||||
nsCString token;
|
||||
PRTime expirationTime;
|
||||
TimeStamp expirationTime;
|
||||
};
|
||||
|
||||
struct CacheEntry : public LinkedListElement<CacheEntry>
|
||||
|
@ -61,7 +60,7 @@ public:
|
|||
MOZ_COUNT_DTOR(nsPreflightCache::CacheEntry);
|
||||
}
|
||||
|
||||
void PurgeExpired(PRTime now);
|
||||
void PurgeExpired(TimeStamp now);
|
||||
bool CheckRequest(const nsCString& aMethod,
|
||||
const nsTArray<nsCString>& aCustomHeaders);
|
||||
|
||||
|
@ -124,7 +123,7 @@ static bool EnsurePreflightCache()
|
|||
}
|
||||
|
||||
void
|
||||
nsPreflightCache::CacheEntry::PurgeExpired(PRTime now)
|
||||
nsPreflightCache::CacheEntry::PurgeExpired(TimeStamp now)
|
||||
{
|
||||
uint32_t i;
|
||||
for (i = 0; i < mMethods.Length(); ++i) {
|
||||
|
@ -143,7 +142,7 @@ bool
|
|||
nsPreflightCache::CacheEntry::CheckRequest(const nsCString& aMethod,
|
||||
const nsTArray<nsCString>& aHeaders)
|
||||
{
|
||||
PurgeExpired(PR_Now());
|
||||
PurgeExpired(TimeStamp::NowLoRes());
|
||||
|
||||
if (!aMethod.EqualsLiteral("GET") && !aMethod.EqualsLiteral("POST")) {
|
||||
uint32_t i;
|
||||
|
@ -214,7 +213,7 @@ nsPreflightCache::GetEntry(nsIURI* aURI,
|
|||
// Now enforce the max count.
|
||||
if (mTable.Count() == PREFLIGHT_CACHE_SIZE) {
|
||||
// Try to kick out all the expired entries.
|
||||
PRTime now = PR_Now();
|
||||
TimeStamp now = TimeStamp::NowLoRes();
|
||||
mTable.Enumerate(RemoveExpiredEntries, &now);
|
||||
|
||||
// If that didn't remove anything then kick out the least recently used
|
||||
|
@ -267,7 +266,7 @@ nsPreflightCache::RemoveExpiredEntries(const nsACString& aKey,
|
|||
nsAutoPtr<CacheEntry>& aValue,
|
||||
void* aUserData)
|
||||
{
|
||||
PRTime* now = static_cast<PRTime*>(aUserData);
|
||||
TimeStamp* now = static_cast<TimeStamp*>(aUserData);
|
||||
|
||||
aValue->PurgeExpired(*now);
|
||||
|
||||
|
@ -899,8 +898,7 @@ nsCORSPreflightListener::AddResultToCache(nsIRequest *aRequest)
|
|||
nsCOMPtr<nsIURI> uri;
|
||||
NS_GetFinalChannelURI(http, getter_AddRefs(uri));
|
||||
|
||||
// PR_Now gives microseconds
|
||||
PRTime expirationTime = PR_Now() + (uint64_t)age * PR_USEC_PER_SEC;
|
||||
TimeStamp expirationTime = TimeStamp::NowLoRes() + TimeDuration::FromSeconds(age);
|
||||
|
||||
nsPreflightCache::CacheEntry* entry =
|
||||
sPreflightCache->GetEntry(uri, mReferrerPrincipal, mWithCredentials,
|
||||
|
|
|
@ -2012,7 +2012,6 @@ GK_ATOM(mac_lion_theme, "mac-lion-theme")
|
|||
GK_ATOM(windows_compositor, "windows-compositor")
|
||||
GK_ATOM(windows_glass, "windows-glass")
|
||||
GK_ATOM(touch_enabled, "touch-enabled")
|
||||
GK_ATOM(maemo_classic, "maemo-classic")
|
||||
GK_ATOM(menubar_drag, "menubar-drag")
|
||||
GK_ATOM(swipe_animation_enabled, "swipe-animation-enabled")
|
||||
GK_ATOM(physical_home_button, "physical-home-button")
|
||||
|
@ -2053,7 +2052,6 @@ GK_ATOM(_moz_windows_glass, "-moz-windows-glass")
|
|||
GK_ATOM(_moz_windows_theme, "-moz-windows-theme")
|
||||
GK_ATOM(_moz_os_version, "-moz-os-version")
|
||||
GK_ATOM(_moz_touch_enabled, "-moz-touch-enabled")
|
||||
GK_ATOM(_moz_maemo_classic, "-moz-maemo-classic")
|
||||
GK_ATOM(_moz_menubar_drag, "-moz-menubar-drag")
|
||||
GK_ATOM(_moz_device_pixel_ratio, "-moz-device-pixel-ratio")
|
||||
GK_ATOM(_moz_device_orientation, "-moz-device-orientation")
|
||||
|
|
|
@ -482,12 +482,14 @@ nsMixedContentBlocker::ShouldLoad(uint32_t aContentType,
|
|||
*aDecision = nsIContentPolicy::ACCEPT;
|
||||
rootDoc->SetHasMixedActiveContentLoaded(true);
|
||||
if (!rootDoc->GetHasMixedDisplayContentLoaded() && NS_SUCCEEDED(stateRV)) {
|
||||
rootDoc->SetHasMixedDisplayContentLoaded(true);
|
||||
eventSink->OnSecurityChange(aRequestingContext, (State | nsIWebProgressListener::STATE_LOADED_MIXED_DISPLAY_CONTENT));
|
||||
}
|
||||
} else {
|
||||
*aDecision = nsIContentPolicy::REJECT_REQUEST;
|
||||
LogMixedContentMessage(classification, aContentLocation, rootDoc, eBlocked);
|
||||
if (!rootDoc->GetHasMixedDisplayContentBlocked() && NS_SUCCEEDED(stateRV)) {
|
||||
rootDoc->SetHasMixedDisplayContentBlocked(true);
|
||||
eventSink->OnSecurityChange(aRequestingContext, (State | nsIWebProgressListener::STATE_BLOCKED_MIXED_DISPLAY_CONTENT));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2676,12 +2676,6 @@ DoDelayedStop(nsPluginInstanceOwner* aInstanceOwner,
|
|||
nsObjectLoadingContent* aContent,
|
||||
bool aDelayedStop)
|
||||
{
|
||||
#if (MOZ_PLATFORM_MAEMO==5)
|
||||
// Don't delay stop on Maemo/Hildon (bug 530739).
|
||||
if (aDelayedStop && aInstanceOwner->MatchPluginName("Shockwave Flash"))
|
||||
return false;
|
||||
#endif
|
||||
|
||||
// Don't delay stopping QuickTime (bug 425157), Flip4Mac (bug 426524),
|
||||
// XStandard (bug 430219), CMISS Zinc (bug 429604).
|
||||
if (aDelayedStop
|
||||
|
|
|
@ -454,8 +454,10 @@ function runTest() {
|
|||
allowMethods: test.allowMethods,
|
||||
cacheTime: test.cacheTime };
|
||||
xhr = new XMLHttpRequest();
|
||||
xhr.open("POST", setStateURL + escape(sec.toSource()), false);
|
||||
xhr.open("POST", setStateURL + escape(sec.toSource()), true);
|
||||
xhr.onloadend = function() { gen.next(); }
|
||||
xhr.send();
|
||||
yield undefined;
|
||||
|
||||
loaderWindow.postMessage(req.toSource(), origin);
|
||||
|
||||
|
|
|
@ -8,19 +8,21 @@
|
|||
|
||||
#include "nsIDOMEventTarget.h"
|
||||
#include "nsWrapperCache.h"
|
||||
#include "nsIDOMEventListener.h"
|
||||
#include "mozilla/ErrorResult.h"
|
||||
#include "mozilla/dom/Nullable.h"
|
||||
#include "nsIAtom.h"
|
||||
|
||||
class nsDOMEvent;
|
||||
class nsIDOMWindow;
|
||||
class nsIDOMEventListener;
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
class ErrorResult;
|
||||
|
||||
namespace dom {
|
||||
|
||||
class EventListener;
|
||||
class EventHandlerNonNull;
|
||||
template <class T> class Nullable;
|
||||
|
||||
// IID for the dom::EventTarget interface
|
||||
#define NS_EVENTTARGET_IID \
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
|
||||
#include "DOMWheelEvent.h"
|
||||
#include "nsGUIEvent.h"
|
||||
#include "nsIContent.h"
|
||||
#include "prtime.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "nsDOMClassInfoID.h"
|
||||
#include "SpeechRecognitionError.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
|
|
@ -10,16 +10,13 @@
|
|||
#include "nsCOMPtr.h"
|
||||
#include "nsEvent.h"
|
||||
#include "nsINode.h"
|
||||
#include "nsString.h"
|
||||
#include "nsTArray.h"
|
||||
#include "nsThreadUtils.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
|
||||
class nsCompositionEvent;
|
||||
class nsDispatchingCallback;
|
||||
class nsIMEStateManager;
|
||||
class nsIWidget;
|
||||
class nsPresContext;
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
|
|
|
@ -7,10 +7,8 @@
|
|||
|
||||
#include "mozilla/dom/EventTarget.h"
|
||||
#include "mozilla/dom/TouchBinding.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsDOMTouchEvent.h"
|
||||
#include "nsPresContext.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
|
|
@ -6,16 +6,12 @@
|
|||
#ifndef nsContentEventHandler_h__
|
||||
#define nsContentEventHandler_h__
|
||||
|
||||
#include "nscore.h"
|
||||
#include "nsCOMPtr.h"
|
||||
|
||||
#include "nsISelection.h"
|
||||
#include "nsRange.h"
|
||||
#include "nsIDOMTreeWalker.h"
|
||||
|
||||
class nsCaret;
|
||||
class nsIContent;
|
||||
class nsIPresShell;
|
||||
class nsPresContext;
|
||||
class nsQueryContentEvent;
|
||||
class nsSelectionEvent;
|
||||
|
|
|
@ -7,10 +7,9 @@
|
|||
|
||||
#include "nsDOMEvent.h"
|
||||
#include "nsIDOMAnimationEvent.h"
|
||||
#include "nsString.h"
|
||||
#include "mozilla/dom/AnimationEventBinding.h"
|
||||
|
||||
class nsAnimationEvent;
|
||||
class nsAString;
|
||||
|
||||
class nsDOMAnimationEvent : public nsDOMEvent,
|
||||
public nsIDOMAnimationEvent
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "nsDOMClipboardEvent.h"
|
||||
#include "nsClientRect.h"
|
||||
#include "nsDOMDataTransfer.h"
|
||||
#include "nsIClipboard.h"
|
||||
|
||||
|
|
|
@ -7,11 +7,7 @@
|
|||
|
||||
#include "nsDOMDataTransfer.h"
|
||||
|
||||
#include "prlog.h"
|
||||
#include "nsString.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIInterfaceRequestorUtils.h"
|
||||
#include "nsIVariant.h"
|
||||
#include "nsISupportsPrimitives.h"
|
||||
#include "nsDOMClassInfoID.h"
|
||||
|
@ -21,12 +17,10 @@
|
|||
#include "nsError.h"
|
||||
#include "nsIDragService.h"
|
||||
#include "nsIClipboard.h"
|
||||
#include "nsIScriptableRegion.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsCRT.h"
|
||||
#include "nsIScriptObjectPrincipal.h"
|
||||
#include "nsIWebNavigation.h"
|
||||
#include "nsIScriptContext.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
|
|
@ -11,16 +11,16 @@
|
|||
#include "nsIVariant.h"
|
||||
#include "nsIPrincipal.h"
|
||||
#include "nsIDOMDataTransfer.h"
|
||||
#include "nsIDragService.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsIFile.h"
|
||||
#include "nsDOMFile.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
|
||||
class nsITransferable;
|
||||
class nsISupportsArray;
|
||||
class nsILoadContext;
|
||||
|
||||
/**
|
||||
* TransferItem is used to hold data for a particular format. Each piece of
|
||||
|
|
|
@ -4,11 +4,10 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "nsDOMDragEvent.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsGUIEvent.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsDOMDataTransfer.h"
|
||||
#include "nsIDragService.h"
|
||||
#include "nsIDOMDataTransfer.h"
|
||||
#include "prtime.h"
|
||||
|
||||
nsDOMDragEvent::nsDOMDragEvent(mozilla::dom::EventTarget* aOwner,
|
||||
nsPresContext* aPresContext,
|
||||
|
|
|
@ -10,8 +10,6 @@
|
|||
#include "nsDOMMouseEvent.h"
|
||||
#include "mozilla/dom/DragEventBinding.h"
|
||||
|
||||
class nsEvent;
|
||||
|
||||
class nsDOMDragEvent : public nsDOMMouseEvent,
|
||||
public nsIDOMDragEvent
|
||||
{
|
||||
|
|
|
@ -5,9 +5,6 @@
|
|||
|
||||
#include "base/basictypes.h"
|
||||
|
||||
/* This must occur *after* base/basictypes.h to avoid typedefs conflicts. */
|
||||
#include "mozilla/Util.h"
|
||||
|
||||
#include "ipc/IPCMessageUtils.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsError.h"
|
||||
|
@ -17,18 +14,10 @@
|
|||
#include "nsIContent.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIInterfaceRequestor.h"
|
||||
#include "nsIInterfaceRequestorUtils.h"
|
||||
#include "nsGkAtoms.h"
|
||||
#include "nsMutationEvent.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsJSEnvironment.h"
|
||||
#include "nsIURI.h"
|
||||
#include "nsIScriptSecurityManager.h"
|
||||
#include "nsIScriptError.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "nsJSUtils.h"
|
||||
#include "DictionaryHelpers.h"
|
||||
#include "nsLayoutUtils.h"
|
||||
#include "nsIScrollableFrame.h"
|
||||
#include "nsDOMEventTargetHelper.h"
|
||||
|
@ -334,6 +323,9 @@ nsDOMEvent::SetTrusted(bool aTrusted)
|
|||
bool
|
||||
nsDOMEvent::Init(mozilla::dom::EventTarget* aGlobal)
|
||||
{
|
||||
if (!mIsMainThreadEvent) {
|
||||
return nsContentUtils::ThreadsafeIsCallerChrome();
|
||||
}
|
||||
bool trusted = false;
|
||||
nsCOMPtr<nsPIDOMWindow> w = do_QueryInterface(aGlobal);
|
||||
if (w) {
|
||||
|
@ -479,7 +471,7 @@ nsDOMEvent::InitEvent(const nsAString& aEventTypeArg, bool aCanBubbleArg, bool a
|
|||
|
||||
if (IsTrusted()) {
|
||||
// Ensure the caller is permitted to dispatch trusted DOM events.
|
||||
if (!nsContentUtils::IsCallerChrome()) {
|
||||
if (!nsContentUtils::ThreadsafeIsCallerChrome()) {
|
||||
SetTrusted(false);
|
||||
}
|
||||
}
|
||||
|
@ -511,43 +503,47 @@ nsDOMEvent::DuplicatePrivateData()
|
|||
|
||||
nsEvent* newEvent = nullptr;
|
||||
uint32_t msg = mEvent->message;
|
||||
bool isInputEvent = false;
|
||||
|
||||
switch (mEvent->eventStructType) {
|
||||
case NS_EVENT:
|
||||
{
|
||||
newEvent = new nsEvent(false, msg);
|
||||
newEvent->AssignEventData(*mEvent, true);
|
||||
break;
|
||||
}
|
||||
case NS_GUI_EVENT:
|
||||
{
|
||||
nsGUIEvent* oldGUIEvent = static_cast<nsGUIEvent*>(mEvent);
|
||||
// Not copying widget, it is a weak reference.
|
||||
newEvent = new nsGUIEvent(false, msg, nullptr);
|
||||
nsGUIEvent* guiEvent = new nsGUIEvent(false, msg, nullptr);
|
||||
guiEvent->AssignGUIEventData(*oldGUIEvent, true);
|
||||
newEvent = guiEvent;
|
||||
break;
|
||||
}
|
||||
case NS_SCROLLBAR_EVENT:
|
||||
{
|
||||
newEvent = new nsScrollbarEvent(false, msg, nullptr);
|
||||
static_cast<nsScrollbarEvent*>(newEvent)->position =
|
||||
static_cast<nsScrollbarEvent*>(mEvent)->position;
|
||||
nsScrollbarEvent* oldScrollbarEvent =
|
||||
static_cast<nsScrollbarEvent*>(mEvent);
|
||||
nsScrollbarEvent* scrollbarEvent =
|
||||
new nsScrollbarEvent(false, msg, nullptr);
|
||||
scrollbarEvent->AssignGUIEventData(*scrollbarEvent, true);
|
||||
scrollbarEvent->position = oldScrollbarEvent->position;
|
||||
newEvent = scrollbarEvent;
|
||||
break;
|
||||
}
|
||||
case NS_INPUT_EVENT:
|
||||
{
|
||||
newEvent = new nsInputEvent(false, msg, nullptr);
|
||||
isInputEvent = true;
|
||||
nsInputEvent* oldInputEvent = static_cast<nsInputEvent*>(mEvent);
|
||||
nsInputEvent* inputEvent = new nsInputEvent(false, msg, nullptr);
|
||||
inputEvent->AssignInputEventData(*oldInputEvent, true);
|
||||
newEvent = inputEvent;
|
||||
break;
|
||||
}
|
||||
case NS_KEY_EVENT:
|
||||
{
|
||||
nsKeyEvent* keyEvent = new nsKeyEvent(false, msg, nullptr);
|
||||
nsKeyEvent* oldKeyEvent = static_cast<nsKeyEvent*>(mEvent);
|
||||
isInputEvent = true;
|
||||
keyEvent->keyCode = oldKeyEvent->keyCode;
|
||||
keyEvent->charCode = oldKeyEvent->charCode;
|
||||
keyEvent->location = oldKeyEvent->location;
|
||||
keyEvent->isChar = oldKeyEvent->isChar;
|
||||
keyEvent->mKeyNameIndex = oldKeyEvent->mKeyNameIndex;
|
||||
nsKeyEvent* keyEvent = new nsKeyEvent(false, msg, nullptr);
|
||||
keyEvent->AssignKeyEventData(*oldKeyEvent, true);
|
||||
newEvent = keyEvent;
|
||||
break;
|
||||
}
|
||||
|
@ -556,15 +552,7 @@ nsDOMEvent::DuplicatePrivateData()
|
|||
nsMouseEvent* oldMouseEvent = static_cast<nsMouseEvent*>(mEvent);
|
||||
nsMouseEvent* mouseEvent =
|
||||
new nsMouseEvent(false, msg, nullptr, oldMouseEvent->reason);
|
||||
isInputEvent = true;
|
||||
mouseEvent->clickCount = oldMouseEvent->clickCount;
|
||||
mouseEvent->acceptActivation = oldMouseEvent->acceptActivation;
|
||||
mouseEvent->context = oldMouseEvent->context;
|
||||
mouseEvent->relatedTarget = oldMouseEvent->relatedTarget;
|
||||
mouseEvent->button = oldMouseEvent->button;
|
||||
mouseEvent->buttons = oldMouseEvent->buttons;
|
||||
mouseEvent->pressure = oldMouseEvent->pressure;
|
||||
mouseEvent->inputSource = oldMouseEvent->inputSource;
|
||||
mouseEvent->AssignMouseEventData(*oldMouseEvent, true);
|
||||
newEvent = mouseEvent;
|
||||
break;
|
||||
}
|
||||
|
@ -573,7 +561,7 @@ nsDOMEvent::DuplicatePrivateData()
|
|||
nsDragEvent* oldDragEvent = static_cast<nsDragEvent*>(mEvent);
|
||||
nsDragEvent* dragEvent =
|
||||
new nsDragEvent(false, msg, nullptr);
|
||||
isInputEvent = true;
|
||||
dragEvent->AssignInputEventData(*oldDragEvent, true);
|
||||
dragEvent->dataTransfer = oldDragEvent->dataTransfer;
|
||||
dragEvent->clickCount = oldDragEvent->clickCount;
|
||||
dragEvent->acceptActivation = oldDragEvent->acceptActivation;
|
||||
|
@ -589,21 +577,27 @@ nsDOMEvent::DuplicatePrivateData()
|
|||
{
|
||||
nsClipboardEvent* oldClipboardEvent = static_cast<nsClipboardEvent*>(mEvent);
|
||||
nsClipboardEvent* clipboardEvent = new nsClipboardEvent(false, msg);
|
||||
clipboardEvent->AssignEventData(*oldClipboardEvent, true);
|
||||
clipboardEvent->clipboardData = oldClipboardEvent->clipboardData;
|
||||
newEvent = clipboardEvent;
|
||||
break;
|
||||
}
|
||||
case NS_SCRIPT_ERROR_EVENT:
|
||||
{
|
||||
newEvent = new nsScriptErrorEvent(false, msg);
|
||||
static_cast<nsScriptErrorEvent*>(newEvent)->lineNr =
|
||||
static_cast<nsScriptErrorEvent*>(mEvent)->lineNr;
|
||||
nsScriptErrorEvent* oldScriptErrorEvent =
|
||||
static_cast<nsScriptErrorEvent*>(mEvent);
|
||||
nsScriptErrorEvent* scriptErrorEvent = new nsScriptErrorEvent(false, msg);
|
||||
scriptErrorEvent->AssignEventData(*oldScriptErrorEvent, true);
|
||||
scriptErrorEvent->lineNr = oldScriptErrorEvent->lineNr;
|
||||
newEvent = scriptErrorEvent;
|
||||
break;
|
||||
}
|
||||
case NS_TEXT_EVENT:
|
||||
{
|
||||
newEvent = new nsTextEvent(false, msg, nullptr);
|
||||
isInputEvent = true;
|
||||
nsTextEvent* oldTextEvent = static_cast<nsTextEvent*>(mEvent);
|
||||
nsTextEvent* textEvent = new nsTextEvent(false, msg, nullptr);
|
||||
textEvent->AssignGUIEventData(*oldTextEvent, true);
|
||||
newEvent = textEvent;
|
||||
break;
|
||||
}
|
||||
case NS_COMPOSITION_EVENT:
|
||||
|
@ -612,17 +606,18 @@ nsDOMEvent::DuplicatePrivateData()
|
|||
new nsCompositionEvent(false, msg, nullptr);
|
||||
nsCompositionEvent* oldCompositionEvent =
|
||||
static_cast<nsCompositionEvent*>(mEvent);
|
||||
compositionEvent->AssignGUIEventData(*oldCompositionEvent, true);
|
||||
compositionEvent->data = oldCompositionEvent->data;
|
||||
newEvent = compositionEvent;
|
||||
break;
|
||||
}
|
||||
case NS_MOUSE_SCROLL_EVENT:
|
||||
{
|
||||
nsMouseScrollEvent* mouseScrollEvent =
|
||||
new nsMouseScrollEvent(false, msg, nullptr);
|
||||
isInputEvent = true;
|
||||
nsMouseScrollEvent* oldMouseScrollEvent =
|
||||
static_cast<nsMouseScrollEvent*>(mEvent);
|
||||
nsMouseScrollEvent* mouseScrollEvent =
|
||||
new nsMouseScrollEvent(false, msg, nullptr);
|
||||
mouseScrollEvent->AssignInputEventData(*oldMouseScrollEvent, true);
|
||||
mouseScrollEvent->isHorizontal = oldMouseScrollEvent->isHorizontal;
|
||||
mouseScrollEvent->delta = oldMouseScrollEvent->delta;
|
||||
mouseScrollEvent->relatedTarget = oldMouseScrollEvent->relatedTarget;
|
||||
|
@ -635,11 +630,11 @@ nsDOMEvent::DuplicatePrivateData()
|
|||
}
|
||||
case NS_WHEEL_EVENT:
|
||||
{
|
||||
widget::WheelEvent* wheelEvent =
|
||||
new widget::WheelEvent(false, msg, nullptr);
|
||||
isInputEvent = true;
|
||||
widget::WheelEvent* oldWheelEvent =
|
||||
static_cast<widget::WheelEvent*>(mEvent);
|
||||
widget::WheelEvent* wheelEvent =
|
||||
new widget::WheelEvent(false, msg, nullptr);
|
||||
wheelEvent->AssignInputEventData(*oldWheelEvent, true);
|
||||
wheelEvent->deltaX = oldWheelEvent->deltaX;
|
||||
wheelEvent->deltaY = oldWheelEvent->deltaY;
|
||||
wheelEvent->deltaZ = oldWheelEvent->deltaZ;
|
||||
|
@ -662,18 +657,24 @@ nsDOMEvent::DuplicatePrivateData()
|
|||
}
|
||||
case NS_SCROLLPORT_EVENT:
|
||||
{
|
||||
newEvent = new nsScrollPortEvent(false, msg, nullptr);
|
||||
static_cast<nsScrollPortEvent*>(newEvent)->orient =
|
||||
static_cast<nsScrollPortEvent*>(mEvent)->orient;
|
||||
nsScrollPortEvent* oldScrollPortEvent =
|
||||
static_cast<nsScrollPortEvent*>(mEvent);
|
||||
nsScrollPortEvent* scrollPortEvent =
|
||||
new nsScrollPortEvent(false, msg, nullptr);
|
||||
scrollPortEvent->AssignGUIEventData(*oldScrollPortEvent, true);
|
||||
scrollPortEvent->orient = oldScrollPortEvent->orient;
|
||||
newEvent = scrollPortEvent;
|
||||
break;
|
||||
}
|
||||
case NS_SCROLLAREA_EVENT:
|
||||
{
|
||||
nsScrollAreaEvent *newScrollAreaEvent =
|
||||
nsScrollAreaEvent* oldScrollAreaEvent =
|
||||
static_cast<nsScrollAreaEvent*>(mEvent);
|
||||
nsScrollAreaEvent* scrollAreaEvent =
|
||||
new nsScrollAreaEvent(false, msg, nullptr);
|
||||
newScrollAreaEvent->mArea =
|
||||
static_cast<nsScrollAreaEvent *>(mEvent)->mArea;
|
||||
newEvent = newScrollAreaEvent;
|
||||
scrollAreaEvent->AssignGUIEventData(*oldScrollAreaEvent, true);
|
||||
scrollAreaEvent->mArea = oldScrollAreaEvent->mArea;
|
||||
newEvent = scrollAreaEvent;
|
||||
break;
|
||||
}
|
||||
case NS_MUTATION_EVENT:
|
||||
|
@ -681,6 +682,7 @@ nsDOMEvent::DuplicatePrivateData()
|
|||
nsMutationEvent* mutationEvent = new nsMutationEvent(false, msg);
|
||||
nsMutationEvent* oldMutationEvent =
|
||||
static_cast<nsMutationEvent*>(mEvent);
|
||||
mutationEvent->AssignEventData(*oldMutationEvent, true);
|
||||
mutationEvent->mRelatedNode = oldMutationEvent->mRelatedNode;
|
||||
mutationEvent->mAttrName = oldMutationEvent->mAttrName;
|
||||
mutationEvent->mPrevAttrValue = oldMutationEvent->mPrevAttrValue;
|
||||
|
@ -691,13 +693,17 @@ nsDOMEvent::DuplicatePrivateData()
|
|||
}
|
||||
case NS_FORM_EVENT:
|
||||
{
|
||||
newEvent = new nsFormEvent(false, msg);
|
||||
nsFormEvent* oldFormEvent = static_cast<nsFormEvent*>(mEvent);
|
||||
nsFormEvent* formEvent = new nsFormEvent(false, msg);
|
||||
formEvent->AssignEventData(*oldFormEvent, true);
|
||||
newEvent = formEvent;
|
||||
break;
|
||||
}
|
||||
case NS_FOCUS_EVENT:
|
||||
{
|
||||
nsFocusEvent* newFocusEvent = new nsFocusEvent(false, msg);
|
||||
nsFocusEvent* oldFocusEvent = static_cast<nsFocusEvent*>(mEvent);
|
||||
newFocusEvent->AssignGUIEventData(*oldFocusEvent, true);
|
||||
newFocusEvent->fromRaise = oldFocusEvent->fromRaise;
|
||||
newFocusEvent->isRefocus = oldFocusEvent->isRefocus;
|
||||
newEvent = newFocusEvent;
|
||||
|
@ -705,34 +711,47 @@ nsDOMEvent::DuplicatePrivateData()
|
|||
}
|
||||
case NS_COMMAND_EVENT:
|
||||
{
|
||||
newEvent = new nsCommandEvent(false, mEvent->userType,
|
||||
static_cast<nsCommandEvent*>(mEvent)->command, nullptr);
|
||||
nsCommandEvent* oldCommandEvent = static_cast<nsCommandEvent*>(mEvent);
|
||||
nsCommandEvent* commandEvent =
|
||||
new nsCommandEvent(false, mEvent->userType,
|
||||
oldCommandEvent->command, nullptr);
|
||||
commandEvent->AssignGUIEventData(*oldCommandEvent, true);
|
||||
newEvent = commandEvent;
|
||||
break;
|
||||
}
|
||||
case NS_UI_EVENT:
|
||||
{
|
||||
newEvent = new nsUIEvent(false, msg,
|
||||
static_cast<nsUIEvent*>(mEvent)->detail);
|
||||
nsUIEvent* oldUIEvent = static_cast<nsUIEvent*>(mEvent);
|
||||
nsUIEvent* uiEvent = new nsUIEvent(false, msg, oldUIEvent->detail);
|
||||
uiEvent->AssignEventData(*oldUIEvent, true);
|
||||
newEvent = uiEvent;
|
||||
break;
|
||||
}
|
||||
case NS_SVGZOOM_EVENT:
|
||||
{
|
||||
newEvent = new nsGUIEvent(false, msg, nullptr);
|
||||
newEvent->eventStructType = NS_SVGZOOM_EVENT;
|
||||
nsGUIEvent* oldGUIEvent = static_cast<nsGUIEvent*>(mEvent);
|
||||
nsGUIEvent* guiEvent = new nsGUIEvent(false, msg, nullptr);
|
||||
guiEvent->eventStructType = NS_SVGZOOM_EVENT;
|
||||
guiEvent->AssignGUIEventData(*oldGUIEvent, true);
|
||||
newEvent = guiEvent;
|
||||
break;
|
||||
}
|
||||
case NS_SMIL_TIME_EVENT:
|
||||
{
|
||||
newEvent = new nsUIEvent(false, msg, 0);
|
||||
newEvent->eventStructType = NS_SMIL_TIME_EVENT;
|
||||
nsUIEvent* oldUIEvent = static_cast<nsUIEvent*>(mEvent);
|
||||
nsUIEvent* uiEvent = new nsUIEvent(false, msg, 0);
|
||||
uiEvent->eventStructType = NS_SMIL_TIME_EVENT;
|
||||
uiEvent->AssignGUIEventData(*oldUIEvent, true);
|
||||
newEvent = uiEvent;
|
||||
break;
|
||||
}
|
||||
case NS_SIMPLE_GESTURE_EVENT:
|
||||
{
|
||||
nsSimpleGestureEvent* oldSimpleGestureEvent = static_cast<nsSimpleGestureEvent*>(mEvent);
|
||||
nsSimpleGestureEvent* oldSimpleGestureEvent =
|
||||
static_cast<nsSimpleGestureEvent*>(mEvent);
|
||||
nsSimpleGestureEvent* simpleGestureEvent =
|
||||
new nsSimpleGestureEvent(false, msg, nullptr, 0, 0.0);
|
||||
isInputEvent = true;
|
||||
simpleGestureEvent->AssignInputEventData(*oldSimpleGestureEvent, true);
|
||||
simpleGestureEvent->direction = oldSimpleGestureEvent->direction;
|
||||
simpleGestureEvent->delta = oldSimpleGestureEvent->delta;
|
||||
simpleGestureEvent->clickCount = oldSimpleGestureEvent->clickCount;
|
||||
|
@ -743,27 +762,34 @@ nsDOMEvent::DuplicatePrivateData()
|
|||
{
|
||||
nsTransitionEvent* oldTransitionEvent =
|
||||
static_cast<nsTransitionEvent*>(mEvent);
|
||||
newEvent = new nsTransitionEvent(false, msg,
|
||||
oldTransitionEvent->propertyName,
|
||||
oldTransitionEvent->elapsedTime,
|
||||
oldTransitionEvent->pseudoElement);
|
||||
nsTransitionEvent* transitionEvent =
|
||||
new nsTransitionEvent(false, msg,
|
||||
oldTransitionEvent->propertyName,
|
||||
oldTransitionEvent->elapsedTime,
|
||||
oldTransitionEvent->pseudoElement);
|
||||
transitionEvent->AssignEventData(*oldTransitionEvent, true);
|
||||
newEvent = transitionEvent;
|
||||
break;
|
||||
}
|
||||
case NS_ANIMATION_EVENT:
|
||||
{
|
||||
nsAnimationEvent* oldAnimationEvent =
|
||||
static_cast<nsAnimationEvent*>(mEvent);
|
||||
newEvent = new nsAnimationEvent(false, msg,
|
||||
oldAnimationEvent->animationName,
|
||||
oldAnimationEvent->elapsedTime,
|
||||
oldAnimationEvent->pseudoElement);
|
||||
nsAnimationEvent* animationEvent =
|
||||
new nsAnimationEvent(false, msg,
|
||||
oldAnimationEvent->animationName,
|
||||
oldAnimationEvent->elapsedTime,
|
||||
oldAnimationEvent->pseudoElement);
|
||||
animationEvent->AssignEventData(*oldAnimationEvent, true);
|
||||
newEvent = animationEvent;
|
||||
break;
|
||||
}
|
||||
case NS_TOUCH_EVENT:
|
||||
{
|
||||
nsTouchEvent *oldTouchEvent = static_cast<nsTouchEvent*>(mEvent);
|
||||
newEvent = new nsTouchEvent(false, oldTouchEvent);
|
||||
isInputEvent = true;
|
||||
nsTouchEvent* oldTouchEvent = static_cast<nsTouchEvent*>(mEvent);
|
||||
nsTouchEvent* touchEvent = new nsTouchEvent(false, oldTouchEvent);
|
||||
touchEvent->AssignInputEventData(*oldTouchEvent, true);
|
||||
newEvent = touchEvent;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
@ -773,19 +799,7 @@ nsDOMEvent::DuplicatePrivateData()
|
|||
}
|
||||
}
|
||||
|
||||
if (isInputEvent) {
|
||||
nsInputEvent* oldInputEvent = static_cast<nsInputEvent*>(mEvent);
|
||||
nsInputEvent* newInputEvent = static_cast<nsInputEvent*>(newEvent);
|
||||
newInputEvent->modifiers = oldInputEvent->modifiers;
|
||||
}
|
||||
|
||||
newEvent->target = mEvent->target;
|
||||
newEvent->currentTarget = mEvent->currentTarget;
|
||||
newEvent->originalTarget = mEvent->originalTarget;
|
||||
newEvent->mFlags = mEvent->mFlags;
|
||||
newEvent->time = mEvent->time;
|
||||
newEvent->refPoint = mEvent->refPoint;
|
||||
newEvent->userType = mEvent->userType;
|
||||
newEvent->mFlags = mEvent->mFlags;
|
||||
|
||||
mEvent = newEvent;
|
||||
mPresContext = nullptr;
|
||||
|
|
|
@ -6,12 +6,9 @@
|
|||
#include "nsDOMEventTargetHelper.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsEventDispatcher.h"
|
||||
#include "nsGUIEvent.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsDOMJSUtils.h"
|
||||
#include "prprf.h"
|
||||
#include "nsGlobalWindow.h"
|
||||
#include "nsDOMEvent.h"
|
||||
#include "mozilla/Likely.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
|
|
@ -17,8 +17,6 @@
|
|||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/dom/EventTarget.h"
|
||||
|
||||
class nsDOMEvent;
|
||||
|
||||
#define NS_DOMEVENTTARGETHELPER_IID \
|
||||
{ 0xda0e6d40, 0xc17b, 0x4937, \
|
||||
{ 0x8e, 0xa2, 0x99, 0xca, 0x1c, 0x81, 0xea, 0xbe } }
|
||||
|
|
|
@ -10,8 +10,6 @@
|
|||
#include "nsDOMUIEvent.h"
|
||||
#include "mozilla/dom/MouseEventBinding.h"
|
||||
|
||||
class nsEvent;
|
||||
|
||||
class nsDOMMouseEvent : public nsDOMUIEvent,
|
||||
public nsIDOMMouseEvent
|
||||
{
|
||||
|
|
|
@ -9,10 +9,11 @@
|
|||
|
||||
#include "nsIDOMNotifyAudioAvailableEvent.h"
|
||||
#include "nsDOMEvent.h"
|
||||
#include "nsPresContext.h"
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
#include "mozilla/dom/NotifyAudioAvailableEventBinding.h"
|
||||
|
||||
class nsPresContext;
|
||||
|
||||
class nsDOMNotifyAudioAvailableEvent : public nsDOMEvent,
|
||||
public nsIDOMNotifyAudioAvailableEvent
|
||||
{
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
#include "nsContentUtils.h"
|
||||
#include "nsClientRect.h"
|
||||
#include "nsPaintRequest.h"
|
||||
#include "nsIFrame.h"
|
||||
|
||||
nsDOMNotifyPaintEvent::nsDOMNotifyPaintEvent(mozilla::dom::EventTarget* aOwner,
|
||||
nsPresContext* aPresContext,
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
#include "nsIDOMScrollAreaEvent.h"
|
||||
#include "nsDOMUIEvent.h"
|
||||
|
||||
#include "nsGUIEvent.h"
|
||||
#include "nsClientRect.h"
|
||||
#include "mozilla/dom/ScrollAreaEventBinding.h"
|
||||
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
#include "nsGUIEvent.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "nsPresContext.h"
|
||||
#include "mozilla/dom/Touch.h"
|
||||
#include "mozilla/dom/TouchListBinding.h"
|
||||
|
||||
|
|
|
@ -6,13 +6,14 @@
|
|||
#define nsDOMTouchEvent_h_
|
||||
|
||||
#include "nsDOMUIEvent.h"
|
||||
#include "nsString.h"
|
||||
#include "nsTArray.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "nsJSEnvironment.h"
|
||||
#include "mozilla/dom/TouchEventBinding.h"
|
||||
#include "nsWrapperCache.h"
|
||||
|
||||
class nsAString;
|
||||
|
||||
class nsDOMTouchList MOZ_FINAL : public nsISupports
|
||||
, public nsWrapperCache
|
||||
{
|
||||
|
|
|
@ -7,10 +7,9 @@
|
|||
|
||||
#include "nsDOMEvent.h"
|
||||
#include "nsIDOMTransitionEvent.h"
|
||||
#include "nsString.h"
|
||||
#include "mozilla/dom/TransitionEventBinding.h"
|
||||
|
||||
class nsTransitionEvent;
|
||||
class nsAString;
|
||||
|
||||
class nsDOMTransitionEvent : public nsDOMEvent,
|
||||
public nsIDOMTransitionEvent
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
#include "ipc/IPCMessageUtils.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsDOMUIEvent.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsIInterfaceRequestorUtils.h"
|
||||
#include "nsIDOMWindow.h"
|
||||
#include "nsIDOMNode.h"
|
||||
|
@ -15,7 +14,6 @@
|
|||
#include "nsContentUtils.h"
|
||||
#include "nsEventStateManager.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsIScrollableFrame.h"
|
||||
#include "mozilla/Util.h"
|
||||
#include "mozilla/Assertions.h"
|
||||
#include "prtime.h"
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "nsEventDispatcher.h"
|
||||
#include "nsDOMEvent.h"
|
||||
#include "nsPresContext.h"
|
||||
#include "nsEventListenerManager.h"
|
||||
#include "nsContentUtils.h"
|
||||
|
@ -15,7 +14,6 @@
|
|||
#include <new>
|
||||
#include "nsINode.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsFrameLoader.h"
|
||||
#include "nsDOMTouchEvent.h"
|
||||
#include "GeckoProfiler.h"
|
||||
#include "GeneratedEvents.h"
|
||||
|
@ -662,7 +660,7 @@ nsEventDispatcher::DispatchDOMEvent(nsISupports* aTarget,
|
|||
|
||||
if (!dontResetTrusted) {
|
||||
//Check security state to determine if dispatcher is trusted
|
||||
aDOMEvent->SetTrusted(nsContentUtils::IsCallerChrome());
|
||||
aDOMEvent->SetTrusted(nsContentUtils::ThreadsafeIsCallerChrome());
|
||||
}
|
||||
|
||||
return nsEventDispatcher::Dispatch(aTarget, aPresContext, innerEvent,
|
||||
|
|
|
@ -3,7 +3,9 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifdef MOZ_B2G
|
||||
#include "mozilla/Hal.h"
|
||||
#endif
|
||||
#include "mozilla/HalSensor.h"
|
||||
|
||||
// Microsoft's API Name hackery sucks
|
||||
|
@ -13,46 +15,29 @@
|
|||
#include "nsGUIEvent.h"
|
||||
#include "nsDOMEvent.h"
|
||||
#include "nsEventListenerManager.h"
|
||||
#include "nsCaret.h"
|
||||
#include "nsIDOMEventListener.h"
|
||||
#include "nsITextControlFrame.h"
|
||||
#include "nsGkAtoms.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsIJSEventListener.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsLayoutUtils.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsIContent.h"
|
||||
#include "mozilla/MemoryReporting.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsView.h"
|
||||
#include "nsViewManager.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIScriptSecurityManager.h"
|
||||
#include "nsError.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsMutationEvent.h"
|
||||
#include "nsIXPConnect.h"
|
||||
#include "nsDOMCID.h"
|
||||
#include "nsFocusManager.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsCxPusher.h"
|
||||
#include "nsJSUtils.h"
|
||||
#include "nsContentCID.h"
|
||||
#include "nsEventDispatcher.h"
|
||||
#include "nsDOMJSUtils.h"
|
||||
#include "nsDataHashtable.h"
|
||||
#include "nsCOMArray.h"
|
||||
#include "nsEventListenerService.h"
|
||||
#include "nsIContentSecurityPolicy.h"
|
||||
#include "nsJSEnvironment.h"
|
||||
#include "xpcpublic.h"
|
||||
#include "nsSandboxFlags.h"
|
||||
#include "mozilla/dom/time/TimeChangeObserver.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
|
|
|
@ -8,31 +8,27 @@
|
|||
|
||||
#include "mozilla/dom/EventListenerBinding.h"
|
||||
#include "mozilla/MemoryReporting.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsCOMArray.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsCxPusher.h"
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
#include "nsGkAtoms.h"
|
||||
#include "nsGUIEvent.h"
|
||||
#include "nsIDOMEventListener.h"
|
||||
#include "nsIJSEventListener.h"
|
||||
#include "nsIScriptContext.h"
|
||||
#include "nsTObserverArray.h"
|
||||
|
||||
class nsIDOMEvent;
|
||||
class nsIAtom;
|
||||
class nsIWidget;
|
||||
struct nsPoint;
|
||||
struct EventTypeData;
|
||||
class nsEventTargetChainItem;
|
||||
class nsPIDOMWindow;
|
||||
class nsCxPusher;
|
||||
class nsIEventListenerInfo;
|
||||
class nsIScriptContext;
|
||||
|
||||
struct nsListenerStruct;
|
||||
class nsEventListenerManager;
|
||||
|
||||
template<class T> class nsCOMArray;
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
|
|
|
@ -5,13 +5,9 @@
|
|||
#include "nsEventListenerService.h"
|
||||
#include "nsCOMArray.h"
|
||||
#include "nsEventListenerManager.h"
|
||||
#include "nsIVariant.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsMemory.h"
|
||||
#include "nsCxPusher.h"
|
||||
#include "nsIXPConnect.h"
|
||||
#include "nsIDOMWindow.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsJSUtils.h"
|
||||
#include "nsGUIEvent.h"
|
||||
#include "nsEventDispatcher.h"
|
||||
|
@ -21,6 +17,7 @@
|
|||
#endif
|
||||
#include "nsDOMClassInfoID.h"
|
||||
#include "mozilla/Maybe.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
|
||||
using namespace mozilla::dom;
|
||||
using mozilla::AutoSafeJSContext;
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsEventStateManager.h"
|
||||
#include "nsEventListenerManager.h"
|
||||
#include "nsIMEStateManager.h"
|
||||
#include "nsContentEventHandler.h"
|
||||
#include "nsIContent.h"
|
||||
|
@ -35,19 +34,9 @@
|
|||
#include "nsPIWindowRoot.h"
|
||||
#include "nsIWebNavigation.h"
|
||||
#include "nsIContentViewer.h"
|
||||
#include <algorithm>
|
||||
#ifdef MOZ_XUL
|
||||
#include "nsXULPopupManager.h"
|
||||
#endif
|
||||
#include "nsFrameManager.h"
|
||||
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIScriptSecurityManager.h"
|
||||
|
||||
#include "nsFocusManager.h"
|
||||
|
||||
#include "nsIDOMXULElement.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsIDOMKeyEvent.h"
|
||||
#include "nsIObserverService.h"
|
||||
#include "nsIDocShell.h"
|
||||
|
@ -56,14 +45,9 @@
|
|||
#include "nsIDOMDragEvent.h"
|
||||
#include "nsIDOMUIEvent.h"
|
||||
#include "nsDOMDragEvent.h"
|
||||
#include "nsIDOMNSEditableElement.h"
|
||||
#include "nsIDOMMozBrowserFrame.h"
|
||||
#include "nsIMozBrowserFrame.h"
|
||||
|
||||
#include "nsCaret.h"
|
||||
|
||||
#include "nsSubDocumentFrame.h"
|
||||
#include "nsLayoutCID.h"
|
||||
#include "nsLayoutUtils.h"
|
||||
#include "nsIInterfaceRequestorUtils.h"
|
||||
#include "nsUnicharUtils.h"
|
||||
|
@ -88,14 +72,11 @@
|
|||
#include "nsIController.h"
|
||||
#include "nsICommandParams.h"
|
||||
#include "mozilla/Services.h"
|
||||
#include "mozAutoDocUpdate.h"
|
||||
#include "mozilla/dom/HTMLLabelElement.h"
|
||||
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/LookAndFeel.h"
|
||||
#include "GeckoProfiler.h"
|
||||
|
||||
#include "nsIDOMClientRect.h"
|
||||
#include "Units.h"
|
||||
|
||||
#ifdef XP_MACOSX
|
||||
|
|
|
@ -12,20 +12,14 @@
|
|||
#include "nsGUIEvent.h"
|
||||
#include "nsIObserver.h"
|
||||
#include "nsWeakReference.h"
|
||||
#include "nsITimer.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsCOMArray.h"
|
||||
#include "nsIFrameLoader.h"
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
#include "nsIMarkupDocumentViewer.h"
|
||||
#include "nsIScrollableFrame.h"
|
||||
#include "nsFocusManager.h"
|
||||
#include "nsEventStates.h"
|
||||
#include "mozilla/TimeStamp.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "Units.h"
|
||||
|
||||
class nsIPresShell;
|
||||
class nsIContent;
|
||||
class nsIDocument;
|
||||
class nsIDocShell;
|
||||
|
@ -34,7 +28,10 @@ class nsIDocShellTreeItem;
|
|||
class imgIContainer;
|
||||
class nsDOMDataTransfer;
|
||||
class MouseEnterLeaveDispatcher;
|
||||
class nsIFrame;
|
||||
class nsEventStates;
|
||||
class nsIMarkupDocumentViewer;
|
||||
class nsIScrollableFrame;
|
||||
class nsITimer;
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
|
|
@ -6,15 +6,11 @@
|
|||
|
||||
#include "nsIMEStateManager.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsViewManager.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsISupports.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsIInterfaceRequestorUtils.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsPresContext.h"
|
||||
#include "nsIDOMWindow.h"
|
||||
#include "nsIDOMMouseEvent.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsINode.h"
|
||||
|
@ -33,10 +29,10 @@
|
|||
#include "nsIForm.h"
|
||||
#include "mozilla/dom/HTMLFormElement.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "nsEventDispatcher.h"
|
||||
#include "TextComposition.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "nsAsyncDOMEvent.h"
|
||||
#include "nsGUIEvent.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::widget;
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
#ifndef nsIMEStateManager_h__
|
||||
#define nsIMEStateManager_h__
|
||||
|
||||
#include "nscore.h"
|
||||
#include "nsEvent.h"
|
||||
#include "nsIWidget.h"
|
||||
|
||||
|
|
|
@ -5,9 +5,9 @@
|
|||
|
||||
#include "nsPaintRequest.h"
|
||||
|
||||
#include "nsIFrame.h"
|
||||
#include "mozilla/dom/PaintRequestBinding.h"
|
||||
#include "mozilla/dom/PaintRequestListBinding.h"
|
||||
#include "nsClientRect.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
|
|
|
@ -10,9 +10,10 @@
|
|||
#include "nsPresContext.h"
|
||||
#include "nsIDOMEvent.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "nsClientRect.h"
|
||||
#include "nsWrapperCache.h"
|
||||
|
||||
class nsClientRect;
|
||||
|
||||
class nsPaintRequest MOZ_FINAL : public nsIDOMPaintRequest
|
||||
, public nsWrapperCache
|
||||
{
|
||||
|
|
|
@ -89,10 +89,14 @@ public:
|
|||
NS_IMETHODIMP Run()
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
mRecorder->mState = RecordingState::Inactive;
|
||||
mRecorder->DispatchSimpleEvent(NS_LITERAL_STRING("stop"));
|
||||
mRecorder->mReadThread->Shutdown();
|
||||
mRecorder->mReadThread = nullptr;
|
||||
|
||||
// Setting mState to Inactive here is for the case where SourceStream
|
||||
// ends itself, thus the recorder should stop itself too.
|
||||
mRecorder->mState = RecordingState::Inactive;
|
||||
mRecorder->DispatchSimpleEvent(NS_LITERAL_STRING("stop"));
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -154,7 +158,7 @@ MediaRecorder::ExtractEncodedData()
|
|||
NS_DispatchToMainThread(new PushBlobTask(this));
|
||||
lastBlobTimeStamp = TimeStamp::Now();
|
||||
}
|
||||
} while (mState == RecordingState::Recording && !mEncoder->IsShutdown());
|
||||
} while (!mEncoder->IsShutdown());
|
||||
|
||||
NS_DispatchToMainThread(new PushBlobTask(this));
|
||||
}
|
||||
|
@ -229,7 +233,12 @@ MediaRecorder::Stop(ErrorResult& aResult)
|
|||
return;
|
||||
}
|
||||
mState = RecordingState::Inactive;
|
||||
mTrackUnionStream->RemoveListener(mEncoder);
|
||||
|
||||
mStreamPort->Destroy();
|
||||
mStreamPort = nullptr;
|
||||
|
||||
mTrackUnionStream->Destroy();
|
||||
mTrackUnionStream = nullptr;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -193,7 +193,8 @@ inline MediaByteRange::MediaByteRange(TimestampedMediaByteRange& aByteRange)
|
|||
* Decoder they are called on the Decode thread for example. You must
|
||||
* ensure that no threads are calling these methods once Close is called.
|
||||
*
|
||||
* Instances of this class are explicitly managed. 'delete' it when done.
|
||||
* Instances of this class are reference counted. Use nsRefPtr for
|
||||
* managing the lifetime of instances of this class.
|
||||
*
|
||||
* The generic implementation of this class is ChannelMediaResource, which can
|
||||
* handle any URI for which Necko supports AsyncOpen.
|
||||
|
|
|
@ -82,7 +82,7 @@ AudioTrackEncoder::NotifyEndOfStream()
|
|||
// If source audio chunks are completely silent till the end of encoding,
|
||||
// initialize the encoder with default channel counts and sampling rate, and
|
||||
// append this many null data to the segment of track encoder.
|
||||
if (!mCanceled && !mInitialized && mSilentDuration > 0) {
|
||||
if (!mCanceled && !mInitialized) {
|
||||
Init(DEFAULT_CHANNELS, DEFAULT_SAMPLING_RATE);
|
||||
mRawSegment->AppendNullData(mSilentDuration);
|
||||
mSilentDuration = 0;
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
#include "nsIGfxInfo.h"
|
||||
#include "gfxCrashReporterUtils.h"
|
||||
#include "prmem.h"
|
||||
#include "MediaResourceServer.h"
|
||||
|
||||
#include "MPAPI.h"
|
||||
|
||||
|
@ -33,40 +34,9 @@ Decoder::Decoder() :
|
|||
|
||||
namespace mozilla {
|
||||
|
||||
static MediaResource *GetResource(Decoder *aDecoder)
|
||||
static char* GetResource(Decoder *aDecoder)
|
||||
{
|
||||
return reinterpret_cast<MediaResource *>(aDecoder->mResource);
|
||||
}
|
||||
|
||||
static bool Read(Decoder *aDecoder, char *aBuffer, int64_t aOffset, uint32_t aCount, uint32_t* aBytes)
|
||||
{
|
||||
MediaResource *resource = GetResource(aDecoder);
|
||||
if (aOffset != resource->Tell()) {
|
||||
nsresult rv = resource->Seek(nsISeekableStream::NS_SEEK_SET, aOffset);
|
||||
if (NS_FAILED(rv)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
nsresult rv = resource->Read(aBuffer, aCount, aBytes);
|
||||
if (NS_FAILED(rv)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static uint64_t GetLength(Decoder *aDecoder)
|
||||
{
|
||||
return GetResource(aDecoder)->GetLength();
|
||||
}
|
||||
|
||||
static void SetMetaDataReadMode(Decoder *aDecoder)
|
||||
{
|
||||
GetResource(aDecoder)->SetReadMode(MediaCacheStream::MODE_METADATA);
|
||||
}
|
||||
|
||||
static void SetPlaybackReadMode(Decoder *aDecoder)
|
||||
{
|
||||
GetResource(aDecoder)->SetReadMode(MediaCacheStream::MODE_PLAYBACK);
|
||||
return static_cast<char*>(aDecoder->mResource);
|
||||
}
|
||||
|
||||
class GetIntPrefEvent : public nsRunnable {
|
||||
|
@ -92,10 +62,10 @@ static bool GetIntPref(const char* aPref, int32_t* aResult)
|
|||
}
|
||||
|
||||
static PluginHost sPluginHost = {
|
||||
Read,
|
||||
GetLength,
|
||||
SetMetaDataReadMode,
|
||||
SetPlaybackReadMode,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
GetIntPref
|
||||
};
|
||||
|
||||
|
@ -221,6 +191,8 @@ static const char* GetOmxLibraryName()
|
|||
MediaPluginHost::MediaPluginHost() {
|
||||
MOZ_COUNT_CTOR(MediaPluginHost);
|
||||
|
||||
mResourceServer = MediaResourceServer::Start();
|
||||
|
||||
const char* name = GetOmxLibraryName();
|
||||
ALOG("Loading OMX Plugin: %s", name ? name : "nullptr");
|
||||
if (name) {
|
||||
|
@ -250,6 +222,7 @@ MediaPluginHost::MediaPluginHost() {
|
|||
}
|
||||
|
||||
MediaPluginHost::~MediaPluginHost() {
|
||||
mResourceServer->Stop();
|
||||
MOZ_COUNT_DTOR(MediaPluginHost);
|
||||
}
|
||||
|
||||
|
@ -277,7 +250,6 @@ MPAPI::Decoder *MediaPluginHost::CreateDecoder(MediaResource *aResource, const n
|
|||
if (!decoder) {
|
||||
return nullptr;
|
||||
}
|
||||
decoder->mResource = aResource;
|
||||
|
||||
const char *chars;
|
||||
size_t len = NS_CStringGetData(aMimeType, &chars, nullptr);
|
||||
|
@ -287,6 +259,12 @@ MPAPI::Decoder *MediaPluginHost::CreateDecoder(MediaResource *aResource, const n
|
|||
if (!plugin->CanDecode(chars, len, &codecs)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
nsCString url;
|
||||
nsresult rv = mResourceServer->AddResource(aResource, url);
|
||||
if (NS_FAILED (rv)) continue;
|
||||
|
||||
decoder->mResource = strdup(url.get());
|
||||
if (plugin->CreateDecoder(&sPluginHost, decoder, chars, len)) {
|
||||
aResource->AddRef();
|
||||
return decoder.forget();
|
||||
|
@ -299,11 +277,12 @@ MPAPI::Decoder *MediaPluginHost::CreateDecoder(MediaResource *aResource, const n
|
|||
void MediaPluginHost::DestroyDecoder(Decoder *aDecoder)
|
||||
{
|
||||
aDecoder->DestroyDecoder(aDecoder);
|
||||
MediaResource* resource = GetResource(aDecoder);
|
||||
char* resource = GetResource(aDecoder);
|
||||
if (resource) {
|
||||
// resource *shouldn't* be null, but check anyway just in case the plugin
|
||||
// decoder does something stupid.
|
||||
resource->Release();
|
||||
mResourceServer->RemoveResource(nsCString(resource));
|
||||
free(resource);
|
||||
}
|
||||
delete aDecoder;
|
||||
}
|
||||
|
|
|
@ -9,13 +9,16 @@
|
|||
#include "nsTArray.h"
|
||||
#include "MediaResource.h"
|
||||
#include "MPAPI.h"
|
||||
#include "MediaResourceServer.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
class MediaPluginReader;
|
||||
|
||||
class MediaPluginHost {
|
||||
nsCOMPtr<MediaResourceServer> mResourceServer;
|
||||
nsTArray<MPAPI::Manifest *> mPlugins;
|
||||
|
||||
MPAPI::Manifest *FindPlugin(const nsACString& aMimeType);
|
||||
public:
|
||||
MediaPluginHost();
|
||||
|
|
|
@ -0,0 +1,526 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim:set ts=2 sw=2 sts=2 et cindent: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
#include "mozilla/Assertions.h"
|
||||
#include "mozilla/Base64.h"
|
||||
#include "nsThreadUtils.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsISocketTransport.h"
|
||||
#include "nsIOutputStream.h"
|
||||
#include "nsIInputStream.h"
|
||||
#include "nsIRandomGenerator.h"
|
||||
#include "nsReadLine.h"
|
||||
#include "nsNetCID.h"
|
||||
#include "VideoUtils.h"
|
||||
#include "MediaResource.h"
|
||||
#include "MediaResourceServer.h"
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#define strtoll _strtoi64
|
||||
#define snprintf _snprintf_s
|
||||
#endif
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
/*
|
||||
ReadCRLF is a variant of NS_ReadLine from nsReadLine.h that deals
|
||||
with the carriage return/line feed requirements of HTTP requests.
|
||||
*/
|
||||
template<typename CharT, class StreamType, class StringType>
|
||||
nsresult
|
||||
ReadCRLF (StreamType* aStream, nsLineBuffer<CharT> * aBuffer,
|
||||
StringType & aLine, bool *aMore)
|
||||
{
|
||||
// eollast is true if the last character in the buffer is a '\r',
|
||||
// signaling a potential '\r\n' sequence split between reads.
|
||||
bool eollast = false;
|
||||
|
||||
aLine.Truncate();
|
||||
|
||||
while (1) { // will be returning out of this loop on eol or eof
|
||||
if (aBuffer->start == aBuffer->end) { // buffer is empty. Read into it.
|
||||
uint32_t bytesRead;
|
||||
nsresult rv = aStream->Read(aBuffer->buf, kLineBufferSize, &bytesRead);
|
||||
if (NS_FAILED(rv) || bytesRead == 0) {
|
||||
*aMore = false;
|
||||
return rv;
|
||||
}
|
||||
aBuffer->start = aBuffer->buf;
|
||||
aBuffer->end = aBuffer->buf + bytesRead;
|
||||
*(aBuffer->end) = '\0';
|
||||
}
|
||||
|
||||
/*
|
||||
* Walk the buffer looking for an end-of-line.
|
||||
* There are 4 cases to consider:
|
||||
* 1. the CR char is the last char in the buffer
|
||||
* 2. the CRLF sequence are the last characters in the buffer
|
||||
* 3. the CRLF sequence + one or more chars at the end of the buffer
|
||||
* we need at least one char after the first CRLF sequence to
|
||||
* set |aMore| correctly.
|
||||
* 4. The LF character is the first char in the buffer when eollast is
|
||||
* true.
|
||||
*/
|
||||
CharT* current = aBuffer->start;
|
||||
if (eollast) { // Case 4
|
||||
if (*current == '\n') {
|
||||
aBuffer->start = ++current;
|
||||
*aMore = true;
|
||||
return NS_OK;
|
||||
}
|
||||
else {
|
||||
eollast = false;
|
||||
aLine.Append('\r');
|
||||
}
|
||||
}
|
||||
// Cases 2 and 3
|
||||
for ( ; current < aBuffer->end-1; ++current) {
|
||||
if (*current == '\r' && *(current+1) == '\n') {
|
||||
*current++ = '\0';
|
||||
*current++ = '\0';
|
||||
aLine.Append(aBuffer->start);
|
||||
aBuffer->start = current;
|
||||
*aMore = true;
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
// Case 1
|
||||
if (*current == '\r') {
|
||||
eollast = true;
|
||||
*current++ = '\0';
|
||||
}
|
||||
|
||||
aLine.Append(aBuffer->start);
|
||||
aBuffer->start = aBuffer->end; // mark the buffer empty
|
||||
}
|
||||
}
|
||||
|
||||
// Each client HTTP request results in a thread being spawned to process it.
|
||||
// That thread has a single event dispatched to it which handles the HTTP
|
||||
// protocol. It parses the headers and forwards data from the MediaResource
|
||||
// associated with the URL back to client. When the request is complete it will
|
||||
// shutdown the thread.
|
||||
class ServeResourceEvent : public nsRunnable {
|
||||
private:
|
||||
// Reading from this reads the data sent from the client.
|
||||
nsCOMPtr<nsIInputStream> mInput;
|
||||
|
||||
// Writing to this sends data to the client.
|
||||
nsCOMPtr<nsIOutputStream> mOutput;
|
||||
|
||||
// The MediaResourceServer that owns the MediaResource instances
|
||||
// served. This is used to lookup the MediaResource from the URL.
|
||||
nsCOMPtr<MediaResourceServer> mServer;
|
||||
|
||||
// Write 'aBufferLength' bytes from 'aBuffer' to 'mOutput'. This
|
||||
// method ensures all the data is written by checking the number
|
||||
// of bytes returned from the output streams 'Write' method and
|
||||
// looping until done.
|
||||
nsresult WriteAll(char const* aBuffer, int32_t aBufferLength);
|
||||
|
||||
public:
|
||||
ServeResourceEvent(nsIInputStream* aInput, nsIOutputStream* aOutput,
|
||||
MediaResourceServer* aServer)
|
||||
: mInput(aInput), mOutput(aOutput), mServer(aServer) {}
|
||||
|
||||
// This method runs on the thread and exits when it has completed the
|
||||
// HTTP request.
|
||||
NS_IMETHOD Run();
|
||||
|
||||
// Given the first line of an HTTP request, parse the URL requested and
|
||||
// return the MediaResource for that URL.
|
||||
already_AddRefed<MediaResource> GetMediaResource(nsCString const& aHTTPRequest);
|
||||
|
||||
// Gracefully shutdown the thread and cleanup resources
|
||||
void Shutdown();
|
||||
};
|
||||
|
||||
nsresult
|
||||
ServeResourceEvent::WriteAll(char const* aBuffer, int32_t aBufferLength)
|
||||
{
|
||||
while (aBufferLength > 0) {
|
||||
uint32_t written = 0;
|
||||
nsresult rv = mOutput->Write(aBuffer, aBufferLength, &written);
|
||||
if (NS_FAILED (rv)) return rv;
|
||||
|
||||
aBufferLength -= written;
|
||||
aBuffer += written;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
already_AddRefed<MediaResource>
|
||||
ServeResourceEvent::GetMediaResource(nsCString const& aHTTPRequest)
|
||||
{
|
||||
// Check that the HTTP method is GET
|
||||
const char* HTTP_METHOD = "GET ";
|
||||
if (strncmp(aHTTPRequest.get(), HTTP_METHOD, strlen(HTTP_METHOD)) != 0) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const char* url_start = strchr(aHTTPRequest.get(), ' ');
|
||||
if (!url_start) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const char* url_end = strrchr(++url_start, ' ');
|
||||
if (!url_end) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// The path extracted from the HTTP request is used as a key in hash
|
||||
// table. It is not related to retrieving data from the filesystem so
|
||||
// we don't need to do any sanity checking on ".." paths and similar
|
||||
// exploits.
|
||||
nsCString relative(url_start, url_end - url_start);
|
||||
nsRefPtr<MediaResource> resource =
|
||||
mServer->GetResource(mServer->GetURLPrefix() + relative);
|
||||
return resource.forget();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
ServeResourceEvent::Run() {
|
||||
bool more = false; // Are there HTTP headers to read after the first line
|
||||
nsCString line; // Contains the current line read from input stream
|
||||
nsLineBuffer<char>* buffer = new nsLineBuffer<char>();
|
||||
nsresult rv = ReadCRLF(mInput.get(), buffer, line, &more);
|
||||
if (NS_FAILED(rv)) { Shutdown(); return rv; }
|
||||
|
||||
// First line contains the HTTP GET request. Extract the URL and obtain
|
||||
// the MediaResource for it.
|
||||
nsRefPtr<MediaResource> resource = GetMediaResource(line);
|
||||
if (!resource) {
|
||||
const char* response_404 = "HTTP/1.1 404 Not Found\r\n"
|
||||
"Content-Length: 0\r\n\r\n";
|
||||
rv = WriteAll(response_404, strlen(response_404));
|
||||
Shutdown();
|
||||
return rv;
|
||||
}
|
||||
|
||||
// Offset in bytes to start reading from resource.
|
||||
// This is zero by default but can be set to another starting value if
|
||||
// this HTTP request includes a byte range request header.
|
||||
int64_t start = 0;
|
||||
|
||||
// Keep reading lines until we get a zero length line, which is the HTTP
|
||||
// protocol's way of signifying the end of headers and start of body, or
|
||||
// until we have no more data to read.
|
||||
while (more && line.Length() > 0) {
|
||||
rv = ReadCRLF(mInput.get(), buffer, line, &more);
|
||||
if (NS_FAILED(rv)) { Shutdown(); return rv; }
|
||||
|
||||
// Look for a byte range request header. If there is one, set the
|
||||
// media resource offset to start from to that requested. Here we
|
||||
// only check for the range request format used by Android rather
|
||||
// than implementing all possibilities in the HTTP specification.
|
||||
// That is, the range request is of the form:
|
||||
// Range: bytes=nnnn-
|
||||
// Were 'nnnn' is an integer number.
|
||||
// The end of the range is not checked, instead we return up to
|
||||
// the end of the resource and the client is informed of this via
|
||||
// the content-range header.
|
||||
NS_NAMED_LITERAL_CSTRING(byteRange, "Range: bytes=");
|
||||
const char* s = strstr(line.get(), byteRange.get());
|
||||
if (s) {
|
||||
start = strtoll(s+byteRange.Length(), NULL, 10);
|
||||
|
||||
// Clamp 'start' to be between 0 and the resource length.
|
||||
start = std::max(0ll, std::min(resource->GetLength(), start));
|
||||
}
|
||||
}
|
||||
|
||||
// HTTP response to use if this is a non byte range request
|
||||
const char* response_normal = "HTTP/1.1 200 OK\r\n";
|
||||
|
||||
// HTTP response to use if this is a byte range request
|
||||
const char* response_range = "HTTP/1.1 206 Partial Content\r\n";
|
||||
|
||||
// End of HTTP reponse headers is indicated by an empty line.
|
||||
const char* response_end = "\r\n";
|
||||
|
||||
// If the request was a byte range request, we need to read from the
|
||||
// requested offset. If the resource is non-seekable, or the seek
|
||||
// fails, then the start offset is set back to zero. This results in all
|
||||
// HTTP response data being as if the byte range request was not made.
|
||||
if (start > 0 && !resource->IsTransportSeekable()) {
|
||||
start = 0;
|
||||
}
|
||||
|
||||
const char* response_line = start > 0 ?
|
||||
response_range :
|
||||
response_normal;
|
||||
rv = WriteAll(response_line, strlen(response_line));
|
||||
if (NS_FAILED(rv)) { Shutdown(); return NS_OK; }
|
||||
|
||||
// Buffer used for reading from the input stream and writing to
|
||||
// the output stream. The buffer size should be big enough for the
|
||||
// HTTP response headers sent below. A static_assert ensures
|
||||
// this where the buffer is used.
|
||||
const int buffer_size = 32768;
|
||||
nsAutoArrayPtr<char> b(new char[buffer_size]);
|
||||
|
||||
// If we know the length of the resource, send a Content-Length header.
|
||||
int64_t contentlength = resource->GetLength() - start;
|
||||
if (contentlength > 0) {
|
||||
static_assert (buffer_size > 1024,
|
||||
"buffer_size must be large enough "
|
||||
"to hold response headers");
|
||||
snprintf(b, buffer_size, "Content-Length: %lld\r\n", contentlength);
|
||||
rv = WriteAll(b, strlen(b));
|
||||
if (NS_FAILED(rv)) { Shutdown(); return NS_OK; }
|
||||
}
|
||||
|
||||
// If the request was a byte range request, respond with a Content-Range
|
||||
// header which details the extent of the data returned.
|
||||
if (start > 0) {
|
||||
static_assert (buffer_size > 1024,
|
||||
"buffer_size must be large enough "
|
||||
"to hold response headers");
|
||||
snprintf(b, buffer_size, "Content-Range: bytes %lld-%lld/%lld\r\n",
|
||||
start, resource->GetLength() - 1, resource->GetLength());
|
||||
rv = WriteAll(b, strlen(b));
|
||||
if (NS_FAILED(rv)) { Shutdown(); return NS_OK; }
|
||||
}
|
||||
|
||||
rv = WriteAll(response_end, strlen(response_end));
|
||||
if (NS_FAILED(rv)) { Shutdown(); return NS_OK; }
|
||||
|
||||
rv = mOutput->Flush();
|
||||
if (NS_FAILED(rv)) { Shutdown(); return NS_OK; }
|
||||
|
||||
// Read data from media resource
|
||||
uint32_t bytesRead = 0; // Number of bytes read/written to streams
|
||||
rv = resource->ReadAt(start, b, buffer_size, &bytesRead);
|
||||
while (NS_SUCCEEDED(rv) && bytesRead != 0) {
|
||||
// Keep track of what we think the starting position for the next read
|
||||
// is. This is used in subsequent ReadAt calls to ensure we are reading
|
||||
// from the correct offset in the case where another thread is reading
|
||||
// from th same MediaResource.
|
||||
start += bytesRead;
|
||||
|
||||
// Write data obtained from media resource to output stream
|
||||
rv = WriteAll(b, bytesRead);
|
||||
if (NS_FAILED (rv)) break;
|
||||
|
||||
rv = resource->ReadAt(start, b, 32768, &bytesRead);
|
||||
}
|
||||
|
||||
Shutdown();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
ServeResourceEvent::Shutdown()
|
||||
{
|
||||
// Cleanup resources and exit.
|
||||
mInput->Close();
|
||||
mOutput->Close();
|
||||
|
||||
// To shutdown the current thread we need to first exit this event.
|
||||
// The Shutdown event below is posted to the main thread to do this.
|
||||
nsCOMPtr<nsIRunnable> event = new ShutdownThreadEvent(NS_GetCurrentThread());
|
||||
NS_DispatchToMainThread(event, NS_DISPATCH_NORMAL);
|
||||
}
|
||||
|
||||
/*
|
||||
This is the listener attached to the server socket. When an HTTP
|
||||
request is made by the client the OnSocketAccepted method is
|
||||
called. This method will spawn a thread to process the request.
|
||||
The thread receives a single event which does the parsing of
|
||||
the HTTP request and forwarding the data from the MediaResource
|
||||
to the output stream of the request.
|
||||
|
||||
The MediaResource used for providing the request data is obtained
|
||||
from the MediaResourceServer that created this listener, using the
|
||||
URL the client requested.
|
||||
*/
|
||||
class ResourceSocketListener : public nsIServerSocketListener
|
||||
{
|
||||
public:
|
||||
// The MediaResourceServer used to look up the MediaResource
|
||||
// on requests.
|
||||
nsCOMPtr<MediaResourceServer> mServer;
|
||||
|
||||
public:
|
||||
NS_DECL_THREADSAFE_ISUPPORTS
|
||||
NS_DECL_NSISERVERSOCKETLISTENER
|
||||
|
||||
ResourceSocketListener(MediaResourceServer* aServer) :
|
||||
mServer(aServer)
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~ResourceSocketListener() { }
|
||||
};
|
||||
|
||||
NS_IMPL_ISUPPORTS1(ResourceSocketListener, nsIServerSocketListener)
|
||||
|
||||
NS_IMETHODIMP
|
||||
ResourceSocketListener::OnSocketAccepted(nsIServerSocket* aServ,
|
||||
nsISocketTransport* aTrans)
|
||||
{
|
||||
nsCOMPtr<nsIInputStream> input;
|
||||
nsCOMPtr<nsIOutputStream> output;
|
||||
nsresult rv;
|
||||
|
||||
rv = aTrans->OpenInputStream(nsITransport::OPEN_BLOCKING, 0, 0, getter_AddRefs(input));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = aTrans->OpenOutputStream(nsITransport::OPEN_BLOCKING, 0, 0, getter_AddRefs(output));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCOMPtr<nsIThread> thread;
|
||||
rv = NS_NewThread(getter_AddRefs(thread));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCOMPtr<nsIRunnable> event = new ServeResourceEvent(input.get(), output.get(), mServer);
|
||||
return thread->Dispatch(event, NS_DISPATCH_NORMAL);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
ResourceSocketListener::OnStopListening(nsIServerSocket* aServ, nsresult aStatus)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
MediaResourceServer::MediaResourceServer() :
|
||||
mMutex("MediaResourceServer")
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
MediaResourceServer::Run()
|
||||
{
|
||||
MutexAutoLock lock(mMutex);
|
||||
|
||||
nsresult rv;
|
||||
mSocket = do_CreateInstance(NS_SERVERSOCKET_CONTRACTID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = mSocket->InitSpecialConnection(-1,
|
||||
nsIServerSocket::LoopbackOnly
|
||||
| nsIServerSocket::KeepWhenOffline,
|
||||
-1);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = mSocket->AsyncListen(new ResourceSocketListener(this));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* static */
|
||||
already_AddRefed<MediaResourceServer>
|
||||
MediaResourceServer::Start()
|
||||
{
|
||||
nsCOMPtr<MediaResourceServer> server = new MediaResourceServer();
|
||||
NS_DispatchToMainThread(server, NS_DISPATCH_SYNC);
|
||||
return server.forget();
|
||||
}
|
||||
|
||||
void
|
||||
MediaResourceServer::Stop()
|
||||
{
|
||||
MutexAutoLock lock(mMutex);
|
||||
mSocket->Close();
|
||||
mSocket = nullptr;
|
||||
}
|
||||
|
||||
nsresult
|
||||
MediaResourceServer::AppendRandomPath(nsCString& aUrl)
|
||||
{
|
||||
// Use a cryptographic quality PRNG to generate raw random bytes
|
||||
// and convert that to a base64 string for use as an URL path. This
|
||||
// is based on code from nsExternalAppHandler::SetUpTempFile.
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIRandomGenerator> rg =
|
||||
do_GetService("@mozilla.org/security/random-generator;1", &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// For each three bytes of random data we will get four bytes of
|
||||
// ASCII. Request a bit more to be safe and truncate to the length
|
||||
// we want at the end.
|
||||
const uint32_t wantedFileNameLength = 16;
|
||||
const uint32_t requiredBytesLength =
|
||||
static_cast<uint32_t>((wantedFileNameLength + 1) / 4 * 3);
|
||||
|
||||
uint8_t* buffer;
|
||||
rv = rg->GenerateRandomBytes(requiredBytesLength, &buffer);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsAutoCString tempLeafName;
|
||||
nsDependentCSubstring randomData(reinterpret_cast<const char*>(buffer),
|
||||
requiredBytesLength);
|
||||
rv = Base64Encode(randomData, tempLeafName);
|
||||
NS_Free(buffer);
|
||||
buffer = nullptr;
|
||||
if (NS_FAILED (rv)) return rv;
|
||||
|
||||
tempLeafName.Truncate(wantedFileNameLength);
|
||||
|
||||
// Base64 characters are alphanumeric (a-zA-Z0-9) and '+' and '/', so we need
|
||||
// to replace illegal characters -- notably '/'
|
||||
tempLeafName.ReplaceChar(FILE_PATH_SEPARATOR FILE_ILLEGAL_CHARACTERS, '_');
|
||||
|
||||
aUrl += "/";
|
||||
aUrl += tempLeafName;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
MediaResourceServer::AddResource(mozilla::MediaResource* aResource, nsCString& aUrl)
|
||||
{
|
||||
nsCString url = GetURLPrefix();
|
||||
nsresult rv = AppendRandomPath(url);
|
||||
if (NS_FAILED (rv)) return rv;
|
||||
|
||||
{
|
||||
MutexAutoLock lock(mMutex);
|
||||
|
||||
// Adding a resource URL that already exists is considered an error.
|
||||
if (mResources.find(aUrl) != mResources.end()) return NS_ERROR_FAILURE;
|
||||
mResources[url] = aResource;
|
||||
}
|
||||
|
||||
aUrl = url;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
MediaResourceServer::RemoveResource(nsCString const& aUrl)
|
||||
{
|
||||
MutexAutoLock lock(mMutex);
|
||||
mResources.erase(aUrl);
|
||||
}
|
||||
|
||||
nsCString
|
||||
MediaResourceServer::GetURLPrefix()
|
||||
{
|
||||
MutexAutoLock lock(mMutex);
|
||||
|
||||
int32_t port = 0;
|
||||
nsresult rv = mSocket->GetPort(&port);
|
||||
if (NS_FAILED (rv) || port < 0) {
|
||||
return nsCString("");
|
||||
}
|
||||
|
||||
char buffer[256];
|
||||
snprintf(buffer, sizeof(buffer), "http://127.0.0.1:%d", port >= 0 ? port : 0);
|
||||
return nsCString(buffer);
|
||||
}
|
||||
|
||||
already_AddRefed<MediaResource>
|
||||
MediaResourceServer::GetResource(nsCString const& aUrl)
|
||||
{
|
||||
MutexAutoLock lock(mMutex);
|
||||
ResourceMap::const_iterator it = mResources.find(aUrl);
|
||||
if (it == mResources.end()) return nullptr;
|
||||
|
||||
nsRefPtr<MediaResource> resource = it->second;
|
||||
return resource.forget();
|
||||
}
|
|
@ -0,0 +1,96 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim:set ts=2 sw=2 sts=2 et cindent: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
#if !defined(MediaResourceServer_h_)
|
||||
#define MediaResourceServer_h_
|
||||
|
||||
#include <map>
|
||||
#include "nsIServerSocket.h"
|
||||
#include "MediaResource.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
class MediaResource;
|
||||
|
||||
/*
|
||||
MediaResourceServer instantiates a socket server that understands
|
||||
HTTP requests for MediaResource instances. The server runs on an
|
||||
automatically selected port and MediaResource instances are registered.
|
||||
The registration returns a string URL than can be used to fetch the
|
||||
resource. That URL contains a randomly generated path to make it
|
||||
difficult for other local applications on the device to guess it.
|
||||
|
||||
The HTTP protocol is limited in that it supports only what the
|
||||
Android DataSource implementation uses to fetch media. It
|
||||
understands HTTP GET and byte range requests.
|
||||
|
||||
The intent of this class is to be used in Media backends that
|
||||
have a system component that does its own network requests. These
|
||||
requests are made against this server which then uses standard
|
||||
Gecko network requests and media cache usage.
|
||||
|
||||
The MediaResourceServer can be instantiated on any thread and
|
||||
its methods are threadsafe - they can be called on any thread.
|
||||
The server socket itself is always run on the main thread and
|
||||
this is done by the Start() static method by synchronously
|
||||
dispatching to the main thread.
|
||||
*/
|
||||
class MediaResourceServer : public nsRunnable
|
||||
{
|
||||
private:
|
||||
// Mutex protecting private members of MediaResourceServer.
|
||||
// All member variables below this point in the class definition
|
||||
// must acquire the mutex before access.
|
||||
mozilla::Mutex mMutex;
|
||||
|
||||
// Server socket used to listen for incoming connections
|
||||
nsCOMPtr<nsIServerSocket> mSocket;
|
||||
|
||||
// Mapping between MediaResource URL's to the MediaResource
|
||||
// object served at that URL.
|
||||
typedef std::map<nsCString,
|
||||
nsRefPtr<mozilla::MediaResource> > ResourceMap;
|
||||
ResourceMap mResources;
|
||||
|
||||
// Create a MediaResourceServer that will listen on an automatically
|
||||
// selected port when started. This is private as it should only be
|
||||
// called internally from the public 'Start' method.
|
||||
MediaResourceServer();
|
||||
NS_IMETHOD Run();
|
||||
|
||||
// Append a random URL path to a string. This is used for creating a
|
||||
// unique URl for a resource which helps prevent malicious software
|
||||
// running on the same machine as the server from guessing the URL
|
||||
// and accessing video data.
|
||||
nsresult AppendRandomPath(nsCString& aURL);
|
||||
|
||||
public:
|
||||
// Create a MediaResourceServer and start it listening. This call will
|
||||
// perform a synchronous request on the main thread.
|
||||
static already_AddRefed<MediaResourceServer> Start();
|
||||
|
||||
// Stops the server from listening and accepting further connections.
|
||||
void Stop();
|
||||
|
||||
// Add a MediaResource to be served by this server. Stores the
|
||||
// absolute URL that can be used to access the resource in 'aUrl'.
|
||||
nsresult AddResource(mozilla::MediaResource* aResource, nsCString& aUrl);
|
||||
|
||||
// Remove a MediaResource so it is no longer served by this server.
|
||||
// The URL provided must match exactly that provided by a previous
|
||||
// call to "AddResource".
|
||||
void RemoveResource(nsCString const& aUrl);
|
||||
|
||||
// Returns the prefix for HTTP requests to the server. This plus
|
||||
// the result of AddResource results in an Absolute URL.
|
||||
nsCString GetURLPrefix();
|
||||
|
||||
// Returns the resource asociated with a given URL
|
||||
already_AddRefed<mozilla::MediaResource> GetResource(nsCString const& aUrl);
|
||||
};
|
||||
|
||||
} // namespace mozilla
|
||||
|
||||
#endif
|
|
@ -11,12 +11,14 @@ EXPORTS += [
|
|||
'MediaPluginDecoder.h',
|
||||
'MediaPluginHost.h',
|
||||
'MediaPluginReader.h',
|
||||
'MediaResourceServer.h',
|
||||
]
|
||||
|
||||
CPP_SOURCES += [
|
||||
'MediaPluginDecoder.cpp',
|
||||
'MediaPluginHost.cpp',
|
||||
'MediaPluginReader.cpp',
|
||||
'MediaResourceServer.cpp',
|
||||
]
|
||||
|
||||
LIBRARY_NAME = 'gkconmediaplugins_s'
|
||||
|
|
|
@ -127,6 +127,7 @@ MOCHITEST_FILES = \
|
|||
test_decoder_disable.html \
|
||||
test_mediarecorder_record_no_timeslice.html \
|
||||
test_mediarecorder_reload_crash.html \
|
||||
test_mediarecorder_record_immediate_stop.html \
|
||||
test_media_selection.html \
|
||||
test_playback.html \
|
||||
test_seekLies.html \
|
||||
|
|
|
@ -0,0 +1,113 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Test MediaRecorder Immediate Stop</title>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
<script type="text/javascript" src="manifest.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<pre id="test">
|
||||
<script class="testbody" type="text/javascript">
|
||||
var manager = new MediaTestManager;
|
||||
|
||||
/**
|
||||
* Stops the media recorder immediately after starting the recorder. This test
|
||||
* verifies whether the media recorder can handle this scenario nicely. The
|
||||
* return blob size should be greater than zero, but its duration would be zero
|
||||
* length when play.
|
||||
*/
|
||||
function startTest(test, token) {
|
||||
var element = document.createElement('audio');
|
||||
var expectedMimeType = test.type.substring(0, test.type.indexOf(';'));
|
||||
|
||||
element.token = token;
|
||||
manager.started(token);
|
||||
|
||||
element.src = test.name;
|
||||
element.test = test;
|
||||
element.stream = element.mozCaptureStreamUntilEnded();
|
||||
|
||||
var mediaRecorder = new MediaRecorder(element.stream);
|
||||
var onStopFired = false;
|
||||
var onDataAvailableFired = false;
|
||||
|
||||
mediaRecorder.onerror = function () {
|
||||
ok(false, 'Unexpected onerror callback fired');
|
||||
};
|
||||
|
||||
mediaRecorder.onwarning = function () {
|
||||
ok(false, 'Unexpected onwarning callback fired');
|
||||
};
|
||||
|
||||
// This handler verifies that only a single onstop event handler is fired.
|
||||
mediaRecorder.onstop = function () {
|
||||
if (onStopFired) {
|
||||
ok(false, 'onstop unexpectedly fired more than once');
|
||||
} else {
|
||||
onStopFired = true;
|
||||
|
||||
// ondataavailable should always fire before onstop
|
||||
if (onDataAvailableFired) {
|
||||
manager.finished(token);
|
||||
} else {
|
||||
ok(false, 'onstop fired without an ondataavailable event first');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// This handler verifies that only a single ondataavailable event handler
|
||||
// is fired with the blob generated having greater than zero size
|
||||
// and a correct mime type.
|
||||
mediaRecorder.ondataavailable = function (evt) {
|
||||
if (onDataAvailableFired) {
|
||||
ok(false, 'ondataavailable unexpectedly fired more than once');
|
||||
} else {
|
||||
onDataAvailableFired = true;
|
||||
|
||||
ok(evt instanceof BlobEvent,
|
||||
'Events fired from ondataavailable should be BlobEvent');
|
||||
is(evt.type, 'dataavailable',
|
||||
'Event type should dataavailable');
|
||||
ok(evt.data.size > 0,
|
||||
'Blob data received should be greater than zero');
|
||||
is(evt.data.type, expectedMimeType,
|
||||
'Blob data received should have type = ' + expectedMimeType);
|
||||
|
||||
is(mediaRecorder.mimeType, expectedMimeType,
|
||||
'Mime type in ondataavailable = ' + expectedMimeType);
|
||||
|
||||
// onstop should not have fired before ondataavailable
|
||||
if (onStopFired) {
|
||||
ok(false, 'ondataavailable unexpectedly fired later than onstop');
|
||||
manager.finished(token);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// This handler completes a start and stop of recording and verifies
|
||||
// respective media recorder state.
|
||||
var canPlayThrough = function() {
|
||||
element.removeEventListener('canplaythrough', canPlayThrough, false);
|
||||
|
||||
mediaRecorder.start();
|
||||
is(mediaRecorder.state, 'recording', 'Media recorder should be recording');
|
||||
is(mediaRecorder.stream, element.stream,
|
||||
'Media recorder stream = element stream at the start of recording');
|
||||
|
||||
mediaRecorder.stop();
|
||||
is(mediaRecorder.state, 'inactive',
|
||||
'Media recorder is inactive after being stopped');
|
||||
is(mediaRecorder.stream, element.stream,
|
||||
'Media recorder stream = element stream post recording');
|
||||
};
|
||||
|
||||
element.addEventListener('canplaythrough', canPlayThrough, false);
|
||||
element.play();
|
||||
}
|
||||
|
||||
manager.runTests(gMediaRecorderTests, startTest);
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
|
@ -19,7 +19,6 @@ include $(topsrcdir)/ipc/chromium/chromium-config.mk
|
|||
ifdef MOZ_WEBRTC
|
||||
LOCAL_INCLUDES += \
|
||||
-I$(topsrcdir)/media/webrtc/trunk \
|
||||
-I$(topsrcdir)/media/webrtc/trunk/webrtc \
|
||||
-I$(topsrcdir)/media/webrtc/signaling/src/common \
|
||||
-I$(topsrcdir)/media/webrtc/signaling/src/common/browser_logging \
|
||||
-I$(topsrcdir)/dom/base \
|
||||
|
|
|
@ -30,21 +30,21 @@
|
|||
// WebRTC library includes follow
|
||||
|
||||
// Audio Engine
|
||||
#include "voice_engine/include/voe_base.h"
|
||||
#include "voice_engine/include/voe_codec.h"
|
||||
#include "voice_engine/include/voe_hardware.h"
|
||||
#include "voice_engine/include/voe_network.h"
|
||||
#include "voice_engine/include/voe_audio_processing.h"
|
||||
#include "voice_engine/include/voe_volume_control.h"
|
||||
#include "voice_engine/include/voe_external_media.h"
|
||||
#include "voice_engine/include/voe_audio_processing.h"
|
||||
#include "webrtc/voice_engine/include/voe_base.h"
|
||||
#include "webrtc/voice_engine/include/voe_codec.h"
|
||||
#include "webrtc/voice_engine/include/voe_hardware.h"
|
||||
#include "webrtc/voice_engine/include/voe_network.h"
|
||||
#include "webrtc/voice_engine/include/voe_audio_processing.h"
|
||||
#include "webrtc/voice_engine/include/voe_volume_control.h"
|
||||
#include "webrtc/voice_engine/include/voe_external_media.h"
|
||||
#include "webrtc/voice_engine/include/voe_audio_processing.h"
|
||||
|
||||
// Video Engine
|
||||
#include "video_engine/include/vie_base.h"
|
||||
#include "video_engine/include/vie_codec.h"
|
||||
#include "video_engine/include/vie_render.h"
|
||||
#include "video_engine/include/vie_capture.h"
|
||||
#include "video_engine/include/vie_file.h"
|
||||
#include "webrtc/video_engine/include/vie_base.h"
|
||||
#include "webrtc/video_engine/include/vie_codec.h"
|
||||
#include "webrtc/video_engine/include/vie_render.h"
|
||||
#include "webrtc/video_engine/include/vie_capture.h"
|
||||
#include "webrtc/video_engine/include/vie_file.h"
|
||||
#ifdef MOZ_B2G_CAMERA
|
||||
#include "CameraPreviewMediaStream.h"
|
||||
#include "DOMCameraManager.h"
|
||||
|
@ -301,9 +301,9 @@ public:
|
|||
}
|
||||
|
||||
// VoEMediaProcess.
|
||||
void Process(const int channel, const webrtc::ProcessingTypes type,
|
||||
WebRtc_Word16 audio10ms[], const int length,
|
||||
const int samplingFreq, const bool isStereo);
|
||||
void Process(int channel, webrtc::ProcessingTypes type,
|
||||
int16_t audio10ms[], int length,
|
||||
int samplingFreq, bool isStereo);
|
||||
|
||||
NS_DECL_THREADSAFE_ISUPPORTS
|
||||
|
||||
|
|
|
@ -343,12 +343,12 @@ MediaEngineWebRTCAudioSource::Shutdown()
|
|||
mInitDone = false;
|
||||
}
|
||||
|
||||
typedef WebRtc_Word16 sample;
|
||||
typedef int16_t sample;
|
||||
|
||||
void
|
||||
MediaEngineWebRTCAudioSource::Process(const int channel,
|
||||
const webrtc::ProcessingTypes type, sample* audio10ms,
|
||||
const int length, const int samplingFreq, const bool isStereo)
|
||||
MediaEngineWebRTCAudioSource::Process(int channel,
|
||||
webrtc::ProcessingTypes type, sample* audio10ms,
|
||||
int length, int samplingFreq, bool isStereo)
|
||||
{
|
||||
MonitorAutoLock lock(mMonitor);
|
||||
if (mState != kStarted)
|
||||
|
|
|
@ -184,8 +184,12 @@ function xpcWaitForFinishedFrames(callback, numFrames) {
|
|||
(win.document.body.textContent == body ||
|
||||
win.document.body.textContent == popup_body) &&
|
||||
win.document.readyState == "complete") {
|
||||
if (!contains(win, finishedWindows)) {
|
||||
finishedWindows.push(win);
|
||||
|
||||
var util = win.QueryInterface(SpecialPowers.Ci.nsIInterfaceRequestor)
|
||||
.getInterface(SpecialPowers.Ci.nsIDOMWindowUtils);
|
||||
var windowId = util.outerWindowID;
|
||||
if (!contains(windowId, finishedWindows)) {
|
||||
finishedWindows.push(windowId);
|
||||
frameFinished();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2335,8 +2335,8 @@ numericSuffixes = {
|
|||
IDLType.Tags.uint64: 'ULL',
|
||||
IDLType.Tags.unrestricted_float: 'F',
|
||||
IDLType.Tags.float: 'F',
|
||||
IDLType.Tags.unrestricted_double: 'D',
|
||||
IDLType.Tags.double: 'D'
|
||||
IDLType.Tags.unrestricted_double: '',
|
||||
IDLType.Tags.double: ''
|
||||
}
|
||||
|
||||
def numericValue(t, v):
|
||||
|
@ -2552,6 +2552,28 @@ class JSToNativeConversionInfo():
|
|||
self.declArgs = declArgs
|
||||
self.holderArgs = holderArgs
|
||||
|
||||
def getHandleDefault(defaultValue):
|
||||
tag = defaultValue.type.tag()
|
||||
if tag in numericSuffixes:
|
||||
# Some numeric literals require a suffix to compile without warnings
|
||||
return numericValue(tag, defaultValue.value)
|
||||
assert(tag == IDLType.Tags.bool)
|
||||
return toStringBool(defaultValue.value)
|
||||
|
||||
def handleDefaultStringValue(defaultValue, method):
|
||||
"""
|
||||
Returns a string which ends up calling 'method' with a (PRUnichar*, length)
|
||||
pair that sets this string default value. This string is suitable for
|
||||
passing as the second argument of handleDefault; in particular it does not
|
||||
end with a ';'
|
||||
"""
|
||||
assert defaultValue.type.isDOMString()
|
||||
return ("static const PRUnichar data[] = { %s };\n"
|
||||
"%s(data, ArrayLength(data) - 1)" %
|
||||
(", ".join(["'" + char + "'" for char in
|
||||
defaultValue.value] + ["0"]),
|
||||
method))
|
||||
|
||||
# If this function is modified, modify CGNativeMember.getArg and
|
||||
# CGNativeMember.getRetvalInfo accordingly. The latter cares about the decltype
|
||||
# and holdertype we end up using, because it needs to be able to return the code
|
||||
|
@ -2889,9 +2911,6 @@ for (uint32_t i = 0; i < length; ++i) {
|
|||
if nullable:
|
||||
type = type.inner
|
||||
|
||||
assert(defaultValue is None or
|
||||
(isinstance(defaultValue, IDLNullValue) and nullable))
|
||||
|
||||
unionArgumentObj = "${holderName}"
|
||||
if nullable:
|
||||
unionArgumentObj += ".ref()"
|
||||
|
@ -3095,15 +3114,36 @@ for (uint32_t i = 0; i < length; ++i) {
|
|||
holderArgs = "${declName}"
|
||||
constructHolder = None
|
||||
|
||||
if defaultValue and not isinstance(defaultValue, IDLNullValue):
|
||||
tag = defaultValue.type.tag()
|
||||
|
||||
if tag in numericSuffixes or tag is IDLType.Tags.bool:
|
||||
defaultStr = getHandleDefault(defaultValue)
|
||||
value = declLoc + (".Value()" if nullable else "")
|
||||
default = CGGeneric("%s.SetAs%s() = %s;" % (value,
|
||||
defaultValue.type,
|
||||
defaultStr))
|
||||
else:
|
||||
default = CGGeneric(
|
||||
handleDefaultStringValue(
|
||||
defaultValue, "%s.SetStringData" % unionArgumentObj) +
|
||||
";")
|
||||
|
||||
templateBody = CGIfElseWrapper("!(${haveValue})", default, templateBody)
|
||||
|
||||
templateBody = CGList([constructHolder, templateBody], "\n")
|
||||
|
||||
if nullable:
|
||||
if defaultValue:
|
||||
assert(isinstance(defaultValue, IDLNullValue))
|
||||
valueMissing = "!(${haveValue}) || "
|
||||
if isinstance(defaultValue, IDLNullValue):
|
||||
extraConditionForNull = "!(${haveValue}) || "
|
||||
else:
|
||||
extraConditionForNull = "${haveValue} && "
|
||||
else:
|
||||
valueMissing = ""
|
||||
extraConditionForNull = ""
|
||||
templateBody = handleNull(templateBody, declLoc,
|
||||
extraConditionForNull=valueMissing)
|
||||
extraConditionForNull=extraConditionForNull)
|
||||
|
||||
templateBody = CGList([constructDecl, templateBody], "\n")
|
||||
|
||||
return JSToNativeConversionInfo(templateBody.define(),
|
||||
|
@ -3349,14 +3389,11 @@ for (uint32_t i = 0; i < length; ++i) {
|
|||
|
||||
if isinstance(defaultValue, IDLNullValue):
|
||||
assert(type.nullable())
|
||||
return handleDefault(conversionCode,
|
||||
"%s.SetNull()" % varName)
|
||||
return handleDefault(
|
||||
conversionCode,
|
||||
("static const PRUnichar data[] = { %s };\n"
|
||||
"%s.SetData(data, ArrayLength(data) - 1)" %
|
||||
(", ".join(["'" + char + "'" for char in defaultValue.value] + ["0"]),
|
||||
varName)))
|
||||
defaultCode = "%s.SetNull()" % varName
|
||||
else:
|
||||
defaultCode = handleDefaultStringValue(defaultValue,
|
||||
"%s.SetData" % varName)
|
||||
return handleDefault(conversionCode, defaultCode)
|
||||
|
||||
if isMember:
|
||||
# We have to make a copy, because our jsval may well not
|
||||
|
@ -3692,18 +3729,11 @@ for (uint32_t i = 0; i < length; ++i) {
|
|||
# We already handled IDLNullValue, so just deal with the other ones
|
||||
not isinstance(defaultValue, IDLNullValue)):
|
||||
tag = defaultValue.type.tag()
|
||||
if tag in numericSuffixes:
|
||||
# Some numeric literals require a suffix to compile without warnings
|
||||
defaultStr = numericValue(tag, defaultValue.value)
|
||||
else:
|
||||
assert(tag == IDLType.Tags.bool)
|
||||
defaultStr = toStringBool(defaultValue.value)
|
||||
template = CGWrapper(CGIndenter(CGGeneric(template)),
|
||||
pre="if (${haveValue}) {\n",
|
||||
post=("\n"
|
||||
"} else {\n"
|
||||
" %s = %s;\n"
|
||||
"}" % (writeLoc, defaultStr))).define()
|
||||
defaultStr = getHandleDefault(defaultValue)
|
||||
template = CGIfElseWrapper("${haveValue}",
|
||||
CGGeneric(template),
|
||||
CGGeneric("%s = %s;" % (writeLoc,
|
||||
defaultStr))).define()
|
||||
|
||||
return JSToNativeConversionInfo(template, declType=declType,
|
||||
dealWithOptional=isOptional)
|
||||
|
@ -6109,11 +6139,11 @@ def getUnionTypeTemplateVars(unionType, type, descriptorProvider, isReturnValue=
|
|||
if type.isObject():
|
||||
body = ("mUnion.mValue.mObject.SetValue(cx, obj);\n"
|
||||
"mUnion.mType = mUnion.eObject;")
|
||||
setter = ClassMethod("SetToObject", "void",
|
||||
[Argument("JSContext*", "cx"),
|
||||
Argument("JSObject*", "obj")],
|
||||
inline=True, bodyInHeader=True,
|
||||
body=body)
|
||||
setters = [ClassMethod("SetToObject", "void",
|
||||
[Argument("JSContext*", "cx"),
|
||||
Argument("JSObject*", "obj")],
|
||||
inline=True, bodyInHeader=True,
|
||||
body=body)]
|
||||
|
||||
else:
|
||||
jsConversion = string.Template(conversionInfo.template).substitute(
|
||||
|
@ -6128,19 +6158,25 @@ def getUnionTypeTemplateVars(unionType, type, descriptorProvider, isReturnValue=
|
|||
pre="tryNext = false;\n",
|
||||
post="\n"
|
||||
"return true;")
|
||||
setter = ClassMethod("TrySetTo" + name, "bool",
|
||||
[Argument("JSContext*", "cx"),
|
||||
Argument("JS::Handle<JS::Value>", "value"),
|
||||
Argument("JS::MutableHandle<JS::Value>", "pvalue"),
|
||||
Argument("bool&", "tryNext")],
|
||||
inline=True, bodyInHeader=True,
|
||||
body=jsConversion.define())
|
||||
setters = [ClassMethod("TrySetTo" + name, "bool",
|
||||
[Argument("JSContext*", "cx"),
|
||||
Argument("JS::Handle<JS::Value>", "value"),
|
||||
Argument("JS::MutableHandle<JS::Value>", "pvalue"),
|
||||
Argument("bool&", "tryNext")],
|
||||
inline=True, bodyInHeader=True,
|
||||
body=jsConversion.define())]
|
||||
if type.isString():
|
||||
setters.append(ClassMethod("SetStringData", "void",
|
||||
[Argument("const nsDependentString::char_type*", "aData"),
|
||||
Argument("nsDependentString::size_type", "aLength")],
|
||||
inline=True, bodyInHeader=True,
|
||||
body="mStringHolder.SetData(aData, aLength);"))
|
||||
|
||||
return {
|
||||
"name": name,
|
||||
"structType": structType,
|
||||
"externalType": externalType,
|
||||
"setter": setter,
|
||||
"setters": setters,
|
||||
"holderType": conversionInfo.holderType.define() if conversionInfo.holderType else None,
|
||||
"ctorArgs": ctorArgs,
|
||||
"ctorArgList": [Argument("JSContext*", "cx")] if type.isSpiderMonkeyInterface() else []
|
||||
|
@ -6301,7 +6337,7 @@ class CGUnionConversionStruct(CGThing):
|
|||
for t in self.type.flatMemberTypes:
|
||||
vars = getUnionTypeTemplateVars(self.type,
|
||||
t, self.descriptorProvider)
|
||||
methods.append(vars["setter"])
|
||||
methods.extend(vars["setters"])
|
||||
if vars["name"] != "Object":
|
||||
body=string.Template("mUnion.mType = mUnion.e${name};\n"
|
||||
"return mUnion.mValue.m${name}.SetValue(${ctorArgs});").substitute(vars)
|
||||
|
|
|
@ -2386,16 +2386,28 @@ class IDLValue(IDLObject):
|
|||
if type == self.type:
|
||||
return self # Nothing to do
|
||||
|
||||
# We first check for unions to ensure that even if the union is nullable
|
||||
# we end up with the right flat member type, not the union's type.
|
||||
if type.isUnion():
|
||||
for subtype in type.unroll().memberTypes:
|
||||
try:
|
||||
coercedValue = self.coerceToType(subtype, location)
|
||||
# Create a new IDLValue to make sure that we have the
|
||||
# correct float/double type. This is necessary because we
|
||||
# use the value's type when it is a default value of a
|
||||
# union, and the union cares about the exact float type.
|
||||
return IDLValue(self.location, subtype, coercedValue.value)
|
||||
except:
|
||||
pass
|
||||
# If the type allows null, rerun this matching on the inner type, except
|
||||
# nullable enums. We handle those specially, because we want our
|
||||
# default string values to stay strings even when assigned to a nullable
|
||||
# enum.
|
||||
if type.nullable() and not type.isEnum():
|
||||
elif type.nullable() and not type.isEnum():
|
||||
innerValue = self.coerceToType(type.inner, location)
|
||||
return IDLValue(self.location, type, innerValue.value)
|
||||
|
||||
# Else, see if we can coerce to 'type'.
|
||||
if self.type.isInteger() and type.isInteger():
|
||||
elif self.type.isInteger() and type.isInteger():
|
||||
# We're both integer types. See if we fit.
|
||||
|
||||
(min, max) = integerTypeSizes[type._typeTag]
|
||||
|
@ -2428,9 +2440,8 @@ class IDLValue(IDLObject):
|
|||
raise WebIDLError("Trying to convert unrestricted value %s to non-unrestricted"
|
||||
% self.value, [location]);
|
||||
return self
|
||||
else:
|
||||
raise WebIDLError("Cannot coerce type %s to type %s." %
|
||||
(self.type, type), [location])
|
||||
raise WebIDLError("Cannot coerce type %s to type %s." %
|
||||
(self.type, type), [location])
|
||||
|
||||
def _getDependentObjects(self):
|
||||
return set()
|
||||
|
|
|
@ -513,6 +513,34 @@ public:
|
|||
//void PassUnionWithCallback(JSContext*, const TestCallbackOrLong&);
|
||||
void PassUnionWithObject(JSContext*, const ObjectOrLong&);
|
||||
|
||||
void PassUnionWithDefaultValue1(const DoubleOrString& arg);
|
||||
void PassUnionWithDefaultValue2(const DoubleOrString& arg);
|
||||
void PassUnionWithDefaultValue3(const DoubleOrString& arg);
|
||||
void PassUnionWithDefaultValue4(const FloatOrString& arg);
|
||||
void PassUnionWithDefaultValue5(const FloatOrString& arg);
|
||||
void PassUnionWithDefaultValue6(const FloatOrString& arg);
|
||||
void PassUnionWithDefaultValue7(const UnrestrictedDoubleOrString& arg);
|
||||
void PassUnionWithDefaultValue8(const UnrestrictedDoubleOrString& arg);
|
||||
void PassUnionWithDefaultValue9(const UnrestrictedDoubleOrString& arg);
|
||||
void PassUnionWithDefaultValue10(const UnrestrictedDoubleOrString& arg);
|
||||
void PassUnionWithDefaultValue11(const UnrestrictedFloatOrString& arg);
|
||||
void PassUnionWithDefaultValue12(const UnrestrictedFloatOrString& arg);
|
||||
void PassUnionWithDefaultValue13(const UnrestrictedFloatOrString& arg);
|
||||
void PassUnionWithDefaultValue14(const UnrestrictedFloatOrString& arg);
|
||||
|
||||
void PassNullableUnionWithDefaultValue1(const Nullable<DoubleOrString>& arg);
|
||||
void PassNullableUnionWithDefaultValue2(const Nullable<DoubleOrString>& arg);
|
||||
void PassNullableUnionWithDefaultValue3(const Nullable<DoubleOrString>& arg);
|
||||
void PassNullableUnionWithDefaultValue4(const Nullable<FloatOrString>& arg);
|
||||
void PassNullableUnionWithDefaultValue5(const Nullable<FloatOrString>& arg);
|
||||
void PassNullableUnionWithDefaultValue6(const Nullable<FloatOrString>& arg);
|
||||
void PassNullableUnionWithDefaultValue7(const Nullable<UnrestrictedDoubleOrString>& arg);
|
||||
void PassNullableUnionWithDefaultValue8(const Nullable<UnrestrictedDoubleOrString>& arg);
|
||||
void PassNullableUnionWithDefaultValue9(const Nullable<UnrestrictedDoubleOrString>& arg);
|
||||
void PassNullableUnionWithDefaultValue10(const Nullable<UnrestrictedFloatOrString>& arg);
|
||||
void PassNullableUnionWithDefaultValue11(const Nullable<UnrestrictedFloatOrString>& arg);
|
||||
void PassNullableUnionWithDefaultValue12(const Nullable<UnrestrictedFloatOrString>& arg);
|
||||
|
||||
void ReceiveUnion(const CanvasPatternOrCanvasGradientReturnValue&);
|
||||
void ReceiveUnionContainingNull(const CanvasPatternOrNullOrCanvasGradientReturnValue&);
|
||||
void ReceiveNullableUnion(const Nullable<CanvasPatternOrCanvasGradientReturnValue>&);
|
||||
|
|
|
@ -466,6 +466,33 @@ interface TestInterface {
|
|||
void passUnionWithObject((object or long) arg);
|
||||
//void passUnionWithDict((Dict or long) arg);
|
||||
|
||||
void passUnionWithDefaultValue1(optional (double or DOMString) arg = "");
|
||||
void passUnionWithDefaultValue2(optional (double or DOMString) arg = 1);
|
||||
void passUnionWithDefaultValue3(optional (double or DOMString) arg = 1.5);
|
||||
void passUnionWithDefaultValue4(optional (float or DOMString) arg = "");
|
||||
void passUnionWithDefaultValue5(optional (float or DOMString) arg = 1);
|
||||
void passUnionWithDefaultValue6(optional (float or DOMString) arg = 1.5);
|
||||
void passUnionWithDefaultValue7(optional (unrestricted double or DOMString) arg = "");
|
||||
void passUnionWithDefaultValue8(optional (unrestricted double or DOMString) arg = 1);
|
||||
void passUnionWithDefaultValue9(optional (unrestricted double or DOMString) arg = 1.5);
|
||||
void passUnionWithDefaultValue10(optional (unrestricted double or DOMString) arg = Infinity);
|
||||
void passUnionWithDefaultValue11(optional (unrestricted float or DOMString) arg = "");
|
||||
void passUnionWithDefaultValue12(optional (unrestricted float or DOMString) arg = 1);
|
||||
void passUnionWithDefaultValue13(optional (unrestricted float or DOMString) arg = Infinity);
|
||||
|
||||
void passNullableUnionWithDefaultValue1(optional (double or DOMString)? arg = "");
|
||||
void passNullableUnionWithDefaultValue2(optional (double or DOMString)? arg = 1);
|
||||
void passNullableUnionWithDefaultValue3(optional (double or DOMString)? arg = null);
|
||||
void passNullableUnionWithDefaultValue4(optional (float or DOMString)? arg = "");
|
||||
void passNullableUnionWithDefaultValue5(optional (float or DOMString)? arg = 1);
|
||||
void passNullableUnionWithDefaultValue6(optional (float or DOMString)? arg = null);
|
||||
void passNullableUnionWithDefaultValue7(optional (unrestricted double or DOMString)? arg = "");
|
||||
void passNullableUnionWithDefaultValue8(optional (unrestricted double or DOMString)? arg = 1);
|
||||
void passNullableUnionWithDefaultValue9(optional (unrestricted double or DOMString)? arg = null);
|
||||
void passNullableUnionWithDefaultValue10(optional (unrestricted float or DOMString)? arg = "");
|
||||
void passNullableUnionWithDefaultValue11(optional (unrestricted float or DOMString)? arg = 1);
|
||||
void passNullableUnionWithDefaultValue12(optional (unrestricted float or DOMString)? arg = null);
|
||||
|
||||
(CanvasPattern or CanvasGradient) receiveUnion();
|
||||
(CanvasPattern? or CanvasGradient) receiveUnionContainingNull();
|
||||
(CanvasPattern or CanvasGradient)? receiveNullableUnion();
|
||||
|
|
|
@ -362,6 +362,33 @@ interface TestExampleInterface {
|
|||
void passUnionWithObject((object or long) arg);
|
||||
//void passUnionWithDict((Dict or long) arg);
|
||||
|
||||
void passUnionWithDefaultValue1(optional (double or DOMString) arg = "");
|
||||
void passUnionWithDefaultValue2(optional (double or DOMString) arg = 1);
|
||||
void passUnionWithDefaultValue3(optional (double or DOMString) arg = 1.5);
|
||||
void passUnionWithDefaultValue4(optional (float or DOMString) arg = "");
|
||||
void passUnionWithDefaultValue5(optional (float or DOMString) arg = 1);
|
||||
void passUnionWithDefaultValue6(optional (float or DOMString) arg = 1.5);
|
||||
void passUnionWithDefaultValue7(optional (unrestricted double or DOMString) arg = "");
|
||||
void passUnionWithDefaultValue8(optional (unrestricted double or DOMString) arg = 1);
|
||||
void passUnionWithDefaultValue9(optional (unrestricted double or DOMString) arg = 1.5);
|
||||
void passUnionWithDefaultValue10(optional (unrestricted double or DOMString) arg = Infinity);
|
||||
void passUnionWithDefaultValue11(optional (unrestricted float or DOMString) arg = "");
|
||||
void passUnionWithDefaultValue12(optional (unrestricted float or DOMString) arg = 1);
|
||||
void passUnionWithDefaultValue13(optional (unrestricted float or DOMString) arg = Infinity);
|
||||
|
||||
void passNullableUnionWithDefaultValue1(optional (double or DOMString)? arg = "");
|
||||
void passNullableUnionWithDefaultValue2(optional (double or DOMString)? arg = 1);
|
||||
void passNullableUnionWithDefaultValue3(optional (double or DOMString)? arg = null);
|
||||
void passNullableUnionWithDefaultValue4(optional (float or DOMString)? arg = "");
|
||||
void passNullableUnionWithDefaultValue5(optional (float or DOMString)? arg = 1);
|
||||
void passNullableUnionWithDefaultValue6(optional (float or DOMString)? arg = null);
|
||||
void passNullableUnionWithDefaultValue7(optional (unrestricted double or DOMString)? arg = "");
|
||||
void passNullableUnionWithDefaultValue8(optional (unrestricted double or DOMString)? arg = 1);
|
||||
void passNullableUnionWithDefaultValue9(optional (unrestricted double or DOMString)? arg = null);
|
||||
void passNullableUnionWithDefaultValue10(optional (unrestricted float or DOMString)? arg = "");
|
||||
void passNullableUnionWithDefaultValue11(optional (unrestricted float or DOMString)? arg = 1);
|
||||
void passNullableUnionWithDefaultValue12(optional (unrestricted float or DOMString)? arg = null);
|
||||
|
||||
//(CanvasPattern or CanvasGradient) receiveUnion();
|
||||
//(CanvasPattern? or CanvasGradient) receiveUnionContainingNull();
|
||||
//(CanvasPattern or CanvasGradient)? receiveNullableUnion();
|
||||
|
|
|
@ -386,6 +386,33 @@ interface TestJSImplInterface {
|
|||
void passUnionWithObject((object or long) arg);
|
||||
//void passUnionWithDict((Dict or long) arg);
|
||||
|
||||
void passUnionWithDefaultValue1(optional (double or DOMString) arg = "");
|
||||
void passUnionWithDefaultValue2(optional (double or DOMString) arg = 1);
|
||||
void passUnionWithDefaultValue3(optional (double or DOMString) arg = 1.5);
|
||||
void passUnionWithDefaultValue4(optional (float or DOMString) arg = "");
|
||||
void passUnionWithDefaultValue5(optional (float or DOMString) arg = 1);
|
||||
void passUnionWithDefaultValue6(optional (float or DOMString) arg = 1.5);
|
||||
void passUnionWithDefaultValue7(optional (unrestricted double or DOMString) arg = "");
|
||||
void passUnionWithDefaultValue8(optional (unrestricted double or DOMString) arg = 1);
|
||||
void passUnionWithDefaultValue9(optional (unrestricted double or DOMString) arg = 1.5);
|
||||
void passUnionWithDefaultValue10(optional (unrestricted double or DOMString) arg = Infinity);
|
||||
void passUnionWithDefaultValue11(optional (unrestricted float or DOMString) arg = "");
|
||||
void passUnionWithDefaultValue12(optional (unrestricted float or DOMString) arg = 1);
|
||||
void passUnionWithDefaultValue13(optional (unrestricted float or DOMString) arg = Infinity);
|
||||
|
||||
void passNullableUnionWithDefaultValue1(optional (double or DOMString)? arg = "");
|
||||
void passNullableUnionWithDefaultValue2(optional (double or DOMString)? arg = 1);
|
||||
void passNullableUnionWithDefaultValue3(optional (double or DOMString)? arg = null);
|
||||
void passNullableUnionWithDefaultValue4(optional (float or DOMString)? arg = "");
|
||||
void passNullableUnionWithDefaultValue5(optional (float or DOMString)? arg = 1);
|
||||
void passNullableUnionWithDefaultValue6(optional (float or DOMString)? arg = null);
|
||||
void passNullableUnionWithDefaultValue7(optional (unrestricted double or DOMString)? arg = "");
|
||||
void passNullableUnionWithDefaultValue8(optional (unrestricted double or DOMString)? arg = 1);
|
||||
void passNullableUnionWithDefaultValue9(optional (unrestricted double or DOMString)? arg = null);
|
||||
void passNullableUnionWithDefaultValue10(optional (unrestricted float or DOMString)? arg = "");
|
||||
void passNullableUnionWithDefaultValue11(optional (unrestricted float or DOMString)? arg = 1);
|
||||
void passNullableUnionWithDefaultValue12(optional (unrestricted float or DOMString)? arg = null);
|
||||
|
||||
//(CanvasPattern or CanvasGradient) receiveUnion();
|
||||
//(CanvasPattern? or CanvasGradient) receiveUnionContainingNull();
|
||||
//(CanvasPattern or CanvasGradient)? receiveNullableUnion();
|
||||
|
|
|
@ -15,7 +15,7 @@ include $(topsrcdir)/dom/dom-config.mk
|
|||
|
||||
ifdef MOZ_WEBRTC
|
||||
LOCAL_INCLUDES += \
|
||||
-I$(topsrcdir)/media/webrtc/trunk/webrtc \
|
||||
-I$(topsrcdir)/media/webrtc/trunk \
|
||||
-I$(topsrcdir)/media/webrtc/signaling/src/common \
|
||||
$(NULL)
|
||||
endif
|
||||
|
|
|
@ -260,17 +260,6 @@ PluginPRLibrary::AsyncSetWindow(NPP instance, NPWindow* window)
|
|||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
#if defined(MOZ_WIDGET_QT) && (MOZ_PLATFORM_MAEMO == 6)
|
||||
nsresult
|
||||
PluginPRLibrary::HandleGUIEvent(NPP instance, const nsGUIEvent& anEvent,
|
||||
bool* handled)
|
||||
{
|
||||
nsNPAPIPluginInstance* inst = (nsNPAPIPluginInstance*)instance->ndata;
|
||||
NS_ENSURE_TRUE(inst, NS_ERROR_NULL_POINTER);
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
#endif
|
||||
|
||||
nsresult
|
||||
PluginPRLibrary::GetImageContainer(NPP instance, ImageContainer** aContainer)
|
||||
{
|
||||
|
|
|
@ -121,11 +121,6 @@ public:
|
|||
const nsIntRect&, gfxContext** aCtx) MOZ_OVERRIDE;
|
||||
virtual nsresult EndUpdateBackground(NPP instance,
|
||||
gfxContext* aCtx, const nsIntRect&) MOZ_OVERRIDE;
|
||||
#if defined(MOZ_WIDGET_QT) && (MOZ_PLATFORM_MAEMO == 6)
|
||||
virtual nsresult HandleGUIEvent(NPP instance,
|
||||
const nsGUIEvent& anEvent, bool* handled);
|
||||
#endif
|
||||
|
||||
virtual void GetLibraryPath(nsACString& aPath) { aPath.Assign(mFilePath); }
|
||||
|
||||
private:
|
||||
|
|
|
@ -386,9 +386,6 @@ typedef enum {
|
|||
, NPPVpluginCoreAnimationLayer = 1003
|
||||
#endif
|
||||
|
||||
#if defined(MOZ_PLATFORM_MAEMO) && ((MOZ_PLATFORM_MAEMO == 5) || (MOZ_PLATFORM_MAEMO == 6))
|
||||
, NPPVpluginWindowlessLocalBool = 2002
|
||||
#endif
|
||||
} NPPVariable;
|
||||
|
||||
/*
|
||||
|
@ -447,9 +444,6 @@ typedef enum {
|
|||
, NPNVsupportsCompositingCoreAnimationPluginsBool = 74656 /* TRUE if the browser supports
|
||||
CA model compositing */
|
||||
#endif
|
||||
#if defined(MOZ_PLATFORM_MAEMO) && ((MOZ_PLATFORM_MAEMO == 5) || (MOZ_PLATFORM_MAEMO == 6))
|
||||
, NPNVSupportsWindowlessLocal = 2002
|
||||
#endif
|
||||
} NPNVariable;
|
||||
|
||||
typedef enum {
|
||||
|
|
|
@ -1203,23 +1203,6 @@ nsNPAPIPluginInstance::AsyncSetWindow(NPWindow* window)
|
|||
return library->AsyncSetWindow(&mNPP, window);
|
||||
}
|
||||
|
||||
#if defined(MOZ_WIDGET_QT) && (MOZ_PLATFORM_MAEMO == 6)
|
||||
nsresult
|
||||
nsNPAPIPluginInstance::HandleGUIEvent(const nsGUIEvent& anEvent, bool* handled)
|
||||
{
|
||||
if (RUNNING != mRunning) {
|
||||
*handled = false;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
AutoPluginLibraryCall library(this);
|
||||
if (!library)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
return library->HandleGUIEvent(&mNPP, anEvent, handled);
|
||||
}
|
||||
#endif
|
||||
|
||||
nsresult
|
||||
nsNPAPIPluginInstance::GetImageContainer(ImageContainer**aContainer)
|
||||
{
|
||||
|
|
|
@ -118,9 +118,6 @@ public:
|
|||
nsPluginInstanceOwner* GetOwner();
|
||||
void SetOwner(nsPluginInstanceOwner *aOwner);
|
||||
nsresult ShowStatus(const char* message);
|
||||
#if defined(MOZ_WIDGET_QT) && (MOZ_PLATFORM_MAEMO == 6)
|
||||
nsresult HandleGUIEvent(const nsGUIEvent& anEvent, bool* handled);
|
||||
#endif
|
||||
|
||||
nsNPAPIPlugin* GetPlugin();
|
||||
|
||||
|
|
|
@ -1798,24 +1798,6 @@ nsresult nsPluginInstanceOwner::DispatchFocusToPlugin(nsIDOMEvent* aFocusEvent)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
#if defined(MOZ_WIDGET_QT) && (MOZ_PLATFORM_MAEMO == 6)
|
||||
nsresult nsPluginInstanceOwner::Text(nsIDOMEvent* aTextEvent)
|
||||
{
|
||||
if (mInstance) {
|
||||
nsEvent *event = aTextEvent->GetInternalNSEvent();
|
||||
if (event && event->eventStructType == NS_TEXT_EVENT) {
|
||||
nsEventStatus rv = ProcessEvent(*static_cast<nsGUIEvent*>(event));
|
||||
if (nsEventStatus_eConsumeNoDefault == rv) {
|
||||
aTextEvent->PreventDefault();
|
||||
aTextEvent->StopPropagation();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
nsresult nsPluginInstanceOwner::ProcessKeyPress(nsIDOMEvent* aKeyEvent)
|
||||
{
|
||||
#ifdef XP_MACOSX
|
||||
|
@ -1953,11 +1935,6 @@ nsPluginInstanceOwner::HandleEvent(nsIDOMEvent* aEvent)
|
|||
if (eventType.EqualsLiteral("keypress")) {
|
||||
return ProcessKeyPress(aEvent);
|
||||
}
|
||||
#if defined(MOZ_WIDGET_QT) && (MOZ_PLATFORM_MAEMO == 6)
|
||||
if (eventType.EqualsLiteral("text")) {
|
||||
return Text(aEvent);
|
||||
}
|
||||
#endif
|
||||
|
||||
nsCOMPtr<nsIDOMDragEvent> dragEvent(do_QueryInterface(aEvent));
|
||||
if (dragEvent && mInstance) {
|
||||
|
@ -2396,29 +2373,10 @@ nsEventStatus nsPluginInstanceOwner::ProcessEvent(const nsGUIEvent& anEvent)
|
|||
// DOMKeyCodeToGdkKeyCode(keyEvent.keyCode) and
|
||||
// gdk_keymap_get_entries_for_keyval will be useful, but the
|
||||
// mappings will not be unique.
|
||||
#if defined(MOZ_WIDGET_QT) && (MOZ_PLATFORM_MAEMO == 6)
|
||||
bool handled;
|
||||
if (NS_SUCCEEDED(mInstance->HandleGUIEvent(anEvent, &handled)) &&
|
||||
handled) {
|
||||
rv = nsEventStatus_eConsumeNoDefault;
|
||||
}
|
||||
#else
|
||||
NS_WARNING("Synthesized key event not sent to plugin");
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
|
||||
#if defined(MOZ_WIDGET_QT) && (MOZ_PLATFORM_MAEMO == 6)
|
||||
case NS_TEXT_EVENT:
|
||||
{
|
||||
bool handled;
|
||||
if (NS_SUCCEEDED(mInstance->HandleGUIEvent(anEvent, &handled)) &&
|
||||
handled) {
|
||||
rv = nsEventStatus_eConsumeNoDefault;
|
||||
}
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
switch (anEvent.message)
|
||||
{
|
||||
|
@ -2582,9 +2540,6 @@ nsPluginInstanceOwner::Destroy()
|
|||
mContent->RemoveEventListener(NS_LITERAL_STRING("dragstart"), this, true);
|
||||
mContent->RemoveEventListener(NS_LITERAL_STRING("draggesture"), this, true);
|
||||
mContent->RemoveEventListener(NS_LITERAL_STRING("dragend"), this, true);
|
||||
#if defined(MOZ_WIDGET_QT) && (MOZ_PLATFORM_MAEMO == 6)
|
||||
mContent->RemoveEventListener(NS_LITERAL_STRING("text"), this, true);
|
||||
#endif
|
||||
|
||||
#if MOZ_WIDGET_ANDROID
|
||||
RemovePluginView();
|
||||
|
@ -3011,9 +2966,6 @@ nsresult nsPluginInstanceOwner::Init(nsIContent* aContent)
|
|||
mContent->AddEventListener(NS_LITERAL_STRING("dragstart"), this, true);
|
||||
mContent->AddEventListener(NS_LITERAL_STRING("draggesture"), this, true);
|
||||
mContent->AddEventListener(NS_LITERAL_STRING("dragend"), this, true);
|
||||
#if defined(MOZ_WIDGET_QT) && (MOZ_PLATFORM_MAEMO == 6)
|
||||
mContent->AddEventListener(NS_LITERAL_STRING("text"), this, true);
|
||||
#endif
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -83,10 +83,6 @@ public:
|
|||
|
||||
nsresult ProcessMouseDown(nsIDOMEvent* aKeyEvent);
|
||||
nsresult ProcessKeyPress(nsIDOMEvent* aKeyEvent);
|
||||
#if defined(MOZ_WIDGET_QT) && (MOZ_PLATFORM_MAEMO == 6)
|
||||
nsresult Text(nsIDOMEvent* aTextEvent);
|
||||
#endif
|
||||
|
||||
nsresult Destroy();
|
||||
|
||||
#ifdef XP_WIN
|
||||
|
|
|
@ -139,11 +139,6 @@ child:
|
|||
// refer to the existing background or a fresh descriptor.
|
||||
async UpdateBackground(SurfaceDescriptor background, nsIntRect rect);
|
||||
|
||||
rpc HandleTextEvent(nsTextEvent event)
|
||||
returns (bool handled);
|
||||
rpc HandleKeyEvent(nsKeyEvent event)
|
||||
returns (bool handled);
|
||||
|
||||
async NPP_DidComposite();
|
||||
|
||||
rpc NPP_Destroy()
|
||||
|
|
|
@ -4,15 +4,6 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#if defined(MOZ_WIDGET_QT) && (MOZ_PLATFORM_MAEMO == 6)
|
||||
#include <QEvent>
|
||||
#include <QKeyEvent>
|
||||
#include <QApplication>
|
||||
#include <QInputMethodEvent>
|
||||
#include "nsQtKeyUtils.h"
|
||||
#include "NestedLoopTimer.h"
|
||||
#endif
|
||||
|
||||
#include "PluginBackgroundDestroyer.h"
|
||||
#include "PluginInstanceChild.h"
|
||||
#include "PluginModuleChild.h"
|
||||
|
@ -151,9 +142,6 @@ PluginInstanceChild::PluginInstanceChild(const NPPluginFuncs* aPluginIface)
|
|||
, mDoAlphaExtraction(false)
|
||||
, mHasPainted(false)
|
||||
, mSurfaceDifferenceRect(0,0,0,0)
|
||||
#if (MOZ_PLATFORM_MAEMO == 5) || (MOZ_PLATFORM_MAEMO == 6)
|
||||
, mMaemoImageRendering(true)
|
||||
#endif
|
||||
{
|
||||
memset(&mWindow, 0, sizeof(mWindow));
|
||||
mWindow.type = NPWindowTypeWindow;
|
||||
|
@ -293,18 +281,6 @@ PluginInstanceChild::NPN_GetValue(NPNVariable aVar,
|
|||
|
||||
switch(aVar) {
|
||||
|
||||
#if (MOZ_PLATFORM_MAEMO == 5) || (MOZ_PLATFORM_MAEMO == 6)
|
||||
case NPNVSupportsWindowlessLocal: {
|
||||
#ifdef MOZ_WIDGET_QT
|
||||
const char *graphicsSystem = PR_GetEnv("MOZ_QT_GRAPHICSSYSTEM");
|
||||
// we should set local rendering to false in order to render X-Plugin
|
||||
// there is no possibility to change it later on maemo5 platform
|
||||
mMaemoImageRendering = (!(graphicsSystem && !strcmp(graphicsSystem, "native")));
|
||||
#endif
|
||||
*((NPBool*)aValue) = mMaemoImageRendering;
|
||||
return NPERR_NO_ERROR;
|
||||
}
|
||||
#endif
|
||||
#if defined(MOZ_X11)
|
||||
case NPNVToolkit:
|
||||
*((NPNToolkitType*)aValue) = NPNVGtk2;
|
||||
|
@ -2729,57 +2705,6 @@ PluginInstanceChild::RecvAsyncSetWindow(const gfxSurfaceType& aSurfaceType,
|
|||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
PluginInstanceChild::AnswerHandleKeyEvent(const nsKeyEvent& aKeyEvent,
|
||||
bool* handled)
|
||||
{
|
||||
AssertPluginThread();
|
||||
#if defined(MOZ_WIDGET_QT) && (MOZ_PLATFORM_MAEMO == 6)
|
||||
Qt::KeyboardModifiers modifier;
|
||||
if (aKeyEvent.IsShift())
|
||||
modifier |= Qt::ShiftModifier;
|
||||
if (aKeyEvent.IsControl())
|
||||
modifier |= Qt::ControlModifier;
|
||||
if (aKeyEvent.IsAlt())
|
||||
modifier |= Qt::AltModifier;
|
||||
if (aKeyEvent.IsMeta())
|
||||
modifier |= Qt::MetaModifier;
|
||||
|
||||
QEvent::Type type;
|
||||
if (aKeyEvent.message == NS_KEY_DOWN) {
|
||||
type = QEvent::KeyPress;
|
||||
} else if (aKeyEvent.message == NS_KEY_UP) {
|
||||
type = QEvent::KeyRelease;
|
||||
} else {
|
||||
*handled = false;
|
||||
return true;
|
||||
}
|
||||
QKeyEvent keyEv(type, DOMKeyCodeToQtKeyCode(aKeyEvent.keyCode), modifier);
|
||||
*handled = QApplication::sendEvent(qApp, &keyEv);
|
||||
#else
|
||||
NS_ERROR("Not implemented");
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
PluginInstanceChild::AnswerHandleTextEvent(const nsTextEvent& aEvent,
|
||||
bool* handled)
|
||||
{
|
||||
AssertPluginThread();
|
||||
#if defined(MOZ_WIDGET_QT) && (MOZ_PLATFORM_MAEMO == 6)
|
||||
QInputMethodEvent event;
|
||||
event.setCommitString(QString((const QChar*)aEvent.theText.get(),
|
||||
aEvent.theText.Length()));
|
||||
*handled = QApplication::sendEvent(qApp, &event);
|
||||
#else
|
||||
NS_ERROR("Not implemented");
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
PluginInstanceChild::DoAsyncSetWindow(const gfxSurfaceType& aSurfaceType,
|
||||
const NPRemoteWindow& aWindow,
|
||||
|
@ -2858,17 +2783,6 @@ PluginInstanceChild::CreateOptSurface(void)
|
|||
gfxASurface::ImageFormatRGB24;
|
||||
|
||||
#ifdef MOZ_X11
|
||||
#if (MOZ_PLATFORM_MAEMO == 5) || (MOZ_PLATFORM_MAEMO == 6)
|
||||
// On Maemo 5, we must send the Visibility event to activate the plugin
|
||||
if (mMaemoImageRendering) {
|
||||
NPEvent pluginEvent;
|
||||
XVisibilityEvent& visibilityEvent = pluginEvent.xvisibility;
|
||||
visibilityEvent.type = VisibilityNotify;
|
||||
visibilityEvent.display = 0;
|
||||
visibilityEvent.state = VisibilityUnobscured;
|
||||
mPluginIface->event(&mData, reinterpret_cast<void*>(&pluginEvent));
|
||||
}
|
||||
#endif
|
||||
Display* dpy = mWsInfo.display;
|
||||
Screen* screen = DefaultScreenOfDisplay(dpy);
|
||||
if (format == gfxASurface::ImageFormatRGB24 &&
|
||||
|
@ -2932,12 +2846,7 @@ PluginInstanceChild::MaybeCreatePlatformHelperSurface(void)
|
|||
}
|
||||
|
||||
#ifdef MOZ_X11
|
||||
#ifdef MOZ_PLATFORM_MAEMO
|
||||
// On maemo plugins support non-default visual rendering
|
||||
bool supportNonDefaultVisual = true;
|
||||
#else
|
||||
bool supportNonDefaultVisual = false;
|
||||
#endif
|
||||
Screen* screen = DefaultScreenOfDisplay(mWsInfo.display);
|
||||
Visual* defaultVisual = DefaultVisualOfScreen(screen);
|
||||
Visual* visual = nullptr;
|
||||
|
@ -2956,14 +2865,6 @@ PluginInstanceChild::MaybeCreatePlatformHelperSurface(void)
|
|||
mDoAlphaExtraction = mIsTransparent;
|
||||
}
|
||||
} else if (mCurrentSurface->GetType() == gfxASurface::SurfaceTypeImage) {
|
||||
#if (MOZ_PLATFORM_MAEMO == 5) || (MOZ_PLATFORM_MAEMO == 6)
|
||||
if (mMaemoImageRendering) {
|
||||
// No helper surface needed, when mMaemoImageRendering is TRUE.
|
||||
// we can rendering directly into image memory
|
||||
// with NPImageExpose Maemo5 NPAPI
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
// For image layer surface we should always create helper surface
|
||||
createHelperSurface = true;
|
||||
// Check if we can create helper surface with non-default visual
|
||||
|
@ -3120,22 +3021,6 @@ PluginInstanceChild::UpdateWindowAttributes(bool aForceSetWindow)
|
|||
needWindowUpdate = true;
|
||||
}
|
||||
}
|
||||
#if (MOZ_PLATFORM_MAEMO == 5) || (MOZ_PLATFORM_MAEMO == 6)
|
||||
else if (curSurface && curSurface->GetType() == gfxASurface::SurfaceTypeImage
|
||||
&& mMaemoImageRendering) {
|
||||
// For maemo5 we need to setup window/colormap to 0
|
||||
// and specify depth of image surface
|
||||
gfxImageSurface* img = static_cast<gfxImageSurface*>(curSurface.get());
|
||||
if (mWindow.window ||
|
||||
mWsInfo.depth != gfxUtils::ImageFormatToDepth(img->Format()) ||
|
||||
mWsInfo.colormap) {
|
||||
mWindow.window = nullptr;
|
||||
mWsInfo.depth = gfxUtils::ImageFormatToDepth(img->Format());
|
||||
mWsInfo.colormap = 0;
|
||||
needWindowUpdate = true;
|
||||
}
|
||||
}
|
||||
#endif // MAEMO
|
||||
#endif // MOZ_X11
|
||||
#ifdef XP_WIN
|
||||
HDC dc = NULL;
|
||||
|
@ -3218,46 +3103,6 @@ PluginInstanceChild::PaintRectToPlatformSurface(const nsIntRect& aRect,
|
|||
UpdateWindowAttributes();
|
||||
|
||||
#ifdef MOZ_X11
|
||||
#if (MOZ_PLATFORM_MAEMO == 5) || (MOZ_PLATFORM_MAEMO == 6)
|
||||
// On maemo5 we do support Image rendering NPAPI
|
||||
if (mMaemoImageRendering &&
|
||||
aSurface->GetType() == gfxASurface::SurfaceTypeImage) {
|
||||
aSurface->Flush();
|
||||
gfxImageSurface* image = static_cast<gfxImageSurface*>(aSurface);
|
||||
NPImageExpose imgExp;
|
||||
imgExp.depth = gfxUtils::ImageFormatToDepth(image->Format());
|
||||
imgExp.x = aRect.x;
|
||||
imgExp.y = aRect.y;
|
||||
imgExp.width = aRect.width;
|
||||
imgExp.height = aRect.height;
|
||||
imgExp.stride = image->Stride();
|
||||
imgExp.data = (char *)image->Data();
|
||||
imgExp.dataSize.width = image->Width();
|
||||
imgExp.dataSize.height = image->Height();
|
||||
imgExp.translateX = 0;
|
||||
imgExp.translateY = 0;
|
||||
imgExp.scaleX = 1;
|
||||
imgExp.scaleY = 1;
|
||||
NPEvent pluginEvent;
|
||||
XGraphicsExposeEvent& exposeEvent = pluginEvent.xgraphicsexpose;
|
||||
exposeEvent.type = GraphicsExpose;
|
||||
exposeEvent.display = 0;
|
||||
// Store imageExpose structure pointer as drawable member
|
||||
exposeEvent.drawable = (Drawable)&imgExp;
|
||||
exposeEvent.x = imgExp.x;
|
||||
exposeEvent.y = imgExp.y;
|
||||
exposeEvent.width = imgExp.width;
|
||||
exposeEvent.height = imgExp.height;
|
||||
exposeEvent.count = 0;
|
||||
// information not set:
|
||||
exposeEvent.serial = 0;
|
||||
exposeEvent.send_event = False;
|
||||
exposeEvent.major_code = 0;
|
||||
exposeEvent.minor_code = 0;
|
||||
mPluginIface->event(&mData, reinterpret_cast<void*>(&exposeEvent));
|
||||
aSurface->MarkDirty(gfxRect(aRect.x, aRect.y, aRect.width, aRect.height));
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
NS_ASSERTION(aSurface->GetType() == gfxASurface::SurfaceTypeXlib,
|
||||
"Non supported platform surface type");
|
||||
|
@ -3324,11 +3169,6 @@ PluginInstanceChild::PaintRectToSurface(const nsIntRect& aRect,
|
|||
}
|
||||
if (mHelperSurface) {
|
||||
// On X11 we can paint to non Xlib surface only with HelperSurface
|
||||
#if (MOZ_PLATFORM_MAEMO == 5) || (MOZ_PLATFORM_MAEMO == 6)
|
||||
// Don't use mHelperSurface if surface is image and mMaemoImageRendering is TRUE
|
||||
if (!mMaemoImageRendering ||
|
||||
renderSurface->GetType() != gfxASurface::SurfaceTypeImage)
|
||||
#endif
|
||||
renderSurface = mHelperSurface;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -100,11 +100,6 @@ protected:
|
|||
const NPRemoteWindow& aWindow,
|
||||
bool aIsAsync);
|
||||
|
||||
virtual bool
|
||||
AnswerHandleKeyEvent(const nsKeyEvent& aEvent, bool* handled);
|
||||
virtual bool
|
||||
AnswerHandleTextEvent(const nsTextEvent& aEvent, bool* handled);
|
||||
|
||||
virtual PPluginSurfaceChild* AllocPPluginSurfaceChild(const WindowsSharedMemoryHandle&,
|
||||
const gfxIntSize&, const bool&) {
|
||||
return new PPluginSurfaceChild();
|
||||
|
@ -598,9 +593,10 @@ private:
|
|||
// that surface here.
|
||||
nsRefPtr<gfxASurface> mHelperSurface;
|
||||
|
||||
// true when plugin does not support painting to ARGB32 surface
|
||||
// this is false for maemo platform, and false if plugin
|
||||
// supports NPPVpluginTransparentAlphaBool (which is not part of NPAPI yet)
|
||||
// true when plugin does not support painting to ARGB32
|
||||
// surface this is false if plugin supports
|
||||
// NPPVpluginTransparentAlphaBool (which is not part of
|
||||
// NPAPI yet)
|
||||
bool mDoAlphaExtraction;
|
||||
|
||||
// true when the plugin has painted at least once. We use this to ensure
|
||||
|
@ -612,12 +608,6 @@ private:
|
|||
// Used for reading back to current surface and syncing data,
|
||||
// in plugin coordinates.
|
||||
nsIntRect mSurfaceDifferenceRect;
|
||||
|
||||
#if (MOZ_PLATFORM_MAEMO == 5) || (MOZ_PLATFORM_MAEMO == 6)
|
||||
// Maemo5 Flash does not remember WindowlessLocal state
|
||||
// we should listen for NPP values negotiation and remember it
|
||||
bool mMaemoImageRendering;
|
||||
#endif
|
||||
};
|
||||
|
||||
} // namespace plugins
|
||||
|
|
|
@ -686,31 +686,6 @@ PluginInstanceParent::AsyncSetWindow(NPWindow* aWindow)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
#if defined(MOZ_WIDGET_QT) && (MOZ_PLATFORM_MAEMO == 6)
|
||||
nsresult
|
||||
PluginInstanceParent::HandleGUIEvent(const nsGUIEvent& anEvent, bool* handled)
|
||||
{
|
||||
switch (anEvent.eventStructType) {
|
||||
case NS_KEY_EVENT:
|
||||
if (!CallHandleKeyEvent(static_cast<const nsKeyEvent&>(anEvent),
|
||||
handled)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
break;
|
||||
case NS_TEXT_EVENT:
|
||||
if (!CallHandleTextEvent(static_cast<const nsTextEvent&>(anEvent),
|
||||
handled)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
NS_ERROR("Not implemented for this event type");
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
nsresult
|
||||
PluginInstanceParent::GetImageContainer(ImageContainer** aContainer)
|
||||
{
|
||||
|
|
|
@ -278,10 +278,6 @@ public:
|
|||
gfxContext** aCtx);
|
||||
nsresult EndUpdateBackground(gfxContext* aCtx,
|
||||
const nsIntRect& aRect);
|
||||
#if defined(MOZ_WIDGET_QT) && (MOZ_PLATFORM_MAEMO == 6)
|
||||
nsresult HandleGUIEvent(const nsGUIEvent& anEvent, bool* handled);
|
||||
#endif
|
||||
|
||||
void DidComposite() { unused << SendNPP_DidComposite(); }
|
||||
|
||||
private:
|
||||
|
|
|
@ -85,9 +85,6 @@ public:
|
|||
const nsIntRect&, gfxContext**) = 0;
|
||||
virtual nsresult EndUpdateBackground(NPP instance,
|
||||
gfxContext*, const nsIntRect&) = 0;
|
||||
#if defined(MOZ_WIDGET_QT) && (MOZ_PLATFORM_MAEMO == 6)
|
||||
virtual nsresult HandleGUIEvent(NPP instance, const nsGUIEvent&, bool*) = 0;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -169,14 +169,12 @@ PluginModuleChild::Init(const std::string& aPluginFilename,
|
|||
|
||||
nsPluginFile pluginFile(localFile);
|
||||
|
||||
// Maemo flash can render with any provided rectangle and so does not
|
||||
// require this quirk.
|
||||
#if (defined(MOZ_X11) && !defined(MOZ_PLATFORM_MAEMO)) || defined(OS_MACOSX)
|
||||
#if defined(MOZ_X11) || defined(OS_MACOSX)
|
||||
nsPluginInfo info = nsPluginInfo();
|
||||
if (NS_FAILED(pluginFile.GetPluginInfo(info, &mLibrary)))
|
||||
return false;
|
||||
|
||||
#if defined(MOZ_X11) && !defined(MOZ_PLATFORM_MAEMO)
|
||||
#if defined(MOZ_X11)
|
||||
NS_NAMED_LITERAL_CSTRING(flash10Head, "Shockwave Flash 10.");
|
||||
if (StringBeginsWith(nsDependentCString(info.fDescription), flash10Head)) {
|
||||
AddQuirk(QUIRK_FLASH_EXPOSE_COORD_TRANSLATION);
|
||||
|
|
|
@ -1115,20 +1115,6 @@ PluginModuleParent::AsyncSetWindow(NPP instance, NPWindow* window)
|
|||
return i->AsyncSetWindow(window);
|
||||
}
|
||||
|
||||
#if defined(MOZ_WIDGET_QT) && (MOZ_PLATFORM_MAEMO == 6)
|
||||
nsresult
|
||||
PluginModuleParent::HandleGUIEvent(NPP instance,
|
||||
const nsGUIEvent& anEvent,
|
||||
bool* handled)
|
||||
{
|
||||
PluginInstanceParent* i = InstCast(instance);
|
||||
if (!i)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
return i->HandleGUIEvent(anEvent, handled);
|
||||
}
|
||||
#endif
|
||||
|
||||
nsresult
|
||||
PluginModuleParent::GetImageContainer(NPP instance,
|
||||
mozilla::layers::ImageContainer** aContainer)
|
||||
|
|
|
@ -274,10 +274,6 @@ private:
|
|||
virtual nsresult IsRemoteDrawingCoreAnimation(NPP instance, bool *aDrawing);
|
||||
virtual nsresult ContentsScaleFactorChanged(NPP instance, double aContentsScaleFactor);
|
||||
#endif
|
||||
#if defined(MOZ_WIDGET_QT) && (MOZ_PLATFORM_MAEMO == 6)
|
||||
virtual nsresult HandleGUIEvent(NPP instance, const nsGUIEvent& anEvent,
|
||||
bool* handled);
|
||||
#endif
|
||||
|
||||
private:
|
||||
CrashReporterParent* CrashReporter();
|
||||
|
|
|
@ -16,11 +16,6 @@ LOCAL_INCLUDES = \
|
|||
-I$(topsrcdir)/content/events/src \
|
||||
$(NULL)
|
||||
|
||||
ifdef MOZ_MAEMO_LIBLOCATION
|
||||
LOCAL_INCLUDES += $(MOZ_PLATFORM_MAEMO_CFLAGS) \
|
||||
-I$(topsrcdir)/dom/system/unix \
|
||||
$(NULL)
|
||||
endif
|
||||
ifdef MOZ_ENABLE_QTMOBILITY
|
||||
LOCAL_INCLUDES += $(MOZ_QT_CFLAGS) \
|
||||
-I$(topsrcdir)/dom/system/unix \
|
||||
|
|
|
@ -27,10 +27,6 @@
|
|||
|
||||
class nsIPrincipal;
|
||||
|
||||
#ifdef MOZ_MAEMO_LIBLOCATION
|
||||
#include "MaemoLocationProvider.h"
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_ENABLE_QTMOBILITY
|
||||
#include "QTMLocationProvider.h"
|
||||
#endif
|
||||
|
@ -681,10 +677,6 @@ nsresult nsGeolocationService::Init()
|
|||
obs->AddObserver(this, "quit-application", false);
|
||||
obs->AddObserver(this, "mozsettings-changed", false);
|
||||
|
||||
#ifdef MOZ_MAEMO_LIBLOCATION
|
||||
mProvider = new MaemoLocationProvider();
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_ENABLE_QTMOBILITY
|
||||
mProvider = new QTMLocationProvider();
|
||||
#endif
|
||||
|
|
|
@ -1,251 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
#include "nsGeoPosition.h"
|
||||
#include "MaemoLocationProvider.h"
|
||||
#include "nsIClassInfo.h"
|
||||
#include "nsDOMClassInfoID.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
NS_IMPL_ISUPPORTS2(MaemoLocationProvider, nsIGeolocationProvider, nsITimerCallback)
|
||||
|
||||
MaemoLocationProvider::MaemoLocationProvider() :
|
||||
mLocationChanged(0),
|
||||
mControlError(0),
|
||||
mDeviceDisconnected(0),
|
||||
mControlStopped(0),
|
||||
mHasSeenLocation(false),
|
||||
mHasGPS(true),
|
||||
mGPSControl(nullptr),
|
||||
mGPSDevice(nullptr),
|
||||
mIgnoreMinorChanges(false),
|
||||
mPrevLat(0.0),
|
||||
mPrevLong(0.0),
|
||||
mIgnoreBigHErr(true),
|
||||
mMaxHErr(1000),
|
||||
mIgnoreBigVErr(true),
|
||||
mMaxVErr(100)
|
||||
{
|
||||
}
|
||||
|
||||
MaemoLocationProvider::~MaemoLocationProvider()
|
||||
{
|
||||
}
|
||||
|
||||
void MaemoLocationProvider::DeviceDisconnected(LocationGPSDevice* device, void* self)
|
||||
{
|
||||
}
|
||||
|
||||
void MaemoLocationProvider::ControlStopped(LocationGPSDControl* device, void* self)
|
||||
{
|
||||
MaemoLocationProvider* provider = static_cast<MaemoLocationProvider*>(self);
|
||||
provider->StartControl();
|
||||
}
|
||||
|
||||
void MaemoLocationProvider::ControlError(LocationGPSDControl* control, void* self)
|
||||
{
|
||||
}
|
||||
|
||||
void MaemoLocationProvider::LocationChanged(LocationGPSDevice* device, void* self)
|
||||
{
|
||||
if (!device || !device->fix)
|
||||
return;
|
||||
|
||||
guint32 &fields = device->fix->fields;
|
||||
if (!(fields & LOCATION_GPS_DEVICE_LATLONG_SET))
|
||||
return;
|
||||
|
||||
if (!(device->fix->eph && !isnan(device->fix->eph)))
|
||||
return;
|
||||
|
||||
MaemoLocationProvider* provider = static_cast<MaemoLocationProvider*>(self);
|
||||
NS_ENSURE_TRUE_VOID(provider);
|
||||
provider->LocationUpdate(device);
|
||||
}
|
||||
|
||||
nsresult
|
||||
MaemoLocationProvider::LocationUpdate(LocationGPSDevice* aDev)
|
||||
{
|
||||
double hErr = aDev->fix->eph/100;
|
||||
if (mIgnoreBigHErr && hErr > (double)mMaxHErr)
|
||||
hErr = (double)mMaxHErr;
|
||||
|
||||
double vErr = aDev->fix->epv/2;
|
||||
if (mIgnoreBigVErr && vErr > (double)mMaxVErr)
|
||||
vErr = (double)mMaxVErr;
|
||||
|
||||
double altitude = 0, speed = 0, track = 0;
|
||||
if (aDev->fix->epv && !isnan(aDev->fix->epv))
|
||||
altitude = aDev->fix->altitude;
|
||||
if (aDev->fix->eps && !isnan(aDev->fix->eps))
|
||||
speed = aDev->fix->speed;
|
||||
if (aDev->fix->epd && !isnan(aDev->fix->epd))
|
||||
track = aDev->fix->track;
|
||||
|
||||
#ifdef DEBUG
|
||||
double dist = location_distance_between(mPrevLat, mPrevLong, aDev->fix->latitude, aDev->fix->longitude)*1000;
|
||||
fprintf(stderr, "dist:%.9f, Lat: %.6f, Long:%.6f, HErr:%g, Alt:%.6f, VErr:%g, dir:%g[%g], sp:%g[%g]\n",
|
||||
dist, aDev->fix->latitude, aDev->fix->longitude,
|
||||
hErr, altitude,
|
||||
aDev->fix->epv/2, track, aDev->fix->epd,
|
||||
speed, aDev->fix->eps);
|
||||
mPrevLat = aDev->fix->latitude;
|
||||
mPrevLong = aDev->fix->longitude;
|
||||
#endif
|
||||
|
||||
nsRefPtr<nsGeoPosition> somewhere = new nsGeoPosition(aDev->fix->latitude,
|
||||
aDev->fix->longitude,
|
||||
altitude,
|
||||
hErr,
|
||||
vErr,
|
||||
track,
|
||||
speed,
|
||||
PR_Now());
|
||||
Update(somewhere);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
MaemoLocationProvider::Notify(nsITimer* aTimer)
|
||||
{
|
||||
LocationChanged(mGPSDevice, this);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
MaemoLocationProvider::StartControl()
|
||||
{
|
||||
if (mGPSControl)
|
||||
return NS_OK;
|
||||
|
||||
mGPSControl = location_gpsd_control_get_default();
|
||||
NS_ENSURE_TRUE(mGPSControl, NS_ERROR_FAILURE);
|
||||
|
||||
mControlError = g_signal_connect(mGPSControl, "error",
|
||||
G_CALLBACK(ControlError), this);
|
||||
|
||||
mControlStopped = g_signal_connect(mGPSControl, "gpsd_stopped",
|
||||
G_CALLBACK(ControlStopped), this);
|
||||
|
||||
location_gpsd_control_start(mGPSControl);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
MaemoLocationProvider::StartDevice()
|
||||
{
|
||||
if (mGPSDevice)
|
||||
return NS_OK;
|
||||
|
||||
mGPSDevice = (LocationGPSDevice*)g_object_new(LOCATION_TYPE_GPS_DEVICE, NULL);
|
||||
NS_ENSURE_TRUE(mGPSDevice, NS_ERROR_FAILURE);
|
||||
|
||||
mLocationChanged = g_signal_connect(mGPSDevice, "changed",
|
||||
G_CALLBACK(LocationChanged), this);
|
||||
|
||||
mDeviceDisconnected = g_signal_connect(mGPSDevice, "disconnected",
|
||||
G_CALLBACK(DeviceDisconnected), this);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP MaemoLocationProvider::Startup()
|
||||
{
|
||||
nsresult rv(NS_OK);
|
||||
|
||||
rv = StartControl();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = StartDevice();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
mIgnoreBigHErr =
|
||||
Preferences::GetBool("geo.herror.ignore.big", mIgnoreBigHErr);
|
||||
|
||||
if (mIgnoreBigHErr) {
|
||||
mMaxHErr = Preferences::GetInt("geo.herror.max.value", mMaxHErr);
|
||||
}
|
||||
|
||||
mIgnoreBigVErr =
|
||||
Preferences::GetBool("geo.verror.ignore.big", mIgnoreBigVErr);
|
||||
|
||||
if (mIgnoreBigVErr) {
|
||||
mMaxVErr = Preferences::GetInt("geo.verror.max.value", mMaxVErr);
|
||||
}
|
||||
|
||||
if (mUpdateTimer)
|
||||
return NS_OK;
|
||||
|
||||
// 0 second no timer created
|
||||
int32_t update = Preferences::GetInt("geo.default.update", 0);
|
||||
|
||||
if (!update)
|
||||
return NS_OK;
|
||||
|
||||
mUpdateTimer = do_CreateInstance("@mozilla.org/timer;1", &rv);
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
if (update)
|
||||
mUpdateTimer->InitWithCallback(this, update, nsITimer::TYPE_REPEATING_SLACK);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP MaemoLocationProvider::Watch(nsIGeolocationUpdate *callback)
|
||||
{
|
||||
if (mCallback)
|
||||
return NS_OK;
|
||||
|
||||
mCallback = callback;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP MaemoLocationProvider::Shutdown()
|
||||
{
|
||||
if (mUpdateTimer)
|
||||
mUpdateTimer->Cancel();
|
||||
|
||||
g_signal_handler_disconnect(mGPSDevice, mLocationChanged);
|
||||
g_signal_handler_disconnect(mGPSDevice, mDeviceDisconnected);
|
||||
|
||||
g_signal_handler_disconnect(mGPSDevice, mControlError);
|
||||
g_signal_handler_disconnect(mGPSDevice, mControlStopped);
|
||||
|
||||
mHasSeenLocation = false;
|
||||
mCallback = nullptr;
|
||||
|
||||
if (mGPSControl) {
|
||||
location_gpsd_control_stop(mGPSControl);
|
||||
g_object_unref(mGPSControl);
|
||||
mGPSControl = nullptr;
|
||||
}
|
||||
if (mGPSDevice) {
|
||||
g_object_unref(mGPSDevice);
|
||||
mGPSDevice = nullptr;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void MaemoLocationProvider::Update(nsIDOMGeoPosition* aPosition)
|
||||
{
|
||||
mHasSeenLocation = true;
|
||||
if (mCallback)
|
||||
mCallback->Update(aPosition);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
MaemoLocationProvider::SetHighAccuracy(bool)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
|
@ -1,85 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsCOMArray.h"
|
||||
#include "nsTArray.h"
|
||||
#include "nsITimer.h"
|
||||
#include "nsIObserver.h"
|
||||
#include "nsIURI.h"
|
||||
|
||||
#include "nsWeakPtr.h"
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
|
||||
#include "nsIDOMGeoGeolocation.h"
|
||||
#include "nsIDOMGeoPosition.h"
|
||||
#include "nsIDOMGeoPositionError.h"
|
||||
#include "nsIDOMGeoPositionCallback.h"
|
||||
#include "nsIDOMGeoPositionErrorCallback.h"
|
||||
#include "nsIDOMGeoPositionCoords.h"
|
||||
|
||||
#include "nsPIDOMWindow.h"
|
||||
|
||||
#include "nsIGeolocationProvider.h"
|
||||
|
||||
|
||||
extern "C"
|
||||
{
|
||||
#include <location/location-gps-device.h>
|
||||
#include <location/location-gpsd-control.h>
|
||||
#include <location/location-distance-utils.h>
|
||||
#include <location/location-misc.h>
|
||||
}
|
||||
|
||||
class MaemoLocationProvider : public nsIGeolocationProvider,
|
||||
public nsITimerCallback
|
||||
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIGEOLOCATIONPROVIDER
|
||||
NS_DECL_NSITIMERCALLBACK
|
||||
|
||||
MaemoLocationProvider();
|
||||
|
||||
void Update(nsIDOMGeoPosition* aPosition);
|
||||
|
||||
private:
|
||||
~MaemoLocationProvider();
|
||||
|
||||
nsresult StartControl();
|
||||
nsresult StartDevice();
|
||||
nsresult LocationUpdate(LocationGPSDevice* aDev);
|
||||
|
||||
static void DeviceDisconnected(LocationGPSDevice* device, void* self);
|
||||
static void ControlStopped(LocationGPSDControl* device, void* self);
|
||||
static void ControlError(LocationGPSDControl* control, void* self);
|
||||
static void LocationChanged(LocationGPSDevice* device, void* self);
|
||||
|
||||
gulong mLocationChanged;
|
||||
gulong mControlError;
|
||||
gulong mDeviceDisconnected;
|
||||
gulong mControlStopped;
|
||||
|
||||
nsCOMPtr<nsIGeolocationUpdate> mCallback;
|
||||
bool mHasSeenLocation;
|
||||
bool mHasGPS;
|
||||
|
||||
nsCOMPtr<nsITimer> mUpdateTimer;
|
||||
LocationGPSDControl* mGPSControl;
|
||||
LocationGPSDevice* mGPSDevice;
|
||||
|
||||
bool mIgnoreMinorChanges;
|
||||
|
||||
double mPrevLat;
|
||||
double mPrevLong;
|
||||
|
||||
bool mIgnoreBigHErr;
|
||||
int32_t mMaxHErr;
|
||||
bool mIgnoreBigVErr;
|
||||
int32_t mMaxVErr;
|
||||
|
||||
};
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче