mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Merge the last PGO-green inbound changeset to m-c.
This commit is contained in:
commit
81777c9d46
2
aclocal.m4
vendored
2
aclocal.m4
vendored
@ -17,6 +17,8 @@ builtin(include, build/autoconf/mozcommonheader.m4)dnl
|
||||
builtin(include, build/autoconf/acwinpaths.m4)dnl
|
||||
builtin(include, build/autoconf/lto.m4)dnl
|
||||
builtin(include, build/autoconf/gcc-pr49911.m4)dnl
|
||||
builtin(include, build/autoconf/gcc-pr39608.m4)dnl
|
||||
builtin(include, build/autoconf/llvm-pr8927.m4)dnl
|
||||
builtin(include, build/autoconf/frameptr.m4)dnl
|
||||
builtin(include, build/autoconf/compiler-opts.m4)dnl
|
||||
builtin(include, build/autoconf/expandlibs.m4)dnl
|
||||
|
@ -435,9 +435,17 @@ pref("marionette.defaultPrefs.port", 2828);
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_UPDATER
|
||||
// Timeout before the update prompt automatically installs the update
|
||||
pref("b2g.update.apply-prompt-timeout", 60000); // milliseconds
|
||||
// Optional timeout the user can wait before getting another update prompt
|
||||
pref("b2g.update.apply-wait-timeout", 1800000); // milliseconds
|
||||
// Amount of time the updater waits for the process to exit cleanly before
|
||||
// forcefully exiting the process
|
||||
pref("b2g.update.self-destruct-timeout", 5000); // milliseconds
|
||||
|
||||
pref("app.update.enabled", true);
|
||||
pref("app.update.auto", true);
|
||||
pref("app.update.silent", true);
|
||||
pref("app.update.auto", false);
|
||||
pref("app.update.silent", false);
|
||||
pref("app.update.mode", 0);
|
||||
pref("app.update.incompatible.mode", 0);
|
||||
pref("app.update.staging.enabled", true);
|
||||
|
@ -185,7 +185,7 @@ select > button {
|
||||
background-color: transparent;
|
||||
background-position: -15px center, 4px center !important;
|
||||
background-repeat: no-repeat, no-repeat !important;
|
||||
background-size: 100% 90%, normal normal;
|
||||
background-size: 100% 90%, auto auto;
|
||||
|
||||
-moz-binding: none !important;
|
||||
position: relative !important;
|
||||
|
@ -9,6 +9,7 @@ const Cc = Components.classes;
|
||||
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
Cu.import("resource://gre/modules/Webapps.jsm");
|
||||
|
||||
function ContentPermissionPrompt() {}
|
||||
|
||||
@ -52,13 +53,29 @@ ContentPermissionPrompt.prototype = {
|
||||
request.cancel();
|
||||
});
|
||||
|
||||
let principal = request.principal;
|
||||
let isApp = principal.appStatus != Ci.nsIPrincipal.APP_STATUS_NOT_INSTALLED;
|
||||
|
||||
let details = {
|
||||
"type": "permission-prompt",
|
||||
"permission": request.type,
|
||||
"id": requestId,
|
||||
"url": request.principal.URI.spec
|
||||
type: "permission-prompt",
|
||||
permission: request.type,
|
||||
id: requestId,
|
||||
origin: principal.origin,
|
||||
isApp: isApp
|
||||
};
|
||||
browser.shell.sendChromeEvent(details);
|
||||
|
||||
if (!isApp) {
|
||||
browser.shell.sendChromeEvent(details);
|
||||
return;
|
||||
}
|
||||
|
||||
// When it's an app, get the manifest to add the l10n application name.
|
||||
let app = DOMApplicationRegistry.getAppByLocalId(principal.appId);
|
||||
DOMApplicationRegistry.getManifestFor(app.origin, function getManifest(aManifest) {
|
||||
let helper = new DOMApplicationManifest(aManifest, app.origin);
|
||||
details.appName = helper.name;
|
||||
browser.shell.sendChromeEvent(details);
|
||||
});
|
||||
},
|
||||
|
||||
classID: Components.ID("{8c719f03-afe0-4aac-91ff-6c215895d467}"),
|
||||
|
@ -18,12 +18,28 @@ let log =
|
||||
function log_dump(msg) { dump("UpdatePrompt: "+ msg +"\n"); } :
|
||||
function log_noop(msg) { };
|
||||
|
||||
const APPLY_PROMPT_TIMEOUT =
|
||||
Services.prefs.getIntPref("b2g.update.apply-prompt-timeout");
|
||||
const APPLY_WAIT_TIMEOUT =
|
||||
Services.prefs.getIntPref("b2g.update.apply-wait-timeout");
|
||||
const SELF_DESTRUCT_TIMEOUT =
|
||||
Services.prefs.getIntPref("b2g.update.self-destruct-timeout");
|
||||
|
||||
XPCOMUtils.defineLazyServiceGetter(Services, "aus",
|
||||
"@mozilla.org/updates/update-service;1",
|
||||
"nsIApplicationUpdateService");
|
||||
|
||||
function UpdatePrompt() { }
|
||||
|
||||
UpdatePrompt.prototype = {
|
||||
classID: Components.ID("{88b3eb21-d072-4e3b-886d-f89d8c49fe59}"),
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsIUpdatePrompt]),
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsIUpdatePrompt,
|
||||
Ci.nsIRequestObserver,
|
||||
Ci.nsIProgressEventSink]),
|
||||
|
||||
_update: null,
|
||||
_applyPromptTimer: null,
|
||||
_applyWaitTimer: null,
|
||||
_selfDestructTimer: null,
|
||||
|
||||
// nsIUpdatePrompt
|
||||
@ -32,20 +48,146 @@ UpdatePrompt.prototype = {
|
||||
// updates when on a billed pipe. Initially, opt-in for 3g, but
|
||||
// that doesn't cover all cases.
|
||||
checkForUpdates: function UP_checkForUpdates() { },
|
||||
showUpdateAvailable: function UP_showUpdateAvailable(aUpdate) { },
|
||||
|
||||
showUpdateAvailable: function UP_showUpdateAvailable(aUpdate) {
|
||||
if (!this.sendUpdateEvent("update-available", aUpdate,
|
||||
this.handleAvailableResult)) {
|
||||
|
||||
log("Unable to prompt for available update, forcing download");
|
||||
this.downloadUpdate(aUpdate);
|
||||
}
|
||||
},
|
||||
|
||||
showUpdateDownloaded: function UP_showUpdateDownloaded(aUpdate, aBackground) {
|
||||
// FIXME/bug 737598: we should let the user request that the
|
||||
// update be applied later, e.g. if they're in the middle of a
|
||||
// phone call ;).
|
||||
if (!this.sendUpdateEvent("update-downloaded", aUpdate,
|
||||
this.handleDownloadedResult)) {
|
||||
log("Unable to prompt, forcing restart");
|
||||
this.restartProcess();
|
||||
return;
|
||||
}
|
||||
|
||||
// Schedule a fallback timeout in case the UI is unable to respond or show
|
||||
// a prompt for some reason
|
||||
this._applyPromptTimer = this.createTimer(APPLY_PROMPT_TIMEOUT);
|
||||
},
|
||||
|
||||
showUpdateError: function UP_showUpdateError(aUpdate) {
|
||||
if (aUpdate.state == "failed") {
|
||||
log("Failed to download update, errorCode: " + aUpdate.errorCode);
|
||||
}
|
||||
},
|
||||
|
||||
showUpdateHistory: function UP_showUpdateHistory(aParent) { },
|
||||
showUpdateInstalled: function UP_showUpdateInstalled() { },
|
||||
|
||||
sendUpdateEvent: function UP_sendUpdateEvent(aType, aUpdate, aCallback) {
|
||||
let detail = {
|
||||
displayVersion: aUpdate.displayVersion,
|
||||
detailsURL: aUpdate.detailsURL
|
||||
};
|
||||
|
||||
let patch = aUpdate.selectedPatch;
|
||||
if (!patch) {
|
||||
// For now we just check the first patch to get size information if a
|
||||
// patch hasn't been selected yet.
|
||||
if (aUpdate.patchCount == 0) {
|
||||
log("Warning: no patches available in update");
|
||||
return false;
|
||||
}
|
||||
patch = aUpdate.getPatchAt(0);
|
||||
}
|
||||
|
||||
detail.size = patch.size;
|
||||
detail.updateType = patch.type;
|
||||
|
||||
this._update = aUpdate;
|
||||
return this.sendChromeEvent(aType, detail, aCallback);
|
||||
},
|
||||
|
||||
sendChromeEvent: function UP_sendChromeEvent(aType, aDetail, aCallback) {
|
||||
let browser = Services.wm.getMostRecentWindow("navigator:browser");
|
||||
if (!browser) {
|
||||
log("Warning: Couldn't send update event " + aType +
|
||||
": no content browser");
|
||||
return false;
|
||||
}
|
||||
|
||||
let content = browser.getContentWindow();
|
||||
if (!content) {
|
||||
log("Warning: Couldn't send update event " + aType +
|
||||
": no content window");
|
||||
return false;
|
||||
}
|
||||
|
||||
let detail = aDetail || {};
|
||||
detail.type = aType;
|
||||
|
||||
if (!aCallback) {
|
||||
browser.shell.sendChromeEvent(detail);
|
||||
return true;
|
||||
}
|
||||
|
||||
let resultType = aType + "-result";
|
||||
let handleContentEvent = (function(e) {
|
||||
if (!e.detail) {
|
||||
return;
|
||||
}
|
||||
|
||||
let detail = e.detail;
|
||||
if (detail.type == resultType) {
|
||||
aCallback.call(this, detail);
|
||||
content.removeEventListener("mozContentEvent", handleContentEvent);
|
||||
this._update = null;
|
||||
}
|
||||
}).bind(this);
|
||||
|
||||
content.addEventListener("mozContentEvent", handleContentEvent);
|
||||
browser.shell.sendChromeEvent(detail);
|
||||
return true;
|
||||
},
|
||||
|
||||
handleAvailableResult: function UP_handleAvailableResult(aDetail) {
|
||||
// If the user doesn't choose "download", the updater will implicitly call
|
||||
// showUpdateAvailable again after a certain period of time
|
||||
switch (aDetail.result) {
|
||||
case "download":
|
||||
this.downloadUpdate(this._update);
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
handleDownloadedResult: function UP_handleDownloadedResult(aDetail) {
|
||||
if (this._applyPromptTimer) {
|
||||
this._applyPromptTimer.cancel();
|
||||
this._applyPromptTimer = null;
|
||||
}
|
||||
|
||||
switch (aDetail.result) {
|
||||
case "wait":
|
||||
// Wait for a fixed period of time, allowing the user to temporarily
|
||||
// postpone applying an update
|
||||
this._applyWaitTimer = this.createTimer(APPLY_WAIT_TIMEOUT);
|
||||
break;
|
||||
case "restart":
|
||||
this.restartProcess();
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
downloadUpdate: function UP_downloadUpdate(aUpdate) {
|
||||
Services.aus.downloadUpdate(aUpdate, true);
|
||||
Services.aus.addDownloadListener(this);
|
||||
},
|
||||
|
||||
restartProcess: function UP_restartProcess() {
|
||||
log("Update downloaded, restarting to apply it");
|
||||
|
||||
// If not cleanly shut down within 5 seconds, this process will
|
||||
// explode.
|
||||
this._setSelfDestructTimer(5000);
|
||||
this._selfDestructTimer = this.createTimer(SELF_DESTRUCT_TIMEOUT);
|
||||
|
||||
let appStartup = Cc["@mozilla.org/toolkit/app-startup;1"].getService(Ci.nsIAppStartup);
|
||||
let appStartup = Cc["@mozilla.org/toolkit/app-startup;1"]
|
||||
.getService(Ci.nsIAppStartup);
|
||||
// NB: on Gonk, we rely on the system process manager to restart
|
||||
// us. Trying to restart here would conflict with the process
|
||||
// manager. We should be using a runtime check to detect Gonk
|
||||
@ -57,33 +199,60 @@ UpdatePrompt.prototype = {
|
||||
);
|
||||
},
|
||||
|
||||
_setSelfDestructTimer: function UP__setSelfDestructTimer(timeoutMs) {
|
||||
notify: function UP_notify(aTimer) {
|
||||
if (aTimer == this._selfDestructTimer) {
|
||||
this._selfDestructTimer = null;
|
||||
this.selfDestruct();
|
||||
} else if (aTimer == this._applyPromptTimer) {
|
||||
log("Timed out waiting for result, restarting");
|
||||
this._applyPromptTimer = null;
|
||||
this.restartProcess();
|
||||
} else if (aTimer == this._applyWaitTimer) {
|
||||
this._applyWaitTimer = null;
|
||||
this.showUpdatePrompt();
|
||||
}
|
||||
},
|
||||
|
||||
selfDestruct: function UP_selfDestruct() {
|
||||
#ifdef ANDROID
|
||||
Cu.import("resource://gre/modules/ctypes.jsm");
|
||||
let libc = ctypes.open("libc.so");
|
||||
let _exit = libc.declare("_exit", ctypes.default_abi,
|
||||
let _exit = libc.declare("_exit", ctypes.default_abi,
|
||||
ctypes.void_t, // [return]
|
||||
ctypes.int); // status
|
||||
this.notify = function UP_notify(_) {
|
||||
log("Self-destruct timer fired; didn't cleanly shut down. BOOM");
|
||||
_exit(0);
|
||||
}
|
||||
|
||||
let timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
|
||||
timer.initWithCallback(this, timeoutMs, timer.TYPE_ONE_SHOT);
|
||||
this._selfDestructTimer = timer;
|
||||
log("Self-destruct timer fired; didn't cleanly shut down. BOOM");
|
||||
_exit(0);
|
||||
#endif
|
||||
},
|
||||
|
||||
showUpdateInstalled: function UP_showUpdateInstalled() { },
|
||||
|
||||
showUpdateError: function UP_showUpdateError(aUpdate) {
|
||||
if (aUpdate.state == "failed") {
|
||||
log("Failed to download update, errorCode: " + aUpdate.errorCode);
|
||||
}
|
||||
createTimer: function UP_createTimer(aTimeoutMs) {
|
||||
let timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
|
||||
timer.initWithCallback(this, aTimeoutMs, timer.TYPE_ONE_SHOT);
|
||||
return timer;
|
||||
},
|
||||
|
||||
showUpdateHistory: function UP_showUpdateHistory(aParent) { },
|
||||
// nsIRequestObserver
|
||||
|
||||
onStartRequest: function UP_onStartRequest(aRequest, aContext) {
|
||||
this.sendChromeEvent("update-downloading");
|
||||
},
|
||||
|
||||
onStopRequest: function UP_onStopRequest(aRequest, aContext, aStatusCode) {
|
||||
Services.aus.removeDownloadListener(this);
|
||||
},
|
||||
|
||||
// nsIProgressEventSink
|
||||
|
||||
onProgress: function UP_onProgress(aRequest, aContext, aProgress,
|
||||
aProgressMax) {
|
||||
this.sendChromeEvent("update-progress", {
|
||||
progress: aProgress,
|
||||
total: aProgressMax
|
||||
});
|
||||
},
|
||||
|
||||
onStatus: function UP_onStatus(aRequest, aUpdate, aStatus, aStatusArg) { }
|
||||
};
|
||||
|
||||
const NSGetFactory = XPCOMUtils.generateNSGetFactory([UpdatePrompt]);
|
||||
|
@ -9,7 +9,11 @@ ENABLE_MARIONETTE=1
|
||||
# Needed to enable breakpad in application.ini
|
||||
export MOZILLA_OFFICIAL=1
|
||||
|
||||
mk_add_options MOZ_MAKE_FLAGS=-j1
|
||||
if test -n "${_PYMAKE}"; then
|
||||
mk_add_options MOZ_MAKE_FLAGS=-j4
|
||||
else
|
||||
mk_add_options MOZ_MAKE_FLAGS=-j1
|
||||
fi
|
||||
|
||||
# Package js shell.
|
||||
export MOZ_PACKAGE_JSSHELL=1
|
||||
|
@ -18,7 +18,11 @@ export MOZILLA_OFFICIAL=1
|
||||
|
||||
export MOZ_TELEMETRY_REPORTING=1
|
||||
|
||||
mk_add_options MOZ_MAKE_FLAGS=-j1
|
||||
if test -n "${_PYMAKE}"; then
|
||||
mk_add_options MOZ_MAKE_FLAGS=-j4
|
||||
else
|
||||
mk_add_options MOZ_MAKE_FLAGS=-j1
|
||||
fi
|
||||
|
||||
# Package js shell.
|
||||
export MOZ_PACKAGE_JSSHELL=1
|
||||
|
37
build/autoconf/gcc-pr39608.m4
Normal file
37
build/autoconf/gcc-pr39608.m4
Normal file
@ -0,0 +1,37 @@
|
||||
dnl This Source Code Form is subject to the terms of the Mozilla Public
|
||||
dnl License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
dnl file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
dnl Check if the compiler is gcc and has pr39608. If so
|
||||
dnl disable vrp.
|
||||
|
||||
AC_DEFUN([MOZ_GCC_PR39608],
|
||||
[
|
||||
AC_MSG_CHECKING(for gcc pr39608)
|
||||
ac_have_gcc_pr39608="yes"
|
||||
AC_LANG_SAVE
|
||||
AC_LANG_CPLUSPLUS
|
||||
|
||||
AC_TRY_COMPILE([
|
||||
typedef void (*FuncType)();
|
||||
template<FuncType Impl>
|
||||
void f();
|
||||
template<typename T> class C {
|
||||
typedef C<T> ThisC;
|
||||
template<int g()>
|
||||
static void h() {
|
||||
f<ThisC::h<g> >();
|
||||
}
|
||||
};
|
||||
], true,
|
||||
ac_have_gcc_pr39608="no",
|
||||
true)
|
||||
|
||||
AC_LANG_RESTORE
|
||||
|
||||
AC_MSG_RESULT($ac_have_gcc_pr39608)
|
||||
if test "$ac_have_gcc_pr39608" = "yes"; then
|
||||
echo This compiler would fail to build firefox, plase upgrade.
|
||||
exit 1
|
||||
fi
|
||||
])
|
52
build/autoconf/llvm-pr8927.m4
Normal file
52
build/autoconf/llvm-pr8927.m4
Normal file
@ -0,0 +1,52 @@
|
||||
dnl This Source Code Form is subject to the terms of the Mozilla Public
|
||||
dnl License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
dnl file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
dnl Check if the compiler suffers from http://llvm.org/pr8927. If so, ask the
|
||||
dnl user to upgrade.
|
||||
|
||||
AC_DEFUN([MOZ_LLVM_PR8927],
|
||||
[
|
||||
AC_MSG_CHECKING(for llvm pr8927)
|
||||
ac_have_llvm_pr8927="no"
|
||||
AC_LANG_SAVE
|
||||
AC_LANG_C
|
||||
|
||||
_SAVE_CFLAGS=$CFLAGS
|
||||
CFLAGS="-O2"
|
||||
AC_TRY_RUN([
|
||||
struct foobar {
|
||||
int x;
|
||||
};
|
||||
static const struct foobar* foo() {
|
||||
static const struct foobar d = { 0 };
|
||||
return &d;
|
||||
}
|
||||
static const struct foobar* bar() {
|
||||
static const struct foobar d = { 0 };
|
||||
return &d;
|
||||
}
|
||||
__attribute__((noinline)) int zed(const struct foobar *a,
|
||||
const struct foobar *b) {
|
||||
return a == b;
|
||||
}
|
||||
int main() {
|
||||
return zed(foo(), bar());
|
||||
}
|
||||
], true,
|
||||
ac_have_llvm_pr8927="yes",
|
||||
true)
|
||||
CFLAGS="$_SAVE_CFLAGS"
|
||||
|
||||
AC_LANG_RESTORE
|
||||
|
||||
if test "$ac_have_llvm_pr8927" = "yes"; then
|
||||
AC_MSG_RESULT(yes)
|
||||
echo This compiler would miscompile firefox, plase upgrade.
|
||||
echo see http://developer.mozilla.org/en-US/docs/Developer_Guide/Build_Instructions/Mac_OS_X_Prerequisites
|
||||
echo for more information.
|
||||
exit 1
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
])
|
@ -58,16 +58,16 @@ mkdir_deps =$(foreach dir,$(getargv),$(call slash_strip,$(dir)/.mkdir.done))
|
||||
%/.mkdir.done: # mkdir -p -p => mkdir -p
|
||||
$(subst $(space)-p,$(null),$(MKDIR)) -p $(dir $@)
|
||||
# Make the timestamp old enough for not being a problem with symbolic links
|
||||
# targets depending on it. Use Jan 3, 1970 to accomodate any timezone where
|
||||
# 197001010000 would translate to something older than epoch.
|
||||
@touch -t 197001030000 $@
|
||||
# targets depending on it. Use Jan 3, 1980 to accomodate any timezone where
|
||||
# 198001010000 would translate to something older than FAT epoch.
|
||||
@touch -t 198001030000 $@
|
||||
|
||||
# A handful of makefiles are attempting "mkdir dot". Likely not intended
|
||||
# or stale logic so add a stub target to handle the request and warn for now.
|
||||
.mkdir.done:
|
||||
ifndef NOWARN_AUTOTARGETS # {
|
||||
@echo "WARNING: $(MKDIR) -dot- requested by $(MAKE) -C $(CURDIR) $(MAKECMDGOALS)"
|
||||
@touch -t 197001030000 $@
|
||||
@touch -t 198001030000 $@
|
||||
endif #}
|
||||
|
||||
INCLUDED_AUTOTARGETS_MK = 1
|
||||
|
@ -2944,6 +2944,8 @@ AC_SUBST(WRAP_SYSTEM_INCLUDES)
|
||||
AC_SUBST(VISIBILITY_FLAGS)
|
||||
|
||||
MOZ_GCC_PR49911
|
||||
MOZ_GCC_PR39608
|
||||
MOZ_LLVM_PR8927
|
||||
|
||||
dnl Check for __force_align_arg_pointer__ for SSE2 on gcc
|
||||
dnl ========================================================
|
||||
|
@ -8699,7 +8699,7 @@ HasCrossProcessParent(nsIDocument* aDocument)
|
||||
if (!docShell) {
|
||||
return false;
|
||||
}
|
||||
return docShell->GetIsBrowserElement();
|
||||
return docShell->GetIsContentBoundary();
|
||||
}
|
||||
|
||||
static bool
|
||||
|
@ -15,9 +15,7 @@
|
||||
#endif
|
||||
#ifdef MOZ_OPUS
|
||||
#include <opus/opus.h>
|
||||
extern "C" {
|
||||
#include "opus/opus_multistream.h"
|
||||
}
|
||||
// For MOZ_SAMPLE_TYPE_*
|
||||
#include "nsBuiltinDecoderStateMachine.h"
|
||||
#include "nsBuiltinDecoderReader.h"
|
||||
|
@ -177,7 +177,7 @@ IsDOMObject(JSObject* obj)
|
||||
IsNewProxyBinding(js::GetProxyHandler(obj))));
|
||||
}
|
||||
|
||||
// Some callers don't want to set an exception when unwrappin fails
|
||||
// Some callers don't want to set an exception when unwrapping fails
|
||||
// (for example, overload resolution uses unwrapping to tell what sort
|
||||
// of thing it's looking at).
|
||||
// U must be something that a T* can be assigned to (e.g. T* or an nsRefPtr<T>).
|
||||
|
@ -1012,14 +1012,20 @@ class AttrDefiner(PropertyDefiner):
|
||||
return "JSPROP_SHARED | JSPROP_ENUMERATE | JSPROP_NATIVE_ACCESSORS"
|
||||
|
||||
def getter(attr):
|
||||
return ("{(JSPropertyOp)genericGetter, &%(name)s_getterinfo}"
|
||||
% {"name" : attr.identifier.name})
|
||||
native = ("genericLenientGetter" if attr.hasLenientThis()
|
||||
else "genericGetter")
|
||||
return ("{(JSPropertyOp)%(native)s, &%(name)s_getterinfo}"
|
||||
% {"name" : attr.identifier.name,
|
||||
"native" : native})
|
||||
|
||||
def setter(attr):
|
||||
if attr.readonly:
|
||||
return "JSOP_NULLWRAPPER"
|
||||
return ("{(JSStrictPropertyOp)genericSetter, &%(name)s_setterinfo}"
|
||||
% {"name" : attr.identifier.name})
|
||||
native = ("genericLenientSetter" if attr.hasLenientThis()
|
||||
else "genericSetter")
|
||||
return ("{(JSStrictPropertyOp)%(native)s, &%(name)s_setterinfo}"
|
||||
% {"name" : attr.identifier.name,
|
||||
"native" : native})
|
||||
|
||||
def specData(attr):
|
||||
return (attr.identifier.name, flags(attr), getter(attr),
|
||||
@ -3386,18 +3392,24 @@ class CGAbstractBindingMethod(CGAbstractStaticMethod):
|
||||
function to do the rest of the work. This function should return a
|
||||
CGThing which is already properly indented.
|
||||
"""
|
||||
def __init__(self, descriptor, name, args):
|
||||
def __init__(self, descriptor, name, args, unwrapFailureCode=None):
|
||||
CGAbstractStaticMethod.__init__(self, descriptor, name, "JSBool", args)
|
||||
|
||||
if unwrapFailureCode is None:
|
||||
self.unwrapFailureCode = ("return Throw<%s>(cx, rv);" %
|
||||
toStringBool(not descriptor.workers))
|
||||
else:
|
||||
self.unwrapFailureCode = unwrapFailureCode
|
||||
|
||||
def definition_body(self):
|
||||
# Our descriptor might claim that we're not castable, simply because
|
||||
# we're someone's consequential interface. But for this-unwrapping, we
|
||||
# know that we're the real deal. So fake a descriptor here for
|
||||
# consumption by FailureFatalCastableObjectUnwrapper.
|
||||
unwrapThis = CGIndenter(CGGeneric(
|
||||
str(FailureFatalCastableObjectUnwrapper(
|
||||
str(CastableObjectUnwrapper(
|
||||
FakeCastableDescriptor(self.descriptor),
|
||||
"obj", "self"))))
|
||||
"obj", "self", self.unwrapFailureCode))))
|
||||
return CGList([ self.getThis(), unwrapThis,
|
||||
self.generate_code() ], "\n").define()
|
||||
|
||||
@ -3454,10 +3466,20 @@ class CGGenericGetter(CGAbstractBindingMethod):
|
||||
"""
|
||||
A class for generating the C++ code for an IDL attribute getter.
|
||||
"""
|
||||
def __init__(self, descriptor):
|
||||
def __init__(self, descriptor, lenientThis=False):
|
||||
args = [Argument('JSContext*', 'cx'), Argument('unsigned', 'argc'),
|
||||
Argument('JS::Value*', 'vp')]
|
||||
CGAbstractBindingMethod.__init__(self, descriptor, 'genericGetter', args)
|
||||
if lenientThis:
|
||||
name = "genericLenientGetter"
|
||||
unwrapFailureCode = (
|
||||
"MOZ_ASSERT(!JS_IsExceptionPending(cx));\n"
|
||||
"JS_SET_RVAL(cx, vp, JS::UndefinedValue());\n"
|
||||
"return true;")
|
||||
else:
|
||||
name = "genericGetter"
|
||||
unwrapFailureCode = None
|
||||
CGAbstractBindingMethod.__init__(self, descriptor, name, args,
|
||||
unwrapFailureCode)
|
||||
|
||||
def generate_code(self):
|
||||
return CGIndenter(CGGeneric(
|
||||
@ -3498,10 +3520,19 @@ class CGGenericSetter(CGAbstractBindingMethod):
|
||||
"""
|
||||
A class for generating the C++ code for an IDL attribute setter.
|
||||
"""
|
||||
def __init__(self, descriptor):
|
||||
def __init__(self, descriptor, lenientThis=False):
|
||||
args = [Argument('JSContext*', 'cx'), Argument('unsigned', 'argc'),
|
||||
Argument('JS::Value*', 'vp')]
|
||||
CGAbstractBindingMethod.__init__(self, descriptor, 'genericSetter', args)
|
||||
if lenientThis:
|
||||
name = "genericLenientSetter"
|
||||
unwrapFailureCode = (
|
||||
"MOZ_ASSERT(!JS_IsExceptionPending(cx));\n"
|
||||
"return true;")
|
||||
else:
|
||||
name = "genericSetter"
|
||||
unwrapFailureCode = None
|
||||
CGAbstractBindingMethod.__init__(self, descriptor, name, args,
|
||||
unwrapFailureCode)
|
||||
|
||||
def generate_code(self):
|
||||
return CGIndenter(CGGeneric(
|
||||
@ -5005,7 +5036,8 @@ class CGDescriptor(CGThing):
|
||||
|
||||
cgThings = []
|
||||
if descriptor.interface.hasInterfacePrototypeObject():
|
||||
hasMethod, hasGetter, hasSetter = False, False, False
|
||||
(hasMethod, hasGetter, hasLenientGetter,
|
||||
hasSetter, hasLenientSetter) = False, False, False, False, False
|
||||
for m in descriptor.interface.members:
|
||||
if m.isMethod() and not m.isStatic() and not m.isIdentifierLess():
|
||||
cgThings.append(CGSpecializedMethod(descriptor, m))
|
||||
@ -5013,14 +5045,24 @@ class CGDescriptor(CGThing):
|
||||
hasMethod = True
|
||||
elif m.isAttr():
|
||||
cgThings.append(CGSpecializedGetter(descriptor, m))
|
||||
hasGetter = True
|
||||
if m.hasLenientThis():
|
||||
hasLenientGetter = True
|
||||
else:
|
||||
hasGetter = True
|
||||
if not m.readonly:
|
||||
cgThings.append(CGSpecializedSetter(descriptor, m))
|
||||
hasSetter = True
|
||||
if m.hasLenientThis():
|
||||
hasLenientSetter = True
|
||||
else:
|
||||
hasSetter = True
|
||||
cgThings.append(CGMemberJITInfo(descriptor, m))
|
||||
if hasMethod: cgThings.append(CGGenericMethod(descriptor))
|
||||
if hasGetter: cgThings.append(CGGenericGetter(descriptor))
|
||||
if hasLenientGetter: cgThings.append(CGGenericGetter(descriptor,
|
||||
lenientThis=True))
|
||||
if hasSetter: cgThings.append(CGGenericSetter(descriptor))
|
||||
if hasLenientSetter: cgThings.append(CGGenericSetter(descriptor,
|
||||
lenientThis=True))
|
||||
|
||||
if descriptor.concrete and not descriptor.proxy:
|
||||
if not descriptor.workers and descriptor.wrapperCache:
|
||||
|
@ -164,7 +164,7 @@ class IDLObject(object):
|
||||
def addExtendedAttributes(self, attrs):
|
||||
assert False # Override me!
|
||||
|
||||
def handleExtendedAttribute(self, attr, value):
|
||||
def handleExtendedAttribute(self, attr):
|
||||
assert False # Override me!
|
||||
|
||||
class IDLScope(IDLObject):
|
||||
@ -327,13 +327,14 @@ class IDLObjectWithIdentifier(IDLObject):
|
||||
"""
|
||||
assert isinstance(self, IDLArgument) or isinstance(self, IDLAttribute)
|
||||
unhandledAttrs = list()
|
||||
for attrAndValue in attrs:
|
||||
if len(attrAndValue) != 2:
|
||||
unhandledAttrs.append(attrAndValue)
|
||||
for attr in attrs:
|
||||
if not attr.hasValue():
|
||||
unhandledAttrs.append(attr)
|
||||
continue
|
||||
|
||||
(attr, value) = attrAndValue
|
||||
if attr == "TreatNullAs":
|
||||
identifier = attr.identifier()
|
||||
value = attr.value()
|
||||
if identifier == "TreatNullAs":
|
||||
if not self.type.isString() or self.type.nullable():
|
||||
raise WebIDLError("[TreatNullAs] is only allowed on "
|
||||
"arguments or attributes whose type is "
|
||||
@ -344,9 +345,10 @@ class IDLObjectWithIdentifier(IDLObject):
|
||||
"dictionary members", [self.location])
|
||||
if value != 'EmptyString':
|
||||
raise WebIDLError("[TreatNullAs] must take the identifier "
|
||||
"EmptyString", [self.location])
|
||||
"'EmptyString', not '%s'" % value,
|
||||
[self.location])
|
||||
self.treatNullAs = value
|
||||
elif attr == "TreatUndefinedAs":
|
||||
elif identifier == "TreatUndefinedAs":
|
||||
if not self.type.isString():
|
||||
raise WebIDLError("[TreatUndefinedAs] is only allowed on "
|
||||
"arguments or attributes whose type is "
|
||||
@ -371,7 +373,7 @@ class IDLObjectWithIdentifier(IDLObject):
|
||||
"Missing", [self.location])
|
||||
self.treatUndefinedAs = value
|
||||
else:
|
||||
unhandledAttrs.append(attrAndValue)
|
||||
unhandledAttrs.append(attr)
|
||||
|
||||
return unhandledAttrs
|
||||
|
||||
@ -650,14 +652,17 @@ class IDLInterface(IDLObjectWithScope):
|
||||
def addExtendedAttributes(self, attrs):
|
||||
self._extendedAttrDict = {}
|
||||
for attr in attrs:
|
||||
attrlist = list(attr)
|
||||
identifier = attrlist.pop(0)
|
||||
identifier = attr.identifier()
|
||||
|
||||
# Special cased attrs
|
||||
if identifier == "TreatNonCallableAsNull":
|
||||
raise WebIDLError("TreatNonCallableAsNull cannot be specified on interfaces",
|
||||
[self.location])
|
||||
[attr.location, self.location])
|
||||
elif identifier == "NoInterfaceObject":
|
||||
if not attr.noArguments():
|
||||
raise WebIDLError("[NoInterfaceObject] must take no arguments",
|
||||
[attr.location])
|
||||
|
||||
if self.ctor():
|
||||
raise WebIDLError("Constructor and NoInterfaceObject are incompatible",
|
||||
[self.location])
|
||||
@ -668,7 +673,7 @@ class IDLInterface(IDLObjectWithScope):
|
||||
raise WebIDLError("Constructor and NoInterfaceObject are incompatible",
|
||||
[self.location])
|
||||
|
||||
args = attrlist[0] if len(attrlist) else []
|
||||
args = attr.args() if attr.hasArgs() else []
|
||||
|
||||
retType = IDLWrapperType(self.location, self)
|
||||
|
||||
@ -680,9 +685,12 @@ class IDLInterface(IDLObjectWithScope):
|
||||
# assumed to be able to throw (since there's no way to
|
||||
# indicate otherwise) and never have any other
|
||||
# extended attributes.
|
||||
method.addExtendedAttributes([("Creator",), ("Throws",)])
|
||||
method.addExtendedAttributes(
|
||||
[IDLExtendedAttribute(self.location, ("Creator",)),
|
||||
IDLExtendedAttribute(self.location, ("Throws",))])
|
||||
method.resolve(self)
|
||||
|
||||
attrlist = attr.listValue()
|
||||
self._extendedAttrDict[identifier] = attrlist if len(attrlist) else True
|
||||
|
||||
def addImplementedInterface(self, implementedInterface):
|
||||
@ -1884,12 +1892,11 @@ class IDLInterfaceMember(IDLObjectWithIdentifier):
|
||||
|
||||
def addExtendedAttributes(self, attrs):
|
||||
for attr in attrs:
|
||||
attrlist = list(attr)
|
||||
identifier = attrlist.pop(0)
|
||||
self.handleExtendedAttribute(identifier, attrlist)
|
||||
self._extendedAttrDict[identifier] = attrlist if len(attrlist) else True
|
||||
self.handleExtendedAttribute(attr)
|
||||
attrlist = attr.listValue()
|
||||
self._extendedAttrDict[attr.identifier()] = attrlist if len(attrlist) else True
|
||||
|
||||
def handleExtendedAttribute(self, name, list):
|
||||
def handleExtendedAttribute(self, attr):
|
||||
pass
|
||||
|
||||
def getExtendedAttribute(self, name):
|
||||
@ -1932,7 +1939,8 @@ class IDLConst(IDLInterfaceMember):
|
||||
pass
|
||||
|
||||
class IDLAttribute(IDLInterfaceMember):
|
||||
def __init__(self, location, identifier, type, readonly, inherit):
|
||||
def __init__(self, location, identifier, type, readonly, inherit,
|
||||
static=False):
|
||||
IDLInterfaceMember.__init__(self, location, identifier,
|
||||
IDLInterfaceMember.Tags.Attr)
|
||||
|
||||
@ -1940,11 +1948,16 @@ class IDLAttribute(IDLInterfaceMember):
|
||||
self.type = type
|
||||
self.readonly = readonly
|
||||
self.inherit = inherit
|
||||
self.static = static
|
||||
self.lenientThis = False
|
||||
|
||||
if readonly and inherit:
|
||||
raise WebIDLError("An attribute cannot be both 'readonly' and 'inherit'",
|
||||
[self.location])
|
||||
|
||||
def isStatic(self):
|
||||
return self.static
|
||||
|
||||
def __str__(self):
|
||||
return "'%s' attribute '%s'" % (self.type, self.identifier)
|
||||
|
||||
@ -1981,14 +1994,23 @@ class IDLAttribute(IDLInterfaceMember):
|
||||
def validate(self):
|
||||
pass
|
||||
|
||||
def handleExtendedAttribute(self, name, list):
|
||||
if name == "TreatNonCallableAsNull":
|
||||
def handleExtendedAttribute(self, attr):
|
||||
identifier = attr.identifier()
|
||||
if identifier == "TreatNonCallableAsNull":
|
||||
self.type.markTreatNonCallableAsNull();
|
||||
if name == "SetterInfallible" and self.readonly:
|
||||
elif identifier == "SetterInfallible" and self.readonly:
|
||||
raise WebIDLError("Readonly attributes must not be flagged as "
|
||||
"[SetterInfallible]",
|
||||
[self.location])
|
||||
IDLInterfaceMember.handleExtendedAttribute(self, name, list)
|
||||
elif identifier == "LenientThis":
|
||||
if not attr.noArguments():
|
||||
raise WebIDLError("[LenientThis] must take no arguments",
|
||||
[attr.location])
|
||||
if self.isStatic():
|
||||
raise WebIDLError("[LenientThis] is only allowed on non-static "
|
||||
"attributes", [attr.location, self.location])
|
||||
self.lenientThis = True
|
||||
IDLInterfaceMember.handleExtendedAttribute(self, attr)
|
||||
|
||||
def resolve(self, parentScope):
|
||||
assert isinstance(parentScope, IDLScope)
|
||||
@ -1999,6 +2021,9 @@ class IDLAttribute(IDLInterfaceMember):
|
||||
attrs = self.checkForStringHandlingExtendedAttributes(attrs)
|
||||
IDLInterfaceMember.addExtendedAttributes(self, attrs)
|
||||
|
||||
def hasLenientThis(self):
|
||||
return self.lenientThis
|
||||
|
||||
class IDLArgument(IDLObjectWithIdentifier):
|
||||
def __init__(self, location, identifier, type, optional=False, defaultValue=None, variadic=False, dictionaryMember=False):
|
||||
IDLObjectWithIdentifier.__init__(self, location, None, identifier)
|
||||
@ -2022,20 +2047,26 @@ class IDLArgument(IDLObjectWithIdentifier):
|
||||
isDictionaryMember=self.dictionaryMember,
|
||||
isOptional=self.optional)
|
||||
for attribute in attrs:
|
||||
attr = attribute[0]
|
||||
if attr == "Clamp":
|
||||
identifier = attribute.identifier()
|
||||
if identifier == "Clamp":
|
||||
if not attribute.noArguments():
|
||||
raise WebIDLError("[Clamp] must take no arguments",
|
||||
[attribute.location])
|
||||
if self.enforceRange:
|
||||
raise WebIDLError("[EnforceRange] and [Clamp] are mutually exclusive",
|
||||
[self.location]);
|
||||
self.clamp = True
|
||||
elif attr == "EnforceRange":
|
||||
elif identifier == "EnforceRange":
|
||||
if not attribute.noArguments():
|
||||
raise WebIDLError("[EnforceRange] must take no arguments",
|
||||
[attribute.location])
|
||||
if self.clamp:
|
||||
raise WebIDLError("[EnforceRange] and [Clamp] are mutually exclusive",
|
||||
[self.location]);
|
||||
self.enforceRange = True
|
||||
else:
|
||||
raise WebIDLError("Unhandled extended attribute on an argument",
|
||||
[self.location])
|
||||
[attribute.location])
|
||||
|
||||
def isComplete(self):
|
||||
return self._isComplete
|
||||
@ -2423,16 +2454,17 @@ class IDLMethod(IDLInterfaceMember, IDLScope):
|
||||
"distinguishable" % (argc, self.identifier.name),
|
||||
locations)
|
||||
|
||||
def handleExtendedAttribute(self, name, list):
|
||||
if name == "GetterInfallible":
|
||||
def handleExtendedAttribute(self, attr):
|
||||
identifier = attr.identifier()
|
||||
if identifier == "GetterInfallible":
|
||||
raise WebIDLError("Methods must not be flagged as "
|
||||
"[GetterInfallible]",
|
||||
[self.location])
|
||||
if name == "SetterInfallible":
|
||||
[attr.location, self.location])
|
||||
if identifier == "SetterInfallible":
|
||||
raise WebIDLError("Methods must not be flagged as "
|
||||
"[SetterInfallible]",
|
||||
[self.location])
|
||||
IDLInterfaceMember.handleExtendedAttribute(self, name, list)
|
||||
[attr.location, self.location])
|
||||
IDLInterfaceMember.handleExtendedAttribute(self, attr)
|
||||
|
||||
class IDLImplementsStatement(IDLObject):
|
||||
def __init__(self, location, implementor, implementee):
|
||||
@ -2472,6 +2504,42 @@ class IDLImplementsStatement(IDLObject):
|
||||
def addExtendedAttributes(self, attrs):
|
||||
assert len(attrs) == 0
|
||||
|
||||
class IDLExtendedAttribute(IDLObject):
|
||||
"""
|
||||
A class to represent IDL extended attributes so we can give them locations
|
||||
"""
|
||||
def __init__(self, location, tuple):
|
||||
IDLObject.__init__(self, location)
|
||||
self._tuple = tuple
|
||||
|
||||
def identifier(self):
|
||||
return self._tuple[0]
|
||||
|
||||
def noArguments(self):
|
||||
return len(self._tuple) == 1
|
||||
|
||||
def hasValue(self):
|
||||
return len(self._tuple) == 2 and isinstance(self._tuple[1], str)
|
||||
|
||||
def value(self):
|
||||
assert(self.hasValue())
|
||||
return self._tuple[1]
|
||||
|
||||
def hasArgs(self):
|
||||
return (len(self._tuple) == 2 and isinstance(self._tuple[1], list) or
|
||||
len(self._tuple) == 3)
|
||||
|
||||
def args(self):
|
||||
assert(self.hasArgs())
|
||||
# Our args are our last element
|
||||
return self._tuple[-1]
|
||||
|
||||
def listValue(self):
|
||||
"""
|
||||
Backdoor for storing random data in _extendedAttrDict
|
||||
"""
|
||||
return list(self._tuple)[1:]
|
||||
|
||||
# Parser
|
||||
|
||||
class Tokenizer(object):
|
||||
@ -3277,7 +3345,7 @@ class Parser(Tokenizer):
|
||||
| ExtendedAttributeIdent
|
||||
| ExtendedAttributeNamedArgList
|
||||
"""
|
||||
p[0] = p[1]
|
||||
p[0] = IDLExtendedAttribute(self.getLocation(p, 1), p[1])
|
||||
|
||||
def p_ExtendedAttributeEmpty(self, p):
|
||||
"""
|
||||
|
@ -19,3 +19,89 @@ def WebIDLTest(parser, harness):
|
||||
""")
|
||||
|
||||
results = parser.finish()
|
||||
|
||||
parser = parser.reset()
|
||||
parser.parse("""
|
||||
interface TestLenientThis {
|
||||
[LenientThis] attribute byte b;
|
||||
};
|
||||
""")
|
||||
|
||||
results = parser.finish()
|
||||
harness.ok(results[0].members[0].hasLenientThis(),
|
||||
"Should have a lenient this")
|
||||
|
||||
parser = parser.reset()
|
||||
threw = False
|
||||
try:
|
||||
parser.parse("""
|
||||
interface TestLenientThis2 {
|
||||
[LenientThis=something] attribute byte b;
|
||||
};
|
||||
""")
|
||||
results = parser.finish()
|
||||
except:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "[LenientThis] must take no arguments")
|
||||
|
||||
parser = parser.reset()
|
||||
parser.parse("""
|
||||
interface TestClamp {
|
||||
void testClamp([Clamp] long foo);
|
||||
void testNotClamp(long foo);
|
||||
};
|
||||
""")
|
||||
|
||||
results = parser.finish()
|
||||
# Pull out the first argument out of the arglist of the first (and
|
||||
# only) signature.
|
||||
harness.ok(results[0].members[0].signatures()[0][1][0].clamp,
|
||||
"Should be clamped")
|
||||
harness.ok(not results[0].members[1].signatures()[0][1][0].clamp,
|
||||
"Should not be clamped")
|
||||
|
||||
parser = parser.reset()
|
||||
threw = False
|
||||
try:
|
||||
parser.parse("""
|
||||
interface TestClamp2 {
|
||||
void testClamp([Clamp=something] long foo);
|
||||
};
|
||||
""")
|
||||
results = parser.finish()
|
||||
except:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "[Clamp] must take no arguments")
|
||||
|
||||
parser = parser.reset()
|
||||
parser.parse("""
|
||||
interface TestEnforceRange {
|
||||
void testEnforceRange([EnforceRange] long foo);
|
||||
void testNotEnforceRange(long foo);
|
||||
};
|
||||
""")
|
||||
|
||||
results = parser.finish()
|
||||
# Pull out the first argument out of the arglist of the first (and
|
||||
# only) signature.
|
||||
harness.ok(results[0].members[0].signatures()[0][1][0].enforceRange,
|
||||
"Should be enforceRange")
|
||||
harness.ok(not results[0].members[1].signatures()[0][1][0].enforceRange,
|
||||
"Should not be enforceRange")
|
||||
|
||||
parser = parser.reset()
|
||||
threw = False
|
||||
try:
|
||||
parser.parse("""
|
||||
interface TestEnforceRange2 {
|
||||
void testEnforceRange([EnforceRange=something] long foo);
|
||||
};
|
||||
""")
|
||||
results = parser.finish()
|
||||
except:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "[EnforceRange] must take no arguments")
|
||||
|
||||
|
@ -401,6 +401,10 @@ public:
|
||||
already_AddRefed<TestInterface> ExerciseTypedefInterfaces2(TestInterface*);
|
||||
void ExerciseTypedefInterfaces3(TestInterface&);
|
||||
|
||||
// Miscellania
|
||||
int32_t AttrWithLenientThis();
|
||||
void SetAttrWithLenientThis(int32_t);
|
||||
|
||||
// Methods and properties imported via "implements"
|
||||
bool ImplementedProperty();
|
||||
void SetImplementedProperty(bool);
|
||||
|
@ -319,6 +319,9 @@ interface TestInterface {
|
||||
void exerciseTypedefInterfaces1(AnotherNameForTestInterface arg);
|
||||
AnotherNameForTestInterface exerciseTypedefInterfaces2(NullableTestInterface arg);
|
||||
void exerciseTypedefInterfaces3(YetAnotherNameForTestInterface arg);
|
||||
|
||||
// Miscellania
|
||||
[LenientThis] attribute long attrWithLenientThis;
|
||||
};
|
||||
|
||||
interface TestNonWrapperCacheInterface {
|
||||
|
@ -17,10 +17,8 @@
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsDOMClassInfo.h"
|
||||
#include "nsDOMEvent.h"
|
||||
#include "nsIDOMBluetoothAuthorizeEvent.h"
|
||||
#include "nsIDOMBluetoothDeviceEvent.h"
|
||||
#include "nsIDOMBluetoothDeviceAddressEvent.h"
|
||||
#include "nsIDOMBluetoothPairingEvent.h"
|
||||
#include "nsIDOMDOMRequest.h"
|
||||
#include "nsThreadUtils.h"
|
||||
#include "nsXPCOMCIDInternal.h"
|
||||
@ -263,11 +261,6 @@ BluetoothAdapter::Create(nsPIDOMWindow* aOwner, const BluetoothValue& aValue)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (NS_FAILED(bs->RegisterBluetoothSignalHandler(NS_LITERAL_STRING(LOCAL_AGENT_PATH), adapter))) {
|
||||
NS_WARNING("Failed to register local agent object with observer!");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (NS_FAILED(bs->RegisterBluetoothSignalHandler(NS_LITERAL_STRING(REMOTE_AGENT_PATH), adapter))) {
|
||||
NS_WARNING("Failed to register remote agent object with observer!");
|
||||
return nullptr;
|
||||
@ -316,91 +309,6 @@ BluetoothAdapter::Notify(const BluetoothSignal& aData)
|
||||
SetPropertyByValue(v);
|
||||
nsRefPtr<BluetoothPropertyEvent> e = BluetoothPropertyEvent::Create(v.name());
|
||||
e->Dispatch(ToIDOMEventTarget(), NS_LITERAL_STRING("propertychanged"));
|
||||
} else if (aData.name().EqualsLiteral("RequestConfirmation")) {
|
||||
arr = aData.value().get_ArrayOfBluetoothNamedValue();
|
||||
|
||||
NS_ASSERTION(arr.Length() == 2, "RequestConfirmation: Wrong length of parameters");
|
||||
NS_ASSERTION(arr[0].value().type() == BluetoothValue::TnsString,
|
||||
"RequestConfirmation: Invalid value type");
|
||||
NS_ASSERTION(arr[1].value().type() == BluetoothValue::Tuint32_t,
|
||||
"RequestConfirmation: Invalid value type");
|
||||
|
||||
nsCOMPtr<nsIDOMEvent> event;
|
||||
NS_NewDOMBluetoothPairingEvent(getter_AddRefs(event), nullptr, nullptr);
|
||||
|
||||
nsCOMPtr<nsIDOMBluetoothPairingEvent> e = do_QueryInterface(event);
|
||||
e->InitBluetoothPairingEvent(NS_LITERAL_STRING("requestconfirmation"),
|
||||
false,
|
||||
false,
|
||||
arr[0].value().get_nsString(),
|
||||
arr[1].value().get_uint32_t());
|
||||
e->SetTrusted(true);
|
||||
bool dummy;
|
||||
DispatchEvent(event, &dummy);
|
||||
} else if (aData.name().EqualsLiteral("RequestPinCode")) {
|
||||
arr = aData.value().get_ArrayOfBluetoothNamedValue();
|
||||
|
||||
NS_ASSERTION(arr.Length() == 1, "RequestPinCode: Wrong length of parameters");
|
||||
NS_ASSERTION(arr[0].value().type() == BluetoothValue::TnsString,
|
||||
"RequestPinCode: Invalid value type");
|
||||
|
||||
nsCOMPtr<nsIDOMEvent> event;
|
||||
NS_NewDOMBluetoothDeviceAddressEvent(getter_AddRefs(event), nullptr, nullptr);
|
||||
|
||||
nsCOMPtr<nsIDOMBluetoothDeviceAddressEvent> e = do_QueryInterface(event);
|
||||
e->InitBluetoothDeviceAddressEvent(NS_LITERAL_STRING("requestpincode"),
|
||||
false, false, arr[0].value().get_nsString());
|
||||
e->SetTrusted(true);
|
||||
bool dummy;
|
||||
DispatchEvent(event, &dummy);
|
||||
} else if (aData.name().EqualsLiteral("RequestPasskey")) {
|
||||
arr = aData.value().get_ArrayOfBluetoothNamedValue();
|
||||
|
||||
NS_ASSERTION(arr.Length() == 1, "RequestPasskey: Wrong length of parameters");
|
||||
NS_ASSERTION(arr[0].value().type() == BluetoothValue::TnsString,
|
||||
"RequestPasskey: Invalid value type");
|
||||
|
||||
nsCOMPtr<nsIDOMEvent> event;
|
||||
NS_NewDOMBluetoothDeviceAddressEvent(getter_AddRefs(event), nullptr, nullptr);
|
||||
|
||||
nsCOMPtr<nsIDOMBluetoothDeviceAddressEvent> e = do_QueryInterface(event);
|
||||
e->InitBluetoothDeviceAddressEvent(NS_LITERAL_STRING("requestpasskey"),
|
||||
false, false, arr[0].value().get_nsString());
|
||||
e->SetTrusted(true);
|
||||
bool dummy;
|
||||
DispatchEvent(event, &dummy);
|
||||
} else if (aData.name().EqualsLiteral("Authorize")) {
|
||||
arr = aData.value().get_ArrayOfBluetoothNamedValue();
|
||||
|
||||
NS_ASSERTION(arr.Length() == 2, "Authorize: Wrong length of parameters");
|
||||
NS_ASSERTION(arr[0].value().type() == BluetoothValue::TnsString,
|
||||
"Authorize: Invalid value type");
|
||||
NS_ASSERTION(arr[1].value().type() == BluetoothValue::TnsString,
|
||||
"Authorize: Invalid value type");
|
||||
|
||||
nsCOMPtr<nsIDOMEvent> event;
|
||||
NS_NewDOMBluetoothAuthorizeEvent(getter_AddRefs(event), nullptr, nullptr);
|
||||
|
||||
nsCOMPtr<nsIDOMBluetoothAuthorizeEvent> e = do_QueryInterface(event);
|
||||
e->InitBluetoothAuthorizeEvent(NS_LITERAL_STRING("authorize"),
|
||||
false,
|
||||
false,
|
||||
arr[0].value().get_nsString(),
|
||||
arr[1].value().get_nsString());
|
||||
e->SetTrusted(true);
|
||||
bool dummy;
|
||||
DispatchEvent(event, &dummy);
|
||||
} else if (aData.name().EqualsLiteral("Cancel")) {
|
||||
nsCOMPtr<nsIDOMEvent> event;
|
||||
NS_NewDOMBluetoothDeviceAddressEvent(getter_AddRefs(event), nullptr, nullptr);
|
||||
|
||||
nsCOMPtr<nsIDOMBluetoothDeviceAddressEvent> e = do_QueryInterface(event);
|
||||
// Just send a null nsString, won't be used
|
||||
e->InitBluetoothDeviceAddressEvent(NS_LITERAL_STRING("cancel"),
|
||||
false, false, EmptyString());
|
||||
e->SetTrusted(true);
|
||||
bool dummy;
|
||||
DispatchEvent(event, &dummy);
|
||||
} else {
|
||||
#ifdef DEBUG
|
||||
nsCString warningMsg;
|
||||
|
@ -1,78 +0,0 @@
|
||||
/* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
|
||||
/* vim: set ts=2 et sw=2 tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "base/basictypes.h"
|
||||
#include "BluetoothPairingEvent.h"
|
||||
|
||||
#include "nsDOMClassInfo.h"
|
||||
|
||||
USING_BLUETOOTH_NAMESPACE
|
||||
|
||||
// static
|
||||
already_AddRefed<BluetoothPairingEvent>
|
||||
BluetoothPairingEvent::Create(const nsAString& aDeviceAddress, const uint32_t& aPasskey)
|
||||
{
|
||||
nsRefPtr<BluetoothPairingEvent> event = new BluetoothPairingEvent();
|
||||
|
||||
event->mPasskey = aPasskey;
|
||||
event->mDeviceAddress = aDeviceAddress;
|
||||
|
||||
return event.forget();
|
||||
}
|
||||
|
||||
// static
|
||||
already_AddRefed<BluetoothPairingEvent>
|
||||
BluetoothPairingEvent::Create(const nsAString& aDeviceAddress, const nsAString& aUuid)
|
||||
{
|
||||
nsRefPtr<BluetoothPairingEvent> event = new BluetoothPairingEvent();
|
||||
|
||||
event->mUuid = aUuid;
|
||||
event->mDeviceAddress = aDeviceAddress;
|
||||
|
||||
return event.forget();
|
||||
}
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_CLASS(BluetoothPairingEvent)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(BluetoothPairingEvent,
|
||||
nsDOMEvent)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(BluetoothPairingEvent,
|
||||
nsDOMEvent)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(BluetoothPairingEvent)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMBluetoothPairingEvent)
|
||||
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(BluetoothPairingEvent)
|
||||
NS_INTERFACE_MAP_END_INHERITING(nsDOMEvent)
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(BluetoothPairingEvent, nsDOMEvent)
|
||||
NS_IMPL_RELEASE_INHERITED(BluetoothPairingEvent, nsDOMEvent)
|
||||
|
||||
DOMCI_DATA(BluetoothPairingEvent, BluetoothPairingEvent)
|
||||
|
||||
NS_IMETHODIMP
|
||||
BluetoothPairingEvent::GetPasskey(uint32_t* aPasskey)
|
||||
{
|
||||
*aPasskey = mPasskey;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
BluetoothPairingEvent::GetUuid(nsAString& aUuid)
|
||||
{
|
||||
aUuid = mUuid;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
BluetoothPairingEvent::GetDeviceAddress(nsAString& aDeviceAddress)
|
||||
{
|
||||
aDeviceAddress = mDeviceAddress;
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -1,70 +0,0 @@
|
||||
/* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
|
||||
/* vim: set ts=2 et sw=2 tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef mozilla_dom_bluetooth_requestpairingevent_h__
|
||||
#define mozilla_dom_bluetooth_requestpairingevent_h__
|
||||
|
||||
#include "BluetoothCommon.h"
|
||||
|
||||
#include "nsIDOMBluetoothPairingEvent.h"
|
||||
#include "nsIDOMEventTarget.h"
|
||||
|
||||
#include "nsDOMEvent.h"
|
||||
|
||||
BEGIN_BLUETOOTH_NAMESPACE
|
||||
|
||||
class BluetoothPairingEvent : public nsDOMEvent
|
||||
, public nsIDOMBluetoothPairingEvent
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_FORWARD_TO_NSDOMEVENT
|
||||
NS_DECL_NSIDOMBLUETOOTHPAIRINGEVENT
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(BluetoothPairingEvent, nsDOMEvent)
|
||||
|
||||
static already_AddRefed<BluetoothPairingEvent>
|
||||
Create(const nsAString& aDeviceAddress, const uint32_t& aPasskey);
|
||||
|
||||
static already_AddRefed<BluetoothPairingEvent>
|
||||
Create(const nsAString& aDeviceAddress, const nsAString& aUuid);
|
||||
|
||||
nsresult
|
||||
Dispatch(nsIDOMEventTarget* aTarget, const nsAString& aEventType)
|
||||
{
|
||||
NS_ASSERTION(aTarget, "Null pointer!");
|
||||
NS_ASSERTION(!aEventType.IsEmpty(), "Empty event type!");
|
||||
|
||||
nsresult rv = InitEvent(aEventType, false, false);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = SetTrusted(true);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsIDOMEvent* thisEvent = static_cast<nsDOMEvent*>(this);
|
||||
|
||||
bool dummy;
|
||||
rv = aTarget->DispatchEvent(thisEvent, &dummy);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
private:
|
||||
BluetoothPairingEvent()
|
||||
: nsDOMEvent(nullptr, nullptr)
|
||||
{ }
|
||||
|
||||
~BluetoothPairingEvent()
|
||||
{ }
|
||||
|
||||
uint32_t mPasskey;
|
||||
nsString mUuid;
|
||||
nsString mDeviceAddress;
|
||||
};
|
||||
|
||||
END_BLUETOOTH_NAMESPACE
|
||||
|
||||
#endif
|
@ -21,6 +21,7 @@
|
||||
#include "nsThreadUtils.h"
|
||||
#include "nsXPCOM.h"
|
||||
#include "nsXPCOMCIDInternal.h"
|
||||
#include "nsISystemMessagesInternal.h"
|
||||
|
||||
#define MOZSETTINGS_CHANGED_ID "mozsettings-changed"
|
||||
#define BLUETOOTH_ENABLED_SETTING "bluetooth.enabled"
|
||||
@ -141,6 +142,18 @@ public:
|
||||
|
||||
NS_IMPL_ISUPPORTS1(BluetoothService::StartupTask, nsISettingsServiceCallback);
|
||||
|
||||
BluetoothService::~BluetoothService()
|
||||
{
|
||||
if (!gBluetoothService) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (NS_FAILED(gBluetoothService->UnregisterBluetoothSignalHandler(
|
||||
NS_LITERAL_STRING(LOCAL_AGENT_PATH), gBluetoothService))) {
|
||||
NS_WARNING("Unresgister observer to register local agent failed!");
|
||||
}
|
||||
}
|
||||
|
||||
nsresult
|
||||
BluetoothService::RegisterBluetoothSignalHandler(const nsAString& aNodeName,
|
||||
BluetoothSignalObserver* aHandler)
|
||||
@ -443,6 +456,13 @@ BluetoothService::Get()
|
||||
}
|
||||
|
||||
gBluetoothService.swap(service);
|
||||
|
||||
if (NS_FAILED(gBluetoothService->RegisterBluetoothSignalHandler(
|
||||
NS_LITERAL_STRING(LOCAL_AGENT_PATH), gBluetoothService))) {
|
||||
NS_WARNING("Resgister observer to register local agent failed!");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return gBluetoothService;
|
||||
}
|
||||
|
||||
@ -467,3 +487,89 @@ BluetoothService::Observe(nsISupports* aSubject, const char* aTopic,
|
||||
MOZ_ASSERT(false, "BluetoothService got unexpected topic!");
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
bool
|
||||
SetJsObject(JSContext* aContext,
|
||||
JSObject* aObj,
|
||||
const InfallibleTArray<BluetoothNamedValue>& aData)
|
||||
{
|
||||
for (int i = 0; i < aData.Length(); i++) {
|
||||
jsval v;
|
||||
if (aData[i].value().type() == BluetoothValue::TnsString) {
|
||||
nsString data = aData[i].value().get_nsString();
|
||||
JSString* JsData = JS_NewStringCopyN(aContext,
|
||||
NS_ConvertUTF16toUTF8(data).get(),
|
||||
data.Length());
|
||||
NS_ENSURE_TRUE(JsData, NS_ERROR_OUT_OF_MEMORY);
|
||||
v = STRING_TO_JSVAL(JsData);
|
||||
} else if (aData[i].value().type() == BluetoothValue::Tuint32_t) {
|
||||
int data = aData[i].value().get_uint32_t();
|
||||
v = INT_TO_JSVAL(data);
|
||||
} else {
|
||||
NS_WARNING("SetJsObject: Parameter is not handled");
|
||||
}
|
||||
|
||||
if (!JS_SetProperty(aContext, aObj,
|
||||
NS_ConvertUTF16toUTF8(aData[i].name()).get(),
|
||||
&v)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothService::Notify(const BluetoothSignal& aData)
|
||||
{
|
||||
InfallibleTArray<BluetoothNamedValue> arr = aData.value().get_ArrayOfBluetoothNamedValue();
|
||||
nsString type;
|
||||
|
||||
JSContext* cx = nsContentUtils::GetSafeJSContext();
|
||||
NS_ASSERTION(!::JS_IsExceptionPending(cx),
|
||||
"Shouldn't get here when an exception is pending!");
|
||||
|
||||
JSObject* obj = JS_NewObject(cx, NULL, NULL, NULL);
|
||||
if (!obj) {
|
||||
NS_WARNING("Failed to new JSObject for system message!");
|
||||
return;
|
||||
}
|
||||
|
||||
bool ok = SetJsObject(cx, obj, arr);
|
||||
if (!ok) {
|
||||
NS_WARNING("Failed to set properties of system message!");
|
||||
return;
|
||||
}
|
||||
|
||||
if (aData.name().EqualsLiteral("RequestConfirmation")) {
|
||||
NS_ASSERTION(arr.Length() == 3, "RequestConfirmation: Wrong length of parameters");
|
||||
type.AssignLiteral("bluetooth-requestconfirmation");
|
||||
} else if (aData.name().EqualsLiteral("RequestPinCode")) {
|
||||
NS_ASSERTION(arr.Length() == 2, "RequestPinCode: Wrong length of parameters");
|
||||
type.AssignLiteral("bluetooth-requestpincode");
|
||||
} else if (aData.name().EqualsLiteral("RequestPasskey")) {
|
||||
NS_ASSERTION(arr.Length() == 2, "RequestPinCode: Wrong length of parameters");
|
||||
type.AssignLiteral("bluetooth-requestpasskey");
|
||||
} else if (aData.name().EqualsLiteral("Authorize")) {
|
||||
NS_ASSERTION(arr.Length() == 2, "Authorize: Wrong length of parameters");
|
||||
type.AssignLiteral("bluetooth-authorize");
|
||||
} else if (aData.name().EqualsLiteral("Cancel")) {
|
||||
NS_ASSERTION(arr.Length() == 0, "Cancel: Wrong length of parameters");
|
||||
type.AssignLiteral("bluetooth-cancel");
|
||||
} else {
|
||||
#ifdef DEBUG
|
||||
nsCString warningMsg;
|
||||
warningMsg.AssignLiteral("Not handling service signal: ");
|
||||
warningMsg.Append(NS_ConvertUTF16toUTF8(aData.name()));
|
||||
NS_WARNING(warningMsg.get());
|
||||
#endif
|
||||
}
|
||||
|
||||
nsCOMPtr<nsISystemMessagesInternal> systemMessenger =
|
||||
do_GetService("@mozilla.org/system-message-internal;1");
|
||||
|
||||
if (!systemMessenger) {
|
||||
NS_WARNING("Failed to get SystemMessenger service!");
|
||||
return;
|
||||
}
|
||||
systemMessenger->BroadcastMessage(type, OBJECT_TO_JSVAL(obj));
|
||||
}
|
||||
|
@ -22,6 +22,7 @@ class BluetoothReplyRunnable;
|
||||
class BluetoothSignal;
|
||||
|
||||
class BluetoothService : public nsIObserver
|
||||
, public BluetoothSignalObserver
|
||||
{
|
||||
class ToggleBtAck;
|
||||
friend class ToggleBtAck;
|
||||
@ -117,10 +118,16 @@ public:
|
||||
*/
|
||||
void UnregisterManager(BluetoothManager* aManager);
|
||||
|
||||
/**
|
||||
/**
|
||||
* Called when get a Bluetooth Signal from BluetoothDBusService
|
||||
*
|
||||
*/
|
||||
void Notify(const BluetoothSignal& aParam);
|
||||
|
||||
/**
|
||||
* Returns the BluetoothService singleton. Only to be called from main thread.
|
||||
*
|
||||
* @param aService Pointer to return singleton into.
|
||||
* @param aService Pointer to return singleton into.
|
||||
*
|
||||
* @return NS_OK on proper assignment, NS_ERROR_FAILURE otherwise (if service
|
||||
* has not yet been started, for instance)
|
||||
@ -281,8 +288,7 @@ protected:
|
||||
mBluetoothSignalObserverTable.Init();
|
||||
}
|
||||
|
||||
virtual ~BluetoothService()
|
||||
{ }
|
||||
~BluetoothService();
|
||||
|
||||
nsresult StartStopBluetooth(bool aStart);
|
||||
|
||||
|
@ -46,8 +46,6 @@ XPIDLSRCS = \
|
||||
nsIDOMBluetoothDeviceEvent.idl \
|
||||
nsIDOMBluetoothDeviceAddressEvent.idl \
|
||||
nsIDOMBluetoothPropertyEvent.idl \
|
||||
nsIDOMBluetoothPairingEvent.idl \
|
||||
nsIDOMBluetoothAuthorizeEvent.idl \
|
||||
$(NULL)
|
||||
|
||||
ifeq (gonk,$(MOZ_WIDGET_TOOLKIT))
|
||||
|
@ -337,6 +337,7 @@ AgentEventFilter(DBusConnection *conn, DBusMessage *msg, void *data)
|
||||
} else {
|
||||
dbus_connection_send(conn, reply, NULL);
|
||||
dbus_message_unref(reply);
|
||||
v = parameters;
|
||||
}
|
||||
} else if (dbus_message_is_method_call(msg, DBUS_AGENT_IFACE, "Authorize")) {
|
||||
// This method gets called when the service daemon needs to authorize a
|
||||
@ -352,11 +353,11 @@ AgentEventFilter(DBusConnection *conn, DBusMessage *msg, void *data)
|
||||
} else {
|
||||
nsString deviceAddress = GetAddressFromObjectPath(NS_ConvertUTF8toUTF16(objectPath));
|
||||
|
||||
parameters.AppendElement(BluetoothNamedValue(NS_LITERAL_STRING("Device"), deviceAddress));
|
||||
parameters.AppendElement(BluetoothNamedValue(NS_LITERAL_STRING("UUID"),
|
||||
parameters.AppendElement(BluetoothNamedValue(NS_LITERAL_STRING("deviceAddress"), deviceAddress));
|
||||
parameters.AppendElement(BluetoothNamedValue(NS_LITERAL_STRING("uuid"),
|
||||
NS_ConvertUTF8toUTF16(uuid)));
|
||||
|
||||
// Because we may have authorization request and pairing request from the
|
||||
// Because we may have authorization request and pairing request from the
|
||||
// same remote device at the same time, we need two tables to keep these messages.
|
||||
sAuthorizeReqTable.Put(deviceAddress, msg);
|
||||
|
||||
@ -379,10 +380,9 @@ AgentEventFilter(DBusConnection *conn, DBusMessage *msg, void *data)
|
||||
errorStr.AssignLiteral("Invalid arguments for RequestConfirmation() method");
|
||||
} else {
|
||||
nsString deviceAddress = GetAddressFromObjectPath(NS_ConvertUTF8toUTF16(objectPath));
|
||||
parameters.AppendElement(BluetoothNamedValue(NS_LITERAL_STRING("deviceAddress"), deviceAddress));
|
||||
parameters.AppendElement(BluetoothNamedValue(NS_LITERAL_STRING("passkey"), passkey));
|
||||
|
||||
parameters.AppendElement(BluetoothNamedValue(NS_LITERAL_STRING("Device"), deviceAddress));
|
||||
parameters.AppendElement(BluetoothNamedValue(NS_LITERAL_STRING("Passkey"), passkey));
|
||||
|
||||
KeepDBusPairingMessage(deviceAddress, msg);
|
||||
|
||||
v = parameters;
|
||||
@ -399,8 +399,7 @@ AgentEventFilter(DBusConnection *conn, DBusMessage *msg, void *data)
|
||||
errorStr.AssignLiteral("Invalid arguments for RequestPinCode() method");
|
||||
} else {
|
||||
nsString deviceAddress = GetAddressFromObjectPath(NS_ConvertUTF8toUTF16(objectPath));
|
||||
|
||||
parameters.AppendElement(BluetoothNamedValue(NS_LITERAL_STRING("Device"), deviceAddress));
|
||||
parameters.AppendElement(BluetoothNamedValue(NS_LITERAL_STRING("deviceAddress"), deviceAddress));
|
||||
|
||||
KeepDBusPairingMessage(deviceAddress, msg);
|
||||
|
||||
@ -417,8 +416,7 @@ AgentEventFilter(DBusConnection *conn, DBusMessage *msg, void *data)
|
||||
errorStr.AssignLiteral("Invalid arguments for RequestPasskey() method");
|
||||
} else {
|
||||
nsString deviceAddress = GetAddressFromObjectPath(NS_ConvertUTF8toUTF16(objectPath));
|
||||
|
||||
parameters.AppendElement(BluetoothNamedValue(NS_LITERAL_STRING("Device"), deviceAddress));
|
||||
parameters.AppendElement(BluetoothNamedValue(NS_LITERAL_STRING("deviceAddress"), deviceAddress));
|
||||
|
||||
KeepDBusPairingMessage(deviceAddress, msg);
|
||||
|
||||
|
@ -1,26 +0,0 @@
|
||||
/* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
|
||||
/* vim: set ts=2 et sw=2 tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "nsIDOMEvent.idl"
|
||||
|
||||
[scriptable, builtinclass, uuid(1cfe7854-31a6-4a41-add6-b4ed35869a6d)]
|
||||
interface nsIDOMBluetoothAuthorizeEvent : nsIDOMEvent
|
||||
{
|
||||
readonly attribute DOMString deviceAddress;
|
||||
readonly attribute DOMString uuid;
|
||||
|
||||
[noscript] void initBluetoothAuthorizeEvent(in DOMString aType,
|
||||
in boolean aCanBubble,
|
||||
in boolean aCancelable,
|
||||
in DOMString aDeviceAddress,
|
||||
in DOMString aUuid);
|
||||
};
|
||||
|
||||
dictionary BluetoothAuthorizeEventInit : EventInit
|
||||
{
|
||||
DOMString deviceAddress;
|
||||
DOMString uuid;
|
||||
};
|
@ -1,26 +0,0 @@
|
||||
/* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
|
||||
/* vim: set ts=2 et sw=2 tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "nsIDOMEvent.idl"
|
||||
|
||||
[scriptable, builtinclass, uuid(333022b8-a7e5-4fff-8588-36f2eedff17e)]
|
||||
interface nsIDOMBluetoothPairingEvent : nsIDOMEvent
|
||||
{
|
||||
readonly attribute DOMString deviceAddress;
|
||||
readonly attribute unsigned long passkey;
|
||||
|
||||
[noscript] void initBluetoothPairingEvent(in DOMString aType,
|
||||
in boolean aCanBubble,
|
||||
in boolean aCancelable,
|
||||
in DOMString aDeviceAddress,
|
||||
in unsigned long aPasskey);
|
||||
};
|
||||
|
||||
dictionary BluetoothPairingEventInit : EventInit
|
||||
{
|
||||
DOMString deviceAddress;
|
||||
unsigned long passkey;
|
||||
};
|
@ -7,6 +7,7 @@
|
||||
let Cu = Components.utils;
|
||||
let Ci = Components.interfaces;
|
||||
let Cc = Components.classes;
|
||||
let Cr = Components.results;
|
||||
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
@ -318,10 +319,18 @@ BrowserElementParent.prototype = {
|
||||
},
|
||||
|
||||
_sendAsyncMsg: function(msg, data) {
|
||||
this._frameElement.QueryInterface(Ci.nsIFrameLoaderOwner)
|
||||
.frameLoader
|
||||
.messageManager
|
||||
.sendAsyncMessage('browser-element-api:' + msg, data);
|
||||
try {
|
||||
this._mm.sendAsyncMessage('browser-element-api:' + msg, data);
|
||||
} catch (e) {
|
||||
// Ignore NS_ERROR_NOT_INITIALIZED. This exception is thrown when
|
||||
// we call _sendAsyncMsg if our frame is not in the DOM, in which case
|
||||
// we don't have child to receive the message.
|
||||
if (e.result == Cr.NS_ERROR_NOT_INITIALIZED) {
|
||||
debug("Handle NS_ERROR_NOT_INITIALIZED");
|
||||
return;
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
},
|
||||
|
||||
_recvHello: function(data) {
|
||||
|
@ -129,6 +129,8 @@ MOCHITEST_FILES = \
|
||||
browserElement_Auth.js \
|
||||
test_browserElement_inproc_Auth.html \
|
||||
file_http_401_response.sjs \
|
||||
browserElement_RemoveBrowserElement.js \
|
||||
test_browserElement_inproc_RemoveBrowserElement.html \
|
||||
$(NULL)
|
||||
|
||||
# Disabled due to https://bugzilla.mozilla.org/show_bug.cgi?id=774100
|
||||
@ -187,6 +189,7 @@ MOCHITEST_FILES += \
|
||||
test_browserElement_oop_SendEvent.html \
|
||||
test_browserElement_oop_ScrollEvent.html \
|
||||
test_browserElement_oop_Auth.html \
|
||||
test_browserElement_oop_RemoveBrowserElement.html \
|
||||
$(NULL)
|
||||
endif #}
|
||||
endif #}
|
||||
|
@ -0,0 +1,32 @@
|
||||
/* Any copyright is dedicated to the public domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
// Bug 787517: Remove iframe in the handler of showmodalprompt. This shouldn't
|
||||
// cause an exception to be thrown.
|
||||
|
||||
"use strict";
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
function runTest() {
|
||||
browserElementTestHelpers.setEnabledPref(true);
|
||||
browserElementTestHelpers.addPermission();
|
||||
|
||||
var iframe = document.createElement('iframe');
|
||||
iframe.mozbrowser = true;
|
||||
document.body.appendChild(iframe);
|
||||
|
||||
iframe.addEventListener("mozbrowsershowmodalprompt", function(e) {
|
||||
document.body.removeChild(iframe);
|
||||
SimpleTest.executeSoon(function() {
|
||||
ok(true);
|
||||
SimpleTest.finish();
|
||||
});
|
||||
});
|
||||
|
||||
iframe.src = "data:text/html,<html><body><script>alert(\"test\")</script>" +
|
||||
"</body></html>";
|
||||
}
|
||||
|
||||
runTest();
|
||||
|
@ -0,0 +1,18 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=787517
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 787517</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="application/javascript" src="browserElementTestHelpers.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=787517">Mozilla Bug 787517</a>
|
||||
|
||||
<script type="application/javascript;version=1.7" src="browserElement_RemoveBrowserElement.js">
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,18 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=787517
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 787517</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="application/javascript" src="browserElementTestHelpers.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=787517">Mozilla Bug 787517</a>
|
||||
|
||||
<script type="application/javascript;version=1.7" src="browserElement_RemoveBrowserElement.js">
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -41,7 +41,7 @@ pageCannotSendReportsTo = page on %1$S cannot send reports to %2$S
|
||||
allowOrDefaultSrcRequired = 'allow' or 'default-src' directive required but not present. Reverting to "default-src 'none'"
|
||||
# LOCALIZATION NOTE (failedToParseUnrecognizedSource):
|
||||
# %1$S is the CSP Source that could not be parsed
|
||||
failedToParseUnrecognizedSource = Failed to parse unrecoginzied source %1$S
|
||||
failedToParseUnrecognizedSource = Failed to parse unrecognized source %1$S
|
||||
# LOCALIZATION NOTE (reportPostRedirect):
|
||||
# %1$S is the specified report URI before redirect
|
||||
reportPostRedirect = Post of violation report to %1$S failed, as a redirect occurred
|
||||
|
@ -1794,7 +1794,10 @@ already_AddRefed<ImageContainer> nsPluginInstanceOwner::GetImageContainerForVide
|
||||
|
||||
data.mHandle = mInstance->GLContext()->CreateSharedHandle(gl::TextureImage::ThreadShared, aVideoInfo->mSurfaceTexture, gl::GLContext::SurfaceTexture);
|
||||
data.mShareType = mozilla::gl::TextureImage::ThreadShared;
|
||||
data.mInverted = mInstance->Inverted();
|
||||
|
||||
// The logic below for Honeycomb is just a guess, but seems to work. We don't have a separate
|
||||
// inverted flag for video.
|
||||
data.mInverted = AndroidBridge::Bridge()->IsHoneycomb() ? true : mInstance->Inverted();
|
||||
data.mSize = gfxIntSize(aVideoInfo->mDimensions.width, aVideoInfo->mDimensions.height);
|
||||
|
||||
SharedTextureImage* pluginImage = static_cast<SharedTextureImage*>(img.get());
|
||||
|
@ -3,11 +3,14 @@
|
||||
* 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 "base/basictypes.h"
|
||||
|
||||
#include "ThebesLayerBuffer.h"
|
||||
#include "Layers.h"
|
||||
#include "gfxContext.h"
|
||||
#include "gfxPlatform.h"
|
||||
#include "gfxUtils.h"
|
||||
#include "ipc/AutoOpenSurface.h"
|
||||
#include "nsDeviceContext.h"
|
||||
#include "sampler.h"
|
||||
|
||||
@ -57,7 +60,7 @@ ThebesLayerBuffer::DrawBufferQuadrant(gfxContext* aTarget,
|
||||
true);
|
||||
|
||||
gfxPoint quadrantTranslation(quadrantRect.x, quadrantRect.y);
|
||||
nsRefPtr<gfxPattern> pattern = new gfxPattern(mBuffer);
|
||||
nsRefPtr<gfxPattern> pattern = new gfxPattern(EnsureBuffer());
|
||||
|
||||
#ifdef MOZ_GFX_OPTIMIZE_MOBILE
|
||||
gfxPattern::GraphicsFilter filter = gfxPattern::FILTER_NEAREST;
|
||||
@ -113,7 +116,7 @@ ThebesLayerBuffer::DrawBufferWithRotation(gfxContext* aTarget, float aOpacity,
|
||||
already_AddRefed<gfxContext>
|
||||
ThebesLayerBuffer::GetContextForQuadrantUpdate(const nsIntRect& aBounds)
|
||||
{
|
||||
nsRefPtr<gfxContext> ctx = new gfxContext(mBuffer);
|
||||
nsRefPtr<gfxContext> ctx = new gfxContext(EnsureBuffer());
|
||||
|
||||
// Figure out which quadrant to draw in
|
||||
int32_t xBoundary = mBufferRect.XMost() - mBufferRotation.x;
|
||||
@ -127,6 +130,35 @@ ThebesLayerBuffer::GetContextForQuadrantUpdate(const nsIntRect& aBounds)
|
||||
return ctx.forget();
|
||||
}
|
||||
|
||||
gfxASurface::gfxContentType
|
||||
ThebesLayerBuffer::BufferContentType()
|
||||
{
|
||||
return mBuffer ? mBuffer->GetContentType() : mBufferProvider->ContentType();
|
||||
}
|
||||
|
||||
bool
|
||||
ThebesLayerBuffer::BufferSizeOkFor(const nsIntSize& aSize)
|
||||
{
|
||||
return (aSize == mBufferRect.Size() ||
|
||||
(SizedToVisibleBounds != mBufferSizePolicy &&
|
||||
aSize < mBufferRect.Size()));
|
||||
}
|
||||
|
||||
gfxASurface*
|
||||
ThebesLayerBuffer::EnsureBuffer()
|
||||
{
|
||||
if (!mBuffer && mBufferProvider) {
|
||||
mBuffer = mBufferProvider->Get();
|
||||
}
|
||||
return mBuffer;
|
||||
}
|
||||
|
||||
bool
|
||||
ThebesLayerBuffer::HaveBuffer()
|
||||
{
|
||||
return mBuffer || mBufferProvider;
|
||||
}
|
||||
|
||||
static void
|
||||
WrapRotationAxis(int32_t* aRotationPoint, int32_t aSize)
|
||||
{
|
||||
@ -156,7 +188,7 @@ ThebesLayerBuffer::BeginPaint(ThebesLayer* aLayer, ContentType aContentType,
|
||||
while (true) {
|
||||
contentType = aContentType;
|
||||
neededRegion = aLayer->GetVisibleRegion();
|
||||
canReuseBuffer = mBuffer && BufferSizeOkFor(neededRegion.GetBounds().Size());
|
||||
canReuseBuffer = HaveBuffer() && BufferSizeOkFor(neededRegion.GetBounds().Size());
|
||||
|
||||
if (canReuseBuffer) {
|
||||
if (mBufferRect.Contains(neededRegion.GetBounds())) {
|
||||
@ -184,7 +216,7 @@ ThebesLayerBuffer::BeginPaint(ThebesLayer* aLayer, ContentType aContentType,
|
||||
neededRegion = destBufferRect;
|
||||
}
|
||||
|
||||
if (mBuffer && contentType != mBuffer->GetContentType()) {
|
||||
if (HaveBuffer() && contentType != BufferContentType()) {
|
||||
// We're effectively clearing the valid region, so we need to draw
|
||||
// the entire needed region now.
|
||||
result.mRegionToInvalidate = aLayer->GetValidRegion();
|
||||
@ -231,7 +263,7 @@ ThebesLayerBuffer::BeginPaint(ThebesLayer* aLayer, ContentType aContentType,
|
||||
if (mBufferRotation == nsIntPoint(0,0)) {
|
||||
nsIntRect srcRect(nsIntPoint(0, 0), mBufferRect.Size());
|
||||
nsIntPoint dest = mBufferRect.TopLeft() - destBufferRect.TopLeft();
|
||||
mBuffer->MovePixels(srcRect, dest);
|
||||
EnsureBuffer()->MovePixels(srcRect, dest);
|
||||
result.mDidSelfCopy = true;
|
||||
// Don't set destBuffer; we special-case self-copies, and
|
||||
// just did the necessary work above.
|
||||
@ -269,7 +301,7 @@ ThebesLayerBuffer::BeginPaint(ThebesLayer* aLayer, ContentType aContentType,
|
||||
bool isClear = mBuffer == nullptr;
|
||||
|
||||
if (destBuffer) {
|
||||
if (mBuffer) {
|
||||
if (HaveBuffer()) {
|
||||
// Copy the bits
|
||||
nsRefPtr<gfxContext> tmpCtx = new gfxContext(destBuffer);
|
||||
nsIntPoint offset = -destBufferRect.TopLeft();
|
||||
|
@ -13,6 +13,7 @@
|
||||
namespace mozilla {
|
||||
namespace layers {
|
||||
|
||||
class AutoOpenSurface;
|
||||
class ThebesLayer;
|
||||
|
||||
/**
|
||||
@ -50,7 +51,8 @@ public:
|
||||
};
|
||||
|
||||
ThebesLayerBuffer(BufferSizePolicy aBufferSizePolicy)
|
||||
: mBufferRotation(0,0)
|
||||
: mBufferProvider(nullptr)
|
||||
, mBufferRotation(0,0)
|
||||
, mBufferSizePolicy(aBufferSizePolicy)
|
||||
{
|
||||
MOZ_COUNT_CTOR(ThebesLayerBuffer);
|
||||
@ -67,6 +69,7 @@ public:
|
||||
void Clear()
|
||||
{
|
||||
mBuffer = nullptr;
|
||||
mBufferProvider = nullptr;
|
||||
mBufferRect.SetEmpty();
|
||||
}
|
||||
|
||||
@ -172,13 +175,22 @@ protected:
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the buffer only. This is intended to be used with the
|
||||
* shadow-layer Open/CloseDescriptor interface, to ensure we don't
|
||||
* accidentally touch a buffer when it's not mapped.
|
||||
* Set the buffer provider only. This is used with surfaces that
|
||||
* require explicit map/unmap, which |aProvider| is used to do on
|
||||
* demand in this code.
|
||||
*
|
||||
* It's the caller's responsibility to ensure |aProvider| is valid
|
||||
* for the duration of operations it requests of this
|
||||
* ThebesLayerBuffer. It's also the caller's responsibility to
|
||||
* unset the provider when inactive, by calling
|
||||
* SetBufferProvider(nullptr).
|
||||
*/
|
||||
void SetBuffer(gfxASurface* aBuffer)
|
||||
void SetBufferProvider(AutoOpenSurface* aProvider)
|
||||
{
|
||||
mBuffer = aBuffer;
|
||||
mBufferProvider = aProvider;
|
||||
if (!mBufferProvider) {
|
||||
mBuffer = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -189,14 +201,31 @@ protected:
|
||||
GetContextForQuadrantUpdate(const nsIntRect& aBounds);
|
||||
|
||||
private:
|
||||
bool BufferSizeOkFor(const nsIntSize& aSize)
|
||||
{
|
||||
return (aSize == mBufferRect.Size() ||
|
||||
(SizedToVisibleBounds != mBufferSizePolicy &&
|
||||
aSize < mBufferRect.Size()));
|
||||
}
|
||||
// Buffer helpers. Don't use mBuffer directly; instead use one of
|
||||
// these helpers.
|
||||
|
||||
/**
|
||||
* Return the buffer's content type. Requires a valid buffer or
|
||||
* buffer provider.
|
||||
*/
|
||||
gfxASurface::gfxContentType BufferContentType();
|
||||
bool BufferSizeOkFor(const nsIntSize& aSize);
|
||||
/**
|
||||
* If the buffer hasn't been mapped, map it and return it.
|
||||
*/
|
||||
gfxASurface* EnsureBuffer();
|
||||
/**
|
||||
* True if we have a buffer where we can get it (but not necessarily
|
||||
* mapped currently).
|
||||
*/
|
||||
bool HaveBuffer();
|
||||
|
||||
nsRefPtr<gfxASurface> mBuffer;
|
||||
/**
|
||||
* This member is only set transiently. It's used to map mBuffer
|
||||
* when we're using surfaces that require explicit map/unmap.
|
||||
*/
|
||||
AutoOpenSurface* mBufferProvider;
|
||||
/** The area of the ThebesLayer that is covered by the buffer as a whole */
|
||||
nsIntRect mBufferRect;
|
||||
/**
|
||||
|
@ -64,7 +64,7 @@ public:
|
||||
* When BasicThebesLayerBuffer is used with layers that hold
|
||||
* SurfaceDescriptor, this buffer only has a valid gfxASurface in
|
||||
* the scope of an AutoOpenSurface for that SurfaceDescriptor. That
|
||||
* is, it's sort of a "virtual buffer" that's only mapped an
|
||||
* is, it's sort of a "virtual buffer" that's only mapped and
|
||||
* unmapped within the scope of AutoOpenSurface. None of the
|
||||
* underlying buffer attributes (rect, rotation) are affected by
|
||||
* mapping/unmapping.
|
||||
@ -72,13 +72,13 @@ public:
|
||||
* These helpers just exist to provide more descriptive names of the
|
||||
* map/unmap process.
|
||||
*/
|
||||
void MapBuffer(gfxASurface* aBuffer)
|
||||
void ProvideBuffer(AutoOpenSurface* aProvider)
|
||||
{
|
||||
SetBuffer(aBuffer);
|
||||
SetBufferProvider(aProvider);
|
||||
}
|
||||
void UnmapBuffer()
|
||||
void RevokeBuffer()
|
||||
{
|
||||
SetBuffer(nullptr);
|
||||
SetBufferProvider(nullptr);
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -248,13 +248,13 @@ struct NS_STACK_CLASS AutoBufferTracker {
|
||||
mLayer->mBufferTracker = this;
|
||||
if (IsSurfaceDescriptorValid(mLayer->mBackBuffer)) {
|
||||
mInitialBuffer.construct(OPEN_READ_WRITE, mLayer->mBackBuffer);
|
||||
mLayer->mBuffer.MapBuffer(mInitialBuffer.ref().Get());
|
||||
mLayer->mBuffer.ProvideBuffer(&mInitialBuffer.ref());
|
||||
}
|
||||
}
|
||||
|
||||
~AutoBufferTracker() {
|
||||
mLayer->mBufferTracker = nullptr;
|
||||
mLayer->mBuffer.UnmapBuffer();
|
||||
mLayer->mBuffer.RevokeBuffer();
|
||||
// mInitialBuffer and mNewBuffer will clean up after themselves if
|
||||
// they were constructed.
|
||||
}
|
||||
@ -597,11 +597,11 @@ BasicShadowThebesLayer::PaintThebes(gfxContext* aContext,
|
||||
}
|
||||
|
||||
AutoOpenSurface autoFrontBuffer(OPEN_READ_ONLY, mFrontBufferDescriptor);
|
||||
mFrontBuffer.MapBuffer(autoFrontBuffer.Get());
|
||||
mFrontBuffer.ProvideBuffer(&autoFrontBuffer);
|
||||
|
||||
mFrontBuffer.DrawTo(this, aContext, GetEffectiveOpacity(), aMaskLayer);
|
||||
|
||||
mFrontBuffer.UnmapBuffer();
|
||||
mFrontBuffer.RevokeBuffer();
|
||||
}
|
||||
|
||||
already_AddRefed<ThebesLayer>
|
||||
|
@ -166,10 +166,8 @@ NS_IMETHODIMP nsBasicUTF7Decoder::ConvertNoBuff(const char * aSrc,
|
||||
PRUnichar * dest = aDest;
|
||||
int32_t bcr,bcw;
|
||||
nsresult res = NS_OK;
|
||||
char ch;
|
||||
|
||||
while (src < srcEnd) {
|
||||
ch = *src;
|
||||
|
||||
// fist, attept to decode in the current mode
|
||||
bcr = srcEnd - src;
|
||||
|
2
js/src/aclocal.m4
vendored
2
js/src/aclocal.m4
vendored
@ -16,6 +16,8 @@ builtin(include, build/autoconf/mozcommonheader.m4)dnl
|
||||
builtin(include, build/autoconf/acwinpaths.m4)dnl
|
||||
builtin(include, build/autoconf/lto.m4)dnl
|
||||
builtin(include, build/autoconf/gcc-pr49911.m4)dnl
|
||||
builtin(include, build/autoconf/gcc-pr39608.m4)dnl
|
||||
builtin(include, build/autoconf/llvm-pr8927.m4)dnl
|
||||
builtin(include, build/autoconf/frameptr.m4)dnl
|
||||
builtin(include, build/autoconf/compiler-opts.m4)dnl
|
||||
builtin(include, build/autoconf/expandlibs.m4)dnl
|
||||
|
37
js/src/build/autoconf/gcc-pr39608.m4
Normal file
37
js/src/build/autoconf/gcc-pr39608.m4
Normal file
@ -0,0 +1,37 @@
|
||||
dnl This Source Code Form is subject to the terms of the Mozilla Public
|
||||
dnl License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
dnl file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
dnl Check if the compiler is gcc and has pr39608. If so
|
||||
dnl disable vrp.
|
||||
|
||||
AC_DEFUN([MOZ_GCC_PR39608],
|
||||
[
|
||||
AC_MSG_CHECKING(for gcc pr39608)
|
||||
ac_have_gcc_pr39608="yes"
|
||||
AC_LANG_SAVE
|
||||
AC_LANG_CPLUSPLUS
|
||||
|
||||
AC_TRY_COMPILE([
|
||||
typedef void (*FuncType)();
|
||||
template<FuncType Impl>
|
||||
void f();
|
||||
template<typename T> class C {
|
||||
typedef C<T> ThisC;
|
||||
template<int g()>
|
||||
static void h() {
|
||||
f<ThisC::h<g> >();
|
||||
}
|
||||
};
|
||||
], true,
|
||||
ac_have_gcc_pr39608="no",
|
||||
true)
|
||||
|
||||
AC_LANG_RESTORE
|
||||
|
||||
AC_MSG_RESULT($ac_have_gcc_pr39608)
|
||||
if test "$ac_have_gcc_pr39608" = "yes"; then
|
||||
echo This compiler would fail to build firefox, plase upgrade.
|
||||
exit 1
|
||||
fi
|
||||
])
|
52
js/src/build/autoconf/llvm-pr8927.m4
Normal file
52
js/src/build/autoconf/llvm-pr8927.m4
Normal file
@ -0,0 +1,52 @@
|
||||
dnl This Source Code Form is subject to the terms of the Mozilla Public
|
||||
dnl License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
dnl file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
dnl Check if the compiler suffers from http://llvm.org/pr8927. If so, ask the
|
||||
dnl user to upgrade.
|
||||
|
||||
AC_DEFUN([MOZ_LLVM_PR8927],
|
||||
[
|
||||
AC_MSG_CHECKING(for llvm pr8927)
|
||||
ac_have_llvm_pr8927="no"
|
||||
AC_LANG_SAVE
|
||||
AC_LANG_C
|
||||
|
||||
_SAVE_CFLAGS=$CFLAGS
|
||||
CFLAGS="-O2"
|
||||
AC_TRY_RUN([
|
||||
struct foobar {
|
||||
int x;
|
||||
};
|
||||
static const struct foobar* foo() {
|
||||
static const struct foobar d = { 0 };
|
||||
return &d;
|
||||
}
|
||||
static const struct foobar* bar() {
|
||||
static const struct foobar d = { 0 };
|
||||
return &d;
|
||||
}
|
||||
__attribute__((noinline)) int zed(const struct foobar *a,
|
||||
const struct foobar *b) {
|
||||
return a == b;
|
||||
}
|
||||
int main() {
|
||||
return zed(foo(), bar());
|
||||
}
|
||||
], true,
|
||||
ac_have_llvm_pr8927="yes",
|
||||
true)
|
||||
CFLAGS="$_SAVE_CFLAGS"
|
||||
|
||||
AC_LANG_RESTORE
|
||||
|
||||
if test "$ac_have_llvm_pr8927" = "yes"; then
|
||||
AC_MSG_RESULT(yes)
|
||||
echo This compiler would miscompile firefox, plase upgrade.
|
||||
echo see http://developer.mozilla.org/en-US/docs/Developer_Guide/Build_Instructions/Mac_OS_X_Prerequisites
|
||||
echo for more information.
|
||||
exit 1
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
])
|
@ -20,7 +20,7 @@
|
||||
|
||||
using namespace js;
|
||||
|
||||
|
||||
|
||||
/*** OrderedHashTable ****************************************************************************/
|
||||
|
||||
/*
|
||||
@ -117,11 +117,15 @@ class OrderedHashTable
|
||||
dataCapacity = capacity;
|
||||
liveCount = 0;
|
||||
hashShift = HashNumberSizeBits - initialBucketsLog2();
|
||||
JS_ASSERT(hashBuckets() == buckets);
|
||||
MOZ_ASSERT(hashBuckets() == buckets);
|
||||
return true;
|
||||
}
|
||||
|
||||
~OrderedHashTable() {
|
||||
for (Range *r = ranges, *next; r; r = next) {
|
||||
next = r->next;
|
||||
r->onTableDestroyed();
|
||||
}
|
||||
alloc.free_(hashTable);
|
||||
freeData(data, dataLength);
|
||||
}
|
||||
@ -226,7 +230,10 @@ class OrderedHashTable
|
||||
* }
|
||||
*
|
||||
* Ranges remain valid for the lifetime of the OrderedHashTable, even if
|
||||
* entries are added or removed or the table is resized.
|
||||
* entries are added or removed or the table is resized. Don't do anything
|
||||
* to a Range, except destroy it, after the OrderedHashTable has been
|
||||
* destroyed. (We support destroying the two objects in either order to
|
||||
* humor the GC, bless its nondeterministic heart.)
|
||||
*
|
||||
* Warning: The behavior when the current front() entry is removed from the
|
||||
* table is subtly different from js::HashTable<>::Enum::removeFront()!
|
||||
@ -244,7 +251,8 @@ class OrderedHashTable
|
||||
* // ...do things that might modify map...
|
||||
* }
|
||||
*/
|
||||
class Range {
|
||||
class Range
|
||||
{
|
||||
friend class OrderedHashTable;
|
||||
|
||||
OrderedHashTable &ht;
|
||||
@ -311,6 +319,7 @@ class OrderedHashTable
|
||||
* j is the index of the removed entry.
|
||||
*/
|
||||
void onRemove(uint32_t j) {
|
||||
MOZ_ASSERT(valid());
|
||||
if (j < i)
|
||||
count--;
|
||||
if (j == i)
|
||||
@ -324,11 +333,25 @@ class OrderedHashTable
|
||||
* will make i and count equal.
|
||||
*/
|
||||
void onCompact() {
|
||||
MOZ_ASSERT(valid());
|
||||
i = count;
|
||||
}
|
||||
|
||||
bool valid() const {
|
||||
return next != this;
|
||||
}
|
||||
|
||||
void onTableDestroyed() {
|
||||
MOZ_ASSERT(valid());
|
||||
prevp = &next;
|
||||
next = this;
|
||||
}
|
||||
|
||||
public:
|
||||
bool empty() const { return i >= ht.dataLength; }
|
||||
bool empty() const {
|
||||
MOZ_ASSERT(valid());
|
||||
return i >= ht.dataLength;
|
||||
}
|
||||
|
||||
/*
|
||||
* Return the first element in the range. This must not be called if
|
||||
@ -339,6 +362,7 @@ class OrderedHashTable
|
||||
* front() invalid. If in doubt, check empty() before calling front().
|
||||
*/
|
||||
T &front() {
|
||||
MOZ_ASSERT(valid());
|
||||
MOZ_ASSERT(!empty());
|
||||
return ht.data[i].element;
|
||||
}
|
||||
@ -353,6 +377,7 @@ class OrderedHashTable
|
||||
* popFront().
|
||||
*/
|
||||
void popFront() {
|
||||
MOZ_ASSERT(valid());
|
||||
MOZ_ASSERT(!empty());
|
||||
MOZ_ASSERT(!Ops::isEmpty(Ops::getKey(ht.data[i].element)));
|
||||
count++;
|
||||
@ -368,6 +393,7 @@ class OrderedHashTable
|
||||
* when the entry was added to the table.
|
||||
*/
|
||||
void rekeyFront(const Key &k) {
|
||||
MOZ_ASSERT(valid());
|
||||
Data &entry = ht.data[i];
|
||||
HashNumber oldHash = prepareHash(Ops::getKey(entry.element)) >> ht.hashShift;
|
||||
HashNumber newHash = prepareHash(k) >> ht.hashShift;
|
||||
@ -403,13 +429,14 @@ class OrderedHashTable
|
||||
* code that the current key had when it was inserted.
|
||||
*/
|
||||
void rekeyFrontWithSameHashCode(const Key &k) {
|
||||
MOZ_ASSERT(valid());
|
||||
#ifdef DEBUG
|
||||
// Assert that k falls in the same hash bucket as the old key.
|
||||
HashNumber h = Ops::hash(k) >> ht.hashShift;
|
||||
Data *e = ht.hashTable[h];
|
||||
while (e && e != &ht.data[i])
|
||||
e = e->chain;
|
||||
JS_ASSERT(e == &ht.data[i]);
|
||||
MOZ_ASSERT(e == &ht.data[i]);
|
||||
#endif
|
||||
Ops::setKey(ht.data[i].element, k);
|
||||
}
|
||||
@ -546,7 +573,7 @@ class OrderedHashTable
|
||||
dataLength = liveCount;
|
||||
dataCapacity = newCapacity;
|
||||
hashShift = newHashShift;
|
||||
JS_ASSERT(hashBuckets() == newHashBuckets);
|
||||
MOZ_ASSERT(hashBuckets() == newHashBuckets);
|
||||
|
||||
compacted();
|
||||
return true;
|
||||
@ -713,7 +740,8 @@ HashableValue::mark(JSTracer *trc) const
|
||||
|
||||
/*** MapIterator *********************************************************************************/
|
||||
|
||||
class js::MapIteratorObject : public JSObject {
|
||||
class js::MapIteratorObject : public JSObject
|
||||
{
|
||||
public:
|
||||
enum { TargetSlot, RangeSlot, SlotCount };
|
||||
static JSFunctionSpec methods[];
|
||||
@ -1161,7 +1189,8 @@ js_InitMapClass(JSContext *cx, JSObject *obj)
|
||||
|
||||
/*** SetIterator *********************************************************************************/
|
||||
|
||||
class js::SetIteratorObject : public JSObject {
|
||||
class js::SetIteratorObject : public JSObject
|
||||
{
|
||||
public:
|
||||
enum { TargetSlot, RangeSlot, SlotCount };
|
||||
static JSFunctionSpec methods[];
|
||||
|
@ -58,16 +58,16 @@ mkdir_deps =$(foreach dir,$(getargv),$(call slash_strip,$(dir)/.mkdir.done))
|
||||
%/.mkdir.done: # mkdir -p -p => mkdir -p
|
||||
$(subst $(space)-p,$(null),$(MKDIR)) -p $(dir $@)
|
||||
# Make the timestamp old enough for not being a problem with symbolic links
|
||||
# targets depending on it. Use Jan 3, 1970 to accomodate any timezone where
|
||||
# 197001010000 would translate to something older than epoch.
|
||||
@touch -t 197001030000 $@
|
||||
# targets depending on it. Use Jan 3, 1980 to accomodate any timezone where
|
||||
# 198001010000 would translate to something older than FAT epoch.
|
||||
@touch -t 198001030000 $@
|
||||
|
||||
# A handful of makefiles are attempting "mkdir dot". Likely not intended
|
||||
# or stale logic so add a stub target to handle the request and warn for now.
|
||||
.mkdir.done:
|
||||
ifndef NOWARN_AUTOTARGETS # {
|
||||
@echo "WARNING: $(MKDIR) -dot- requested by $(MAKE) -C $(CURDIR) $(MAKECMDGOALS)"
|
||||
@touch -t 197001030000 $@
|
||||
@touch -t 198001030000 $@
|
||||
endif #}
|
||||
|
||||
INCLUDED_AUTOTARGETS_MK = 1
|
||||
|
@ -2527,6 +2527,8 @@ AC_SUBST(WRAP_SYSTEM_INCLUDES)
|
||||
AC_SUBST(VISIBILITY_FLAGS)
|
||||
|
||||
MOZ_GCC_PR49911
|
||||
MOZ_GCC_PR39608
|
||||
MOZ_LLVM_PR8927
|
||||
|
||||
dnl Checks for header files.
|
||||
dnl ========================================================
|
||||
|
@ -5664,22 +5664,24 @@ Parser::memberExpr(bool allowCallSyntax)
|
||||
*/
|
||||
uint32_t index;
|
||||
PropertyName *name = NULL;
|
||||
if (propExpr->isKind(PNK_STRING)) {
|
||||
JSAtom *atom = propExpr->pn_atom;
|
||||
if (atom->isIndex(&index)) {
|
||||
propExpr->setKind(PNK_NUMBER);
|
||||
propExpr->setOp(JSOP_DOUBLE);
|
||||
propExpr->pn_dval = index;
|
||||
} else {
|
||||
name = atom->asPropertyName();
|
||||
}
|
||||
} else if (propExpr->isKind(PNK_NUMBER)) {
|
||||
double number = propExpr->pn_dval;
|
||||
if (number != ToUint32(number)) {
|
||||
JSAtom *atom = ToAtom(context, DoubleValue(number));
|
||||
if (!atom)
|
||||
return NULL;
|
||||
name = atom->asPropertyName();
|
||||
if (foldConstants) {
|
||||
if (propExpr->isKind(PNK_STRING)) {
|
||||
JSAtom *atom = propExpr->pn_atom;
|
||||
if (atom->isIndex(&index)) {
|
||||
propExpr->setKind(PNK_NUMBER);
|
||||
propExpr->setOp(JSOP_DOUBLE);
|
||||
propExpr->pn_dval = index;
|
||||
} else {
|
||||
name = atom->asPropertyName();
|
||||
}
|
||||
} else if (propExpr->isKind(PNK_NUMBER)) {
|
||||
double number = propExpr->pn_dval;
|
||||
if (number != ToUint32(number)) {
|
||||
JSAtom *atom = ToAtom(context, DoubleValue(number));
|
||||
if (!atom)
|
||||
return NULL;
|
||||
name = atom->asPropertyName();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1043,7 +1043,7 @@ struct DumpOp {
|
||||
#ifdef DEBUG
|
||||
js_DumpValue(v);
|
||||
#else
|
||||
fputc('?\n', stderr);
|
||||
fprintf(stderr, "?\n");
|
||||
#endif
|
||||
i_++;
|
||||
}
|
||||
@ -1064,7 +1064,7 @@ InlineFrameIterator::dump() const
|
||||
#ifdef DEBUG
|
||||
js_DumpObject(callee());
|
||||
#else
|
||||
fputc('?\n', stderr);
|
||||
fprintf(stderr, "?\n");
|
||||
#endif
|
||||
} else {
|
||||
fprintf(stderr, " global frame, no callee\n");
|
||||
@ -1103,7 +1103,7 @@ InlineFrameIterator::dump() const
|
||||
#ifdef DEBUG
|
||||
js_DumpValue(si.maybeRead());
|
||||
#else
|
||||
fputc('?\n', stderr);
|
||||
fprintf(stderr, "?\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -414,16 +414,22 @@ CallJSNativeConstructor(JSContext *cx, Native native, const CallArgs &args)
|
||||
* constructor to return the callee, the assertion can be removed or
|
||||
* (another) conjunct can be added to the antecedent.
|
||||
*
|
||||
* Proxies are exceptions to both rules: they can return primitives and
|
||||
* they allow content to return the callee.
|
||||
* Exceptions:
|
||||
*
|
||||
* CallOrConstructBoundFunction is an exception as well because we
|
||||
* might have used bind on a proxy function.
|
||||
* - Proxies are exceptions to both rules: they can return primitives and
|
||||
* they allow content to return the callee.
|
||||
*
|
||||
* (new Object(Object)) returns the callee.
|
||||
* - CallOrConstructBoundFunction is an exception as well because we might
|
||||
* have used bind on a proxy function.
|
||||
*
|
||||
* - new Iterator(x) is user-hookable; it returns x.__iterator__() which
|
||||
* could be any object.
|
||||
*
|
||||
* - (new Object(Object)) returns the callee.
|
||||
*/
|
||||
JS_ASSERT_IF(native != FunctionProxyClass.construct &&
|
||||
native != js::CallOrConstructBoundFunction &&
|
||||
native != js::IteratorConstructor &&
|
||||
(!callee->isFunction() || callee->toFunction()->native() != js_Object),
|
||||
!args.rval().isPrimitive() && callee != &args.rval().toObject());
|
||||
|
||||
|
@ -3204,10 +3204,10 @@ ReleaseObservedTypes(JSRuntime *rt)
|
||||
}
|
||||
|
||||
static void
|
||||
SweepCompartments(FreeOp *fop, gcreason::Reason gcReason)
|
||||
SweepCompartments(FreeOp *fop, bool lastGC)
|
||||
{
|
||||
JSRuntime *rt = fop->runtime();
|
||||
JS_ASSERT_IF(gcReason == gcreason::LAST_CONTEXT, !rt->hasContexts());
|
||||
JS_ASSERT_IF(lastGC, !rt->hasContexts());
|
||||
|
||||
JSDestroyCompartmentCallback callback = rt->destroyCompartmentCallback;
|
||||
|
||||
@ -3222,7 +3222,7 @@ SweepCompartments(FreeOp *fop, gcreason::Reason gcReason)
|
||||
JSCompartment *compartment = *read++;
|
||||
|
||||
if (!compartment->hold && compartment->wasGCStarted() &&
|
||||
(compartment->arenas.arenaListsAreEmpty() || gcReason == gcreason::LAST_CONTEXT))
|
||||
(compartment->arenas.arenaListsAreEmpty() || lastGC))
|
||||
{
|
||||
compartment->arenas.checkEmptyFreeLists();
|
||||
if (callback)
|
||||
@ -3899,11 +3899,13 @@ SweepAtomsCompartment(JSRuntime *rt)
|
||||
}
|
||||
|
||||
static void
|
||||
EndSweepPhase(JSRuntime *rt, JSGCInvocationKind gckind, gcreason::Reason gcReason)
|
||||
EndSweepPhase(JSRuntime *rt, JSGCInvocationKind gckind, bool lastGC)
|
||||
{
|
||||
gcstats::AutoPhase ap(rt->gcStats, gcstats::PHASE_SWEEP);
|
||||
FreeOp fop(rt, rt->gcSweepOnBackgroundThread);
|
||||
|
||||
JS_ASSERT_IF(lastGC, !rt->gcSweepOnBackgroundThread);
|
||||
|
||||
JS_ASSERT(rt->gcMarker.isDrained());
|
||||
rt->gcMarker.stop();
|
||||
|
||||
@ -3911,23 +3913,9 @@ EndSweepPhase(JSRuntime *rt, JSGCInvocationKind gckind, gcreason::Reason gcReaso
|
||||
PropertyTree::dumpShapes(rt);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Set up list of compartments for sweeping of background things.
|
||||
*/
|
||||
JS_ASSERT(!rt->gcSweepingCompartments);
|
||||
for (GCCompartmentsIter c(rt); !c.done(); c.next()) {
|
||||
c->gcNextCompartment = rt->gcSweepingCompartments;
|
||||
rt->gcSweepingCompartments = c;
|
||||
}
|
||||
|
||||
{
|
||||
gcstats::AutoPhase ap(rt->gcStats, gcstats::PHASE_DESTROY);
|
||||
|
||||
if (!rt->gcSweepOnBackgroundThread) {
|
||||
rt->freeLifoAlloc.freeAll();
|
||||
SweepBackgroundThings(rt, false);
|
||||
}
|
||||
|
||||
/*
|
||||
* Sweep script filenames after sweeping functions in the generic loop
|
||||
* above. In this way when a scripted function's finalizer destroys the
|
||||
@ -3941,7 +3929,8 @@ EndSweepPhase(JSRuntime *rt, JSGCInvocationKind gckind, gcreason::Reason gcReaso
|
||||
* This removes compartments from rt->compartment, so we do it last to make
|
||||
* sure we don't miss sweeping any compartments.
|
||||
*/
|
||||
SweepCompartments(&fop, gcReason);
|
||||
if (!lastGC)
|
||||
SweepCompartments(&fop, lastGC);
|
||||
|
||||
#ifndef JS_THREADSAFE
|
||||
/*
|
||||
@ -3961,6 +3950,26 @@ EndSweepPhase(JSRuntime *rt, JSGCInvocationKind gckind, gcreason::Reason gcReaso
|
||||
arena->unsetAllocDuringSweep();
|
||||
}
|
||||
|
||||
/* Set up list of compartments for sweeping of background things. */
|
||||
JS_ASSERT(!rt->gcSweepingCompartments);
|
||||
for (GCCompartmentsIter c(rt); !c.done(); c.next()) {
|
||||
c->gcNextCompartment = rt->gcSweepingCompartments;
|
||||
rt->gcSweepingCompartments = c;
|
||||
}
|
||||
|
||||
/* If not sweeping on background thread then we must do it here. */
|
||||
if (!rt->gcSweepOnBackgroundThread) {
|
||||
gcstats::AutoPhase ap(rt->gcStats, gcstats::PHASE_DESTROY);
|
||||
|
||||
SweepBackgroundThings(rt, false);
|
||||
|
||||
rt->freeLifoAlloc.freeAll();
|
||||
|
||||
/* Ensure the compartments get swept if it's the last GC. */
|
||||
if (lastGC)
|
||||
SweepCompartments(&fop, lastGC);
|
||||
}
|
||||
|
||||
for (CompartmentsIter c(rt); !c.done(); c.next()) {
|
||||
c->setGCLastBytes(c->gcBytes, c->gcMallocAndFreeBytes, gckind);
|
||||
if (c->wasGCStarted())
|
||||
@ -4305,7 +4314,7 @@ IncrementalCollectSlice(JSRuntime *rt,
|
||||
break;
|
||||
}
|
||||
|
||||
EndSweepPhase(rt, gckind, reason);
|
||||
EndSweepPhase(rt, gckind, reason == gcreason::LAST_CONTEXT);
|
||||
|
||||
if (rt->gcSweepOnBackgroundThread)
|
||||
rt->gcHelperThread.startBackgroundSweep(gckind == GC_SHRINK);
|
||||
|
@ -6129,9 +6129,8 @@ void
|
||||
TypeCompartment::sweepCompilerOutputs(FreeOp *fop, bool discardConstraints)
|
||||
{
|
||||
if (constrainedOutputs) {
|
||||
bool isCompiling = compiledInfo.outputIndex != RecompileInfo::NoCompilerRunning;
|
||||
if (discardConstraints) {
|
||||
JS_ASSERT(!isCompiling);
|
||||
JS_ASSERT(compiledInfo.outputIndex == RecompileInfo::NoCompilerRunning);
|
||||
#if DEBUG
|
||||
for (unsigned i = 0; i < constrainedOutputs->length(); i++) {
|
||||
CompilerOutput &co = (*constrainedOutputs)[i];
|
||||
|
@ -752,8 +752,8 @@ js_ThrowStopIteration(JSContext *cx)
|
||||
|
||||
/*** Iterator objects ****************************************************************************/
|
||||
|
||||
static JSBool
|
||||
Iterator(JSContext *cx, unsigned argc, Value *vp)
|
||||
JSBool
|
||||
js::IteratorConstructor(JSContext *cx, unsigned argc, Value *vp)
|
||||
{
|
||||
CallArgs args = CallArgsFromVp(argc, vp);
|
||||
if (args.length() == 0) {
|
||||
@ -1777,7 +1777,8 @@ GlobalObject::initIteratorClasses(JSContext *cx, Handle<GlobalObject *> global)
|
||||
|
||||
iteratorProto->asPropertyIterator().setNativeIterator(ni);
|
||||
|
||||
Rooted<JSFunction*> ctor(cx, global->createConstructor(cx, Iterator, CLASS_NAME(cx, Iterator), 2));
|
||||
Rooted<JSFunction*> ctor(cx, global->createConstructor(cx, IteratorConstructor,
|
||||
CLASS_NAME(cx, Iterator), 2));
|
||||
if (!ctor)
|
||||
return false;
|
||||
if (!LinkConstructorAndPrototype(cx, ctor, iteratorProto))
|
||||
|
@ -153,6 +153,9 @@ UnwindIteratorForException(JSContext *cx, JSObject *obj);
|
||||
void
|
||||
UnwindIteratorForUncatchableException(JSContext *cx, JSObject *obj);
|
||||
|
||||
JSBool
|
||||
IteratorConstructor(JSContext *cx, unsigned argc, Value *vp);
|
||||
|
||||
}
|
||||
|
||||
extern bool
|
||||
|
@ -2509,7 +2509,6 @@ Proxy::fun_toString(JSContext *cx, JSObject *proxy_, unsigned indent)
|
||||
{
|
||||
JS_CHECK_RECURSION(cx, return NULL);
|
||||
RootedObject proxy(cx, proxy_);
|
||||
return GetProxyHandler(proxy)->obj_toString(cx, proxy);
|
||||
return GetProxyHandler(proxy)->fun_toString(cx, proxy, indent);
|
||||
}
|
||||
|
||||
|
@ -1701,7 +1701,7 @@ Notes(JSContext *cx, unsigned argc, jsval *vp)
|
||||
for (unsigned i = 0; i < argc; i++) {
|
||||
JSScript *script = ValueToScript(cx, argv[i]);
|
||||
if (!script)
|
||||
continue;
|
||||
return false;
|
||||
|
||||
SrcNotes(cx, script, &sprinter);
|
||||
}
|
||||
@ -1813,38 +1813,45 @@ struct DisassembleOptionParser {
|
||||
|
||||
} /* anonymous namespace */
|
||||
|
||||
static JSBool
|
||||
DisassembleToString(JSContext *cx, unsigned argc, jsval *vp)
|
||||
static bool
|
||||
DisassembleToSprinter(JSContext *cx, unsigned argc, jsval *vp, Sprinter *sprinter)
|
||||
{
|
||||
DisassembleOptionParser p(argc, JS_ARGV(cx, vp));
|
||||
if (!p.parse(cx))
|
||||
return false;
|
||||
|
||||
Sprinter sprinter(cx);
|
||||
if (!sprinter.init())
|
||||
return false;
|
||||
|
||||
bool ok = true;
|
||||
if (p.argc == 0) {
|
||||
/* Without arguments, disassemble the current script. */
|
||||
RootedScript script(cx, GetTopScript(cx));
|
||||
if (script) {
|
||||
if (js_Disassemble(cx, script, p.lines, &sprinter)) {
|
||||
SrcNotes(cx, script, &sprinter);
|
||||
TryNotes(cx, script, &sprinter);
|
||||
} else {
|
||||
ok = false;
|
||||
}
|
||||
if (!js_Disassemble(cx, script, p.lines, sprinter))
|
||||
return false;
|
||||
SrcNotes(cx, script, sprinter);
|
||||
TryNotes(cx, script, sprinter);
|
||||
}
|
||||
} else {
|
||||
for (unsigned i = 0; i < p.argc; i++) {
|
||||
JSFunction *fun;
|
||||
JSScript *script = ValueToScript(cx, p.argv[i], &fun);
|
||||
ok = ok && script && DisassembleScript(cx, script, fun, p.lines, p.recursive, &sprinter);
|
||||
if (!script)
|
||||
return false;
|
||||
if (!DisassembleScript(cx, script, fun, p.lines, p.recursive, sprinter))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
JSString *str = ok ? JS_NewStringCopyZ(cx, sprinter.string()) : NULL;
|
||||
static JSBool
|
||||
DisassembleToString(JSContext *cx, unsigned argc, jsval *vp)
|
||||
{
|
||||
Sprinter sprinter(cx);
|
||||
if (!sprinter.init())
|
||||
return false;
|
||||
if (!DisassembleToSprinter(cx, argc, vp, &sprinter))
|
||||
return false;
|
||||
|
||||
JSString *str = JS_NewStringCopyZ(cx, sprinter.string());
|
||||
if (!str)
|
||||
return false;
|
||||
JS_SET_RVAL(cx, vp, STRING_TO_JSVAL(str));
|
||||
@ -1854,38 +1861,15 @@ DisassembleToString(JSContext *cx, unsigned argc, jsval *vp)
|
||||
static JSBool
|
||||
Disassemble(JSContext *cx, unsigned argc, jsval *vp)
|
||||
{
|
||||
DisassembleOptionParser p(argc, JS_ARGV(cx, vp));
|
||||
if (!p.parse(cx))
|
||||
return false;
|
||||
|
||||
Sprinter sprinter(cx);
|
||||
if (!sprinter.init())
|
||||
return false;
|
||||
if (!DisassembleToSprinter(cx, argc, vp, &sprinter))
|
||||
return false;
|
||||
|
||||
bool ok = true;
|
||||
if (p.argc == 0) {
|
||||
/* Without arguments, disassemble the current script. */
|
||||
RootedScript script(cx, GetTopScript(cx));
|
||||
if (script) {
|
||||
if (js_Disassemble(cx, script, p.lines, &sprinter)) {
|
||||
SrcNotes(cx, script, &sprinter);
|
||||
TryNotes(cx, script, &sprinter);
|
||||
} else {
|
||||
ok = false;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (unsigned i = 0; i < p.argc; i++) {
|
||||
JSFunction *fun;
|
||||
JSScript *script = ValueToScript(cx, p.argv[i], &fun);
|
||||
ok = ok && script && DisassembleScript(cx, script, fun, p.lines, p.recursive, &sprinter);
|
||||
}
|
||||
}
|
||||
|
||||
if (ok)
|
||||
fprintf(stdout, "%s\n", sprinter.string());
|
||||
fprintf(stdout, "%s\n", sprinter.string());
|
||||
JS_SET_RVAL(cx, vp, JSVAL_VOID);
|
||||
return ok;
|
||||
return true;
|
||||
}
|
||||
|
||||
static JSBool
|
||||
|
@ -261,6 +261,8 @@ assertExpr("this", thisExpr);
|
||||
assertExpr("foo", ident("foo"));
|
||||
assertExpr("foo.bar", dotExpr(ident("foo"), ident("bar")));
|
||||
assertExpr("foo[bar]", memExpr(ident("foo"), ident("bar")));
|
||||
assertExpr("foo['bar']", memExpr(ident("foo"), lit("bar")));
|
||||
assertExpr("foo[42]", memExpr(ident("foo"), lit(42)));
|
||||
assertExpr("(function(){})", funExpr(null, [], blockStmt([])));
|
||||
assertExpr("(function f() {})", funExpr(ident("f"), [], blockStmt([])));
|
||||
assertExpr("(function f(x,y,z) {})", funExpr(ident("f"), [ident("x"),ident("y"),ident("z")], blockStmt([])));
|
||||
|
@ -23,10 +23,8 @@ simple_events = [
|
||||
'DeviceLightEvent',
|
||||
'MozApplicationEvent',
|
||||
#ifdef MOZ_B2G_BT
|
||||
'BluetoothAuthorizeEvent',
|
||||
'BluetoothDeviceEvent',
|
||||
'BluetoothDeviceAddressEvent',
|
||||
'BluetoothPairingEvent',
|
||||
#endif
|
||||
'DeviceStorageChangeEvent',
|
||||
'PopupBlockedEvent'
|
||||
|
@ -1,7 +1,10 @@
|
||||
Copyright 2001-2011 Xiph.Org, Skype Limited, Octasic,
|
||||
Copyright 1994-2011 IETF Trust, Xiph.Org, Skype Limited, Octasic,
|
||||
Jean-Marc Valin, Timothy B. Terriberry,
|
||||
CSIRO, Gregory Maxwell, Mark Borgerding,
|
||||
Erik de Castro Lopo
|
||||
CSIRO, Gregory Maxwell, Mark Borgerding,
|
||||
Erik de Castro Lopo. All rights reserved.
|
||||
|
||||
This file is extracted from RFC6716. Please see that RFC for additional
|
||||
information.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
@ -14,7 +17,7 @@ notice, this list of conditions and the following disclaimer.
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
||||
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
||||
names of specific contributors, may be used to endorse or promote
|
||||
products derived from this software without specific prior written
|
||||
permission.
|
||||
|
@ -8,4 +8,4 @@ files after the copy step.
|
||||
|
||||
The upstream repository is https://git.xiph.org/opus.git
|
||||
|
||||
The git tag/revision used was draft-12.
|
||||
The git tag/revision used was 1.0.0.
|
||||
|
@ -1,6 +1,8 @@
|
||||
/*Copyright (c) 2003-2004, Mark Borgerding
|
||||
/*Copyright (c) 2003-2012 IETF Trust, Mark Borgerding. All rights reserved.
|
||||
|
||||
All rights reserved.
|
||||
|
||||
This file is extracted from RFC6716. Please see that RFC for additional
|
||||
information.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
@ -1,12 +1,15 @@
|
||||
/* Copyright (c) 2003-2008 Jean-Marc Valin
|
||||
Copyright (c) 2007-2008 CSIRO
|
||||
Copyright (c) 2007-2009 Xiph.Org Foundation
|
||||
/* Copyright (c) 2003-2012 IETF Trust, Jean-Marc Valin, CSIRO,
|
||||
Xiph.Org Foundation. All rights reserved.
|
||||
Written by Jean-Marc Valin */
|
||||
/**
|
||||
@file arch.h
|
||||
@brief Various architecture definitions for CELT
|
||||
*/
|
||||
/*
|
||||
|
||||
This file is extracted from RFC6716. Please see that RFC for additional
|
||||
information.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
@ -1,8 +1,11 @@
|
||||
/* Copyright (c) 2007-2008 CSIRO
|
||||
Copyright (c) 2007-2009 Xiph.Org Foundation
|
||||
Copyright (c) 2008-2009 Gregory Maxwell
|
||||
/* Copyright (c) 2007-2012 IETF Trust, CSIRO, Xiph.Org Foundation,
|
||||
Gregory Maxwell. All rights reserved.
|
||||
Written by Jean-Marc Valin and Gregory Maxwell */
|
||||
/*
|
||||
|
||||
This file is extracted from RFC6716. Please see that RFC for additional
|
||||
information.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
@ -1,8 +1,11 @@
|
||||
/* Copyright (c) 2007-2008 CSIRO
|
||||
Copyright (c) 2007-2009 Xiph.Org Foundation
|
||||
Copyright (c) 2008-2009 Gregory Maxwell
|
||||
/* Copyright (c) 2007-2012 IETF Trust, CSIRO, Xiph.Org Foundation,
|
||||
Gregory Maxwell. All rights reserved.
|
||||
Written by Jean-Marc Valin and Gregory Maxwell */
|
||||
/*
|
||||
|
||||
This file is extracted from RFC6716. Please see that RFC for additional
|
||||
information.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
@ -1,8 +1,11 @@
|
||||
/* Copyright (c) 2007-2008 CSIRO
|
||||
Copyright (c) 2007-2010 Xiph.Org Foundation
|
||||
Copyright (c) 2008 Gregory Maxwell
|
||||
/* Copyright (c) 2007-2012 IETF Trust, CSIRO, Xiph.Org Foundation,
|
||||
Gregory Maxwell. All rights reserved.
|
||||
Written by Jean-Marc Valin and Gregory Maxwell */
|
||||
/*
|
||||
|
||||
This file is extracted from RFC6716. Please see that RFC for additional
|
||||
information.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
@ -1,6 +1,5 @@
|
||||
/* Copyright (c) 2007-2008 CSIRO
|
||||
Copyright (c) 2007-2009 Xiph.Org Foundation
|
||||
Copyright (c) 2008 Gregory Maxwell
|
||||
/* Copyright (c) 2007-2012 IETF Trust, CSIRO, Xiph.Org Foundation,
|
||||
Gregory Maxwell. All rights reserved.
|
||||
Written by Jean-Marc Valin and Gregory Maxwell */
|
||||
/**
|
||||
@file celt.h
|
||||
@ -8,6 +7,10 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
This file is extracted from RFC6716. Please see that RFC for additional
|
||||
information.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
@ -1,6 +1,10 @@
|
||||
/* Copyright (c) 2009-2010 Xiph.Org Foundation
|
||||
/* Copyright (c) 2009-2012 IETF Trust, Xiph.Org Foundation. All rights reserved.
|
||||
Written by Jean-Marc Valin */
|
||||
/*
|
||||
|
||||
This file is extracted from RFC6716. Please see that RFC for additional
|
||||
information.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
@ -1,6 +1,10 @@
|
||||
/* Copyright (c) 2009-2010 Xiph.Org Foundation
|
||||
/* Copyright (c) 2009-2012 IETF Trust, Xiph.Org Foundation. All rights reserved.
|
||||
Written by Jean-Marc Valin */
|
||||
/*
|
||||
|
||||
This file is extracted from RFC6716. Please see that RFC for additional
|
||||
information.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
@ -1,8 +1,11 @@
|
||||
/* Copyright (c) 2007-2008 CSIRO
|
||||
Copyright (c) 2007-2009 Xiph.Org Foundation
|
||||
Copyright (c) 2007-2009 Timothy B. Terriberry
|
||||
/* Copyright (c) 2007-2012 IETF Trust, CSIRO, Xiph.Org Foundation,
|
||||
Timothy B. Terriberry. All rights reserved.
|
||||
Written by Timothy B. Terriberry and Jean-Marc Valin */
|
||||
/*
|
||||
|
||||
This file is extracted from RFC6716. Please see that RFC for additional
|
||||
information.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
@ -1,8 +1,11 @@
|
||||
/* Copyright (c) 2007-2008 CSIRO
|
||||
Copyright (c) 2007-2009 Xiph.Org Foundation
|
||||
Copyright (c) 2007-2009 Timothy B. Terriberry
|
||||
/* Copyright (c) 2007-2012 IETF Trust, CSIRO, Xiph.Org Foundation,
|
||||
Timothy B. Terriberry. All rights reserved.
|
||||
Written by Timothy B. Terriberry and Jean-Marc Valin */
|
||||
/*
|
||||
|
||||
This file is extracted from RFC6716. Please see that RFC for additional
|
||||
information.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
@ -1,6 +1,10 @@
|
||||
/* Copyright (c) 2003-2008 Timothy B. Terriberry
|
||||
Copyright (c) 2008 Xiph.Org Foundation */
|
||||
/* Copyright (c) 2003-2012 IETF Trust, Timothy B. Terriberry,
|
||||
Xiph.Org Foundation. All rights reserved.*/
|
||||
/*
|
||||
|
||||
This file is extracted from RFC6716. Please see that RFC for additional
|
||||
information.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
@ -1,6 +1,10 @@
|
||||
/* Copyright (c) 2001-2011 Timothy B. Terriberry
|
||||
/* Copyright (c) 2001-2012 IETF Trust, Timothy B. Terriberry. All rights reserved.
|
||||
*/
|
||||
/*
|
||||
|
||||
This file is extracted from RFC6716. Please see that RFC for additional
|
||||
information.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
@ -1,6 +1,10 @@
|
||||
/* Copyright (c) 2001-2011 Timothy B. Terriberry
|
||||
Copyright (c) 2008-2009 Xiph.Org Foundation */
|
||||
/* Copyright (c) 2001-2012 IETF Trust, Timothy B. Terriberry,
|
||||
Xiph.Org Foundation. All rights reserved.*/
|
||||
/*
|
||||
|
||||
This file is extracted from RFC6716. Please see that RFC for additional
|
||||
information.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
@ -1,6 +1,10 @@
|
||||
/* Copyright (c) 2001-2011 Timothy B. Terriberry
|
||||
Copyright (c) 2008-2009 Xiph.Org Foundation */
|
||||
/* Copyright (c) 2001-2012 IETF Trust, Timothy B. Terriberry,
|
||||
Xiph.Org Foundation. All rights reserved.*/
|
||||
/*
|
||||
|
||||
This file is extracted from RFC6716. Please see that RFC for additional
|
||||
information.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
@ -1,6 +1,10 @@
|
||||
/* Copyright (c) 2001-2011 Timothy B. Terriberry
|
||||
Copyright (c) 2008-2009 Xiph.Org Foundation */
|
||||
/* Copyright (c) 2001-2012 IETF Trust, Timothy B. Terriberry,
|
||||
Xiph.Org Foundation. All rights reserved.*/
|
||||
/*
|
||||
|
||||
This file is extracted from RFC6716. Please see that RFC for additional
|
||||
information.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
@ -1,6 +1,10 @@
|
||||
/* Copyright (c) 2001-2011 Timothy B. Terriberry
|
||||
Copyright (c) 2008-2009 Xiph.Org Foundation */
|
||||
/* Copyright (c) 2001-2012 IETF Trust, Timothy B. Terriberry,
|
||||
Xiph.Org Foundation. All rights reserved.*/
|
||||
/*
|
||||
|
||||
This file is extracted from RFC6716. Please see that RFC for additional
|
||||
information.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
@ -1,6 +1,10 @@
|
||||
/* Copyright (c) 2001-2011 Timothy B. Terriberry
|
||||
Copyright (c) 2008-2009 Xiph.Org Foundation */
|
||||
/* Copyright (c) 2001-2012 IETF Trust, Timothy B. Terriberry,
|
||||
Xiph.Org Foundation. All rights reserved.*/
|
||||
/*
|
||||
|
||||
This file is extracted from RFC6716. Please see that RFC for additional
|
||||
information.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
@ -1,10 +1,14 @@
|
||||
/* Copyright (C) 2003-2008 Jean-Marc Valin
|
||||
Copyright (C) 2007-2009 Xiph.Org Foundation */
|
||||
/* Copyright (C) 2003-2012 IETF Trust, Jean-Marc Valin,
|
||||
Xiph.Org Foundation. All rights reserved.*/
|
||||
/**
|
||||
@file fixed_debug.h
|
||||
@brief Fixed-point operations with debugging
|
||||
*/
|
||||
/*
|
||||
|
||||
This file is extracted from RFC6716. Please see that RFC for additional
|
||||
information.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
@ -1,11 +1,14 @@
|
||||
/* Copyright (C) 2007-2009 Xiph.Org Foundation
|
||||
Copyright (C) 2003-2008 Jean-Marc Valin
|
||||
Copyright (C) 2007-2008 CSIRO */
|
||||
/* Copyright (C) 2002-2012 IETF Trust, Xiph.Org Foundation,
|
||||
Jean-Marc Valin, CSIRO. All rights reserved.*/
|
||||
/**
|
||||
@file fixed_generic.h
|
||||
@brief Generic fixed-point operations
|
||||
*/
|
||||
/*
|
||||
|
||||
This file is extracted from RFC6716. Please see that RFC for additional
|
||||
information.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
@ -1,5 +1,9 @@
|
||||
/* Copyright (C) 2001 Erik de Castro Lopo <erikd AT mega-nerd DOT com> */
|
||||
/* Copyright (C) 2001-2012 IETF Trust, Erik de Castro Lopo. All rights reserved.*/
|
||||
/*
|
||||
|
||||
This file is extracted from RFC6716. Please see that RFC for additional
|
||||
information.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
@ -1,9 +1,9 @@
|
||||
/*Copyright (c) 2003-2004, Mark Borgerding
|
||||
Lots of modifications by Jean-Marc Valin
|
||||
Copyright (c) 2005-2007, Xiph.Org Foundation
|
||||
Copyright (c) 2008, Xiph.Org Foundation, CSIRO
|
||||
/*Copyright (c) 2003-2012 IETF Trust, Mark Borgerding, Jean-Marc Valin
|
||||
Xiph.Org Foundation, CSIRO. All rights reserved.
|
||||
|
||||
All rights reserved.
|
||||
|
||||
This file is extracted from RFC6716. Please see that RFC for additional
|
||||
information.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
@ -1,9 +1,9 @@
|
||||
/*Copyright (c) 2003-2004, Mark Borgerding
|
||||
Lots of modifications by Jean-Marc Valin
|
||||
Copyright (c) 2005-2007, Xiph.Org Foundation
|
||||
Copyright (c) 2008, Xiph.Org Foundation, CSIRO
|
||||
/*Copyright (c) 2003-2012 IETF Trust, Mark Borgerding, Jean-Marc Valin
|
||||
Xiph.Org Foundation, CSIRO. All rights reserved.
|
||||
|
||||
All rights reserved.
|
||||
|
||||
This file is extracted from RFC6716. Please see that RFC for additional
|
||||
information.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
@ -1,7 +1,10 @@
|
||||
/* Copyright (c) 2007 CSIRO
|
||||
Copyright (c) 2007-2009 Xiph.Org Foundation
|
||||
/* Copyright (c) 2007-2012 IETF Trust, CSIRO, Xiph.Org Foundation. All rights reserved.
|
||||
Written by Jean-Marc Valin */
|
||||
/*
|
||||
|
||||
This file is extracted from RFC6716. Please see that RFC for additional
|
||||
information.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
@ -1,7 +1,10 @@
|
||||
/* Copyright (c) 2007 CSIRO
|
||||
Copyright (c) 2007-2009 Xiph.Org Foundation
|
||||
/* Copyright (c) 2007-2012 IETF Trust, CSIRO, Xiph.Org Foundation. All rights reserved.
|
||||
Written by Jean-Marc Valin */
|
||||
/*
|
||||
|
||||
This file is extracted from RFC6716. Please see that RFC for additional
|
||||
information.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
@ -1,12 +1,15 @@
|
||||
/* Copyright (c) 2002-2008 Jean-Marc Valin
|
||||
Copyright (c) 2007-2008 CSIRO
|
||||
Copyright (c) 2007-2009 Xiph.Org Foundation
|
||||
/* Copyright (c) 2002-2012 IETF Trust, Jean-Marc Valin,
|
||||
CSIRO, Xiph.Org Foundation. All rights reserved.
|
||||
Written by Jean-Marc Valin */
|
||||
/**
|
||||
@file mathops.h
|
||||
@brief Various math functions
|
||||
*/
|
||||
/*
|
||||
|
||||
This file is extracted from RFC6716. Please see that RFC for additional
|
||||
information.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
@ -1,12 +1,15 @@
|
||||
/* Copyright (c) 2002-2008 Jean-Marc Valin
|
||||
Copyright (c) 2007-2008 CSIRO
|
||||
Copyright (c) 2007-2009 Xiph.Org Foundation
|
||||
/* Copyright (c) 2002-2012 IETF Trust, Jean-Marc Valin, CSIRO,
|
||||
Xiph.Org Foundation. All rights reserved.
|
||||
Written by Jean-Marc Valin */
|
||||
/**
|
||||
@file mathops.h
|
||||
@brief Various math functions
|
||||
*/
|
||||
/*
|
||||
|
||||
This file is extracted from RFC6716. Please see that RFC for additional
|
||||
information.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
@ -1,7 +1,10 @@
|
||||
/* Copyright (c) 2007-2008 CSIRO
|
||||
Copyright (c) 2007-2008 Xiph.Org Foundation
|
||||
/* Copyright (c) 2007-2012 IETF Trust, CSIRO, Xiph.Org Foundation. All rights reserved.
|
||||
Written by Jean-Marc Valin */
|
||||
/*
|
||||
|
||||
This file is extracted from RFC6716. Please see that RFC for additional
|
||||
information.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
@ -1,7 +1,10 @@
|
||||
/* Copyright (c) 2007-2008 CSIRO
|
||||
Copyright (c) 2007-2008 Xiph.Org Foundation
|
||||
/* Copyright (c) 2007-2012 IETF Trust, CSIRO, Xiph.Org Foundation. All rights reserved.
|
||||
Written by Jean-Marc Valin */
|
||||
/*
|
||||
|
||||
This file is extracted from RFC6716. Please see that RFC for additional
|
||||
information.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
@ -1,6 +1,10 @@
|
||||
/* Copyright (c) 2001-2008 Timothy B. Terriberry
|
||||
Copyright (c) 2008-2009 Xiph.Org Foundation */
|
||||
/* Copyright (c) 2001-2012 IETF Trust, Timothy B. Terriberry,
|
||||
Xiph.Org Foundation. All rights reserved.*/
|
||||
/*
|
||||
|
||||
This file is extracted from RFC6716. Please see that RFC for additional
|
||||
information.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
@ -1,8 +1,11 @@
|
||||
/* Copyright (c) 2007-2008 CSIRO
|
||||
Copyright (c) 2007-2009 Xiph.Org Foundation
|
||||
Copyright (c) 2008 Gregory Maxwell
|
||||
/* Copyright (c) 2007-2012 IETF Trust, CSIRO, Xiph.Org Foundation,
|
||||
Gregory Maxwell. All rights reserved.
|
||||
Written by Jean-Marc Valin and Gregory Maxwell */
|
||||
/*
|
||||
|
||||
This file is extracted from RFC6716. Please see that RFC for additional
|
||||
information.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
@ -1,8 +1,11 @@
|
||||
/* Copyright (c) 2007-2008 CSIRO
|
||||
Copyright (c) 2007-2009 Xiph.Org Foundation
|
||||
Copyright (c) 2008 Gregory Maxwell
|
||||
/* Copyright (c) 2007-2012 IETF Trust, CSIRO, Xiph.Org Foundation,
|
||||
Gregory Maxwell. All rights reserved.
|
||||
Written by Jean-Marc Valin and Gregory Maxwell */
|
||||
/*
|
||||
|
||||
This file is extracted from RFC6716. Please see that RFC for additional
|
||||
information.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
@ -1,9 +1,13 @@
|
||||
/* Copyright (C) 2007 Jean-Marc Valin
|
||||
/* Copyright (C) 2007-2012 IETF Trust, Jean-Marc Valin. All rights reserved.
|
||||
|
||||
File: os_support.h
|
||||
This is the (tiny) OS abstraction layer. Aside from math.h, this is the
|
||||
only place where system headers are allowed.
|
||||
|
||||
|
||||
This file is extracted from RFC6716. Please see that RFC for additional
|
||||
information.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
@ -1,5 +1,4 @@
|
||||
/* Copyright (c) 2007-2008 CSIRO
|
||||
Copyright (c) 2007-2009 Xiph.Org Foundation
|
||||
/* Copyright (c) 2007-2012 IETF Trust, CSIRO, Xiph.Org Foundation. All rights reserved.
|
||||
Written by Jean-Marc Valin */
|
||||
/**
|
||||
@file pitch.c
|
||||
@ -7,6 +6,10 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
This file is extracted from RFC6716. Please see that RFC for additional
|
||||
information.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
@ -1,5 +1,4 @@
|
||||
/* Copyright (c) 2007-2008 CSIRO
|
||||
Copyright (c) 2007-2009 Xiph.Org Foundation
|
||||
/* Copyright (c) 2007-2012 IETF Trust, CSIRO, Xiph.Org Foundation. All rights reserved.
|
||||
Written by Jean-Marc Valin */
|
||||
/**
|
||||
@file pitch.h
|
||||
@ -7,6 +6,10 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
This file is extracted from RFC6716. Please see that RFC for additional
|
||||
information.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
@ -1,7 +1,10 @@
|
||||
/* Copyright (c) 2007-2008 CSIRO
|
||||
Copyright (c) 2007-2009 Xiph.Org Foundation
|
||||
/* Copyright (c) 2007-2012 IETF Trust, CSIRO, Xiph.Org Foundation. All rights reserved.
|
||||
Written by Jean-Marc Valin */
|
||||
/*
|
||||
|
||||
This file is extracted from RFC6716. Please see that RFC for additional
|
||||
information.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
@ -1,7 +1,10 @@
|
||||
/* Copyright (c) 2007-2008 CSIRO
|
||||
Copyright (c) 2007-2009 Xiph.Org Foundation
|
||||
/* Copyright (c) 2007-2012 IETF Trust, CSIRO, Xiph.Org Foundation. All rights reserved.
|
||||
Written by Jean-Marc Valin */
|
||||
/*
|
||||
|
||||
This file is extracted from RFC6716. Please see that RFC for additional
|
||||
information.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
@ -1,7 +1,10 @@
|
||||
/* Copyright (c) 2007-2008 CSIRO
|
||||
Copyright (c) 2007-2009 Xiph.Org Foundation
|
||||
/* Copyright (c) 2007-2012 IETF Trust, CSIRO, Xiph.Org Foundation. All rights reserved.
|
||||
Written by Jean-Marc Valin */
|
||||
/*
|
||||
|
||||
This file is extracted from RFC6716. Please see that RFC for additional
|
||||
information.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
@ -1,7 +1,10 @@
|
||||
/* Copyright (c) 2007-2008 CSIRO
|
||||
Copyright (c) 2007-2009 Xiph.Org Foundation
|
||||
/* Copyright (c) 2007-2012 IETF Trust, CSIRO, Xiph.Org Foundation. All rights reserved.
|
||||
Written by Jean-Marc Valin */
|
||||
/*
|
||||
|
||||
This file is extracted from RFC6716. Please see that RFC for additional
|
||||
information.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
@ -1,10 +1,14 @@
|
||||
/* Copyright (C) 2002-2003 Jean-Marc Valin
|
||||
Copyright (C) 2007-2009 Xiph.Org Foundation */
|
||||
/* Copyright (C) 2002-2012 IETF Trust, Jean-Marc Valin, Xiph.Org Foundation.
|
||||
All rights reserved.*/
|
||||
/**
|
||||
@file stack_alloc.h
|
||||
@brief Temporary memory allocation on stack
|
||||
*/
|
||||
/*
|
||||
|
||||
This file is extracted from RFC6716. Please see that RFC for additional
|
||||
information.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
@ -1,6 +1,43 @@
|
||||
/* The contents of this file was automatically generated by dump_modes.c
|
||||
with arguments: 48000 960
|
||||
It contains static definitions for some pre-defined modes. */
|
||||
|
||||
/* Copyright (c) 2011-2012 IETF Trust, CSIRO, Xiph.Org Foundation. All rights reserved.
|
||||
|
||||
|
||||
This file is extracted from RFC6716. Please see that RFC for additional
|
||||
information.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
||||
names of specific contributors, may be used to endorse or promote
|
||||
products derived from this software without specific prior written
|
||||
permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
|
||||
OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
#include "modes.h"
|
||||
#include "rate.h"
|
||||
|
||||
|
@ -1,6 +1,42 @@
|
||||
/* The contents of this file was automatically generated by dump_modes.c
|
||||
with arguments: 48000 960
|
||||
It contains static definitions for some pre-defined modes. */
|
||||
|
||||
/* Copyright (c) 2011-2012 IETF Trust, CSIRO, Xiph.Org Foundation. All rights reserved.
|
||||
|
||||
|
||||
This file is extracted from RFC6716. Please see that RFC for additional
|
||||
information.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
||||
names of specific contributors, may be used to endorse or promote
|
||||
products derived from this software without specific prior written
|
||||
permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
|
||||
OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "modes.h"
|
||||
#include "rate.h"
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user