Merge mozilla-central to fx-team

This commit is contained in:
Carsten "Tomcat" Book 2014-01-13 13:13:04 +01:00
commit 404b53c8d0
855 changed files with 40536 additions and 9157 deletions

View File

@ -5,5 +5,7 @@
# See http://lldb.llvm.org/troubleshooting.html for more info.
settings set target.inline-breakpoint-strategy always
# Deduce the concrete types of objects and pointers when printing them.
# Show the dynamic type of an object when using "expr". This, for example,
# will show a variable declared as "nsIFrame *" that points to an nsBlockFrame
# object as being of type "nsBlockFrame *" rather than "nsIFrame *".
settings set target.prefer-dynamic-value run-target

View File

@ -59,17 +59,17 @@ if a11y_log:
]
LOCAL_INCLUDES += [
'../../../content/xbl/src',
'../../../ipc/chromium/src',
'../../../layout/generic',
'../../../layout/style',
'../../../layout/svg',
'../../../layout/xul',
'../../../layout/xul/tree/',
'../generic',
'../html',
'../xpcom',
'../xul',
'/dom/xbl',
'/ipc/chromium/src',
'/layout/generic',
'/layout/style',
'/layout/svg',
'/layout/xul',
'/layout/xul/tree/',
]
if CONFIG['MOZ_ENABLE_GTK']:

View File

@ -21,7 +21,6 @@
#include "nsIScrollPositionListener.h"
#include "nsITimer.h"
#include "nsIWeakReference.h"
#include "nsIDocShellTreeNode.h"
class nsAccessiblePivot;

View File

@ -1150,14 +1150,16 @@ window.addEventListener('ContentStart', function ss_onContentStart() {
'canvas');
var width = window.innerWidth;
var height = window.innerHeight;
canvas.setAttribute('width', width);
canvas.setAttribute('height', height);
var scale = window.devicePixelRatio;
canvas.setAttribute('width', width * scale);
canvas.setAttribute('height', height * scale);
var context = canvas.getContext('2d');
var flags =
context.DRAWWINDOW_DRAW_CARET |
context.DRAWWINDOW_DRAW_VIEW |
context.DRAWWINDOW_USE_WIDGET_LAYERS;
context.scale(scale, scale);
context.drawWindow(window, 0, 0, width, height,
'rgb(255,255,255)', flags);

View File

@ -1,4 +1,4 @@
{
"revision": "9214b46e662862bf91072a7ba6f7471b43c443e3",
"revision": "458c7c1031a8ee2666b8b4c62301bacd74833332",
"repo_path": "/integration/gaia-central"
}

View File

@ -9,7 +9,7 @@ const gXPInstallObserver = {
if (aDocShell == aSoughtShell)
return aDocShell;
var node = aDocShell.QueryInterface(Components.interfaces.nsIDocShellTreeNode);
var node = aDocShell.QueryInterface(Components.interfaces.nsIDocShellTreeItem);
for (var i = 0; i < node.childCount; ++i) {
var docShell = node.getChildAt(i);
docShell = this._findChildShell(docShell, aSoughtShell);

View File

@ -391,7 +391,7 @@ function findChildShell(aDocument, aDocShell, aSoughtURI) {
(aSoughtURI && aSoughtURI.spec == aDocShell.currentURI.spec))
return aDocShell;
var node = aDocShell.QueryInterface(Components.interfaces.nsIDocShellTreeNode);
var node = aDocShell.QueryInterface(Components.interfaces.nsIDocShellTreeItem);
for (var i = 0; i < node.childCount; ++i) {
var docShell = node.getChildAt(i);
docShell = findChildShell(aDocument, docShell, aSoughtURI);
@ -1839,8 +1839,10 @@ function loadURI(uri, referrer, postData, allowThirdPartyFixup) {
postData = null;
var flags = nsIWebNavigation.LOAD_FLAGS_NONE;
if (allowThirdPartyFixup)
if (allowThirdPartyFixup) {
flags |= nsIWebNavigation.LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP;
flags |= nsIWebNavigation.LOAD_FLAGS_FIXUP_SCHEME_TYPOS;
}
try {
gBrowser.loadURIWithFlags(uri, flags, referrer, null, postData);
@ -5904,8 +5906,9 @@ function WindowIsClosing()
* @returns true if closing can proceed, false if it got cancelled.
*/
function warnAboutClosingWindow() {
// Popups aren't considered full browser windows.
let isPBWindow = PrivateBrowsingUtils.isWindowPrivate(window);
// Popups aren't considered full browser windows; we also ignore private windows.
let isPBWindow = PrivateBrowsingUtils.isWindowPrivate(window) &&
!PrivateBrowsingUtils.permanentPrivateBrowsing;
if (!isPBWindow && !toolbar.visible)
return gBrowser.warnAboutClosingTabs(gBrowser.closingTabsEnum.ALL);

View File

@ -82,7 +82,8 @@ function open()
switch (dialog.openWhereList.value) {
case "0":
var webNav = Components.interfaces.nsIWebNavigation;
var flags = webNav.LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP;
var flags = webNav.LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP |
webNav.LOAD_FLAGS_FIXUP_SCHEME_TYPOS;
if (!mayInheritPrincipal)
flags |= webNav.LOAD_FLAGS_DISALLOW_INHERIT_OWNER;
browser.gBrowser.loadURIWithFlags(url, flags, null, null, postData);

View File

@ -1601,8 +1601,10 @@
b.userTypedValue = aURI;
let flags = Ci.nsIWebNavigation.LOAD_FLAGS_NONE;
if (aAllowThirdPartyFixup)
if (aAllowThirdPartyFixup) {
flags |= Ci.nsIWebNavigation.LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP;
flags |= Ci.nsIWebNavigation.LOAD_FLAGS_FIXUP_SCHEME_TYPOS;
}
if (aFromExternal)
flags |= Ci.nsIWebNavigation.LOAD_FLAGS_FROM_EXTERNAL;
if (aDisableMCB)
@ -4480,7 +4482,10 @@
} else {
// Load in an existing tab.
try {
this.tabbrowser.getBrowserForTab(tab).loadURIWithFlags(url, Ci.nsIWebNavigation.LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP);
let webNav = Ci.nsIWebNavigation;
let flags = webNav.LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP |
webNav.LOAD_FLAGS_FIXUP_SCHEME_TYPOS;
this.tabbrowser.getBrowserForTab(tab).loadURIWithFlags(url, flags);
if (!bgLoad)
this.selectedItem = tab;
} catch(ex) {

View File

@ -293,7 +293,9 @@
}
function loadCurrent() {
let flags = Ci.nsIWebNavigation.LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP;
let webnav = Ci.nsIWebNavigation;
let flags = webnav.LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP |
webnav.LOAD_FLAGS_FIXUP_SCHEME_TYPOS;
// Pass LOAD_FLAGS_DISALLOW_INHERIT_OWNER to prevent any loads from
// inheriting the currently loaded document's principal, unless this
// URL is marked as safe to inherit (e.g. came from a bookmark

View File

@ -300,8 +300,10 @@ function openLinkIn(url, where, params) {
switch (where) {
case "current":
let flags = Ci.nsIWebNavigation.LOAD_FLAGS_NONE;
if (aAllowThirdPartyFixup)
if (aAllowThirdPartyFixup) {
flags |= Ci.nsIWebNavigation.LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP;
flags |= Ci.nsIWebNavigation.LOAD_FLAGS_FIXUP_SCHEME_TYPOS;
}
if (aDisallowInheritPrincipal)
flags |= Ci.nsIWebNavigation.LOAD_FLAGS_DISALLOW_INHERIT_OWNER;
w.gBrowser.loadURIWithFlags(url, flags, aReferrerURI, null, aPostData);

View File

@ -54,9 +54,12 @@ function shouldLoadURI(aURI) {
function resolveURIInternal(aCmdLine, aArgument) {
var uri = aCmdLine.resolveURI(aArgument);
var urifixup = Components.classes["@mozilla.org/docshell/urifixup;1"]
.getService(nsIURIFixup);
if (!(uri instanceof nsIFileURL)) {
return uri;
return urifixup.createFixupURI(aArgument,
urifixup.FIXUP_FLAG_FIX_SCHEME_TYPOS);
}
try {
@ -71,9 +74,6 @@ function resolveURIInternal(aCmdLine, aArgument) {
// doesn't exist. Try URI fixup heuristics: see bug 290782.
try {
var urifixup = Components.classes["@mozilla.org/docshell/urifixup;1"]
.getService(nsIURIFixup);
uri = urifixup.createFixupURI(aArgument, 0);
}
catch (e) {

View File

@ -368,12 +368,16 @@ var BrowserUI = {
Task.spawn(function() {
let postData = {};
let webNav = Ci.nsIWebNavigation;
let flags = webNav.LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP |
webNav.LOAD_FLAGS_FIXUP_SCHEME_TYPOS;
aURI = yield Browser.getShortcutOrURI(aURI, postData);
Browser.loadURI(aURI, { flags: Ci.nsIWebNavigation.LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP, postData: postData });
Browser.loadURI(aURI, { flags: flags, postData: postData });
// Delay doing the fixup so the raw URI is passed to loadURIWithFlags
// and the proper third-party fixup can be done
let fixupFlags = Ci.nsIURIFixup.FIXUP_FLAG_ALLOW_KEYWORD_LOOKUP;
let fixupFlags = Ci.nsIURIFixup.FIXUP_FLAG_ALLOW_KEYWORD_LOOKUP |
Ci.nsIURIFixup.FIXUP_FLAG_FIX_SCHEME_TYPOS;
let uri = gURIFixup.createFixupURI(aURI, fixupFlags);
gHistSvc.markPageAsTyped(uri);

View File

@ -172,7 +172,10 @@ var Browser = {
let self = this;
function loadStartupURI() {
if (activationURI) {
self.addTab(activationURI, true, null, { flags: Ci.nsIWebNavigation.LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP });
let webNav = Ci.nsIWebNavigation;
let flags = webNav.LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP |
webNav.LOAD_FLAGS_FIXUP_SCHEME_TYPOS;
self.addTab(activationURI, true, null, { flags: flags });
} else {
let uri = commandURL || Browser.getHomePage();
self.addTab(uri, true);

View File

@ -1271,6 +1271,7 @@ nsScriptSecurityManager::CheckLoadURIStrWithPrincipal(nsIPrincipal* aPrincipal,
uint32_t flags[] = {
nsIURIFixup::FIXUP_FLAG_NONE,
nsIURIFixup::FIXUP_FLAG_FIX_SCHEME_TYPOS,
nsIURIFixup::FIXUP_FLAG_ALLOW_KEYWORD_LOOKUP,
nsIURIFixup::FIXUP_FLAGS_MAKE_ALTERNATE_URI,
nsIURIFixup::FIXUP_FLAG_ALLOW_KEYWORD_LOOKUP |

View File

@ -14,6 +14,7 @@ interface nsIMessageSender;
interface nsIVariant;
interface nsIDOMElement;
interface nsITabParent;
interface nsILoadContext;
typedef unsigned long long nsContentViewId;
@ -111,7 +112,7 @@ interface nsIContentViewManager : nsISupports
readonly attribute nsIContentView rootContentView;
};
[scriptable, builtinclass, uuid(5b9949dc-56f1-47b6-b6d2-3785bb90ed6d)]
[scriptable, builtinclass, uuid(4c9f91c0-7a5d-11e3-981f-0800200c9a66)]
interface nsIFrameLoader : nsISupports
{
/**
@ -125,6 +126,13 @@ interface nsIFrameLoader : nsISupports
*/
readonly attribute nsITabParent tabParent;
/**
* Get an nsILoadContext for the top-level docshell. For remote
* frames, a shim is returned that contains private browsing and app
* information.
*/
readonly attribute nsILoadContext loadContext;
/**
* Start loading the frame. This method figures out what to load
* from the owner content in the frame loader.

View File

@ -197,7 +197,6 @@ LOCAL_INCLUDES += [
'/content/events/src',
'/content/html/content/src',
'/content/html/document/src',
'/content/xbl/src',
'/content/xml/content/src',
'/content/xml/document/src',
'/content/xul/content/src',
@ -206,6 +205,7 @@ LOCAL_INCLUDES += [
'/dom/base',
'/dom/ipc',
'/dom/workers',
'/dom/xbl',
'/dom/xslt/xpath',
'/image/src',
'/js/ipc',

View File

@ -223,7 +223,7 @@ MarkContentViewer(nsIContentViewer* aViewer, bool aCleanupJS,
}
}
void MarkDocShell(nsIDocShellTreeNode* aNode, bool aCleanupJS,
void MarkDocShell(nsIDocShellTreeItem* aNode, bool aCleanupJS,
bool aPrepareForCC);
void
@ -256,7 +256,7 @@ MarkSHEntry(nsISHEntry* aSHEntry, bool aCleanupJS, bool aPrepareForCC)
}
void
MarkDocShell(nsIDocShellTreeNode* aNode, bool aCleanupJS, bool aPrepareForCC)
MarkDocShell(nsIDocShellTreeItem* aNode, bool aCleanupJS, bool aPrepareForCC)
{
nsCOMPtr<nsIDocShell> shell = do_QueryInterface(aNode);
if (!shell) {
@ -299,8 +299,7 @@ MarkWindowList(nsISimpleEnumerator* aWindowList, bool aCleanupJS,
iter) {
nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(iter);
if (window) {
nsCOMPtr<nsIDocShellTreeNode> rootDocShell =
do_QueryInterface(window->GetDocShell());
nsCOMPtr<nsIDocShell> rootDocShell = window->GetDocShell();
MarkDocShell(rootDocShell, aCleanupJS, aPrepareForCC);
}
@ -379,8 +378,7 @@ nsCCUncollectableMarker::Observe(nsISupports* aSubject, const char* aTopic,
if (hw) {
nsCOMPtr<nsIDocShell> shell;
hw->GetDocShell(getter_AddRefs(shell));
nsCOMPtr<nsIDocShellTreeNode> shellTreeNode = do_QueryInterface(shell);
MarkDocShell(shellTreeNode, cleanupJS, prepareForCC);
MarkDocShell(shell, cleanupJS, prepareForCC);
}
bool hasHiddenPrivateWindow = false;
appShell->GetHasHiddenPrivateWindow(&hasHiddenPrivateWindow);
@ -389,8 +387,7 @@ nsCCUncollectableMarker::Observe(nsISupports* aSubject, const char* aTopic,
if (hw) {
nsCOMPtr<nsIDocShell> shell;
hw->GetDocShell(getter_AddRefs(shell));
nsCOMPtr<nsIDocShellTreeNode> shellTreeNode = do_QueryInterface(shell);
MarkDocShell(shellTreeNode, cleanupJS, prepareForCC);
MarkDocShell(shell, cleanupJS, prepareForCC);
}
}
}

View File

@ -5881,14 +5881,13 @@ nsContentUtils::FlushLayoutForTree(nsIDOMWindow* aWindow)
doc->FlushPendingNotifications(Flush_Layout);
}
nsCOMPtr<nsIDocShellTreeNode> node =
do_QueryInterface(piWin->GetDocShell());
if (node) {
nsCOMPtr<nsIDocShell> docShell = piWin->GetDocShell();
if (docShell) {
int32_t i = 0, i_end;
node->GetChildCount(&i_end);
docShell->GetChildCount(&i_end);
for (; i < i_end; ++i) {
nsCOMPtr<nsIDocShellTreeItem> item;
node->GetChildAt(i, getter_AddRefs(item));
docShell->GetChildAt(i, getter_AddRefs(item));
nsCOMPtr<nsIDOMWindow> win = do_GetInterface(item);
if (win) {
FlushLayoutForTree(win);

View File

@ -713,7 +713,7 @@ bool
nsFrameLoader::AddTreeItemToTreeOwner(nsIDocShellTreeItem* aItem,
nsIDocShellTreeOwner* aOwner,
int32_t aParentType,
nsIDocShellTreeNode* aParentNode)
nsIDocShell* aParentNode)
{
NS_PRECONDITION(aItem, "Must have docshell treeitem");
NS_PRECONDITION(mOwnerContent, "Must have owning content");
@ -1571,9 +1571,8 @@ nsFrameLoader::MaybeCreateDocShell()
return NS_ERROR_NOT_AVAILABLE;
}
nsCOMPtr<nsISupports> container =
doc->GetContainer();
nsCOMPtr<nsIWebNavigation> parentAsWebNav = do_QueryInterface(container);
nsCOMPtr<nsIDocShell> docShell = doc->GetDocShell();
nsCOMPtr<nsIWebNavigation> parentAsWebNav = do_QueryInterface(docShell);
NS_ENSURE_STATE(parentAsWebNav);
// Create the docshell...
@ -1615,53 +1614,41 @@ nsFrameLoader::MaybeCreateDocShell()
mDocShell->SetName(frameName);
}
// If our container is a web-shell, inform it that it has a new
// child. If it's not a web-shell then some things will not operate
// properly.
// Inform our docShell that it has a new child.
// Note: This logic duplicates a lot of logic in
// nsSubDocumentFrame::AttributeChanged. We should fix that.
nsCOMPtr<nsIDocShellTreeNode> parentAsNode(do_QueryInterface(parentAsWebNav));
if (parentAsNode) {
// Note: This logic duplicates a lot of logic in
// nsSubDocumentFrame::AttributeChanged. We should fix that.
int32_t parentType;
docShell->GetItemType(&parentType);
nsCOMPtr<nsIDocShellTreeItem> parentAsItem =
do_QueryInterface(parentAsNode);
// XXXbz why is this in content code, exactly? We should handle
// this some other way..... Not sure how yet.
nsCOMPtr<nsIDocShellTreeOwner> parentTreeOwner;
docShell->GetTreeOwner(getter_AddRefs(parentTreeOwner));
NS_ENSURE_STATE(parentTreeOwner);
mIsTopLevelContent =
AddTreeItemToTreeOwner(mDocShell, parentTreeOwner, parentType, docShell);
int32_t parentType;
parentAsItem->GetItemType(&parentType);
// Make sure all shells have links back to the content element
// in the nearest enclosing chrome shell.
nsCOMPtr<nsIDOMEventTarget> chromeEventHandler;
// XXXbz why is this in content code, exactly? We should handle
// this some other way..... Not sure how yet.
nsCOMPtr<nsIDocShellTreeOwner> parentTreeOwner;
parentAsItem->GetTreeOwner(getter_AddRefs(parentTreeOwner));
NS_ENSURE_STATE(parentTreeOwner);
mIsTopLevelContent =
AddTreeItemToTreeOwner(mDocShell, parentTreeOwner, parentType,
parentAsNode);
if (parentType == nsIDocShellTreeItem::typeChrome) {
// Our parent shell is a chrome shell. It is therefore our nearest
// enclosing chrome shell.
// Make sure all shells have links back to the content element
// in the nearest enclosing chrome shell.
nsCOMPtr<nsIDOMEventTarget> chromeEventHandler;
chromeEventHandler = do_QueryInterface(mOwnerContent);
NS_ASSERTION(chromeEventHandler,
"This mContent should implement this.");
} else {
// Our parent shell is a content shell. Get the chrome event
// handler from it and use that for our shell as well.
if (parentType == nsIDocShellTreeItem::typeChrome) {
// Our parent shell is a chrome shell. It is therefore our nearest
// enclosing chrome shell.
chromeEventHandler = do_QueryInterface(mOwnerContent);
NS_ASSERTION(chromeEventHandler,
"This mContent should implement this.");
} else {
nsCOMPtr<nsIDocShell> parentShell(do_QueryInterface(parentAsNode));
// Our parent shell is a content shell. Get the chrome event
// handler from it and use that for our shell as well.
parentShell->GetChromeEventHandler(getter_AddRefs(chromeEventHandler));
}
mDocShell->SetChromeEventHandler(chromeEventHandler);
docShell->GetChromeEventHandler(getter_AddRefs(chromeEventHandler));
}
mDocShell->SetChromeEventHandler(chromeEventHandler);
// This is nasty, this code (the do_GetInterface(mDocShell) below)
// *must* come *after* the above call to
// mDocShell->SetChromeEventHandler() for the global window to get
@ -2691,3 +2678,18 @@ nsFrameLoader::GetTabParent(nsITabParent** aTabParent)
tp.forget(aTabParent);
return NS_OK;
}
NS_IMETHODIMP
nsFrameLoader::GetLoadContext(nsILoadContext** aLoadContext)
{
nsCOMPtr<nsILoadContext> loadContext;
if (mRemoteBrowser) {
loadContext = mRemoteBrowser->GetLoadContext();
} else {
nsCOMPtr<nsIDocShell> docShell;
GetDocShell(getter_AddRefs(docShell));
loadContext = do_GetInterface(docShell);
}
loadContext.forget(aLoadContext);
return NS_OK;
}

View File

@ -32,7 +32,6 @@ class AutoResetInShow;
class nsITabParent;
class nsIDocShellTreeItem;
class nsIDocShellTreeOwner;
class nsIDocShellTreeNode;
class mozIApplication;
namespace mozilla {
@ -388,7 +387,7 @@ private:
bool AddTreeItemToTreeOwner(nsIDocShellTreeItem* aItem,
nsIDocShellTreeOwner* aOwner,
int32_t aParentType,
nsIDocShellTreeNode* aParentNode);
nsIDocShell* aParentNode);
nsIAtom* TypeAttrName() const {
return mOwnerContent->IsXUL() ? nsGkAtoms::type : nsGkAtoms::mozframetype;

View File

@ -642,8 +642,7 @@ test(function test_FrameAncestor_ignores_userpass_bug779918() {
.createInstance(Ci.nsIDocShell);
docshellparent.setCurrentURI(aParentUri);
docshellchild.setCurrentURI(aChildUri);
docshellparent.QueryInterface(Ci.nsIDocShellTreeNode)
.addChild(docshellchild);
docshellparent.addChild(docshellchild);
return cspObj.permitsAncestry(docshellchild);
};

View File

@ -45,7 +45,7 @@ public:
mStops =
gfx::gfxGradientCache::GetOrCreateGradientStops(aRT,
mRawStops,
gfx::EXTEND_CLAMP);
gfx::ExtendMode::CLAMP);
return mStops;
}

View File

@ -250,9 +250,9 @@ public:
ExtendMode mode;
if (state.patternStyles[aStyle]->mRepeat == CanvasPattern::NOREPEAT) {
mode = EXTEND_CLAMP;
mode = ExtendMode::CLAMP;
} else {
mode = EXTEND_REPEAT;
mode = ExtendMode::REPEAT;
}
mPattern = new (mSurfacePattern.addr())
SurfacePattern(state.patternStyles[aStyle]->mSurface, mode);
@ -332,7 +332,7 @@ public:
mTarget =
mCtx->mTarget->CreateShadowDrawTarget(IntSize(int32_t(mTempRect.width), int32_t(mTempRect.height)),
FORMAT_B8G8R8A8, mSigma);
SurfaceFormat::B8G8R8A8, mSigma);
if (!mTarget) {
// XXX - Deal with the situation where our temp size is too big to
@ -358,6 +358,11 @@ public:
mCtx->CurrentState().op);
}
operator DrawTarget*()
{
return mTarget;
}
DrawTarget* operator->()
{
return mTarget;
@ -873,7 +878,7 @@ CanvasRenderingContext2D::EnsureTarget()
if (!mForceSoftware && CheckSizeForSkiaGL(size))
{
glContext = GLContextProvider::CreateOffscreen(gfxIntSize(size.width, size.height),
caps, gl::ContextFlagsNone);
caps);
}
if (glContext) {
@ -1130,7 +1135,7 @@ CanvasRenderingContext2D::GetInputStream(const char *aMimeType,
SurfaceFormat
CanvasRenderingContext2D::GetSurfaceFormat() const
{
return mOpaque ? FORMAT_B8G8R8X8 : FORMAT_B8G8R8A8;
return mOpaque ? SurfaceFormat::B8G8R8X8 : SurfaceFormat::B8G8R8A8;
}
//
@ -1381,9 +1386,9 @@ CanvasRenderingContext2D::SetFillRule(const nsAString& aString)
FillRule rule;
if (aString.EqualsLiteral("evenodd"))
rule = FILL_EVEN_ODD;
rule = FillRule::FILL_EVEN_ODD;
else if (aString.EqualsLiteral("nonzero"))
rule = FILL_WINDING;
rule = FillRule::FILL_WINDING;
else
return;
@ -1394,9 +1399,9 @@ void
CanvasRenderingContext2D::GetFillRule(nsAString& aString)
{
switch (CurrentState().fillRule) {
case FILL_WINDING:
case FillRule::FILL_WINDING:
aString.AssignLiteral("nonzero"); break;
case FILL_EVEN_ODD:
case FillRule::FILL_EVEN_ODD:
aString.AssignLiteral("evenodd"); break;
}
}
@ -1620,9 +1625,9 @@ CanvasRenderingContext2D::StrokeRect(double x, double y, double w,
}
if (!h) {
CapStyle cap = CAP_BUTT;
if (state.lineJoin == JOIN_ROUND) {
cap = CAP_ROUND;
CapStyle cap = CapStyle::BUTT;
if (state.lineJoin == JoinStyle::ROUND) {
cap = CapStyle::ROUND;
}
AdjustedTarget(this, bounds.IsEmpty() ? nullptr : &bounds)->
StrokeLine(Point(x, y), Point(x + w, y),
@ -1637,9 +1642,9 @@ CanvasRenderingContext2D::StrokeRect(double x, double y, double w,
}
if (!w) {
CapStyle cap = CAP_BUTT;
if (state.lineJoin == JOIN_ROUND) {
cap = CAP_ROUND;
CapStyle cap = CapStyle::BUTT;
if (state.lineJoin == JoinStyle::ROUND) {
cap = CapStyle::ROUND;
}
AdjustedTarget(this, bounds.IsEmpty() ? nullptr : &bounds)->
StrokeLine(Point(x, y), Point(x, y + h),
@ -1747,10 +1752,10 @@ void CanvasRenderingContext2D::DrawSystemFocusRing(mozilla::dom::Element& aEleme
state.shadowBlur = 0;
state.shadowOffset.x = 0;
state.shadowOffset.y = 0;
state.op = mozilla::gfx::OP_OVER;
state.op = mozilla::gfx::CompositionOp::OP_OVER;
state.lineCap = CAP_BUTT;
state.lineJoin = mozilla::gfx::JOIN_MITER_OR_BEVEL;
state.lineCap = CapStyle::BUTT;
state.lineJoin = mozilla::gfx::JoinStyle::MITER_OR_BEVEL;
state.lineWidth = 1;
CurrentState().dash.Clear();
@ -1963,7 +1968,7 @@ CanvasRenderingContext2D::EnsureUserSpacePath(const CanvasWindingRule& winding)
{
FillRule fillRule = CurrentState().fillRule;
if(winding == CanvasWindingRule::Evenodd)
fillRule = FILL_EVEN_ODD;
fillRule = FillRule::FILL_EVEN_ODD;
if (!mPath && !mPathBuilder && !mDSPathBuilder) {
EnsureTarget();
@ -2840,11 +2845,11 @@ CanvasRenderingContext2D::SetLineCap(const nsAString& capstyle)
CapStyle cap;
if (capstyle.EqualsLiteral("butt")) {
cap = CAP_BUTT;
cap = CapStyle::BUTT;
} else if (capstyle.EqualsLiteral("round")) {
cap = CAP_ROUND;
cap = CapStyle::ROUND;
} else if (capstyle.EqualsLiteral("square")) {
cap = CAP_SQUARE;
cap = CapStyle::SQUARE;
} else {
// XXX ERRMSG we need to report an error to developers here! (bug 329026)
return;
@ -2857,13 +2862,13 @@ void
CanvasRenderingContext2D::GetLineCap(nsAString& capstyle)
{
switch (CurrentState().lineCap) {
case CAP_BUTT:
case CapStyle::BUTT:
capstyle.AssignLiteral("butt");
break;
case CAP_ROUND:
case CapStyle::ROUND:
capstyle.AssignLiteral("round");
break;
case CAP_SQUARE:
case CapStyle::SQUARE:
capstyle.AssignLiteral("square");
break;
}
@ -2875,11 +2880,11 @@ CanvasRenderingContext2D::SetLineJoin(const nsAString& joinstyle)
JoinStyle j;
if (joinstyle.EqualsLiteral("round")) {
j = JOIN_ROUND;
j = JoinStyle::ROUND;
} else if (joinstyle.EqualsLiteral("bevel")) {
j = JOIN_BEVEL;
j = JoinStyle::BEVEL;
} else if (joinstyle.EqualsLiteral("miter")) {
j = JOIN_MITER_OR_BEVEL;
j = JoinStyle::MITER_OR_BEVEL;
} else {
// XXX ERRMSG we need to report an error to developers here! (bug 329026)
return;
@ -2892,13 +2897,13 @@ void
CanvasRenderingContext2D::GetLineJoin(nsAString& joinstyle, ErrorResult& error)
{
switch (CurrentState().lineJoin) {
case JOIN_ROUND:
case JoinStyle::ROUND:
joinstyle.AssignLiteral("round");
break;
case JOIN_BEVEL:
case JoinStyle::BEVEL:
joinstyle.AssignLiteral("bevel");
break;
case JOIN_MITER_OR_BEVEL:
case JoinStyle::MITER_OR_BEVEL:
joinstyle.AssignLiteral("miter");
break;
default:
@ -3094,14 +3099,17 @@ CanvasRenderingContext2D::DrawImage(const HTMLImageOrCanvasOrVideoElement& image
CanvasImageCache::Lookup(element, mCanvasElement, &imgSize);
}
nsLayoutUtils::DirectDrawInfo drawInfo;
if (!srcSurf) {
// The canvas spec says that drawImage should draw the first frame
// of animated images
uint32_t sfeFlags = nsLayoutUtils::SFE_WANT_FIRST_FRAME;
// of animated images. We also don't want to rasterize vector images.
uint32_t sfeFlags = nsLayoutUtils::SFE_WANT_FIRST_FRAME |
nsLayoutUtils::SFE_NO_RASTERIZING_VECTORS;
nsLayoutUtils::SurfaceFromElementResult res =
nsLayoutUtils::SurfaceFromElement(element, sfeFlags, mTarget);
if (!res.mSourceSurface) {
if (!res.mSourceSurface && !res.mDrawInfo.mImgContainer) {
// Spec says to silently do nothing if the element is still loading.
if (!res.mIsStillLoading) {
error.Throw(NS_ERROR_NOT_AVAILABLE);
@ -3126,12 +3134,16 @@ CanvasRenderingContext2D::DrawImage(const HTMLImageOrCanvasOrVideoElement& image
res.mCORSUsed);
}
if (res.mImageRequest) {
CanvasImageCache::NotifyDrawImage(element, mCanvasElement, res.mImageRequest,
res.mSourceSurface, imgSize);
}
if (res.mSourceSurface) {
if (res.mImageRequest) {
CanvasImageCache::NotifyDrawImage(element, mCanvasElement, res.mImageRequest,
res.mSourceSurface, imgSize);
}
srcSurf = res.mSourceSurface;
srcSurf = res.mSourceSurface;
} else {
drawInfo = res.mDrawInfo;
}
}
if (optional_argc == 0) {
@ -3167,9 +3179,9 @@ CanvasRenderingContext2D::DrawImage(const HTMLImageOrCanvasOrVideoElement& image
Filter filter;
if (CurrentState().imageSmoothingEnabled)
filter = mgfx::FILTER_LINEAR;
filter = mgfx::Filter::LINEAR;
else
filter = mgfx::FILTER_POINT;
filter = mgfx::Filter::POINT;
mgfx::Rect bounds;
@ -3178,31 +3190,77 @@ CanvasRenderingContext2D::DrawImage(const HTMLImageOrCanvasOrVideoElement& image
bounds = mTarget->GetTransform().TransformBounds(bounds);
}
AdjustedTarget(this, bounds.IsEmpty() ? nullptr : &bounds)->
DrawSurface(srcSurf,
mgfx::Rect(dx, dy, dw, dh),
mgfx::Rect(sx, sy, sw, sh),
DrawSurfaceOptions(filter),
DrawOptions(CurrentState().globalAlpha, UsedOperation()));
if (srcSurf) {
AdjustedTarget(this, bounds.IsEmpty() ? nullptr : &bounds)->
DrawSurface(srcSurf,
mgfx::Rect(dx, dy, dw, dh),
mgfx::Rect(sx, sy, sw, sh),
DrawSurfaceOptions(filter),
DrawOptions(CurrentState().globalAlpha, UsedOperation()));
} else {
DrawDirectlyToCanvas(drawInfo, &bounds, dx, dy, dw, dh,
sx, sy, sw, sh, imgSize);
}
RedrawUser(gfxRect(dx, dy, dw, dh));
}
void
CanvasRenderingContext2D::DrawDirectlyToCanvas(
const nsLayoutUtils::DirectDrawInfo& image,
mgfx::Rect* bounds, double dx, double dy,
double dw, double dh, double sx, double sy,
double sw, double sh, gfxIntSize imgSize)
{
gfxMatrix contextMatrix;
AdjustedTarget tempTarget(this, bounds->IsEmpty() ? nullptr: bounds);
// get any already existing transforms on the context. Include transformations used for context shadow
if (tempTarget) {
Matrix matrix = tempTarget->GetTransform();
contextMatrix = gfxMatrix(matrix._11, matrix._12, matrix._21,
matrix._22, matrix._31, matrix._32);
}
gfxMatrix transformMatrix;
transformMatrix.Translate(gfxPoint(sx, sy));
if (dw > 0 && dh > 0) {
transformMatrix.Scale(sw/dw, sh/dh);
}
transformMatrix.Translate(gfxPoint(-dx, -dy));
nsRefPtr<gfxContext> context = new gfxContext(tempTarget);
context->SetMatrix(contextMatrix);
// FLAG_CLAMP is added for increased performance
uint32_t modifiedFlags = image.mDrawingFlags | imgIContainer::FLAG_CLAMP;
nsresult rv = image.mImgContainer->
Draw(context, GraphicsFilter::FILTER_GOOD, transformMatrix,
gfxRect(gfxPoint(dx, dy), gfxIntSize(dw, dh)),
nsIntRect(nsIntPoint(0, 0), gfxIntSize(imgSize.width, imgSize.height)),
gfxIntSize(imgSize.width, imgSize.height), nullptr, image.mWhichFrame,
modifiedFlags);
NS_ENSURE_SUCCESS_VOID(rv);
}
#ifdef USE_SKIA_GPU
static bool
IsStandardCompositeOp(CompositionOp op)
{
return (op == OP_SOURCE ||
op == OP_ATOP ||
op == OP_IN ||
op == OP_OUT ||
op == OP_OVER ||
op == OP_DEST_IN ||
op == OP_DEST_OUT ||
op == OP_DEST_OVER ||
op == OP_DEST_ATOP ||
op == OP_ADD ||
op == OP_XOR);
return (op == CompositionOp::OP_SOURCE ||
op == CompositionOp::OP_ATOP ||
op == CompositionOp::OP_IN ||
op == CompositionOp::OP_OUT ||
op == CompositionOp::OP_OVER ||
op == CompositionOp::OP_DEST_IN ||
op == CompositionOp::OP_DEST_OUT ||
op == CompositionOp::OP_DEST_OVER ||
op == CompositionOp::OP_DEST_ATOP ||
op == CompositionOp::OP_ADD ||
op == CompositionOp::OP_XOR);
}
#endif
@ -3214,7 +3272,7 @@ CanvasRenderingContext2D::SetGlobalCompositeOperation(const nsAString& op,
#define CANVAS_OP_TO_GFX_OP(cvsop, op2d) \
if (op.EqualsLiteral(cvsop)) \
comp_op = OP_##op2d;
comp_op = CompositionOp::OP_##op2d;
CANVAS_OP_TO_GFX_OP("copy", SOURCE)
else CANVAS_OP_TO_GFX_OP("source-atop", ATOP)
@ -3262,7 +3320,7 @@ CanvasRenderingContext2D::GetGlobalCompositeOperation(nsAString& op,
CompositionOp comp_op = CurrentState().op;
#define CANVAS_OP_TO_GFX_OP(cvsop, op2d) \
if (comp_op == OP_##op2d) \
if (comp_op == CompositionOp::OP_##op2d) \
op.AssignLiteral(cvsop);
CANVAS_OP_TO_GFX_OP("copy", SOURCE)
@ -3394,7 +3452,7 @@ CanvasRenderingContext2D::DrawWindow(nsGlobalWindow& window, double x,
} else if (gfxPlatform::GetPlatform()->SupportsAzureContent()) {
drawDT =
gfxPlatform::GetPlatform()->CreateOffscreenContentDrawTarget(IntSize(ceil(sw), ceil(sh)),
FORMAT_B8G8R8A8);
SurfaceFormat::B8G8R8A8);
if (!drawDT) {
error.Throw(NS_ERROR_FAILURE);
return;
@ -3434,7 +3492,7 @@ CanvasRenderingContext2D::DrawWindow(nsGlobalWindow& window, double x,
mTarget->CreateSourceSurfaceFromData(img->Data(),
IntSize(size.width, size.height),
img->Stride(),
FORMAT_B8G8R8A8);
SurfaceFormat::B8G8R8A8);
} else {
RefPtr<SourceSurface> snapshot = drawDT->Snapshot();
RefPtr<DataSourceSurface> data = snapshot->GetDataSurface();
@ -3454,8 +3512,8 @@ CanvasRenderingContext2D::DrawWindow(nsGlobalWindow& window, double x,
mgfx::Rect destRect(0, 0, w, h);
mgfx::Rect sourceRect(0, 0, sw, sh);
mTarget->DrawSurface(source, destRect, sourceRect,
DrawSurfaceOptions(mgfx::FILTER_POINT),
DrawOptions(1.0f, OP_SOURCE, AA_NONE));
DrawSurfaceOptions(mgfx::Filter::POINT),
DrawOptions(1.0f, CompositionOp::OP_SOURCE, AntialiasMode::NONE));
mTarget->Flush();
} else {
mTarget->SetTransform(matrix);
@ -3733,7 +3791,7 @@ CanvasRenderingContext2D::EnsureErrorTarget()
return;
}
RefPtr<DrawTarget> errorTarget = gfxPlatform::GetPlatform()->CreateOffscreenCanvasDrawTarget(IntSize(1, 1), FORMAT_B8G8R8A8);
RefPtr<DrawTarget> errorTarget = gfxPlatform::GetPlatform()->CreateOffscreenCanvasDrawTarget(IntSize(1, 1), SurfaceFormat::B8G8R8A8);
MOZ_ASSERT(errorTarget, "Failed to allocate the error target!");
sErrorTarget = errorTarget;
@ -3879,7 +3937,7 @@ CanvasRenderingContext2D::PutImageData_explicit(int32_t x, int32_t y, uint32_t w
}
RefPtr<SourceSurface> sourceSurface =
mTarget->CreateSourceSurfaceFromData(imgsurf->Data(), IntSize(w, h), imgsurf->Stride(), FORMAT_B8G8R8A8);
mTarget->CreateSourceSurfaceFromData(imgsurf->Data(), IntSize(w, h), imgsurf->Stride(), SurfaceFormat::B8G8R8A8);
// In certain scenarios, requesting larger than 8k image fails. Bug 803568
// covers the details of how to run into it, but the full detailed

View File

@ -23,6 +23,7 @@
#include "mozilla/gfx/2D.h"
#include "gfx2DGlue.h"
#include "imgIEncoder.h"
#include "nsLayoutUtils.h"
class nsGlobalWindow;
class nsXULElement;
@ -579,6 +580,11 @@ protected:
double dx, double dy, double dw, double dh,
uint8_t optional_argc, mozilla::ErrorResult& error);
void DrawDirectlyToCanvas(const nsLayoutUtils::DirectDrawInfo& image,
mozilla::gfx::Rect* bounds, double dx, double dy,
double dw, double dh, double sx, double sy,
double sw, double sh, gfxIntSize imgSize);
nsString& GetFont()
{
/* will initilize the value if not set, else does nothing */
@ -693,7 +699,7 @@ protected:
{
if (NeedToDrawShadow()) {
// In this case the shadow rendering will use the operator.
return mozilla::gfx::OP_OVER;
return mozilla::gfx::CompositionOp::OP_OVER;
}
return CurrentState().op;
@ -759,10 +765,10 @@ protected:
globalAlpha(1.0f),
shadowBlur(0.0),
dashOffset(0.0f),
op(mozilla::gfx::OP_OVER),
fillRule(mozilla::gfx::FILL_WINDING),
lineCap(mozilla::gfx::CAP_BUTT),
lineJoin(mozilla::gfx::JOIN_MITER_OR_BEVEL),
op(mozilla::gfx::CompositionOp::OP_OVER),
fillRule(mozilla::gfx::FillRule::FILL_WINDING),
lineCap(mozilla::gfx::CapStyle::BUTT),
lineJoin(mozilla::gfx::JoinStyle::MITER_OR_BEVEL),
imageSmoothingEnabled(true)
{ }

View File

@ -72,7 +72,7 @@ WebGLContext::InitWebGL2()
WEBGL_depth_texture,
WEBGL_draw_buffers
};
const GLFeature::Enum sFeatureRequiredArr[] = {
const GLFeature sFeatureRequiredArr[] = {
GLFeature::blend_minmax,
GLFeature::instanced_non_arrays,
GLFeature::transform_feedback

View File

@ -439,8 +439,6 @@ WebGLContext::SetDimensions(int32_t width, int32_t height)
#endif
bool forceEnabled =
Preferences::GetBool("webgl.force-enabled", false);
bool useMesaLlvmPipe =
Preferences::GetBool("gfx.prefer-mesa-llvmpipe", false);
bool disabled =
Preferences::GetBool("webgl.disabled", false);
bool prefer16bit =
@ -533,7 +531,7 @@ WebGLContext::SetDimensions(int32_t width, int32_t height)
#ifdef XP_WIN
// allow forcing GL and not EGL/ANGLE
if (useMesaLlvmPipe || PR_GetEnv("MOZ_WEBGL_FORCE_OPENGL")) {
if (PR_GetEnv("MOZ_WEBGL_FORCE_OPENGL")) {
preferEGL = false;
useANGLE = false;
useOpenGL = true;
@ -555,13 +553,9 @@ WebGLContext::SetDimensions(int32_t width, int32_t height)
// try the default provider, whatever that is
if (!gl && useOpenGL) {
gl::ContextFlags flag = useMesaLlvmPipe
? gl::ContextFlagsMesaLLVMPipe
: gl::ContextFlagsNone;
gl = gl::GLContextProvider::CreateOffscreen(size, caps, flag);
gl = gl::GLContextProvider::CreateOffscreen(size, caps);
if (gl && !InitAndValidateGL()) {
GenerateWarning("Error during %s initialization",
useMesaLlvmPipe ? "Mesa LLVMpipe" : "OpenGL");
GenerateWarning("Error during OpenGL initialization");
return NS_ERROR_FAILURE;
}
}
@ -1296,7 +1290,7 @@ WebGLContext::MaybeRestoreContext()
if (mContextStatus != ContextNotLost || gl == nullptr)
return;
bool isEGL = gl->GetContextType() == gl::ContextTypeEGL,
bool isEGL = gl->GetContextType() == gl::GLContextType::EGL,
isANGLE = gl->IsANGLE();
GLContext::ContextResetARB resetStatus = GLContext::CONTEXT_NO_ERROR;

View File

@ -1425,6 +1425,8 @@ WebGLContext::GetFramebufferAttachmentParameter(JSContext* cx,
JS::NumberValue(uint32_t(LOCAL_GL_SRGB_EXT)) :
JS::NumberValue(uint32_t(LOCAL_GL_LINEAR));
}
break;
case LOCAL_GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE:
return JS::NumberValue(uint32_t(LOCAL_GL_RENDERBUFFER));
@ -1432,11 +1434,10 @@ WebGLContext::GetFramebufferAttachmentParameter(JSContext* cx,
{
return WebGLObjectAsJSValue(cx, fba.Renderbuffer(), rv);
}
default:
ErrorInvalidEnumInfo("getFramebufferAttachmentParameter: pname", pname);
return JS::NullValue();
}
ErrorInvalidEnumInfo("getFramebufferAttachmentParameter: pname", pname);
return JS::NullValue();
} else if (fba.Texture()) {
switch (pname) {
case LOCAL_GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT:
@ -1448,6 +1449,7 @@ WebGLContext::GetFramebufferAttachmentParameter(JSContext* cx,
JS::NumberValue(uint32_t(LOCAL_GL_SRGB_EXT)) :
JS::NumberValue(uint32_t(LOCAL_GL_LINEAR));
}
break;
case LOCAL_GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE:
return JS::NumberValue(uint32_t(LOCAL_GL_TEXTURE));
@ -1467,11 +1469,10 @@ WebGLContext::GetFramebufferAttachmentParameter(JSContext* cx,
face = 0;
return JS::Int32Value(face);
}
default:
ErrorInvalidEnumInfo("getFramebufferAttachmentParameter: pname", pname);
return JS::NullValue();
}
ErrorInvalidEnumInfo("getFramebufferAttachmentParameter: pname", pname);
return JS::NullValue();
} else {
switch (pname) {
case LOCAL_GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE:
@ -2151,7 +2152,7 @@ WebGLContext::LinkProgram(WebGLProgram *program)
// Bug 750527
if (gl->WorkAroundDriverBugs() &&
updateInfoSucceeded &&
gl->Vendor() == gl::GLContext::VendorNVIDIA)
gl->Vendor() == gl::GLVendor::NVIDIA)
{
if (program == mCurrentProgram)
gl->fUseProgram(progname);
@ -2689,16 +2690,16 @@ WebGLContext::SurfaceFromElementResultToImageSurface(nsLayoutUtils::SurfaceFromE
// texture sources in the first place.
switch (data->GetFormat()) {
case FORMAT_B8G8R8A8:
case SurfaceFormat::B8G8R8A8:
*format = WebGLTexelFormat::BGRA8; // careful, our ARGB means BGRA
break;
case FORMAT_B8G8R8X8:
case SurfaceFormat::B8G8R8X8:
*format = WebGLTexelFormat::BGRX8; // careful, our RGB24 is not tightly packed. Whence BGRX8.
break;
case FORMAT_A8:
case SurfaceFormat::A8:
*format = WebGLTexelFormat::A8;
break;
case FORMAT_R5G6B5:
case SurfaceFormat::R5G6B5:
*format = WebGLTexelFormat::RGB565;
break;
default:
@ -3118,7 +3119,7 @@ WebGLContext::CompileShader(WebGLShader *shader)
if (gl->WorkAroundDriverBugs()) {
#ifdef XP_MACOSX
if (gl->Vendor() == gl::GLContext::VendorNVIDIA) {
if (gl->Vendor() == gl::GLVendor::NVIDIA) {
// Work around bug 890432
resources.MaxExpressionComplexity = 1000;
}
@ -3222,12 +3223,12 @@ WebGLContext::CompileShader(WebGLShader *shader)
#ifdef XP_MACOSX
if (gl->WorkAroundDriverBugs()) {
// Work around bug 665578 and bug 769810
if (gl->Vendor() == gl::GLContext::VendorATI) {
if (gl->Vendor() == gl::GLVendor::ATI) {
compileOptions |= SH_EMULATE_BUILT_IN_FUNCTIONS;
}
// Work around bug 735560
if (gl->Vendor() == gl::GLContext::VendorIntel) {
if (gl->Vendor() == gl::GLVendor::Intel) {
compileOptions |= SH_EMULATE_BUILT_IN_FUNCTIONS;
}
}

View File

@ -980,7 +980,7 @@ WebGLContext::InitAndValidateGL()
#ifdef XP_MACOSX
if (gl->WorkAroundDriverBugs() &&
gl->Vendor() == gl::GLContext::VendorATI) {
gl->Vendor() == gl::GLVendor::ATI) {
// The Mac ATI driver, in all known OSX version up to and including 10.8,
// renders points sprites upside-down. Apple bug 11778921
gl->fPointParameterf(LOCAL_GL_POINT_SPRITE_COORD_ORIGIN, LOCAL_GL_LOWER_LEFT);

View File

@ -724,7 +724,7 @@ void WebGLContext::Draw_cleanup()
}
if (gl->WorkAroundDriverBugs()) {
if (gl->Renderer() == gl::GLContext::RendererTegra) {
if (gl->Renderer() == gl::GLRenderer::Tegra) {
mDrawCallsSinceLastFlush++;
if (mDrawCallsSinceLastFlush >= MAX_DRAW_CALLS_SINCE_FLUSH) {

View File

@ -195,7 +195,7 @@ WebGLRenderbuffer::GetRenderbufferParameter(GLenum target, GLenum pname) const {
case LOCAL_GL_RENDERBUFFER_STENCIL_SIZE: {
if (NeedsDepthStencilEmu(mContext->gl, InternalFormatForGL())) {
if (gl->WorkAroundDriverBugs() &&
gl->Renderer() == GLContext::RendererTegra)
gl->Renderer() == GLRenderer::Tegra)
{
return 8;
}

View File

@ -1490,11 +1490,11 @@ nsEventStateManager::HandleAccessKey(nsPresContext* aPresContext,
ProcessingAccessKeyState aAccessKeyState,
int32_t aModifierMask)
{
nsCOMPtr<nsISupports> pcContainer = aPresContext->GetContainerWeak();
nsCOMPtr<nsIDocShell> docShell = aPresContext->GetDocShell();
// Alt or other accesskey modifier is down, we may need to do an accesskey
if (mAccessKeys.Count() > 0 &&
aModifierMask == GetAccessModifierMaskFor(pcContainer)) {
aModifierMask == GetAccessModifierMaskFor(docShell)) {
// Someone registered an accesskey. Find and activate it.
nsAutoTArray<uint32_t, 10> accessCharCodes;
nsContentUtils::GetAccessKeyCandidates(aEvent, accessCharCodes);
@ -1508,7 +1508,6 @@ nsEventStateManager::HandleAccessKey(nsPresContext* aPresContext,
if (nsEventStatus_eConsumeNoDefault != *aStatus) {
// checking all sub docshells
nsCOMPtr<nsIDocShellTreeNode> docShell(do_QueryInterface(pcContainer));
if (!docShell) {
NS_WARNING("no docShellTreeNode for presContext");
return;
@ -1552,7 +1551,6 @@ nsEventStateManager::HandleAccessKey(nsPresContext* aPresContext,
// bubble up the process to the parent docshell if necessary
if (eAccessKeyProcessingDown != aAccessKeyState && nsEventStatus_eConsumeNoDefault != *aStatus) {
nsCOMPtr<nsIDocShellTreeItem> docShell(do_QueryInterface(pcContainer));
if (!docShell) {
NS_WARNING("no docShellTreeItem for presContext");
return;

View File

@ -22,7 +22,6 @@ class nsFrameLoader;
class nsIContent;
class nsIDocument;
class nsIDocShell;
class nsIDocShellTreeNode;
class nsIDocShellTreeItem;
class imgIContainer;
class nsDOMDataTransfer;

View File

@ -80,31 +80,6 @@ HTMLFrameElement::ParseAttribute(int32_t aNamespaceID,
aValue, aResult);
}
void
HTMLFrameElement::MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
nsRuleData* aData)
{
nsGenericHTMLElement::MapScrollingAttributeInto(aAttributes, aData);
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData);
}
NS_IMETHODIMP_(bool)
HTMLFrameElement::IsAttributeMapped(const nsIAtom* aAttribute) const
{
static const MappedAttributeEntry* const map[] = {
sScrollingAttributeMap,
sCommonAttributeMap,
};
return FindAttributeDependence(aAttribute, map);
}
nsMapRuleToAttributesFunc
HTMLFrameElement::GetAttributeMappingFunction() const
{
return &MapAttributesIntoRule;
}
JSObject*
HTMLFrameElement::WrapNode(JSContext* aCx, JS::Handle<JSObject*> aScope)
{

View File

@ -37,8 +37,6 @@ public:
nsIAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult) MOZ_OVERRIDE;
NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const MOZ_OVERRIDE;
nsMapRuleToAttributesFunc GetAttributeMappingFunction() const MOZ_OVERRIDE;
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE;
// WebIDL API

View File

@ -158,7 +158,6 @@ HTMLIFrameElement::MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
}
}
nsGenericHTMLElement::MapScrollingAttributeInto(aAttributes, aData);
nsGenericHTMLElement::MapImageAlignAttributeInto(aAttributes, aData);
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData);
}
@ -175,7 +174,6 @@ HTMLIFrameElement::IsAttributeMapped(const nsIAtom* aAttribute) const
static const MappedAttributeEntry* const map[] = {
attributes,
sScrollingAttributeMap,
sImageAlignAttributeMap,
sCommonAttributeMap,
};
@ -220,8 +218,8 @@ HTMLIFrameElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
// alreay been updated.
mFrameLoader->ApplySandboxFlags(GetSandboxFlags());
}
return nsGenericHTMLElement::AfterSetAttr(aNameSpaceID, aName, aValue,
aNotify);
return nsGenericHTMLFrameElement::AfterSetAttr(aNameSpaceID, aName, aValue,
aNotify);
}
nsresult

View File

@ -171,9 +171,9 @@ LOCAL_INCLUDES += [
'/content/events/src',
'/content/html/document/src',
'/content/media/',
'/content/xbl/src',
'/content/xul/content/src',
'/dom/base',
'/dom/xbl',
'/editor/libeditor/base',
'/editor/libeditor/text',
'/editor/txmgr/src',

View File

@ -1431,12 +1431,6 @@ nsGenericHTMLElement::sBackgroundColorAttributeMap[] = {
{ nullptr }
};
/* static */ const Element::MappedAttributeEntry
nsGenericHTMLElement::sScrollingAttributeMap[] = {
{ &nsGkAtoms::scrolling },
{ nullptr }
};
void
nsGenericHTMLElement::MapImageAlignAttributeInto(const nsMappedAttributes* aAttributes,
nsRuleData* aRuleData)
@ -1675,51 +1669,6 @@ nsGenericHTMLElement::MapBackgroundAttributesInto(const nsMappedAttributes* aAtt
MapBGColorInto(aAttributes, aData);
}
void
nsGenericHTMLElement::MapScrollingAttributeInto(const nsMappedAttributes* aAttributes,
nsRuleData* aData)
{
if (!(aData->mSIDs & NS_STYLE_INHERIT_BIT(Display)))
return;
// scrolling
nsCSSValue* overflowValues[2] = {
aData->ValueForOverflowX(),
aData->ValueForOverflowY(),
};
for (uint32_t i = 0; i < ArrayLength(overflowValues); ++i) {
if (overflowValues[i]->GetUnit() == eCSSUnit_Null) {
const nsAttrValue* value = aAttributes->GetAttr(nsGkAtoms::scrolling);
if (value && value->Type() == nsAttrValue::eEnum) {
int32_t mappedValue;
switch (value->GetEnumValue()) {
case NS_STYLE_FRAME_ON:
case NS_STYLE_FRAME_SCROLL:
case NS_STYLE_FRAME_YES:
mappedValue = NS_STYLE_OVERFLOW_SCROLL;
break;
case NS_STYLE_FRAME_OFF:
case NS_STYLE_FRAME_NOSCROLL:
case NS_STYLE_FRAME_NO:
mappedValue = NS_STYLE_OVERFLOW_HIDDEN;
break;
case NS_STYLE_FRAME_AUTO:
mappedValue = NS_STYLE_OVERFLOW_AUTO;
break;
default:
NS_NOTREACHED("unexpected value");
mappedValue = NS_STYLE_OVERFLOW_AUTO;
break;
}
overflowValues[i]->SetIntValue(mappedValue, eCSSUnit_Enumerated);
}
}
}
}
//----------------------------------------------------------------------
nsresult

View File

@ -753,7 +753,6 @@ public:
static const MappedAttributeEntry sDivAlignAttributeMap[];
static const MappedAttributeEntry sBackgroundAttributeMap[];
static const MappedAttributeEntry sBackgroundColorAttributeMap[];
static const MappedAttributeEntry sScrollingAttributeMap[];
/**
* Helper to map the align attribute into a style struct.

View File

@ -7,16 +7,22 @@
#include "nsGenericHTMLFrameElement.h"
#include "nsIDOMDocument.h"
#include "nsIInterfaceRequestorUtils.h"
#include "nsContentUtils.h"
#include "mozilla/Preferences.h"
#include "mozilla/ErrorResult.h"
#include "nsIAppsService.h"
#include "nsServiceManagerUtils.h"
#include "mozIApplication.h"
#include "nsIPermissionManager.h"
#include "GeckoProfiler.h"
#include "mozIApplication.h"
#include "nsAttrValueInlines.h"
#include "nsContentUtils.h"
#include "nsIAppsService.h"
#include "nsIDocShell.h"
#include "nsIDOMDocument.h"
#include "nsIFrame.h"
#include "nsIInterfaceRequestorUtils.h"
#include "nsIPermissionManager.h"
#include "nsIPresShell.h"
#include "nsIScrollable.h"
#include "nsPresContext.h"
#include "nsServiceManagerUtils.h"
using namespace mozilla;
using namespace mozilla::dom;
@ -275,6 +281,55 @@ nsGenericHTMLFrameElement::UnsetAttr(int32_t aNameSpaceID, nsIAtom* aAttribute,
return NS_OK;
}
/* static */ int32_t
nsGenericHTMLFrameElement::MapScrollingAttribute(const nsAttrValue* aValue)
{
int32_t mappedValue = nsIScrollable::Scrollbar_Auto;
if (aValue && aValue->Type() == nsAttrValue::eEnum) {
switch (aValue->GetEnumValue()) {
case NS_STYLE_FRAME_OFF:
case NS_STYLE_FRAME_NOSCROLL:
case NS_STYLE_FRAME_NO:
mappedValue = nsIScrollable::Scrollbar_Never;
break;
}
}
return mappedValue;
}
/* virtual */ nsresult
nsGenericHTMLFrameElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
const nsAttrValue* aValue,
bool aNotify)
{
if (aName == nsGkAtoms::scrolling && aNameSpaceID == kNameSpaceID_None) {
if (mFrameLoader) {
nsIDocShell* docshell = mFrameLoader->GetExistingDocShell();
nsCOMPtr<nsIScrollable> scrollable = do_QueryInterface(docshell);
if (scrollable) {
int32_t cur;
scrollable->GetDefaultScrollbarPreferences(nsIScrollable::ScrollOrientation_X, &cur);
int32_t val = MapScrollingAttribute(aValue);
if (cur != val) {
scrollable->SetDefaultScrollbarPreferences(nsIScrollable::ScrollOrientation_X, val);
scrollable->SetDefaultScrollbarPreferences(nsIScrollable::ScrollOrientation_Y, val);
nsRefPtr<nsPresContext> presContext;
docshell->GetPresContext(getter_AddRefs(presContext));
nsIPresShell* shell = presContext ? presContext->GetPresShell() : nullptr;
nsIFrame* rootScroll = shell ? shell->GetRootScrollFrame() : nullptr;
if (rootScroll) {
shell->FrameNeedsReflow(rootScroll, nsIPresShell::eStyleChange,
NS_FRAME_IS_DIRTY);
}
}
}
}
}
return nsGenericHTMLElement::AfterSetAttr(aNameSpaceID, aName, aValue,
aNotify);
}
void
nsGenericHTMLFrameElement::DestroyContent()
{

View File

@ -61,6 +61,9 @@ public:
bool aNotify) MOZ_OVERRIDE;
virtual nsresult UnsetAttr(int32_t aNameSpaceID, nsIAtom* aAttribute,
bool aNotify) MOZ_OVERRIDE;
virtual nsresult AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
const nsAttrValue* aValue,
bool aNotify) MOZ_OVERRIDE;
virtual void DestroyContent() MOZ_OVERRIDE;
nsresult CopyInnerTo(mozilla::dom::Element* aDest);
@ -73,6 +76,17 @@ public:
void SwapFrameLoaders(nsXULElement& aOtherOwner, mozilla::ErrorResult& aError);
static bool BrowserFramesEnabled();
/**
* Helper method to map a HTML 'scrolling' attribute value to a nsIScrollable
* enum value. scrolling="no" (and its synonyms) maps to
* nsIScrollable::Scrollbar_Never, and anything else (including nullptr) maps
* to nsIScrollable::Scrollbar_Auto.
* @param aValue the attribute value to map or nullptr
* @return nsIScrollable::Scrollbar_Never or nsIScrollable::Scrollbar_Auto
*/
static int32_t MapScrollingAttribute(const nsAttrValue* aValue);
protected:
// This doesn't really ensure a frame loade in all cases, only when
// it makes sense.

View File

@ -14,7 +14,6 @@ PARALLEL_DIRS += [
'svg',
'xml',
'xul',
'xbl',
]
TEST_TOOL_DIRS += ['test']

View File

@ -817,7 +817,7 @@ SVGPathData::ToPathForLengthOrPositionMeasuring() const
// pass as aStrokeWidth doesn't matter (since it's only used to determine the
// length of those extra little lines).
return BuildPath(FILL_WINDING, NS_STYLE_STROKE_LINECAP_BUTT, 0);
return BuildPath(FillRule::FILL_WINDING, NS_STYLE_STROKE_LINECAP_BUTT, 0);
}
static double

View File

@ -252,10 +252,10 @@ LOCAL_INCLUDES += [
'/content/base/src',
'/content/events/src',
'/content/html/content/src',
'/content/xbl/src',
'/content/xml/content/src',
'/dom',
'/dom/smil',
'/dom/xbl',
'/layout/generic',
'/layout/style',
'/layout/svg',

View File

@ -89,7 +89,7 @@ nsSVGPathGeometryElement::CreatePathBuilder()
FillRule
nsSVGPathGeometryElement::GetFillRule()
{
FillRule fillRule = FILL_WINDING; // Equivalent to NS_STYLE_FILL_RULE_NONZERO
FillRule fillRule = FillRule::FILL_WINDING; // Equivalent to NS_STYLE_FILL_RULE_NONZERO
nsRefPtr<nsStyleContext> styleContext =
nsComputedDOMStyle::GetStyleContextForElementNoFlush(this, nullptr,
@ -102,7 +102,7 @@ nsSVGPathGeometryElement::GetFillRule()
NS_STYLE_FILL_RULE_EVENODD);
if (styleContext->StyleSVG()->mFillRule == NS_STYLE_FILL_RULE_EVENODD) {
fillRule = FILL_EVEN_ODD;
fillRule = FillRule::FILL_EVEN_ODD;
}
} else {
// ReportToConsole

View File

@ -1,8 +0,0 @@
# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# 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/.
PARALLEL_DIRS += ['src', 'builtin']
TEST_DIRS += ['test']

View File

@ -21,9 +21,9 @@ LOCAL_INCLUDES += [
'/content/base/src',
'/content/events/src',
'/content/html/content/src',
'/content/xbl/src',
'/content/xml/content/src',
'/content/xml/document/src',
'/dom/xbl',
'/layout/generic',
'/layout/style',
'/layout/xul',

View File

@ -24,12 +24,12 @@ MSVC_ENABLE_PGO = True
LOCAL_INCLUDES += [
'/content/base/src',
'/content/events/src',
'/content/xbl/src',
'/content/xml/document/src',
'/content/xul/content/src',
'/content/xul/templates/src',
'/docshell/base',
'/dom/base',
'/dom/xbl',
'/layout/base',
'/layout/generic',
'/layout/style',

View File

@ -54,6 +54,21 @@ public:
#endif
{}
LoadContext(dom::Element* aTopFrameElement,
uint32_t aAppId,
bool aIsContent,
bool aUsePrivateBrowsing,
bool aIsInBrowserElement)
: mTopFrameElement(do_GetWeakReference(aTopFrameElement))
, mAppId(aAppId)
, mIsContent(aIsContent)
, mUsePrivateBrowsing(aUsePrivateBrowsing)
, mIsInBrowserElement(aIsInBrowserElement)
#ifdef DEBUG
, mIsNotNull(true)
#endif
{}
// Constructor taking reserved appId for the safebrowsing cookie.
LoadContext(uint32_t aAppId)
: mTopFrameElement(nullptr)

View File

@ -15,7 +15,6 @@ XPIDL_SOURCES += [
'nsIDocShell.idl',
'nsIDocShellLoadInfo.idl',
'nsIDocShellTreeItem.idl',
'nsIDocShellTreeNode.idl',
'nsIDocShellTreeOwner.idl',
'nsIDocumentLoaderFactory.idl',
'nsIDownloadHistory.idl',

View File

@ -974,7 +974,6 @@ NS_IMPL_RELEASE_INHERITED(nsDocShell, nsDocLoader)
NS_INTERFACE_MAP_BEGIN(nsDocShell)
NS_INTERFACE_MAP_ENTRY(nsIDocShell)
NS_INTERFACE_MAP_ENTRY(nsIDocShellTreeItem)
NS_INTERFACE_MAP_ENTRY(nsIDocShellTreeNode)
NS_INTERFACE_MAP_ENTRY(nsIWebNavigation)
NS_INTERFACE_MAP_ENTRY(nsIBaseWindow)
NS_INTERFACE_MAP_ENTRY(nsIScrollable)
@ -1584,6 +1583,9 @@ nsDocShell::LoadURI(nsIURI * aURI,
if (aLoadFlags & LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP)
flags |= INTERNAL_LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP;
if (aLoadFlags & LOAD_FLAGS_FIXUP_SCHEME_TYPOS)
flags |= INTERNAL_LOAD_FLAGS_FIXUP_SCHEME_TYPOS;
if (aLoadFlags & LOAD_FLAGS_FIRST_LOAD)
flags |= INTERNAL_LOAD_FLAGS_FIRST_LOAD;
@ -3608,10 +3610,6 @@ nsDocShell::GetIsInUnload(bool* aIsInUnload)
return NS_OK;
}
//*****************************************************************************
// nsDocShell::nsIDocShellTreeNode
//*****************************************************************************
NS_IMETHODIMP
nsDocShell::GetChildCount(int32_t * aChildCount)
{
@ -4277,6 +4275,9 @@ nsDocShell::LoadURI(const char16_t * aURI,
if (aLoadFlags & LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP) {
fixupFlags |= nsIURIFixup::FIXUP_FLAG_ALLOW_KEYWORD_LOOKUP;
}
if (aLoadFlags & LOAD_FLAGS_FIXUP_SCHEME_TYPOS) {
fixupFlags |= nsIURIFixup::FIXUP_FLAG_FIX_SCHEME_TYPOS;
}
nsCOMPtr<nsIInputStream> fixupStream;
rv = sURIFixup->CreateFixupURI(uriString, fixupFlags,
getter_AddRefs(fixupStream),

View File

@ -11,7 +11,6 @@
#include "nsITimer.h"
#include "nsIDocShell.h"
#include "nsIDocShellTreeItem.h"
#include "nsIDocShellTreeNode.h"
#include "nsIBaseWindow.h"
#include "nsIScrollable.h"
#include "nsITextScroll.h"
@ -155,7 +154,6 @@ public:
NS_DECL_NSIDOCSHELL
NS_DECL_NSIDOCSHELLTREEITEM
NS_DECL_NSIDOCSHELLTREENODE
NS_DECL_NSIWEBNAVIGATION
NS_DECL_NSIBASEWINDOW
NS_DECL_NSISCROLLABLE

View File

@ -8,7 +8,6 @@
#include "nsDocShellEnumerator.h"
#include "nsIDocShellTreeItem.h"
#include "nsIDocShellTreeNode.h"
nsDocShellEnumerator::nsDocShellEnumerator(int32_t inEnumerationDirection)
: mRootItem(nullptr)
@ -123,8 +122,6 @@ nsresult nsDocShellEnumerator::BuildDocShellArray(nsTArray<nsWeakPtr>& inItemArr
nsresult nsDocShellForwardsEnumerator::BuildArrayRecursive(nsIDocShellTreeItem* inItem, nsTArray<nsWeakPtr>& inItemArray)
{
nsresult rv;
nsCOMPtr<nsIDocShellTreeNode> itemAsNode = do_QueryInterface(inItem, &rv);
if (NS_FAILED(rv)) return rv;
int32_t itemType;
// add this item to the array
@ -136,13 +133,13 @@ nsresult nsDocShellForwardsEnumerator::BuildArrayRecursive(nsIDocShellTreeItem*
}
int32_t numChildren;
rv = itemAsNode->GetChildCount(&numChildren);
rv = inItem->GetChildCount(&numChildren);
if (NS_FAILED(rv)) return rv;
for (int32_t i = 0; i < numChildren; ++i)
{
nsCOMPtr<nsIDocShellTreeItem> curChild;
rv = itemAsNode->GetChildAt(i, getter_AddRefs(curChild));
rv = inItem->GetChildAt(i, getter_AddRefs(curChild));
if (NS_FAILED(rv)) return rv;
rv = BuildArrayRecursive(curChild, inItemArray);
@ -156,17 +153,15 @@ nsresult nsDocShellForwardsEnumerator::BuildArrayRecursive(nsIDocShellTreeItem*
nsresult nsDocShellBackwardsEnumerator::BuildArrayRecursive(nsIDocShellTreeItem* inItem, nsTArray<nsWeakPtr>& inItemArray)
{
nsresult rv;
nsCOMPtr<nsIDocShellTreeNode> itemAsNode = do_QueryInterface(inItem, &rv);
if (NS_FAILED(rv)) return rv;
int32_t numChildren;
rv = itemAsNode->GetChildCount(&numChildren);
rv = inItem->GetChildCount(&numChildren);
if (NS_FAILED(rv)) return rv;
for (int32_t i = numChildren - 1; i >= 0; --i)
{
nsCOMPtr<nsIDocShellTreeItem> curChild;
rv = itemAsNode->GetChildAt(i, getter_AddRefs(curChild));
rv = inItem->GetChildAt(i, getter_AddRefs(curChild));
if (NS_FAILED(rv)) return rv;
rv = BuildArrayRecursive(curChild, inItemArray);

View File

@ -44,7 +44,7 @@ interface nsIReflowObserver;
typedef unsigned long nsLoadFlags;
[scriptable, builtinclass, uuid(55ca6545-7ce4-49ad-8117-8286ca9c61bb)]
[scriptable, builtinclass, uuid(e3ea830d-2614-4aeb-9ec3-b8f744b03b80)]
interface nsIDocShell : nsIDocShellTreeItem
{
/**
@ -111,6 +111,8 @@ interface nsIDocShell : nsIDocShellTreeItem
// Whether the load should be treated as srcdoc load, rather than a URI one.
const long INTERNAL_LOAD_FLAGS_IS_SRCDOC = 0x40;
const long INTERNAL_LOAD_FLAGS_FIXUP_SCHEME_TYPOS = 0x80;
/**
* Loads the given URI. This method is identical to loadURI(...) except
* that its parameter list is broken out instead of being packaged inside

View File

@ -4,7 +4,7 @@
* 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 "nsIDocShellTreeNode.idl"
#include "nsISupports.idl"
interface nsIDocShellTreeOwner;
@ -15,8 +15,8 @@ interface nsIDocShellTreeOwner;
* node or a leaf.
*/
[scriptable, uuid(e35bbb39-985b-4d62-81da-73c330222e5f)]
interface nsIDocShellTreeItem : nsIDocShellTreeNode
[scriptable, uuid(cb16a98d-a9e4-4ee2-a450-709b92ad8a89)]
interface nsIDocShellTreeItem : nsISupports
{
/*
name of the DocShellTreeItem
@ -125,5 +125,54 @@ interface nsIDocShellTreeItem : nsIDocShellTreeNode
*/
readonly attribute nsIDocShellTreeOwner treeOwner;
[noscript] void setTreeOwner(in nsIDocShellTreeOwner treeOwner);
/*
The current number of DocShells which are immediate children of the
this object.
*/
readonly attribute long childCount;
/*
Add a new child DocShellTreeItem. Adds to the end of the list.
Note that this does NOT take a reference to the child. The child stays
alive only as long as it's referenced from outside the docshell tree.
@throws NS_ERROR_ILLEGAL_VALUE if child corresponds to the same
object as this treenode or an ancestor of this treenode
@throws NS_ERROR_UNEXPECTED if this node is a leaf in the tree.
*/
void addChild(in nsIDocShellTreeItem child);
/*
Removes a child DocShellTreeItem.
@throws NS_ERROR_UNEXPECTED if this node is a leaf in the tree.
*/
void removeChild(in nsIDocShellTreeItem child);
/**
* Return the child at the index requested. This is 0-based.
*
* @throws NS_ERROR_UNEXPECTED if the index is out of range
*/
nsIDocShellTreeItem getChildAt(in long index);
/*
Return the child DocShellTreeItem with the specified name.
aName - This is the name of the item that is trying to be found.
aRecurse - Is used to tell the function to recurse through children.
Note, recursion will only happen through items of the same type.
aSameType - If this is set only children of the same type will be returned.
aRequestor - This is the docshellTreeItem that is requesting the find. This
parameter is used when recursion is being used to avoid searching the same
tree again when a child has asked a parent to search for children.
aOriginalRequestor - The original treeitem that made the request, if any.
This is used to ensure that we don't run into cross-site issues.
Note the search is depth first when recursing.
*/
nsIDocShellTreeItem findChildWithName(in wstring aName,
in boolean aRecurse,
in boolean aSameType,
in nsIDocShellTreeItem aRequestor,
in nsIDocShellTreeItem aOriginalRequestor);
};

View File

@ -1,75 +0,0 @@
/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsISupports.idl"
interface nsIDocShellTreeItem;
/**
* The nsIDocShellTreeNode supplies the methods for interacting with children
* of a docshell. These are essentially the methods that turn a single docshell
* into a docshell tree.
*/
/*
* Long-term, we probably want to merge this interface into
* nsIDocShellTreeItem. Need to eliminate uses of this interface
* first.
*/
[scriptable, uuid(37f1ab73-f224-44b1-82f0-d2834ab1cec0)]
interface nsIDocShellTreeNode : nsISupports
{
/*
The current number of DocShells which are immediate children of the
this object.
*/
readonly attribute long childCount;
/*
Add a new child DocShellTreeItem. Adds to the end of the list.
Note that this does NOT take a reference to the child. The child stays
alive only as long as it's referenced from outside the docshell tree.
@throws NS_ERROR_ILLEGAL_VALUE if child corresponds to the same
object as this treenode or an ancestor of this treenode
@throws NS_ERROR_UNEXPECTED if this node is a leaf in the tree.
*/
void addChild(in nsIDocShellTreeItem child);
/*
Removes a child DocShellTreeItem.
@throws NS_ERROR_UNEXPECTED if this node is a leaf in the tree.
*/
void removeChild(in nsIDocShellTreeItem child);
/**
* Return the child at the index requested. This is 0-based.
*
* @throws NS_ERROR_UNEXPECTED if the index is out of range
*/
nsIDocShellTreeItem getChildAt(in long index);
/*
Return the child DocShellTreeItem with the specified name.
aName - This is the name of the item that is trying to be found.
aRecurse - Is used to tell the function to recurse through children.
Note, recursion will only happen through items of the same type.
aSameType - If this is set only children of the same type will be returned.
aRequestor - This is the docshellTreeItem that is requesting the find. This
parameter is used when recursion is being used to avoid searching the same
tree again when a child has asked a parent to search for children.
aOriginalRequestor - The original treeitem that made the request, if any.
This is used to ensure that we don't run into cross-site issues.
Note the search is depth first when recursing.
*/
nsIDocShellTreeItem findChildWithName(in wstring aName,
in boolean aRecurse,
in boolean aSameType,
in nsIDocShellTreeItem aRequestor,
in nsIDocShellTreeItem aOriginalRequestor);
};

View File

@ -16,7 +16,7 @@ interface nsIURI;
* location, stop or restart an in process load, or determine where the object
* has previously gone.
*/
[scriptable, uuid(28404f7e-0f17-4dc3-a21a-2074d8659b02)]
[scriptable, uuid(dbd6241d-c76e-42c0-9410-930589d803a2)]
interface nsIWebNavigation : nsISupports
{
/**
@ -191,6 +191,11 @@ interface nsIWebNavigation : nsISupports
*/
const unsigned long LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP = 0x100000;
/**
* This flag specifies that common scheme typos should be corrected.
*/
const unsigned long LOAD_FLAGS_FIXUP_SCHEME_TYPOS = 0x200000;
/* Note that flag 0x80000 is available. */
/**

View File

@ -17,7 +17,6 @@
#include "nsIDocShellLoadInfo.h"
#include "nsISHContainer.h"
#include "nsIDocShellTreeItem.h"
#include "nsIDocShellTreeNode.h"
#include "nsIURI.h"
#include "nsIContentViewer.h"
#include "nsICacheService.h"
@ -1636,22 +1635,21 @@ nsSHistory::CompareFrames(nsISHEntry * aPrevEntry, nsISHEntry * aNextEntry, nsID
int32_t pcnt=0, ncnt=0, dsCount=0;
nsCOMPtr<nsISHContainer> prevContainer(do_QueryInterface(aPrevEntry));
nsCOMPtr<nsISHContainer> nextContainer(do_QueryInterface(aNextEntry));
nsCOMPtr<nsIDocShellTreeNode> dsTreeNode(do_QueryInterface(aParent));
if (!dsTreeNode)
if (!aParent)
return NS_ERROR_FAILURE;
if (!prevContainer || !nextContainer)
return NS_ERROR_FAILURE;
prevContainer->GetChildCount(&pcnt);
nextContainer->GetChildCount(&ncnt);
dsTreeNode->GetChildCount(&dsCount);
aParent->GetChildCount(&dsCount);
// Create an array for child docshells.
nsCOMArray<nsIDocShell> docshells;
for (int32_t i = 0; i < dsCount; ++i) {
nsCOMPtr<nsIDocShellTreeItem> treeItem;
dsTreeNode->GetChildAt(i, getter_AddRefs(treeItem));
aParent->GetChildAt(i, getter_AddRefs(treeItem));
nsCOMPtr<nsIDocShell> shell = do_QueryInterface(treeItem);
if (shell) {
docshells.AppendObject(shell);

View File

@ -111,7 +111,7 @@ function xpcEnumerateContentWindows(callback) {
if (/ChromeWindow/.exec(win)) {
var docshellTreeNode = win.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIWebNavigation)
.QueryInterface(Ci.nsIDocShellTreeNode);
.QueryInterface(Ci.nsIDocShellTreeItem);
var childCount = docshellTreeNode.childCount;
for (var i = 0; i < childCount; ++i) {
var childTreeNode = docshellTreeNode.getChildAt(i);

View File

@ -143,10 +143,10 @@ LOCAL_INCLUDES += [
'../src/geolocation',
'../src/storage',
'../time',
'../xbl',
'/content/base/src',
'/content/events/src',
'/content/html/document/src',
'/content/xbl/src',
'/content/xul/document/src',
'/layout/generic',
'/layout/style',

View File

@ -38,8 +38,7 @@ NS_INTERFACE_MAP_END
NS_IMETHODIMP
nsDOMWindowList::SetDocShell(nsIDocShell* aDocShell)
{
nsCOMPtr<nsIDocShellTreeNode> docShellAsNode(do_QueryInterface(aDocShell));
mDocShellNode = docShellAsNode; // Weak Reference
mDocShellNode = aDocShell; // Weak Reference
return NS_OK;
}

View File

@ -8,7 +8,7 @@
#include "nsCOMPtr.h"
#include "nsIDOMWindowCollection.h"
#include <stdint.h>
#include "nsIDocShellTreeItem.h"
#include "nsIDocShell.h"
class nsIDocShell;
class nsIDOMWindow;
@ -41,7 +41,7 @@ protected:
// Note: this function may flush and cause mDocShellNode to become null.
void EnsureFresh();
nsIDocShellTreeNode* mDocShellNode; //Weak Reference
nsIDocShell* mDocShellNode; //Weak Reference
};
#endif // nsDOMWindowList_h___

View File

@ -5468,13 +5468,13 @@ nsGlobalWindow::GetLength(uint32_t* aLength)
already_AddRefed<nsIDOMWindow>
nsGlobalWindow::GetChildWindow(const nsAString& aName)
{
nsCOMPtr<nsIDocShellTreeNode> dsn(do_QueryInterface(GetDocShell()));
NS_ENSURE_TRUE(dsn, nullptr);
nsCOMPtr<nsIDocShell> docShell(GetDocShell());
NS_ENSURE_TRUE(docShell, nullptr);
nsCOMPtr<nsIDocShellTreeItem> child;
dsn->FindChildWithName(PromiseFlatString(aName).get(),
false, true, nullptr, nullptr,
getter_AddRefs(child));
docShell->FindChildWithName(PromiseFlatString(aName).get(),
false, true, nullptr, nullptr,
getter_AddRefs(child));
nsCOMPtr<nsIDOMWindow> child_win(do_GetInterface(child));
return child_win.forget();

View File

@ -1926,7 +1926,10 @@ nsJSContext::GarbageCollectNow(JS::gcreason::Reason aReason,
JS::PrepareForFullGC(sRuntime);
if (aIncremental == IncrementalGC) {
MOZ_ASSERT(aShrinking == NonShrinkingGC);
JS::IncrementalGC(sRuntime, aReason, aSliceMillis);
} else if (aShrinking == ShrinkingGC) {
JS::ShrinkingGC(sRuntime, aReason);
} else {
JS::GCForReason(sRuntime, aReason);
}

View File

@ -39,7 +39,12 @@ class ErrorResult {
public:
ErrorResult() {
mResult = NS_OK;
#ifdef DEBUG
// ErrorResult is extremely performance-sensitive code, where literally
// every machine instruction matters. Initialize mMessage only to suppress
// a debug-only warning from gcc 4.6.
mMessage = nullptr;
mMightHaveUnreportedJSException = false;
#endif
}

View File

@ -46,7 +46,6 @@ LOCAL_INCLUDES += [
'/content/media/webaudio',
'/content/media/webspeech/recognition',
'/content/svg/content/src',
'/content/xbl/src',
'/content/xml/content/src',
'/content/xul/content/src',
'/content/xul/document/src',
@ -58,6 +57,7 @@ LOCAL_INCLUDES += [
'/dom/indexedDB',
'/dom/src/geolocation',
'/dom/workers',
'/dom/xbl',
'/dom/xslt/base',
'/dom/xslt/xpath',
'/js/ipc',

View File

@ -992,7 +992,7 @@ nsGonkCameraControl::TakePictureImpl(TakePictureTask* aTakePicture)
// Convert 'rotation' to a positive value from 0..270 degrees, in steps of 90.
uint32_t r = static_cast<uint32_t>(aTakePicture->mRotation);
r += mCameraHw->GetSensorOrientation();
r += mCameraHw->GetSensorOrientation(GonkCameraHardware::OFFSET_SENSOR_ORIENTATION);
r %= 360;
r += 45;
r /= 90;
@ -1533,7 +1533,7 @@ nsGonkCameraControl::SetupRecording(int aFd, int aRotation, int64_t aMaxFileSize
// adjust rotation by camera sensor offset
int r = aRotation;
r += mCameraHw->GetSensorOrientation(GonkCameraHardware::RAW_SENSOR_ORIENTATION);
r += mCameraHw->GetSensorOrientation();
r %= 360;
r += 45;
r /= 90;

View File

@ -168,8 +168,10 @@ GonkCameraHardware::Init()
mRawSensorOrientation = info.orientation;
mSensorOrientation = mRawSensorOrientation;
// Some kernels report the wrong sensor orientation through
// get_camera_info()...
/**
* Non-V4L2-based camera driver adds extra offset onto picture orientation
* set by gecko, so we have to adjust it back.
*/
char propname[PROP_NAME_MAX];
char prop[PROP_VALUE_MAX];
int offset = 0;

View File

@ -78,7 +78,7 @@ public:
RAW_SENSOR_ORIENTATION,
OFFSET_SENSOR_ORIENTATION
};
int GetSensorOrientation(uint32_t aType = OFFSET_SENSOR_ORIENTATION);
int GetSensorOrientation(uint32_t aType = RAW_SENSOR_ORIENTATION);
int AutoFocus();
void CancelAutoFocus();

View File

@ -32,7 +32,7 @@ function sendCellBroadcastMessage(pdu, callback) {
pendingEmulatorCmdCount++;
let cmd = "cbs pdu " + pdu;
runEmulatorCmd(cmd, function (result) {
runEmulatorCmd(cmd, function(result) {
pendingEmulatorCmdCount--;
is(result[0], "OK", "Emulator response");
@ -134,7 +134,7 @@ function testReceiving_ETWS_GeographicalScope() {
let pdu = buildHexStr(((gs & 0x03) << 14), 4)
+ buildHexStr(0, (CB_MESSAGE_SIZE_ETWS - 2) * 2);
doTestHelper(pdu, nextTest, function (message) {
doTestHelper(pdu, nextTest, function(message) {
is(message.gsmGeographicalScope, CB_GSM_GEOGRAPHICAL_SCOPE_NAMES[gs],
"message.gsmGeographicalScope");
});
@ -158,7 +158,7 @@ function testReceiving_ETWS_MessageCode() {
let pdu = buildHexStr(((messageCode & 0x3FF) << 4), 4)
+ buildHexStr(0, (CB_MESSAGE_SIZE_ETWS - 2) * 2);
doTestHelper(pdu, nextTest, function (message) {
doTestHelper(pdu, nextTest, function(message) {
is(message.messageCode, messageCode, "message.messageCode");
});
}
@ -180,7 +180,7 @@ function testReceiving_ETWS_MessageId() {
+ buildHexStr((messageId & 0xFFFF), 4)
+ buildHexStr(0, (CB_MESSAGE_SIZE_ETWS - 4) * 2);
doTestHelper(pdu, nextTest, function (message) {
doTestHelper(pdu, nextTest, function(message) {
is(message.messageId, messageId, "message.messageId");
});
}
@ -193,7 +193,7 @@ function testReceiving_ETWS_Timestamp() {
// Here we use a simple ETWS message for test.
let pdu = buildHexStr(0, 12); // 6 octets
doTestHelper(pdu, testReceiving_ETWS_WarningType, function (message) {
doTestHelper(pdu, testReceiving_ETWS_WarningType, function(message) {
// Cell Broadcast messages do not contain a timestamp field (however, ETWS
// does). We only check the timestamp doesn't go too far (60 seconds) here.
let msMessage = message.timestamp.getTime();
@ -216,7 +216,7 @@ function testReceiving_ETWS_WarningType() {
+ buildHexStr(((warningType & 0x7F) << 9), 4)
+ buildHexStr(0, (CB_MESSAGE_SIZE_ETWS - 6) * 2);
doTestHelper(pdu, nextTest, function (message) {
doTestHelper(pdu, nextTest, function(message) {
ok(message.etws, "message.etws");
is(message.etws.warningType, CB_ETWS_WARNING_TYPE_NAMES[warningType],
"message.etws.warningType");
@ -230,7 +230,7 @@ function doTestEmergencyUserAlert_or_Popup(name, mask, nextTest) {
let pdu = buildHexStr(0, 8)
+ buildHexStr(mask, 4)
+ buildHexStr(0, (CB_MESSAGE_SIZE_ETWS - 6) * 2);
doTestHelper(pdu, nextTest, function (message) {
doTestHelper(pdu, nextTest, function(message) {
ok(message.etws != null, "message.etws");
is(message.etws[name], mask != 0, "message.etws." + name);
});
@ -262,7 +262,7 @@ function cleanUp() {
finish();
}
waitFor(testEtwsMessageAttributes, function () {
waitFor(testEtwsMessageAttributes, function() {
return navigator.mozMobileConnections[0].voice.connected;
});

View File

@ -87,7 +87,7 @@ function sendCellBroadcastMessage(pdu, callback) {
pendingEmulatorCmdCount++;
let cmd = "cbs pdu " + pdu;
runEmulatorCmd(cmd, function (result) {
runEmulatorCmd(cmd, function(result) {
pendingEmulatorCmdCount--;
is(result[0], "OK", "Emulator response");
@ -187,7 +187,7 @@ function testReceiving_GSM_GeographicalScope() {
let pdu = buildHexStr(((gs & 0x03) << 14), 4)
+ buildHexStr(0, (CB_MESSAGE_SIZE_GSM - 2) * 2);
doTestHelper(pdu, nextTest, function (message) {
doTestHelper(pdu, nextTest, function(message) {
is(message.gsmGeographicalScope, CB_GSM_GEOGRAPHICAL_SCOPE_NAMES[gs],
"message.gsmGeographicalScope");
});
@ -211,7 +211,7 @@ function testReceiving_GSM_MessageCode() {
let pdu = buildHexStr(((messageCode & 0x3FF) << 4), 4)
+ buildHexStr(0, (CB_MESSAGE_SIZE_GSM - 2) * 2);
doTestHelper(pdu, nextTest, function (message) {
doTestHelper(pdu, nextTest, function(message) {
is(message.messageCode, messageCode, "message.messageCode");
});
}
@ -233,7 +233,7 @@ function testReceiving_GSM_MessageId() {
+ buildHexStr((messageId & 0xFFFF), 4)
+ buildHexStr(0, (CB_MESSAGE_SIZE_GSM - 4) * 2);
doTestHelper(pdu, nextTest, function (message) {
doTestHelper(pdu, nextTest, function(message) {
is(message.messageId, messageId, "message.messageId");
ok(message.etws == null, "message.etws");
});
@ -326,7 +326,7 @@ function testReceiving_GSM_Language_and_Body() {
let nextTest = (dcs < 0xFF) ? do_test.bind(null, dcs + 1)
: testReceiving_GSM_Timestamp;
doTestHelper(pdu, nextTest, function (message) {
doTestHelper(pdu, nextTest, function(message) {
if (language) {
is(message.language, language, "message.language");
} else if (indicator) {
@ -358,7 +358,7 @@ function testReceiving_GSM_Timestamp() {
log("Test receiving GSM Cell Broadcast - Timestamp");
let pdu = buildHexStr(0, CB_MESSAGE_SIZE_GSM * 2);
doTestHelper(pdu, testReceiving_GSM_WarningType, function (message) {
doTestHelper(pdu, testReceiving_GSM_WarningType, function(message) {
// Cell Broadcast messages do not contain a timestamp field (however, ETWS
// does). We only check the timestamp doesn't go too far (60 seconds) here.
let msMessage = message.timestamp.getTime();
@ -380,7 +380,7 @@ function testReceiving_GSM_WarningType() {
+ buildHexStr((messageId & 0xFFFF), 4)
+ buildHexStr(0, (CB_MESSAGE_SIZE_GSM - 4) * 2);
doTestHelper(pdu, nextTest, function (message) {
doTestHelper(pdu, nextTest, function(message) {
is(message.messageId, messageId, "message.messageId");
ok(message.etws != null, "message.etws");
@ -402,7 +402,7 @@ function doTestEmergencyUserAlert_or_Popup(name, mask, nextTest) {
+ buildHexStr(CB_GSM_MESSAGEID_ETWS_BEGIN, 4)
+ buildHexStr(0, (CB_MESSAGE_SIZE_GSM - 4) * 2);
doTestHelper(pdu, nextTest, function (message) {
doTestHelper(pdu, nextTest, function(message) {
is(message.messageId, CB_GSM_MESSAGEID_ETWS_BEGIN, "message.messageId");
ok(message.etws != null, "message.etws");
is(message.etws[name], mask != 0, "message.etws." + name);
@ -435,7 +435,7 @@ function testReceiving_GSM_Multipart() {
pdus.push(pdu);
}
doTestHelper(pdus, nextTest, function (message) {
doTestHelper(pdus, nextTest, function(message) {
is(message.body.length, (numParts * CB_MAX_CONTENT_7BIT),
"message.body");
});
@ -475,7 +475,7 @@ function cleanUp() {
finish();
}
waitFor(testGsmMessageAttributes, function () {
waitFor(testGsmMessageAttributes, function() {
return navigator.mozMobileConnections[0].voice.connected;
});

View File

@ -23,7 +23,7 @@ let icc = iccManager.getIccById(iccId);
ok(icc instanceof MozIcc, "icc is instanceof " + icc.constructor);
/* Remove permission and execute finish() */
let cleanUp = function () {
let cleanUp = function() {
SpecialPowers.removePermission("mobileconnection", document);
finish();
};

View File

@ -28,12 +28,12 @@ let pendingEmulatorCmdCount = 0;
function sendStkPduToEmulator(command, func, expect) {
++pendingEmulatorCmdCount;
runEmulatorCmd(command, function (result) {
runEmulatorCmd(command, function(result) {
--pendingEmulatorCmdCount;
is(result[0], "OK");
});
icc.onstkcommand = function (evt) {
icc.onstkcommand = function(evt) {
if (expect) {
func(evt.command, expect);
} else {

View File

@ -21,7 +21,7 @@ function setRadioEnabled(enabled) {
function setEmulatorMccMnc(mcc, mnc) {
let cmd = "operator set 0 Android,Android," + mcc + mnc;
emulatorHelper.sendCommand(cmd, function (result) {
emulatorHelper.sendCommand(cmd, function(result) {
let re = new RegExp("" + mcc + mnc + "$");
ok(result[0].match(re), "MCC/MNC should be changed.");
});

View File

@ -208,6 +208,9 @@ IDBFactory::Create(JSContext* aCx,
factory->mOwningObject = aOwningObject;
factory->mContentParent = aContentParent;
mozilla::HoldJSObjects(factory.get());
factory->mRootedOwningObject = true;
if (!IndexedDatabaseManager::IsMainProcess()) {
ContentChild* contentChild = ContentChild::GetSingleton();
NS_ENSURE_TRUE(contentChild, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);

View File

@ -68,6 +68,7 @@
#include "nsIDOMWindow.h"
#include "nsIExternalProtocolService.h"
#include "nsIFilePicker.h"
#include "nsIGfxInfo.h"
#include "nsIIdleService.h"
#include "nsIMemoryReporter.h"
#include "nsIMozBrowserFrame.h"
@ -516,8 +517,6 @@ ContentParent::CreateBrowserOrApp(const TabContext& aContext,
if (aContext.IsBrowserElement() || !aContext.HasOwnApp()) {
if (nsRefPtr<ContentParent> cp = GetNewOrUsed(aContext.IsBrowserElement())) {
nsRefPtr<TabParent> tp(new TabParent(cp, aContext));
tp->SetOwnerElement(aFrameElement);
uint32_t chromeFlags = 0;
// Propagate the private-browsing status of the element's parent
@ -537,6 +536,9 @@ ContentParent::CreateBrowserOrApp(const TabContext& aContext,
chromeFlags |= nsIWebBrowserChrome::CHROME_PRIVATE_LIFETIME;
}
nsRefPtr<TabParent> tp(new TabParent(cp, aContext, chromeFlags));
tp->SetOwnerElement(aFrameElement);
PBrowserParent* browser = cp->SendPBrowserConstructor(
tp.forget().get(), // DeallocPBrowserParent() releases this ref.
aContext.AsIPCTabContext(),
@ -599,12 +601,14 @@ ContentParent::CreateBrowserOrApp(const TabContext& aContext,
sAppContentParents->Put(manifestURL, p);
}
nsRefPtr<TabParent> tp = new TabParent(p, aContext);
uint32_t chromeFlags = 0;
nsRefPtr<TabParent> tp = new TabParent(p, aContext, chromeFlags);
tp->SetOwnerElement(aFrameElement);
PBrowserParent* browser = p->SendPBrowserConstructor(
nsRefPtr<TabParent>(tp).forget().get(), // DeallocPBrowserParent() releases this ref.
aContext.AsIPCTabContext(),
/* chromeFlags */ 0);
chromeFlags);
p->MaybeTakeCPUWakeLock(aFrameElement);
@ -2036,7 +2040,7 @@ ContentParent::AllocPBrowserParent(const IPCTabContext& aContext,
return nullptr;
}
TabParent* parent = new TabParent(this, tc.GetTabContext());
TabParent* parent = new TabParent(this, tc.GetTabContext(), aChromeFlags);
// We release this ref in DeallocPBrowserParent()
NS_ADDREF(parent);
@ -3186,6 +3190,21 @@ ContentParent::RecvRecordingDeviceEvents(const nsString& aRecordingStatus,
return true;
}
bool
ContentParent::RecvGetGraphicsFeatureStatus(const int32_t& aFeature,
int32_t* aStatus,
bool* aSuccess)
{
nsCOMPtr<nsIGfxInfo> gfxInfo = do_GetService("@mozilla.org/gfx/info;1");
if (!gfxInfo) {
*aSuccess = false;
return true;
}
*aSuccess = NS_SUCCEEDED(gfxInfo->GetFeatureStatus(aFeature, aStatus));
return true;
}
bool
ContentParent::RecvAddIdleObserver(const uint64_t& aObserver, const uint32_t& aIdleTimeInS)
{

View File

@ -515,6 +515,10 @@ private:
virtual void ProcessingError(Result what) MOZ_OVERRIDE;
virtual bool RecvGetGraphicsFeatureStatus(const int32_t& aFeature,
int32_t* aStatus,
bool* aSuccess);
virtual bool RecvAddIdleObserver(const uint64_t& observerId, const uint32_t& aIdleTimeInS);
virtual bool RecvRemoveIdleObserver(const uint64_t& observerId, const uint32_t& aIdleTimeInS);

View File

@ -507,6 +507,8 @@ parent:
bool isAudio,
bool isVideo);
sync GetGraphicsFeatureStatus(int32_t aFeature) returns (int32_t aStatus, bool aSuccess);
AddIdleObserver(uint64_t observerId, uint32_t idleTimeInS);
RemoveIdleObserver(uint64_t observerId, uint32_t idleTimeInS);
both:

View File

@ -56,6 +56,7 @@
#include "StructuredCloneUtils.h"
#include "JavaScriptParent.h"
#include "TabChild.h"
#include "LoadContext.h"
#include "nsNetCID.h"
#include <algorithm>
@ -197,7 +198,7 @@ TabParent *TabParent::mIMETabParent = nullptr;
NS_IMPL_ISUPPORTS3(TabParent, nsITabParent, nsIAuthPromptProvider, nsISecureBrowserUI)
TabParent::TabParent(ContentParent* aManager, const TabContext& aContext)
TabParent::TabParent(ContentParent* aManager, const TabContext& aContext, uint32_t aChromeFlags)
: TabContext(aContext)
, mFrameElement(nullptr)
, mIMESelectionAnchor(0)
@ -218,6 +219,7 @@ TabParent::TabParent(ContentParent* aManager, const TabContext& aContext)
, mMarkedDestroying(false)
, mIsDestroyed(false)
, mAppPackageFileDescriptorSent(false)
, mChromeFlags(aChromeFlags)
{
}
@ -1731,5 +1733,22 @@ TabParent::RecvContentReceivedTouch(const ScrollableLayerGuid& aGuid,
return true;
}
already_AddRefed<nsILoadContext>
TabParent::GetLoadContext()
{
nsCOMPtr<nsILoadContext> loadContext;
if (mLoadContext) {
loadContext = mLoadContext;
} else {
loadContext = new LoadContext(GetOwnerElement(),
OwnOrContainingAppId(),
true /* aIsContent */,
mChromeFlags & nsIWebBrowserChrome::CHROME_PRIVATE_WINDOW,
IsBrowserElement());
mLoadContext = loadContext;
}
return loadContext.forget();
}
} // namespace tabs
} // namespace mozilla

View File

@ -26,6 +26,7 @@ class nsIContent;
class nsIPrincipal;
class nsIURI;
class nsIWidget;
class nsILoadContext;
class CpowHolder;
namespace mozilla {
@ -58,7 +59,7 @@ class TabParent : public PBrowserParent
typedef mozilla::layout::ScrollingBehavior ScrollingBehavior;
public:
TabParent(ContentParent* aManager, const TabContext& aContext);
TabParent(ContentParent* aManager, const TabContext& aContext, uint32_t aChromeFlags);
virtual ~TabParent();
Element* GetOwnerElement() const { return mFrameElement; }
void SetOwnerElement(Element* aElement);
@ -81,6 +82,8 @@ public:
mBrowserDOMWindow = aBrowserDOMWindow;
}
already_AddRefed<nsILoadContext> GetLoadContext();
/**
* Return the TabParent that has decided it wants to capture an
* event series for fast-path dispatch to its subprocess, if one
@ -372,6 +375,10 @@ private:
bool mIsDestroyed;
// Whether we have already sent a FileDescriptor for the app package.
bool mAppPackageFileDescriptorSent;
uint32_t mChromeFlags;
nsCOMPtr<nsILoadContext> mLoadContext;
};
} // namespace dom

View File

@ -1848,14 +1848,13 @@ MediaManager::MediaCaptureWindowStateInternal(nsIDOMWindow* aWindow, bool* aVide
}
// iterate any children of *this* window (iframes, etc)
nsCOMPtr<nsIDocShellTreeNode> node =
do_QueryInterface(piWin->GetDocShell());
if (node) {
nsCOMPtr<nsIDocShell> docShell = piWin->GetDocShell();
if (docShell) {
int32_t i, count;
node->GetChildCount(&count);
docShell->GetChildCount(&count);
for (i = 0; i < count; ++i) {
nsCOMPtr<nsIDocShellTreeItem> item;
node->GetChildAt(i, getter_AddRefs(item));
docShell->GetChildAt(i, getter_AddRefs(item));
nsCOMPtr<nsPIDOMWindow> win = do_GetInterface(item);
MediaCaptureWindowStateInternal(win, aVideo, aAudio);

View File

@ -15,7 +15,7 @@ Cu.import("resource://gre/modules/PhoneNumberUtils.jsm");
let DEBUG; // set to true to see debug messages
this.MMS_VERSION = (function () {
this.MMS_VERSION = (function() {
Cu.import("resource://gre/modules/Services.jsm");
try {
@ -63,7 +63,7 @@ RangedValue.prototype = {
*
* @throws CodeError if decoded value is not in the range [this.min, this.max].
*/
decode: function decode(data) {
decode: function(data) {
let value = WSP.Octet.decode(data);
if ((value >= this.min) && (value <= this.max)) {
return value;
@ -78,7 +78,7 @@ RangedValue.prototype = {
* @param value
* An integer value within thr range [this.min, this.max].
*/
encode: function encode(data, value) {
encode: function(data, value) {
if ((value < this.min) || (value > this.max)) {
throw new WSP.CodeError(this.name + ": invalid value " + value);
}
@ -103,7 +103,7 @@ this.BooleanValue = {
*
* @throws CodeError if read octet equals to neither 128 nor 129.
*/
decode: function decode(data) {
decode: function(data) {
let value = WSP.Octet.decode(data);
if ((value != 128) && (value != 129)) {
throw new WSP.CodeError("Boolean-value: invalid value " + value);
@ -118,7 +118,7 @@ this.BooleanValue = {
* @param value
* A boolean value to be encoded.
*/
encode: function encode(data, value) {
encode: function(data, value) {
WSP.Octet.encode(data, value ? 128 : 129);
},
};
@ -137,7 +137,7 @@ this.Address = {
*
* @return An object of two string-typed attributes: address and type.
*/
decode: function decode(data) {
decode: function(data) {
let str = EncodedStringValue.decode(data);
let result;
@ -171,7 +171,7 @@ this.Address = {
* @param value
* An object of two string-typed attributes: address and type.
*/
encode: function encode(data, value) {
encode: function(data, value) {
if (!value || !value.type || !value.address) {
throw new WSP.CodeError("Address: invalid value");
}
@ -229,7 +229,7 @@ this.Address = {
*
* @return Address type.
*/
resolveType: function resolveType(address) {
resolveType: function(address) {
if (address.match(this.REGEXP_EMAIL)) {
return "email";
}
@ -284,7 +284,7 @@ this.HeaderField = {
* but the `value` property can be many different types depending on
* `name`.
*/
decode: function decode(data, options) {
decode: function(data, options) {
return WSP.decodeAlternatives(data, options,
MmsHeader, WSP.ApplicationHeader);
},
@ -297,7 +297,7 @@ this.HeaderField = {
* @param options
* Extra context for encoding.
*/
encode: function encode(data, value, options) {
encode: function(data, value, options) {
WSP.encodeAlternatives(data, value, options,
MmsHeader, WSP.ApplicationHeader);
},
@ -324,7 +324,7 @@ this.MmsHeader = {
* @throws NotWellKnownEncodingError if decoded well-known header field
* number is not registered or supported.
*/
decode: function decode(data, options) {
decode: function(data, options) {
let index = WSP.ShortInteger.decode(data);
let entry = MMS_HEADER_FIELDS[index];
@ -363,7 +363,7 @@ this.MmsHeader = {
* @throws NotWellKnownEncodingError if the well-known header field number is
* not registered or supported.
*/
encode: function encode(data, header) {
encode: function(data, header) {
if (!header.name) {
throw new WSP.CodeError("MMS-header: empty header name");
}
@ -417,7 +417,7 @@ this.ContentLocationValue = {
* @return A decoded object containing `uri` and conditional `statusCount`
* properties.
*/
decode: function decode(data, options) {
decode: function(data, options) {
let type = WSP.ensureHeader(options, "x-mms-message-type");
let result = {};
@ -454,7 +454,7 @@ this.ElementDescriptorValue = {
* @return A decoded object containing a string property `contentReference`
* and an optinal `params` name-value map.
*/
decode: function decode(data) {
decode: function(data) {
let length = WSP.ValueLength.decode(data);
let end = data.offset + length;
@ -494,7 +494,7 @@ this.Parameter = {
* @throws NotWellKnownEncodingError if decoded well-known parameter number
* is not registered or supported.
*/
decodeParameterName: function decodeParameterName(data) {
decodeParameterName: function(data) {
let begin = data.offset;
let number;
try {
@ -522,7 +522,7 @@ this.Parameter = {
* but the `value` property can be many different types depending on
* `name`.
*/
decode: function decode(data) {
decode: function(data) {
let name = this.decodeParameterName(data);
let value = WSP.decodeAlternatives(data, null,
WSP.ConstrainedEncoding, WSP.TextString);
@ -540,7 +540,7 @@ this.Parameter = {
*
* @return An array of decoded objects.
*/
decodeMultiple: function decodeMultiple(data, end) {
decodeMultiple: function(data, end) {
let params, param;
while (data.offset < end) {
@ -568,7 +568,7 @@ this.Parameter = {
* @param options
* Extra context for encoding.
*/
encode: function encode(data, param, options) {
encode: function(data, param, options) {
if (!param || !param.name) {
throw new WSP.CodeError("Parameter-name: empty param name");
}
@ -605,7 +605,7 @@ this.EncodedStringValue = {
* @throws NotWellKnownEncodingError if decoded well-known charset number is
* not registered or supported.
*/
decodeCharsetEncodedString: function decodeCharsetEncodedString(data) {
decodeCharsetEncodedString: function(data) {
let length = WSP.ValueLength.decode(data);
let end = data.offset + length;
@ -657,7 +657,7 @@ this.EncodedStringValue = {
*
* @return Decoded string.
*/
decode: function decode(data) {
decode: function(data) {
let begin = data.offset;
try {
return WSP.TextString.decode(data);
@ -675,7 +675,7 @@ this.EncodedStringValue = {
* @param str
* A string.
*/
encodeCharsetEncodedString: function encodeCharsetEncodedString(data, str) {
encodeCharsetEncodedString: function(data, str) {
let conv = Cc["@mozilla.org/intl/scriptableunicodeconverter"]
.createInstance(Ci.nsIScriptableUnicodeConverter);
// `When the text string cannot be represented as us-ascii, the character
@ -714,7 +714,7 @@ this.EncodedStringValue = {
* @param str
* A string.
*/
encode: function encode(data, str) {
encode: function(data, str) {
let begin = data.offset;
try {
WSP.TextString.encode(data, str);
@ -741,7 +741,7 @@ this.ExpiryValue = {
*
* @throws CodeError if decoded token equals to neither 128 nor 129.
*/
decode: function decode(data) {
decode: function(data) {
let length = WSP.ValueLength.decode(data);
let end = data.offset + length;
@ -770,7 +770,7 @@ this.ExpiryValue = {
* @param value
* A Date object for absolute expiry or an integer for relative one.
*/
encode: function encode(data, value) {
encode: function(data, value) {
let isDate, begin = data.offset;
if (value instanceof Date) {
isDate = true;
@ -815,7 +815,7 @@ this.FromValue = {
*
* @throws CodeError if decoded token equals to neither 128 nor 129.
*/
decode: function decode(data) {
decode: function(data) {
let length = WSP.ValueLength.decode(data);
let end = data.offset + length;
@ -842,7 +842,7 @@ this.FromValue = {
* @param value
* A Address-value or null for MMS Proxy-Relay Insert-Address mode.
*/
encode: function encode(data, value) {
encode: function(data, value) {
if (!value) {
WSP.ValueLength.encode(data, 1);
WSP.Octet.encode(data, 129);
@ -876,7 +876,7 @@ this.PreviouslySentByValue = {
* @return Decoded object containing an integer `forwardedCount` and an
* string-typed `originator` attributes.
*/
decode: function decode(data) {
decode: function(data) {
let length = WSP.ValueLength.decode(data);
let end = data.offset + length;
@ -906,7 +906,7 @@ this.PreviouslySentDateValue = {
* @return Decoded object containing an integer `forwardedCount` and an
* Date-typed `timestamp` attributes.
*/
decode: function decode(data) {
decode: function(data) {
let length = WSP.ValueLength.decode(data);
let end = data.offset + length;
@ -943,7 +943,7 @@ this.MessageClassValue = {
*
* @throws CodeError if decoded value is not in the range 128..131.
*/
decodeClassIdentifier: function decodeClassIdentifier(data) {
decodeClassIdentifier: function(data) {
let value = WSP.Octet.decode(data);
if ((value >= 128) && (value < (128 + this.WELL_KNOWN_CLASSES.length))) {
return this.WELL_KNOWN_CLASSES[value - 128];
@ -958,7 +958,7 @@ this.MessageClassValue = {
*
* @return A decoded string.
*/
decode: function decode(data) {
decode: function(data) {
let begin = data.offset;
try {
return this.decodeClassIdentifier(data);
@ -973,7 +973,7 @@ this.MessageClassValue = {
* A wrapped object to store encoded raw data.
* @param klass
*/
encode: function encode(data, klass) {
encode: function(data, klass) {
let index = this.WELL_KNOWN_CLASSES.indexOf(klass.toLowerCase());
if (index >= 0) {
WSP.Octet.encode(data, index + 128);
@ -1008,7 +1008,7 @@ this.MmFlagsValue = {
*
* @throws CodeError if decoded value is not in the range 128..130.
*/
decode: function decode(data) {
decode: function(data) {
let length = WSP.ValueLength.decode(data);
let end = data.offset + length;
@ -1033,7 +1033,7 @@ this.MmFlagsValue = {
* An object containing an integer `type` and an string-typed
* `text` attributes.
*/
encode: function encode(data, value) {
encode: function(data, value) {
if ((value.type < 128) || (value.type > 130)) {
throw new WSP.CodeError("MM-flags-value: invalid type " + value.type);
}
@ -1093,7 +1093,7 @@ this.RecommendedRetrievalModeValue = {
*
* @return A decoded integer.
*/
decode: function decode(data) {
decode: function(data) {
return WSP.Octet.decodeEqualTo(data, 128);
},
};
@ -1131,7 +1131,7 @@ this.ResponseText = {
* @return An object containing a string-typed `text` attribute and a
* integer-typed `statusCount` one.
*/
decode: function decode(data, options) {
decode: function(data, options) {
let type = WSP.ensureHeader(options, "x-mms-message-type");
let result = {};
@ -1180,7 +1180,7 @@ this.RetrieveStatusValue = {
*
* @return A decoded integer.
*/
decode: function decode(data) {
decode: function(data) {
let value = WSP.Octet.decode(data);
if (value == MMS_PDU_ERROR_OK) {
return value;
@ -1230,7 +1230,7 @@ this.PduHelper = {
*
* @return A boolean value indicating whether it's followed by message body.
*/
parseHeaders: function parseHeaders(data, headers) {
parseHeaders: function(data, headers) {
if (!headers) {
headers = {};
}
@ -1269,7 +1269,7 @@ this.PduHelper = {
* @param msg
* A message object to store decoded multipart or octet array content.
*/
parseContent: function parseContent(data, msg) {
parseContent: function(data, msg) {
let contentType = msg.headers["content-type"].media;
if ((contentType == "application/vnd.wap.multipart.related")
|| (contentType == "application/vnd.wap.multipart.mixed")) {
@ -1300,7 +1300,7 @@ this.PduHelper = {
*
* @throws FatalCodeError if the PDU type is not supported yet.
*/
checkMandatoryFields: function checkMandatoryFields(msg) {
checkMandatoryFields: function(msg) {
let type = WSP.ensureHeader(msg.headers, "x-mms-message-type");
let entry = MMS_PDU_TYPES[type];
if (!entry) {
@ -1308,7 +1308,7 @@ this.PduHelper = {
"checkMandatoryFields: unsupported message type " + type);
}
entry.mandatoryFields.forEach(function (name) {
entry.mandatoryFields.forEach(function(name) {
WSP.ensureHeader(msg.headers, name);
});
@ -1326,7 +1326,7 @@ this.PduHelper = {
*
* @return A MMS message object or null in case of errors found.
*/
parse: function parse(data, msg) {
parse: function(data, msg) {
if (!msg) {
msg = {};
}
@ -1355,7 +1355,7 @@ this.PduHelper = {
* @param name
* Name of the header field to be encoded.
*/
encodeHeader: function encodeHeader(data, headers, name) {
encodeHeader: function(data, headers, name) {
let value = headers[name];
if (Array.isArray(value)) {
for (let i = 0; i < value.length; i++) {
@ -1372,7 +1372,7 @@ this.PduHelper = {
* @param headers
* A dictionary object containing multiple name/value mapping.
*/
encodeHeaderIfExists: function encodeHeaderIfExists(data, headers, name) {
encodeHeaderIfExists: function(data, headers, name) {
// Header value could be zero or null.
if (headers[name] !== undefined) {
this.encodeHeader(data, headers, name);
@ -1387,7 +1387,7 @@ this.PduHelper = {
*
* @return the passed data parameter or a created one.
*/
encodeHeaders: function encodeHeaders(data, headers) {
encodeHeaders: function(data, headers) {
if (!data) {
data = {array: [], offset: 0};
}
@ -1425,7 +1425,7 @@ this.PduHelper = {
*
* @return An instance of nsIMultiplexInputStream or null in case of errors.
*/
compose: function compose(multiStream, msg) {
compose: function(multiStream, msg) {
if (!multiStream) {
multiStream = Cc["@mozilla.org/io/multiplex-input-stream;1"]
.createInstance(Ci.nsIMultiplexInputStream);
@ -1455,7 +1455,7 @@ this.PduHelper = {
},
};
const MMS_PDU_TYPES = (function () {
const MMS_PDU_TYPES = (function() {
let pdus = {};
function add(number, hasContent, mandatoryFields) {
pdus[number] = {
@ -1520,7 +1520,7 @@ const MMS_PDU_TYPES = (function () {
*
* @see OMA-TS-MMS_ENC-V1_3-20110913-A clause 7.4
*/
const MMS_HEADER_FIELDS = (function () {
const MMS_HEADER_FIELDS = (function() {
let names = {};
function add(name, number, coder) {
let entry = {
@ -1599,7 +1599,7 @@ const MMS_HEADER_FIELDS = (function () {
})();
// @see OMA-TS-MMS_ENC-V1_3-20110913-A Table 27: Parameter Name Assignments
const MMS_WELL_KNOWN_PARAMS = (function () {
const MMS_WELL_KNOWN_PARAMS = (function() {
let params = {};
function add(name, number, coder) {
@ -1619,11 +1619,11 @@ const MMS_WELL_KNOWN_PARAMS = (function () {
let debug;
if (DEBUG) {
debug = function (s) {
debug = function(s) {
dump("-$- MmsPduHelper: " + s + "\n");
};
} else {
debug = function (s) {};
debug = function(s) {};
}
this.EXPORTED_SYMBOLS = ALL_CONST_SYMBOLS.concat([

View File

@ -102,7 +102,7 @@ const PREF_SEND_RETRY_INTERVAL =
const PREF_RETRIEVAL_RETRY_COUNT =
Services.prefs.getIntPref("dom.mms.retrievalRetryCount");
const PREF_RETRIEVAL_RETRY_INTERVALS = (function () {
const PREF_RETRIEVAL_RETRY_INTERVALS = (function() {
let intervals =
Services.prefs.getCharPref("dom.mms.retrievalRetryIntervals").split(",");
for (let i = 0; i < PREF_RETRIEVAL_RETRY_COUNT; ++i) {
@ -144,7 +144,7 @@ XPCOMUtils.defineLazyServiceGetter(this, "gRil",
"@mozilla.org/ril;1",
"nsIRadioInterfaceLayer");
XPCOMUtils.defineLazyGetter(this, "MMS", function () {
XPCOMUtils.defineLazyGetter(this, "MMS", function() {
let MMS = {};
Cu.import("resource://gre/modules/MmsPduHelper.jsm", MMS);
return MMS;
@ -163,7 +163,7 @@ MmsConnection.prototype = {
mmsProxy: "",
mmsPort: -1,
setApnSetting: function setApnSetting(network) {
setApnSetting: function(network) {
this.mmsc = network.mmsc;
this.mmsProxy = network.mmsProxy;
this.mmsPort = network.mmsPort;
@ -211,7 +211,7 @@ MmsConnection.prototype = {
/**
* Callback when |connectTimer| is timeout or cancelled by shutdown.
*/
flushPendingCallbacks: function flushPendingCallbacks(status) {
flushPendingCallbacks: function(status) {
if (DEBUG) debug("flushPendingCallbacks: " + this.pendingCallbacks.length
+ " pending callbacks with status: " + status);
while (this.pendingCallbacks.length) {
@ -224,14 +224,14 @@ MmsConnection.prototype = {
/**
* Callback when |disconnectTimer| is timeout or cancelled by shutdown.
*/
onDisconnectTimerTimeout: function onDisconnectTimerTimeout() {
onDisconnectTimerTimeout: function() {
if (DEBUG) debug("onDisconnectTimerTimeout: deactivate the MMS data call.");
if (this.connected) {
this.radioInterface.deactivateDataCallByType("mms");
}
},
init: function init() {
init: function() {
Services.obs.addObserver(this, kNetworkInterfaceStateChangedTopic,
false);
Services.obs.addObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID, false);
@ -274,7 +274,7 @@ MmsConnection.prototype = {
*
* @return true if voice call is roaming.
*/
isVoiceRoaming: function isVoiceRoaming() {
isVoiceRoaming: function() {
let isRoaming = this.radioInterface.rilContext.voice.roaming;
if (DEBUG) debug("isVoiceRoaming = " + isRoaming);
return isRoaming;
@ -289,7 +289,7 @@ MmsConnection.prototype = {
* Otherwise, the phone number is in mdn.
* @see nsIDOMMozCdmaIccInfo
*/
getPhoneNumber: function getPhoneNumber() {
getPhoneNumber: function() {
let iccInfo = this.radioInterface.rilContext.iccInfo;
if (!iccInfo) {
@ -311,7 +311,7 @@ MmsConnection.prototype = {
/**
* A utility function to get the ICC ID of the SIM card (if installed).
*/
getIccId: function getIccId() {
getIccId: function() {
let iccInfo = this.radioInterface.rilContext.iccInfo;
if (!iccInfo || !(iccInfo instanceof Ci.nsIDOMMozGsmIccInfo)) {
@ -341,7 +341,7 @@ MmsConnection.prototype = {
* @return true if the callback for MMS network connection is done; false
* otherwise.
*/
acquire: function acquire(callback) {
acquire: function(callback) {
this.refCount++;
this.connectTimer.cancel();
this.disconnectTimer.cancel();
@ -383,7 +383,7 @@ MmsConnection.prototype = {
/**
* Release the MMS network connection.
*/
release: function release() {
release: function() {
this.refCount--;
if (this.refCount <= 0) {
this.refCount = 0;
@ -403,7 +403,7 @@ MmsConnection.prototype = {
}
},
shutdown: function shutdown() {
shutdown: function() {
Services.obs.removeObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID);
Services.obs.removeObserver(this, kNetworkInterfaceStateChangedTopic);
@ -415,7 +415,7 @@ MmsConnection.prototype = {
// nsIObserver
observe: function observe(subject, topic, data) {
observe: function(subject, topic, data) {
switch (topic) {
case kNetworkInterfaceStateChangedTopic: {
// The network for MMS connection must be nsIRilNetworkInterface.
@ -475,10 +475,10 @@ MmsConnection.prototype = {
}
};
XPCOMUtils.defineLazyGetter(this, "gMmsConnections", function () {
XPCOMUtils.defineLazyGetter(this, "gMmsConnections", function() {
return {
_connections: null,
getConnByServiceId: function (id) {
getConnByServiceId: function(id) {
if (!this._connections) {
this._connections = [];
}
@ -505,7 +505,7 @@ MmsProxyFilter.prototype = {
// nsIProtocolProxyFilter
applyFilter: function applyFilter(proxyService, uri, proxyInfo) {
applyFilter: function(proxyService, uri, proxyInfo) {
if (!this.uri.equals(uri)) {
if (DEBUG) debug("applyFilter: content uri = " + JSON.stringify(this.uri) +
" is not matched with uri = " + JSON.stringify(uri) + " .");
@ -525,7 +525,7 @@ MmsProxyFilter.prototype = {
}
};
XPCOMUtils.defineLazyGetter(this, "gMmsTransactionHelper", function () {
XPCOMUtils.defineLazyGetter(this, "gMmsTransactionHelper", function() {
let helper = {
/**
* Send MMS request to MMSC.
@ -542,8 +542,7 @@ XPCOMUtils.defineLazyGetter(this, "gMmsTransactionHelper", function () {
* A callback function that takes two arguments: one for http
* status, the other for wrapped PDU data for further parsing.
*/
sendRequest: function sendRequest(mmsConnection, method, url, istream,
callback) {
sendRequest: function(mmsConnection, method, url, istream, callback) {
// TODO: bug 810226 - Support GPRS bearer for MMS transmission and reception.
let cancellable = {
callback: callback,
@ -551,7 +550,7 @@ XPCOMUtils.defineLazyGetter(this, "gMmsTransactionHelper", function () {
isDone: false,
isCancelled: false,
cancel: function cancel() {
cancel: function() {
if (this.isDone) {
// It's too late to cancel.
return;
@ -569,7 +568,7 @@ XPCOMUtils.defineLazyGetter(this, "gMmsTransactionHelper", function () {
}
},
done: function done(httpStatus, data) {
done: function(httpStatus, data) {
this.isDone = true;
if (!this.callback) {
return;
@ -584,7 +583,7 @@ XPCOMUtils.defineLazyGetter(this, "gMmsTransactionHelper", function () {
};
cancellable.isAcquiringConn =
!mmsConnection.acquire((function (connected, errorCode) {
!mmsConnection.acquire((function(connected, errorCode) {
cancellable.isAcquiringConn = false;
@ -615,9 +614,9 @@ XPCOMUtils.defineLazyGetter(this, "gMmsTransactionHelper", function () {
return cancellable;
},
sendHttpRequest: function sendHttpRequest(mmsConnection, method, url,
istream, proxyFilter, callback) {
let releaseMmsConnectionAndCallback = function (httpStatus, data) {
sendHttpRequest: function(mmsConnection, method, url, istream, proxyFilter,
callback) {
let releaseMmsConnectionAndCallback = function(httpStatus, data) {
gpps.unregisterFilter(proxyFilter);
// Always release the MMS network connection before callback.
mmsConnection.release();
@ -649,7 +648,7 @@ XPCOMUtils.defineLazyGetter(this, "gMmsTransactionHelper", function () {
}
// Setup event listeners
xhr.onreadystatechange = function () {
xhr.onreadystatechange = function() {
if (xhr.readyState != Ci.nsIXMLHttpRequest.DONE) {
return;
}
@ -696,7 +695,7 @@ XPCOMUtils.defineLazyGetter(this, "gMmsTransactionHelper", function () {
* @return the number of recipients
* @see OMA-TS-MMS_CONF-V1_3-20110511-C section 10.2.5
*/
countRecipients: function countRecipients(recipients) {
countRecipients: function(recipients) {
if (recipients && recipients.address) {
return 1;
}
@ -729,7 +728,7 @@ XPCOMUtils.defineLazyGetter(this, "gMmsTransactionHelper", function () {
* parameters.
* @see OMA-TS-MMS_CONF-V1_3-20110511-C section 10.2.5
*/
checkMaxValuesParameters: function checkMaxValuesParameters(msg) {
checkMaxValuesParameters: function(msg) {
let subject = msg.headers["subject"];
if (subject && subject.length > MMS.MMS_MAX_LENGTH_SUBJECT) {
return false;
@ -765,10 +764,8 @@ XPCOMUtils.defineLazyGetter(this, "gMmsTransactionHelper", function () {
return true;
},
translateHttpStatusToMmsStatus:
function translateHttpStatusToMmsStatus(httpStatus,
cancelledReason,
defaultStatus) {
translateHttpStatusToMmsStatus: function(httpStatus, cancelledReason,
defaultStatus) {
switch(httpStatus) {
case _HTTP_STATUS_USER_CANCELLED:
return cancelledReason;
@ -821,10 +818,10 @@ NotifyResponseTransaction.prototype = {
* @param callback [optional]
* A callback function that takes one argument -- the http status.
*/
run: function run(callback) {
run: function(callback) {
let requestCallback;
if (callback) {
requestCallback = function (httpStatus, data) {
requestCallback = function(httpStatus, data) {
// `The MMS Client SHOULD ignore the associated HTTP POST response
// from the MMS Proxy-Relay.` ~ OMA-TS-MMS_CTR-V1_3-20110913-A
// section 8.2.2 "Notification".
@ -862,7 +859,7 @@ CancellableTransaction.prototype = {
cancelledReason: _MMS_ERROR_USER_CANCELLED_NO_REASON,
registerRunCallback: function registerRunCallback(callback) {
registerRunCallback: function(callback) {
if (!this.isObserversAdded) {
Services.obs.addObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID, false);
Services.obs.addObserver(this, kMobileMessageDeletedObserverTopic, false);
@ -874,7 +871,7 @@ CancellableTransaction.prototype = {
this.isCancelled = false;
},
removeObservers: function removeObservers() {
removeObservers: function() {
if (this.isObserversAdded) {
Services.obs.removeObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID);
Services.obs.removeObserver(this, kMobileMessageDeletedObserverTopic);
@ -883,7 +880,7 @@ CancellableTransaction.prototype = {
}
},
runCallbackIfValid: function runCallbackIfValid(mmsStatus, msg) {
runCallbackIfValid: function(mmsStatus, msg) {
this.removeObservers();
if (this.runCallback) {
@ -896,7 +893,7 @@ CancellableTransaction.prototype = {
// |gMmsTransactionHelper.sendRequest(...)|.
cancellable: null,
cancelRunning: function cancelRunning(reason) {
cancelRunning: function(reason) {
this.isCancelled = true;
this.cancelledReason = reason;
@ -919,7 +916,7 @@ CancellableTransaction.prototype = {
// nsIObserver
observe: function observe(subject, topic, data) {
observe: function(subject, topic, data) {
switch (topic) {
case NS_XPCOM_SHUTDOWN_OBSERVER_ID: {
this.cancelRunning(_MMS_ERROR_SHUTDOWN);
@ -972,11 +969,11 @@ RetrieveTransaction.prototype = Object.create(CancellableTransaction.prototype,
* the other for the parsed M-Retrieve.conf message.
*/
run: {
value: function run(callback) {
value: function(callback) {
this.registerRunCallback(callback);
this.retryCount = 0;
let retryCallback = (function (mmsStatus, msg) {
let retryCallback = (function(mmsStatus, msg) {
if (MMS.MMS_PDU_STATUS_DEFERRED == mmsStatus &&
this.retryCount < PREF_RETRIEVAL_RETRY_COUNT) {
let time = PREF_RETRIEVAL_RETRY_INTERVALS[this.retryCount];
@ -1007,13 +1004,13 @@ RetrieveTransaction.prototype = Object.create(CancellableTransaction.prototype,
* the other for the parsed M-Retrieve.conf message.
*/
retrieve: {
value: function retrieve(callback) {
value: function(callback) {
this.timer = null;
this.cancellable =
gMmsTransactionHelper.sendRequest(this.mmsConnection,
"GET", this.contentLocation, null,
(function (httpStatus, data) {
(function(httpStatus, data) {
let mmsStatus = gMmsTransactionHelper
.translateHttpStatusToMmsStatus(httpStatus,
this.cancelledReason,
@ -1140,7 +1137,7 @@ SendTransaction.prototype = Object.create(CancellableTransaction.prototype, {
* A callback function that takes zero argument.
*/
loadBlobs: {
value: function loadBlobs(parts, callback) {
value: function(parts, callback) {
let callbackIfValid = function callbackIfValid() {
if (DEBUG) debug("All parts loaded: " + JSON.stringify(parts));
if (callback) {
@ -1188,11 +1185,11 @@ SendTransaction.prototype = Object.create(CancellableTransaction.prototype, {
* X-Mms-Response-Status, the other for the parsed M-Send.conf message.
*/
run: {
value: function run(callback) {
value: function(callback) {
this.registerRunCallback(callback);
if (!this.istreamComposed) {
this.loadBlobs(this.msg.parts, (function () {
this.loadBlobs(this.msg.parts, (function() {
this.istream = MMS.PduHelper.compose(null, this.msg);
this.istreamSize = this.istream.available();
this.istreamComposed = true;
@ -1211,7 +1208,7 @@ SendTransaction.prototype = Object.create(CancellableTransaction.prototype, {
}
this.retryCount = 0;
let retryCallback = (function (mmsStatus, msg) {
let retryCallback = (function(mmsStatus, msg) {
if ((MMS.MMS_PDU_ERROR_TRANSIENT_FAILURE == mmsStatus ||
MMS.MMS_PDU_ERROR_PERMANENT_FAILURE == mmsStatus) &&
this.retryCount < PREF_SEND_RETRY_COUNT) {
@ -1255,7 +1252,7 @@ SendTransaction.prototype = Object.create(CancellableTransaction.prototype, {
* X-Mms-Response-Status, the other for the parsed M-Send.conf message.
*/
send: {
value: function send(callback) {
value: function(callback) {
this.timer = null;
this.cancellable =
@ -1263,7 +1260,7 @@ SendTransaction.prototype = Object.create(CancellableTransaction.prototype, {
"POST",
null,
this.istream,
(function (httpStatus, data) {
(function(httpStatus, data) {
let mmsStatus = gMmsTransactionHelper.
translateHttpStatusToMmsStatus(
httpStatus,
@ -1325,10 +1322,10 @@ AcknowledgeTransaction.prototype = {
* @param callback [optional]
* A callback function that takes one argument -- the http status.
*/
run: function run(callback) {
run: function(callback) {
let requestCallback;
if (callback) {
requestCallback = function (httpStatus, data) {
requestCallback = function(httpStatus, data) {
// `The MMS Client SHOULD ignore the associated HTTP POST response
// from the MMS Proxy-Relay.` ~ OMA-TS-MMS_CTR-V1_3-20110913-A
// section 8.2.3 "Retrieving an MM".
@ -1430,7 +1427,7 @@ MmsService.prototype = {
* @param wish
* Sender wish. Could be undefined, false, or true.
*/
getReportAllowed: function getReportAllowed(config, wish) {
getReportAllowed: function(config, wish) {
if ((config == CONFIG_SEND_REPORT_DEFAULT_NO)
|| (config == CONFIG_SEND_REPORT_DEFAULT_YES)) {
if (wish != null) {
@ -1450,10 +1447,8 @@ MmsService.prototype = {
* @param intermediate
* Intermediate MMS message parsed from PDU.
*/
convertIntermediateToSavable:
function convertIntermediateToSavable(mmsConnection,
intermediate,
retrievalMode) {
convertIntermediateToSavable: function(mmsConnection, intermediate,
retrievalMode) {
intermediate.type = "mms";
intermediate.delivery = DELIVERY_NOT_DOWNLOADED;
@ -1501,9 +1496,7 @@ MmsService.prototype = {
* The indexedDB savable MMS message, which is going to be
* merged with the extra retrieval confirmation.
*/
mergeRetrievalConfirmation: function mergeRetrievalConfirmation(mmsConnection,
intermediate,
savable) {
mergeRetrievalConfirmation: function(mmsConnection, intermediate, savable) {
// Prepare timestamp/sentTimestamp.
savable.timestamp = Date.now();
savable.sentTimestamp = intermediate.headers["date"].getTime();
@ -1548,8 +1541,8 @@ MmsService.prototype = {
* @param aDomMessage
* The nsIDOMMozMmsMessage object.
*/
retrieveMessage: function retrieveMessage(aMmsConnection, aContentLocation,
aCallback, aDomMessage) {
retrieveMessage: function(aMmsConnection, aContentLocation, aCallback,
aDomMessage) {
// Notifying observers an MMS message is retrieving.
Services.obs.notifyObservers(aDomMessage, kSmsRetrievingObserverTopic, null);
@ -1568,7 +1561,7 @@ MmsService.prototype = {
* @param aDomMessage
* The nsIDOMMozMmsMessage object.
*/
broadcastMmsSystemMessage: function broadcastMmsSystemMessage(aName, aDomMessage) {
broadcastMmsSystemMessage: function(aName, aDomMessage) {
if (DEBUG) debug("Broadcasting the MMS system message: " + aName);
// Sadly we cannot directly broadcast the aDomMessage object
@ -1599,7 +1592,7 @@ MmsService.prototype = {
* @params aDomMessage
* The nsIDOMMozMmsMessage object.
*/
broadcastSentMessageEvent: function broadcastSentMessageEvent(aDomMessage) {
broadcastSentMessageEvent: function(aDomMessage) {
// Broadcasting a 'sms-sent' system message to open apps.
this.broadcastMmsSystemMessage(kSmsSentObserverTopic, aDomMessage);
@ -1625,11 +1618,8 @@ MmsService.prototype = {
/**
* Callback for retrieveMessage.
*/
retrieveMessageCallback: function retrieveMessageCallback(mmsConnection,
wish,
savableMessage,
mmsStatus,
retrievedMessage) {
retrieveMessageCallback: function(mmsConnection, wish, savableMessage,
mmsStatus, retrievedMessage) {
if (DEBUG) debug("retrievedMessage = " + JSON.stringify(retrievedMessage));
let transactionId = savableMessage.headers["x-mms-transaction-id"];
@ -1664,7 +1654,7 @@ MmsService.prototype = {
null,
DELIVERY_STATUS_ERROR,
null,
(function (rv, domMessage) {
(function(rv, domMessage) {
this.broadcastReceivedMessageEvent(domMessage);
}).bind(this));
return;
@ -1674,7 +1664,7 @@ MmsService.prototype = {
retrievedMessage,
savableMessage);
gMobileMessageDatabaseService.saveReceivedMessage(savableMessage,
(function (rv, domMessage) {
(function(rv, domMessage) {
let success = Components.isSuccessCode(rv);
// Cite 6.2.1 "Transaction Flow" in OMA-TS-MMS_ENC-V1_3-20110913-A:
@ -1706,12 +1696,8 @@ MmsService.prototype = {
/**
* Callback for saveReceivedMessage.
*/
saveReceivedMessageCallback:
function saveReceivedMessageCallback(mmsConnection,
retrievalMode,
savableMessage,
rv,
domMessage) {
saveReceivedMessageCallback: function(mmsConnection, retrievalMode,
savableMessage, rv, domMessage) {
let success = Components.isSuccessCode(rv);
if (!success) {
// At this point we could send a message to content to notify the
@ -1777,11 +1763,10 @@ MmsService.prototype = {
* @param notification
* The parsed MMS message object.
*/
handleNotificationIndication: function handleNotificationIndication(serviceId,
notification) {
handleNotificationIndication: function(serviceId, notification) {
let transactionId = notification.headers["x-mms-transaction-id"];
gMobileMessageDatabaseService.getMessageRecordByTransactionId(transactionId,
(function (aRv, aMessageRecord) {
(function(aRv, aMessageRecord) {
if (Ci.nsIMobileMessageCallback.SUCCESS_NO_ERROR === aRv
&& aMessageRecord) {
if (DEBUG) debug("We already got the NotificationIndication with transactionId = "
@ -1830,7 +1815,7 @@ MmsService.prototype = {
* @param aMsg
* The MMS message object.
*/
handleDeliveryIndication: function handleDeliveryIndication(aMsg) {
handleDeliveryIndication: function(aMsg) {
let headers = aMsg.headers;
let envelopeId = headers["message-id"];
let address = headers.to.address;
@ -1897,8 +1882,7 @@ MmsService.prototype = {
* @param aIndication
* The MMS message object.
*/
handleReadOriginateIndication:
function handleReadOriginateIndication(aIndication) {
handleReadOriginateIndication: function(aIndication) {
let headers = aIndication.headers;
let envelopeId = headers["message-id"];
@ -1965,8 +1949,7 @@ MmsService.prototype = {
* name-parameter of Content-Type header nor filename parameter of Content-Disposition
* header is available, Content-Location header SHALL be used if available.
*/
createSavableFromParams: function createSavableFromParams(aMmsConnection,
aParams, aMessage) {
createSavableFromParams: function(aMmsConnection, aParams, aMessage) {
if (DEBUG) debug("createSavableFromParams: aParams: " + JSON.stringify(aParams));
let isAddrValid = true;
@ -2081,7 +2064,7 @@ MmsService.prototype = {
mmsDefaultServiceId: 0,
send: function send(aServiceId, aParams, aRequest) {
send: function(aServiceId, aParams, aRequest) {
if (DEBUG) debug("send: aParams: " + JSON.stringify(aParams));
// Note that the following sanity checks for |aParams| should be consistent
@ -2219,7 +2202,7 @@ MmsService.prototype = {
});
},
retrieve: function retrieve(aMessageId, aRequest) {
retrieve: function(aMessageId, aRequest) {
if (DEBUG) debug("Retrieving message with ID " + aMessageId);
gMobileMessageDatabaseService.getMessageRecordById(aMessageId,
(function notifyResult(aRv, aMessageRecord, aDomMessage) {
@ -2328,7 +2311,7 @@ MmsService.prototype = {
null,
DELIVERY_STATUS_ERROR,
null,
function () {
function() {
aRequest.notifyGetMessageFailed(errorCode);
});
return;
@ -2356,7 +2339,7 @@ MmsService.prototype = {
aMessageRecord);
gMobileMessageDatabaseService.saveReceivedMessage(aMessageRecord,
(function (rv, domMessage) {
(function(rv, domMessage) {
let success = Components.isSuccessCode(rv);
if (!success) {
// At this point we could send a message to content to
@ -2393,7 +2376,7 @@ MmsService.prototype = {
null,
DELIVERY_STATUS_PENDING,
null,
(function (rv) {
(function(rv) {
let success = Components.isSuccessCode(rv);
if (!success) {
if (DEBUG) debug("Could not change the delivery status: MMS " +
@ -2410,7 +2393,7 @@ MmsService.prototype = {
}).bind(this));
},
sendReadReport: function sendReadReport(messageID, toAddress, iccId) {
sendReadReport: function(messageID, toAddress, iccId) {
if (DEBUG) {
debug("messageID: " + messageID + " toAddress: " +
JSON.stringify(toAddress));
@ -2448,7 +2431,7 @@ MmsService.prototype = {
// nsIWapPushApplication
receiveWapPush: function receiveWapPush(array, length, offset, options) {
receiveWapPush: function(array, length, offset, options) {
let data = {array: array, offset: offset};
let msg = MMS.PduHelper.parse(data, null);
if (!msg) {
@ -2474,7 +2457,7 @@ MmsService.prototype = {
// nsIObserver
observe: function observe(aSubject, aTopic, aData) {
observe: function(aSubject, aTopic, aData) {
switch (aTopic) {
case NS_PREFBRANCH_PREFCHANGE_TOPIC_ID:
if (aData === kPrefDefaultServiceId) {

View File

@ -69,7 +69,7 @@ XPCOMUtils.defineLazyServiceGetter(this, "gMMSService",
"@mozilla.org/mms/rilmmsservice;1",
"nsIMmsService");
XPCOMUtils.defineLazyGetter(this, "MMS", function () {
XPCOMUtils.defineLazyGetter(this, "MMS", function() {
let MMS = {};
Cu.import("resource://gre/modules/MmsPduHelper.jsm", MMS);
return MMS;
@ -104,7 +104,7 @@ MobileMessageDB.prototype = {
*
* @return (via callback) a database ready for use.
*/
ensureDB: function ensureDB(callback) {
ensureDB: function(callback) {
if (this.db) {
if (DEBUG) debug("ensureDB: already have a database, returning early.");
callback(null, this.db);
@ -118,11 +118,11 @@ MobileMessageDB.prototype = {
}
let request = indexedDB.open(this.dbName, this.dbVersion);
request.onsuccess = function (event) {
request.onsuccess = function(event) {
if (DEBUG) debug("Opened database:", self.dbName, self.dbVersion);
gotDB(event.target.result);
};
request.onupgradeneeded = function (event) {
request.onupgradeneeded = function(event) {
if (DEBUG) {
debug("Database needs upgrade:", self.dbName,
event.oldVersion, event.newVersion);
@ -234,11 +234,11 @@ MobileMessageDB.prototype = {
update(currentVersion);
};
request.onerror = function (event) {
request.onerror = function(event) {
//TODO look at event.target.Code and change error constant accordingly
callback("Error opening database!", null);
};
request.onblocked = function (event) {
request.onblocked = function(event) {
callback("Opening database request is blocked.", null);
};
},
@ -254,12 +254,12 @@ MobileMessageDB.prototype = {
* @param storeNames
* Names of the stores to open.
*/
newTxn: function newTxn(txn_type, callback, storeNames) {
newTxn: function(txn_type, callback, storeNames) {
if (!storeNames) {
storeNames = [MESSAGE_STORE_NAME];
}
if (DEBUG) debug("Opening transaction for object stores: " + storeNames);
this.ensureDB(function (error, db) {
this.ensureDB(function(error, db) {
if (error) {
if (DEBUG) debug("Could not open database: " + error);
callback(error);
@ -304,7 +304,7 @@ MobileMessageDB.prototype = {
* or any error occurs. Should take only one argument -- null when
* initialized with success or the error object otherwise.
*/
init: function init(aDbName, aDbVersion, aCallback) {
init: function(aDbName, aDbVersion, aCallback) {
this.dbName = aDbName;
this.dbVersion = aDbVersion || DB_VERSION;
@ -347,7 +347,7 @@ MobileMessageDB.prototype = {
});
},
close: function close() {
close: function() {
if (!this.db) {
return;
}
@ -361,13 +361,12 @@ MobileMessageDB.prototype = {
* Sometimes user might reboot or remove battery while sending/receiving
* message. This is function set the status of message records to error.
*/
updatePendingTransactionToError:
function updatePendingTransactionToError(aError) {
updatePendingTransactionToError: function(aError) {
if (aError) {
return;
}
this.newTxn(READ_WRITE, function (error, txn, messageStore) {
this.newTxn(READ_WRITE, function(error, txn, messageStore) {
if (error) {
return;
}
@ -440,7 +439,7 @@ MobileMessageDB.prototype = {
* TODO need to worry about number normalization somewhere...
* TODO full text search on body???
*/
createSchema: function createSchema(db, next) {
createSchema: function(db, next) {
// This messageStore holds the main mobile message data.
let messageStore = db.createObjectStore(MESSAGE_STORE_NAME, { keyPath: "id" });
messageStore.createIndex("timestamp", "timestamp", { unique: false });
@ -451,13 +450,13 @@ MobileMessageDB.prototype = {
/**
* Upgrade to the corresponding database schema version.
*/
upgradeSchema: function upgradeSchema(transaction, next) {
upgradeSchema: function(transaction, next) {
let messageStore = transaction.objectStore(MESSAGE_STORE_NAME);
messageStore.createIndex("read", "read", { unique: false });
next();
},
upgradeSchema2: function upgradeSchema2(transaction, next) {
upgradeSchema2: function(transaction, next) {
let messageStore = transaction.objectStore(MESSAGE_STORE_NAME);
messageStore.openCursor().onsuccess = function(event) {
let cursor = event.target.result;
@ -474,7 +473,7 @@ MobileMessageDB.prototype = {
};
},
upgradeSchema3: function upgradeSchema3(db, transaction, next) {
upgradeSchema3: function(db, transaction, next) {
// Delete redundant "id" index.
let messageStore = transaction.objectStore(MESSAGE_STORE_NAME);
if (messageStore.indexNames.contains("id")) {
@ -498,7 +497,7 @@ MobileMessageDB.prototype = {
next();
},
upgradeSchema4: function upgradeSchema4(transaction, next) {
upgradeSchema4: function(transaction, next) {
let threads = {};
let messageStore = transaction.objectStore(MESSAGE_STORE_NAME);
let mostRecentStore = transaction.objectStore(MOST_RECENT_STORE_NAME);
@ -539,12 +538,12 @@ MobileMessageDB.prototype = {
};
},
upgradeSchema5: function upgradeSchema5(transaction, next) {
upgradeSchema5: function(transaction, next) {
// Don't perform any upgrade. See Bug 819560.
next();
},
upgradeSchema6: function upgradeSchema6(transaction, next) {
upgradeSchema6: function(transaction, next) {
let messageStore = transaction.objectStore(MESSAGE_STORE_NAME);
// Delete "delivery" index.
@ -606,7 +605,7 @@ MobileMessageDB.prototype = {
* Fetching threads list is now simply walking through the thread sotre. The
* "mostRecentStore" is dropped.
*/
upgradeSchema7: function upgradeSchema7(db, transaction, next) {
upgradeSchema7: function(db, transaction, next) {
/**
* This "participant" object store keeps mappings of multiple phone numbers
* of the same recipient to an integer participant id. Each entry looks
@ -671,7 +670,7 @@ MobileMessageDB.prototype = {
// new record in participantStore.
let number = mostRecentRecord.senderOrReceiver;
self.findParticipantRecordByAddress(participantStore, number, true,
function (participantRecord) {
function(participantRecord) {
// Also create a new record in threadStore.
let threadRecord = {
participantIds: [participantRecord.id],
@ -682,13 +681,13 @@ MobileMessageDB.prototype = {
unreadCount: mostRecentRecord.unreadCount,
};
let addThreadRequest = threadStore.add(threadRecord);
addThreadRequest.onsuccess = function (event) {
addThreadRequest.onsuccess = function(event) {
threadRecord.id = event.target.result;
let numberRange = IDBKeyRange.bound([number, 0], [number, ""]);
let messageRequest = messageStore.index("number")
.openCursor(numberRange, NEXT);
messageRequest.onsuccess = function (event) {
messageRequest.onsuccess = function(event) {
let messageCursor = event.target.result;
if (!messageCursor) {
// No more message records, check next most recent record.
@ -722,12 +721,12 @@ MobileMessageDB.prototype = {
// Check next message record.
messageCursor.continue();
};
messageRequest.onerror = function () {
messageRequest.onerror = function() {
// Error in fetching message records, check next most recent record.
mostRecentCursor.continue();
};
};
addThreadRequest.onerror = function () {
addThreadRequest.onerror = function() {
// Error in fetching message records, check next most recent record.
mostRecentCursor.continue();
};
@ -738,7 +737,7 @@ MobileMessageDB.prototype = {
/**
* Add transactionId index for MMS.
*/
upgradeSchema8: function upgradeSchema8(transaction, next) {
upgradeSchema8: function(transaction, next) {
let messageStore = transaction.objectStore(MESSAGE_STORE_NAME);
// Delete "transactionId" index.
@ -769,7 +768,7 @@ MobileMessageDB.prototype = {
};
},
upgradeSchema9: function upgradeSchema9(transaction, next) {
upgradeSchema9: function(transaction, next) {
let messageStore = transaction.objectStore(MESSAGE_STORE_NAME);
// Update type attributes.
@ -789,7 +788,7 @@ MobileMessageDB.prototype = {
};
},
upgradeSchema10: function upgradeSchema10(transaction, next) {
upgradeSchema10: function(transaction, next) {
let threadStore = transaction.objectStore(THREAD_STORE_NAME);
// Add 'lastMessageType' to each thread record.
@ -837,7 +836,7 @@ MobileMessageDB.prototype = {
/**
* Add envelopeId index for MMS.
*/
upgradeSchema11: function upgradeSchema11(transaction, next) {
upgradeSchema11: function(transaction, next) {
let messageStore = transaction.objectStore(MESSAGE_STORE_NAME);
// Delete "envelopeId" index.
@ -869,7 +868,7 @@ MobileMessageDB.prototype = {
/**
* Replace deliveryStatus by deliveryInfo.
*/
upgradeSchema12: function upgradeSchema12(transaction, next) {
upgradeSchema12: function(transaction, next) {
let messageStore = transaction.objectStore(MESSAGE_STORE_NAME);
messageStore.openCursor().onsuccess = function(event) {
@ -906,13 +905,13 @@ MobileMessageDB.prototype = {
/**
* Fix the wrong participants.
*/
upgradeSchema13: function upgradeSchema13(transaction, next) {
upgradeSchema13: function(transaction, next) {
let participantStore = transaction.objectStore(PARTICIPANT_STORE_NAME);
let threadStore = transaction.objectStore(THREAD_STORE_NAME);
let messageStore = transaction.objectStore(MESSAGE_STORE_NAME);
let self = this;
let isInvalid = function (participantRecord) {
let isInvalid = function(participantRecord) {
let entries = [];
for (let addr of participantRecord.addresses) {
entries.push({
@ -1020,7 +1019,7 @@ MobileMessageDB.prototype = {
}
self.findThreadRecordByParticipants(threadStore, participantStore,
threadParticipants, true,
function (threadRecord,
function(threadRecord,
participantIds) {
if (!participantIds) {
debug("participantIds is empty!");
@ -1068,7 +1067,7 @@ MobileMessageDB.prototype = {
unreadCount: messageRecord.read ? 0 : 1,
lastMessageType: messageRecord.type
};
threadStore.add(threadRecord).onsuccess = function (event) {
threadStore.add(threadRecord).onsuccess = function(event) {
let threadId = event.target.result;
// Setup threadId & threadIdIndex.
messageRecord.threadId = threadId;
@ -1086,7 +1085,7 @@ MobileMessageDB.prototype = {
/**
* Add deliveryTimestamp.
*/
upgradeSchema14: function upgradeSchema14(transaction, next) {
upgradeSchema14: function(transaction, next) {
let messageStore = transaction.objectStore(MESSAGE_STORE_NAME);
messageStore.openCursor().onsuccess = function(event) {
@ -1113,7 +1112,7 @@ MobileMessageDB.prototype = {
/**
* Add ICC ID.
*/
upgradeSchema15: function upgradeSchema15(transaction, next) {
upgradeSchema15: function(transaction, next) {
let messageStore = transaction.objectStore(MESSAGE_STORE_NAME);
messageStore.openCursor().onsuccess = function(event) {
let cursor = event.target.result;
@ -1132,7 +1131,7 @@ MobileMessageDB.prototype = {
/**
* Add isReadReportSent for incoming MMS.
*/
upgradeSchema16: function upgradeSchema16(transaction, next) {
upgradeSchema16: function(transaction, next) {
let messageStore = transaction.objectStore(MESSAGE_STORE_NAME);
// Update type attributes.
@ -1152,7 +1151,7 @@ MobileMessageDB.prototype = {
};
},
upgradeSchema17: function upgradeSchema17(transaction, next) {
upgradeSchema17: function(transaction, next) {
let threadStore = transaction.objectStore(THREAD_STORE_NAME);
let messageStore = transaction.objectStore(MESSAGE_STORE_NAME);
@ -1193,7 +1192,7 @@ MobileMessageDB.prototype = {
/**
* Add pid for incoming SMS.
*/
upgradeSchema18: function upgradeSchema18(transaction, next) {
upgradeSchema18: function(transaction, next) {
let messageStore = transaction.objectStore(MESSAGE_STORE_NAME);
messageStore.openCursor().onsuccess = function(event) {
@ -1215,7 +1214,7 @@ MobileMessageDB.prototype = {
/**
* Add readStatus and readTimestamp.
*/
upgradeSchema19: function upgradeSchema19(transaction, next) {
upgradeSchema19: function(transaction, next) {
let messageStore = transaction.objectStore(MESSAGE_STORE_NAME);
messageStore.openCursor().onsuccess = function(event) {
let cursor = event.target.result;
@ -1272,7 +1271,7 @@ MobileMessageDB.prototype = {
/**
* Add sentTimestamp.
*/
upgradeSchema20: function upgradeSchema20(transaction, next) {
upgradeSchema20: function(transaction, next) {
let messageStore = transaction.objectStore(MESSAGE_STORE_NAME);
messageStore.openCursor().onsuccess = function(event) {
let cursor = event.target.result;
@ -1295,8 +1294,7 @@ MobileMessageDB.prototype = {
};
},
matchParsedPhoneNumbers: function matchParsedPhoneNumbers(addr1, parsedAddr1,
addr2, parsedAddr2) {
matchParsedPhoneNumbers: function(addr1, parsedAddr1, addr2, parsedAddr2) {
if ((parsedAddr1.internationalNumber &&
parsedAddr1.internationalNumber === parsedAddr2.internationalNumber) ||
(parsedAddr1.nationalNumber &&
@ -1319,7 +1317,7 @@ MobileMessageDB.prototype = {
addr1.slice(-val) === addr2.slice(-val);
},
matchPhoneNumbers: function matchPhoneNumbers(addr1, parsedAddr1, addr2, parsedAddr2) {
matchPhoneNumbers: function(addr1, parsedAddr1, addr2, parsedAddr2) {
if (parsedAddr1 && parsedAddr2) {
return this.matchParsedPhoneNumbers(addr1, parsedAddr1, addr2, parsedAddr2);
}
@ -1343,7 +1341,7 @@ MobileMessageDB.prototype = {
return false;
},
createDomMessageFromRecord: function createDomMessageFromRecord(aMessageRecord) {
createDomMessageFromRecord: function(aMessageRecord) {
if (DEBUG) {
debug("createDomMessageFromRecord: " + JSON.stringify(aMessageRecord));
}
@ -1424,8 +1422,8 @@ MobileMessageDB.prototype = {
}
},
findParticipantRecordByAddress: function findParticipantRecordByAddress(
aParticipantStore, aAddress, aCreate, aCallback) {
findParticipantRecordByAddress: function(aParticipantStore, aAddress,
aCreate, aCallback) {
if (DEBUG) {
debug("findParticipantRecordByAddress("
+ JSON.stringify(aAddress) + ", " + aCreate + ")");
@ -1475,7 +1473,7 @@ MobileMessageDB.prototype = {
}
// 2) Traverse throught all participants and check all alias addresses.
aParticipantStore.openCursor().onsuccess = (function (event) {
aParticipantStore.openCursor().onsuccess = (function(event) {
let cursor = event.target.result;
if (!cursor) {
// Have traversed whole object store but still in vain.
@ -1486,7 +1484,7 @@ MobileMessageDB.prototype = {
let participantRecord = { addresses: [normalizedAddress] };
let addRequest = aParticipantStore.add(participantRecord);
addRequest.onsuccess = function (event) {
addRequest.onsuccess = function(event) {
participantRecord.id = event.target.result;
if (DEBUG) {
debug("findParticipantRecordByAddress: created "
@ -1529,8 +1527,8 @@ MobileMessageDB.prototype = {
}).bind(this);
},
findParticipantIdsByAddresses: function findParticipantIdsByAddresses(
aParticipantStore, aAddresses, aCreate, aSkipNonexistent, aCallback) {
findParticipantIdsByAddresses: function(aParticipantStore, aAddresses,
aCreate, aSkipNonexistent, aCallback) {
if (DEBUG) {
debug("findParticipantIdsByAddresses("
+ JSON.stringify(aAddresses) + ", "
@ -1547,7 +1545,7 @@ MobileMessageDB.prototype = {
(function findParticipantId(index, result) {
if (index >= aAddresses.length) {
// Sort numerically.
result.sort(function (a, b) {
result.sort(function(a, b) {
return a - b;
});
if (DEBUG) debug("findParticipantIdsByAddresses: returning " + result);
@ -1557,7 +1555,7 @@ MobileMessageDB.prototype = {
self.findParticipantRecordByAddress(aParticipantStore,
aAddresses[index++], aCreate,
function (participantRecord) {
function(participantRecord) {
if (!participantRecord) {
if (!aSkipNonexistent) {
if (DEBUG) debug("findParticipantIdsByAddresses: returning null");
@ -1572,16 +1570,16 @@ MobileMessageDB.prototype = {
}) (0, []);
},
findThreadRecordByParticipants: function findThreadRecordByParticipants(
aThreadStore, aParticipantStore, aAddresses,
aCreateParticipants, aCallback) {
findThreadRecordByParticipants: function(aThreadStore, aParticipantStore,
aAddresses, aCreateParticipants,
aCallback) {
if (DEBUG) {
debug("findThreadRecordByParticipants(" + JSON.stringify(aAddresses)
+ ", " + aCreateParticipants + ")");
}
this.findParticipantIdsByAddresses(aParticipantStore, aAddresses,
aCreateParticipants, false,
function (participantIds) {
function(participantIds) {
if (!participantIds) {
if (DEBUG) debug("findThreadRecordByParticipants: returning null");
aCallback(null, null);
@ -1589,7 +1587,7 @@ MobileMessageDB.prototype = {
}
// Find record from thread store.
let request = aThreadStore.index("participantIds").get(participantIds);
request.onsuccess = function (event) {
request.onsuccess = function(event) {
let threadRecord = event.target.result;
if (DEBUG) {
debug("findThreadRecordByParticipants: return "
@ -1600,7 +1598,7 @@ MobileMessageDB.prototype = {
});
},
newTxnWithCallback: function newTxnWithCallback(aCallback, aFunc, aStoreNames) {
newTxnWithCallback: function(aCallback, aFunc, aStoreNames) {
let self = this;
this.newTxn(READ_WRITE, function(aError, aTransaction, aStores) {
let notifyResult = function(aRv, aMessageRecord) {
@ -1631,7 +1629,7 @@ MobileMessageDB.prototype = {
}, aStoreNames);
},
saveRecord: function saveRecord(aMessageRecord, aAddresses, aCallback) {
saveRecord: function(aMessageRecord, aAddresses, aCallback) {
if (DEBUG) debug("Going to store " + JSON.stringify(aMessageRecord));
let self = this;
@ -1670,10 +1668,9 @@ MobileMessageDB.prototype = {
}, [MESSAGE_STORE_NAME, PARTICIPANT_STORE_NAME, THREAD_STORE_NAME]);
},
replaceShortMessageOnSave:
function replaceShortMessageOnSave(aTransaction, aMessageStore,
aParticipantStore, aThreadStore,
aMessageRecord, aAddresses) {
replaceShortMessageOnSave: function(aTransaction, aMessageStore,
aParticipantStore, aThreadStore,
aMessageRecord, aAddresses) {
let isReplaceTypePid = (aMessageRecord.pid) &&
((aMessageRecord.pid >= RIL.PDU_PID_REPLACE_SHORT_MESSAGE_TYPE_1 &&
aMessageRecord.pid <= RIL.PDU_PID_REPLACE_SHORT_MESSAGE_TYPE_7) ||
@ -1734,9 +1731,8 @@ MobileMessageDB.prototype = {
});
},
realSaveRecord: function realSaveRecord(aTransaction, aMessageStore,
aParticipantStore, aThreadStore,
aMessageRecord, aAddresses) {
realSaveRecord: function(aTransaction, aMessageStore, aParticipantStore,
aThreadStore, aMessageRecord, aAddresses) {
let self = this;
this.findThreadRecordByParticipants(aThreadStore, aParticipantStore,
aAddresses, true,
@ -1837,8 +1833,7 @@ MobileMessageDB.prototype = {
});
},
forEachMatchedMmsDeliveryInfo:
function forEachMatchedMmsDeliveryInfo(aDeliveryInfo, aNeedle, aCallback) {
forEachMatchedMmsDeliveryInfo: function(aDeliveryInfo, aNeedle, aCallback) {
let typedAddress = {
type: MMS.Address.resolveType(aNeedle),
@ -1883,8 +1878,8 @@ MobileMessageDB.prototype = {
}
},
updateMessageDeliveryById: function updateMessageDeliveryById(
id, type, receiver, delivery, deliveryStatus, envelopeId, callback) {
updateMessageDeliveryById: function(id, type, receiver, delivery,
deliveryStatus, envelopeId, callback) {
if (DEBUG) {
debug("Setting message's delivery by " + type + " = "+ id
+ " receiver: " + receiver
@ -1985,7 +1980,7 @@ MobileMessageDB.prototype = {
});
},
fillReceivedMmsThreadParticipants: function fillReceivedMmsThreadParticipants(aMessage, threadParticipants) {
fillReceivedMmsThreadParticipants: function(aMessage, threadParticipants) {
let receivers = aMessage.receivers;
// If we don't want to disable the MMS grouping for receiving, we need to
// add the receivers (excluding the user's own number) to the participants
@ -2023,11 +2018,8 @@ MobileMessageDB.prototype = {
threadParticipants = threadParticipants.concat(slicedReceivers);
},
updateThreadByMessageChange: function updateThreadByMessageChange(messageStore,
threadStore,
threadId,
messageId,
messageRead) {
updateThreadByMessageChange: function(messageStore, threadStore, threadId,
messageId, messageRead) {
threadStore.get(threadId).onsuccess = function(event) {
// This must exist.
let threadRecord = event.target.result;
@ -2084,7 +2076,7 @@ MobileMessageDB.prototype = {
* nsIRilMobileMessageDatabaseService API
*/
saveReceivedMessage: function saveReceivedMessage(aMessage, aCallback) {
saveReceivedMessage: function(aMessage, aCallback) {
if ((aMessage.type != "sms" && aMessage.type != "mms") ||
(aMessage.type == "sms" && (aMessage.messageClass == undefined ||
aMessage.sender == undefined)) ||
@ -2156,7 +2148,7 @@ MobileMessageDB.prototype = {
this.saveRecord(aMessage, threadParticipants, aCallback);
},
saveSendingMessage: function saveSendingMessage(aMessage, aCallback) {
saveSendingMessage: function(aMessage, aCallback) {
if ((aMessage.type != "sms" && aMessage.type != "mms") ||
(aMessage.type == "sms" && aMessage.receiver == undefined) ||
(aMessage.type == "mms" && !Array.isArray(aMessage.receivers)) ||
@ -2227,24 +2219,22 @@ MobileMessageDB.prototype = {
this.saveRecord(aMessage, addresses, aCallback);
},
setMessageDeliveryByMessageId: function setMessageDeliveryByMessageId(
messageId, receiver, delivery, deliveryStatus, envelopeId, callback) {
setMessageDeliveryByMessageId: function(messageId, receiver, delivery,
deliveryStatus, envelopeId, callback) {
this.updateMessageDeliveryById(messageId, "messageId",
receiver, delivery, deliveryStatus,
envelopeId, callback);
},
setMessageDeliveryStatusByEnvelopeId:
function setMessageDeliveryStatusByEnvelopeId(aEnvelopeId, aReceiver,
aDeliveryStatus, aCallback) {
setMessageDeliveryStatusByEnvelopeId: function(aEnvelopeId, aReceiver,
aDeliveryStatus, aCallback) {
this.updateMessageDeliveryById(aEnvelopeId, "envelopeId", aReceiver, null,
aDeliveryStatus, null, aCallback);
},
setMessageReadStatusByEnvelopeId:
function setMessageReadStatusByEnvelopeId(aEnvelopeId, aReceiver,
aReadStatus, aCallback) {
setMessageReadStatusByEnvelopeId: function(aEnvelopeId, aReceiver,
aReadStatus, aCallback) {
if (DEBUG) {
debug("Setting message's read status by envelopeId = " + aEnvelopeId +
", receiver: " + aReceiver + ", readStatus: " + aReadStatus);
@ -2293,10 +2283,10 @@ MobileMessageDB.prototype = {
});
},
getMessageRecordByTransactionId: function getMessageRecordByTransactionId(aTransactionId, aCallback) {
getMessageRecordByTransactionId: function(aTransactionId, aCallback) {
if (DEBUG) debug("Retrieving message with transaction ID " + aTransactionId);
let self = this;
this.newTxn(READ_ONLY, function (error, txn, messageStore) {
this.newTxn(READ_ONLY, function(error, txn, messageStore) {
if (error) {
if (DEBUG) debug(error);
aCallback.notify(Ci.nsIMobileMessageCallback.INTERNAL_ERROR, null, null);
@ -2329,10 +2319,10 @@ MobileMessageDB.prototype = {
});
},
getMessageRecordById: function getMessageRecordById(aMessageId, aCallback) {
getMessageRecordById: function(aMessageId, aCallback) {
if (DEBUG) debug("Retrieving message with ID " + aMessageId);
let self = this;
this.newTxn(READ_ONLY, function (error, txn, messageStore) {
this.newTxn(READ_ONLY, function(error, txn, messageStore) {
if (error) {
if (DEBUG) debug(error);
aCallback.notify(Ci.nsIMobileMessageCallback.INTERNAL_ERROR, null, null);
@ -2381,10 +2371,10 @@ MobileMessageDB.prototype = {
* nsIMobileMessageDatabaseService API
*/
getMessage: function getMessage(aMessageId, aRequest) {
getMessage: function(aMessageId, aRequest) {
if (DEBUG) debug("Retrieving message with ID " + aMessageId);
let notifyCallback = {
notify: function notify(aRv, aMessageRecord, aDomMessage) {
notify: function(aRv, aMessageRecord, aDomMessage) {
if (Ci.nsIMobileMessageCallback.SUCCESS_NO_ERROR == aRv) {
aRequest.notifyMessageGot(aDomMessage);
return;
@ -2395,11 +2385,11 @@ MobileMessageDB.prototype = {
this.getMessageRecordById(aMessageId, notifyCallback);
},
deleteMessage: function deleteMessage(messageIds, length, aRequest) {
deleteMessage: function(messageIds, length, aRequest) {
if (DEBUG) debug("deleteMessage: message ids " + JSON.stringify(messageIds));
let deleted = [];
let self = this;
this.newTxn(READ_WRITE, function (error, txn, stores) {
this.newTxn(READ_WRITE, function(error, txn, stores) {
if (error) {
if (DEBUG) debug("deleteMessage: failed to open transaction");
aRequest.notifyDeleteMessageFailed(Ci.nsIMobileMessageCallback.INTERNAL_ERROR);
@ -2452,7 +2442,7 @@ MobileMessageDB.prototype = {
}, [MESSAGE_STORE_NAME, THREAD_STORE_NAME]);
},
createMessageCursor: function createMessageCursor(filter, reverse, callback) {
createMessageCursor: function(filter, reverse, callback) {
if (DEBUG) {
debug("Creating a message cursor. Filters:" +
" startDate: " + filter.startDate +
@ -2467,7 +2457,7 @@ MobileMessageDB.prototype = {
let cursor = new GetMessagesCursor(this, callback);
let self = this;
self.newTxn(READ_ONLY, function (error, txn, stores) {
self.newTxn(READ_ONLY, function(error, txn, stores) {
let collector = cursor.collector;
let collect = collector.collect.bind(collector);
FilterSearcherHelper.transact(self, txn, error, filter, reverse, collect);
@ -2476,9 +2466,9 @@ MobileMessageDB.prototype = {
return cursor;
},
markMessageRead: function markMessageRead(messageId, value, aSendReadReport, aRequest) {
markMessageRead: function(messageId, value, aSendReadReport, aRequest) {
if (DEBUG) debug("Setting message " + messageId + " read to " + value);
this.newTxn(READ_WRITE, function (error, txn, stores) {
this.newTxn(READ_WRITE, function(error, txn, stores) {
if (error) {
if (DEBUG) debug(error);
aRequest.notifyMarkMessageReadFailed(Ci.nsIMobileMessageCallback.INTERNAL_ERROR);
@ -2566,11 +2556,11 @@ MobileMessageDB.prototype = {
}, [MESSAGE_STORE_NAME, THREAD_STORE_NAME]);
},
createThreadCursor: function createThreadCursor(callback) {
createThreadCursor: function(callback) {
if (DEBUG) debug("Getting thread list");
let cursor = new GetThreadsCursor(this, callback);
this.newTxn(READ_ONLY, function (error, txn, threadStore) {
this.newTxn(READ_ONLY, function(error, txn, threadStore) {
let collector = cursor.collector;
if (error) {
if (DEBUG) debug(error);
@ -2613,7 +2603,7 @@ let FilterSearcherHelper = {
* Result colletor function. It takes three parameters -- txn, message
* id, and message timestamp.
*/
filterIndex: function filterIndex(index, range, direction, txn, collect) {
filterIndex: function(index, range, direction, txn, collect) {
let messageStore = txn.objectStore(MESSAGE_STORE_NAME);
let request = messageStore.index(index).openKeyCursor(range, direction);
request.onsuccess = function onsuccess(event) {
@ -2650,8 +2640,7 @@ let FilterSearcherHelper = {
* Result colletor function. It takes three parameters -- txn, message
* id, and message timestamp.
*/
filterTimestamp: function filterTimestamp(startDate, endDate, direction, txn,
collect) {
filterTimestamp: function(startDate, endDate, direction, txn, collect) {
let range = null;
if (startDate != null && endDate != null) {
range = IDBKeyRange.bound(startDate.getTime(), endDate.getTime());
@ -2681,7 +2670,7 @@ let FilterSearcherHelper = {
* Result colletor function. It takes three parameters -- txn, message
* id, and message timestamp.
*/
transact: function transact(mmdb, txn, error, filter, reverse, collect) {
transact: function(mmdb, txn, error, filter, reverse, collect) {
if (error) {
//TODO look at event.target.errorCode, pick appropriate error constant.
if (DEBUG) debug("IDBRequest error " + error.target.errorCode);
@ -2773,7 +2762,7 @@ let FilterSearcherHelper = {
let participantStore = txn.objectStore(PARTICIPANT_STORE_NAME);
mmdb.findParticipantIdsByAddresses(participantStore, filter.numbers,
false, true,
(function (participantIds) {
(function(participantIds) {
if (!participantIds || !participantIds.length) {
// Oops! No such participant at all.
@ -2827,7 +2816,7 @@ ResultsCollector.prototype = {
*
* @return true if expects more. false otherwise.
*/
collect: function collect(txn, id, timestamp) {
collect: function(txn, id, timestamp) {
if (this.done) {
return false;
}
@ -2868,7 +2857,7 @@ ResultsCollector.prototype = {
* @param callback
* A callback function that accepts a numeric id.
*/
squeeze: function squeeze(callback) {
squeeze: function(callback) {
if (this.requestWaiting) {
throw new Error("Already waiting for another request!");
}
@ -2889,7 +2878,7 @@ ResultsCollector.prototype = {
* @param callback
* A callback function that accepts a numeric id.
*/
drip: function drip(txn, callback) {
drip: function(txn, callback) {
if (!this.results.length) {
if (DEBUG) debug("No messages matching the filter criteria");
callback(txn, COLLECT_ID_END);
@ -2923,7 +2912,7 @@ IntersectionResultsCollector.prototype = {
* Queue up {id, timestamp} pairs, find out intersections and report to
* |cascadedCollect|. Return true if it is still possible to have another match.
*/
collect: function collect(contextIndex, txn, id, timestamp) {
collect: function(contextIndex, txn, id, timestamp) {
if (DEBUG) {
debug("IntersectionResultsCollector: "
+ contextIndex + ", " + id + ", " + timestamp);
@ -3013,7 +3002,7 @@ IntersectionResultsCollector.prototype = {
return this.cascadedCollect(txn, id, timestamp);
},
newContext: function newContext() {
newContext: function() {
let contextIndex = this.contexts.length;
this.contexts.push({
results: [],
@ -3038,7 +3027,7 @@ UnionResultsCollector.prototype = {
cascadedCollect: null,
contexts: null,
collect: function collect(contextIndex, txn, id, timestamp) {
collect: function(contextIndex, txn, id, timestamp) {
if (DEBUG) {
debug("UnionResultsCollector: "
+ contextIndex + ", " + id + ", " + timestamp);
@ -3074,7 +3063,7 @@ UnionResultsCollector.prototype = {
let tres = contexts[0].results;
let qres = contexts[1].results;
tres = tres.filter(function (element) {
tres = tres.filter(function(element) {
return qres.indexOf(element.id) != -1;
});
@ -3086,11 +3075,11 @@ UnionResultsCollector.prototype = {
return false;
},
newTimestampContext: function newTimestampContext() {
newTimestampContext: function() {
return this.collect.bind(this, 0);
},
newContext: function newContext() {
newContext: function() {
this.contexts[1].processing++;
return this.collect.bind(this, 1);
}
@ -3111,7 +3100,7 @@ GetMessagesCursor.prototype = {
callback: null,
collector: null,
getMessageTxn: function getMessageTxn(messageStore, messageId) {
getMessageTxn: function(messageStore, messageId) {
if (DEBUG) debug ("Fetching message " + messageId);
let getRequest = messageStore.get(messageId);
@ -3132,7 +3121,7 @@ GetMessagesCursor.prototype = {
};
},
notify: function notify(txn, messageId) {
notify: function(txn, messageId) {
if (!messageId) {
this.callback.notifyCursorDone();
return;
@ -3153,7 +3142,7 @@ GetMessagesCursor.prototype = {
// Or, we have to open another transaction ourselves.
let self = this;
this.mmdb.newTxn(READ_ONLY, function (error, txn, messageStore) {
this.mmdb.newTxn(READ_ONLY, function(error, txn, messageStore) {
if (error) {
self.callback.notifyCursorError(Ci.nsIMobileMessageCallback.INTERNAL_ERROR);
return;
@ -3164,7 +3153,7 @@ GetMessagesCursor.prototype = {
// nsICursorContinueCallback
handleContinue: function handleContinue() {
handleContinue: function() {
if (DEBUG) debug("Getting next message in list");
this.collector.squeeze(this.notify.bind(this));
}
@ -3185,7 +3174,7 @@ GetThreadsCursor.prototype = {
callback: null,
collector: null,
getThreadTxn: function getThreadTxn(threadStore, threadId) {
getThreadTxn: function(threadStore, threadId) {
if (DEBUG) debug ("Fetching thread " + threadId);
let getRequest = threadStore.get(threadId);
@ -3213,7 +3202,7 @@ GetThreadsCursor.prototype = {
};
},
notify: function notify(txn, threadId) {
notify: function(txn, threadId) {
if (!threadId) {
this.callback.notifyCursorDone();
return;
@ -3234,7 +3223,7 @@ GetThreadsCursor.prototype = {
// Or, we have to open another transaction ourselves.
let self = this;
this.mmdb.newTxn(READ_ONLY, function (error, txn, threadStore) {
this.mmdb.newTxn(READ_ONLY, function(error, txn, threadStore) {
if (error) {
self.callback.notifyCursorError(Ci.nsIMobileMessageCallback.INTERNAL_ERROR);
return;
@ -3245,7 +3234,7 @@ GetThreadsCursor.prototype = {
// nsICursorContinueCallback
handleContinue: function handleContinue() {
handleContinue: function() {
if (DEBUG) debug("Getting next thread in list");
this.collector.squeeze(this.notify.bind(this));
}

View File

@ -46,7 +46,7 @@ MobileMessageDatabaseService.prototype = {
/**
* nsIObserver
*/
observe: function observe() {},
observe: function() {},
/**
* nsIRilMobileMessageDatabaseService API

View File

@ -215,7 +215,7 @@ this.Octet = {
*
* @throws RangeError if no more data is available.
*/
decode: function decode(data) {
decode: function(data) {
if (data.offset >= data.array.length) {
throw new RangeError();
}
@ -234,7 +234,7 @@ this.Octet = {
* @throws RangeError if no enough data to read.
* @throws TypeError if `data` has neither subarray() nor slice() method.
*/
decodeMultiple: function decodeMultiple(data, end) {
decodeMultiple: function(data, end) {
if ((end < data.offset) || (end > data.array.length)) {
throw new RangeError();
}
@ -267,7 +267,7 @@ this.Octet = {
*
* @throws CodeError if read octet is not equal to expected one.
*/
decodeEqualTo: function decodeEqualTo(data, expected) {
decodeEqualTo: function(data, expected) {
if (this.decode(data) != expected) {
throw new CodeError("Octet - decodeEqualTo: doesn't match " + expected);
}
@ -281,7 +281,7 @@ this.Octet = {
* @param octet
* Octet value to be encoded.
*/
encode: function encode(data, octet) {
encode: function(data, octet) {
if (data.offset >= data.array.length) {
data.array.push(octet);
data.offset++;
@ -296,7 +296,7 @@ this.Octet = {
* @param octet
* An octet array object.
*/
encodeMultiple: function encodeMultiple(data, array) {
encodeMultiple: function(data, array) {
for (let i = 0; i < array.length; i++) {
this.encode(data, array[i]);
}
@ -325,7 +325,7 @@ this.Text = {
* @throws NullCharError if a NUL character read.
* @throws CodeError if a control character read.
*/
decode: function decode(data) {
decode: function(data) {
let code = Octet.decode(data);
if ((code >= CTLS) && (code != DEL)) {
return String.fromCharCode(code);
@ -386,7 +386,7 @@ this.Text = {
*
* @throws CodeError if a control character got.
*/
encode: function encode(data, text) {
encode: function(data, text) {
if (!text) {
throw new CodeError("Text: empty string");
}
@ -408,7 +408,7 @@ this.NullTerminatedTexts = {
*
* @return Decoded string.
*/
decode: function decode(data) {
decode: function(data) {
let str = "";
try {
// A End-of-string is also a CTL, which should cause a error.
@ -426,7 +426,7 @@ this.NullTerminatedTexts = {
* @param str
* A String to be encoded.
*/
encode: function encode(data, str) {
encode: function(data, str) {
if (str) {
for (let i = 0; i < str.length; i++) {
Text.encode(data, str.charAt(i));
@ -453,7 +453,7 @@ this.Token = {
* @throws NullCharError if a NUL character read.
* @throws CodeError if an invalid character read.
*/
decode: function decode(data) {
decode: function(data) {
let code = Octet.decode(data);
if ((code < ASCIIS) && (code >= CTLS)) {
if ((code == HT) || (code == SP)
@ -483,7 +483,7 @@ this.Token = {
*
* @throws CodeError if an invalid character got.
*/
encode: function encode(data, token) {
encode: function(data, token) {
if (!token) {
throw new CodeError("Token: empty string");
}
@ -529,7 +529,7 @@ this.URIC = {
* @throws NullCharError if a NUL character read.
* @throws CodeError if an invalid character read.
*/
decode: function decode(data) {
decode: function(data) {
let code = Octet.decode(data);
if (code == NUL) {
throw new NullCharError();
@ -562,7 +562,7 @@ this.TextString = {
*
* @return Decoded string.
*/
decode: function decode(data) {
decode: function(data) {
let begin = data.offset;
let firstCode = Octet.decode(data);
if (firstCode == 127) {
@ -591,7 +591,7 @@ this.TextString = {
* @param str
* A String to be encoded.
*/
encode: function encode(data, str) {
encode: function(data, str) {
if (!str) {
Octet.encode(data, 0);
return;
@ -618,7 +618,7 @@ this.TokenText = {
*
* @return Decoded string.
*/
decode: function decode(data) {
decode: function(data) {
let str = "";
try {
// A End-of-string is also a CTL, which should cause a error.
@ -636,7 +636,7 @@ this.TokenText = {
* @param str
* A String to be encoded.
*/
encode: function encode(data, str) {
encode: function(data, str) {
if (str) {
for (let i = 0; i < str.length; i++) {
Token.encode(data, str.charAt(i));
@ -663,7 +663,7 @@ this.QuotedString = {
*
* @throws CodeError if first octet read is not 0x34.
*/
decode: function decode(data) {
decode: function(data) {
let value = Octet.decode(data);
if (value != 34) {
throw new CodeError("Quoted-string: not quote " + value);
@ -678,7 +678,7 @@ this.QuotedString = {
* @param str
* A String to be encoded.
*/
encode: function encode(data, str) {
encode: function(data, str) {
Octet.encode(data, 34);
NullTerminatedTexts.encode(data, str);
},
@ -702,7 +702,7 @@ this.ShortInteger = {
*
* @throws CodeError if the octet read is less than 0x80.
*/
decode: function decode(data) {
decode: function(data) {
let value = Octet.decode(data);
if (!(value & 0x80)) {
throw new CodeError("Short-integer: invalid value " + value);
@ -719,7 +719,7 @@ this.ShortInteger = {
*
* @throws CodeError if the octet read is larger-equal than 0x80.
*/
encode: function encode(data, value) {
encode: function(data, value) {
if (value >= 0x80) {
throw new CodeError("Short-integer: invalid value " + value);
}
@ -748,7 +748,7 @@ this.LongInteger = {
*
* @return A decoded integer value or an octets array of max 30 elements.
*/
decodeMultiOctetInteger: function decodeMultiOctetInteger(data, length) {
decodeMultiOctetInteger: function(data, length) {
if (length < 7) {
// Return a integer instead of an array as possible. For a multi-octet
// integer, there are only maximum 53 bits for integer in javascript. We
@ -772,7 +772,7 @@ this.LongInteger = {
*
* @throws CodeError if the length read is not in 1..30.
*/
decode: function decode(data) {
decode: function(data) {
let length = Octet.decode(data);
if ((length < 1) || (length > 30)) {
throw new CodeError("Long-integer: invalid length " + length);
@ -788,7 +788,7 @@ this.LongInteger = {
* An octet array of less-equal than 30 elements or an integer
* greater-equal than 128.
*/
encode: function encode(data, numOrArray) {
encode: function(data, numOrArray) {
if (typeof numOrArray === "number") {
let num = numOrArray;
if (num >= 0x1000000000000) {
@ -828,7 +828,7 @@ this.UintVar = {
*
* @return Decoded integer value.
*/
decode: function decode(data) {
decode: function(data) {
let value = Octet.decode(data);
let result = value & 0x7F;
while (value & 0x80) {
@ -845,7 +845,7 @@ this.UintVar = {
* @param value
* An integer value.
*/
encode: function encode(data, value) {
encode: function(data, value) {
if (value < 0) {
throw new CodeError("UintVar: invalid value " + value);
}
@ -883,7 +883,7 @@ this.ConstrainedEncoding = {
*
* @return Decode integer value or string.
*/
decode: function decode(data) {
decode: function(data) {
return decodeAlternatives(data, null, TextString, ShortInteger);
},
@ -893,7 +893,7 @@ this.ConstrainedEncoding = {
* @param value
* An integer or a string value.
*/
encode: function encode(data, value) {
encode: function(data, value) {
if (typeof value == "number") {
ShortInteger.encode(data, value);
} else {
@ -919,7 +919,7 @@ this.ValueLength = {
*
* @throws CodeError if the first octet read is larger than 31.
*/
decode: function decode(data) {
decode: function(data) {
let value = Octet.decode(data);
if (value <= 30) {
return value;
@ -937,7 +937,7 @@ this.ValueLength = {
* A wrapped object to store encoded raw data.
* @param value
*/
encode: function encode(data, value) {
encode: function(data, value) {
if (value <= 30) {
Octet.encode(data, value);
} else {
@ -959,7 +959,7 @@ this.NoValue = {
*
* @return Always returns null.
*/
decode: function decode(data) {
decode: function(data) {
Octet.decodeEqualTo(data, 0);
return null;
},
@ -970,7 +970,7 @@ this.NoValue = {
* @param value
* A null or undefined value.
*/
encode: function encode(data, value) {
encode: function(data, value) {
if (value != null) {
throw new CodeError("No-value: invalid value " + value);
}
@ -990,7 +990,7 @@ this.TextValue = {
*
* @return Decoded string or null for No-value.
*/
decode: function decode(data) {
decode: function(data) {
return decodeAlternatives(data, null, NoValue, TokenText, QuotedString);
},
@ -1000,7 +1000,7 @@ this.TextValue = {
* @param text
* A null or undefined or text string.
*/
encode: function encode(data, text) {
encode: function(data, text) {
encodeAlternatives(data, text, null, NoValue, TokenText, QuotedString);
},
};
@ -1017,7 +1017,7 @@ this.IntegerValue = {
*
* @return Decoded integer value or array of octets.
*/
decode: function decode(data) {
decode: function(data) {
return decodeAlternatives(data, null, ShortInteger, LongInteger);
},
@ -1027,7 +1027,7 @@ this.IntegerValue = {
* @param value
* An integer value or an octet array of less-equal than 31 elements.
*/
encode: function encode(data, value) {
encode: function(data, value) {
if (typeof value === "number") {
encodeAlternatives(data, value, null, ShortInteger, LongInteger);
} else if (Array.isArray(value) || (value instanceof Uint8Array)) {
@ -1053,7 +1053,7 @@ this.DateValue = {
*
* @return A Date object.
*/
decode: function decode(data) {
decode: function(data) {
let numOrArray = LongInteger.decode(data);
let seconds;
if (typeof numOrArray == "number") {
@ -1074,7 +1074,7 @@ this.DateValue = {
* @param date
* A Date object.
*/
encode: function encode(data, date) {
encode: function(data, date) {
let seconds = date.getTime() / 1000;
if (seconds < 0) {
throw new CodeError("Date-value: negative seconds " + seconds);
@ -1108,7 +1108,7 @@ this.QValue = {
*
* @throws CodeError if decoded UintVar is not in range 1..1099.
*/
decode: function decode(data) {
decode: function(data) {
let value = UintVar.decode(data);
if (value > 0) {
if (value <= 100) {
@ -1128,7 +1128,7 @@ this.QValue = {
* @param value
* An integer within the range 1..1099.
*/
encode: function encode(data, value) {
encode: function(data, value) {
if ((value < 0) || (value >= 1)) {
throw new CodeError("Q-value: invalid value " + value);
}
@ -1162,7 +1162,7 @@ this.VersionValue = {
*
* @return Binary encoded version number.
*/
decode: function decode(data) {
decode: function(data) {
let begin = data.offset;
let value;
try {
@ -1202,7 +1202,7 @@ this.VersionValue = {
* @param version
* A binary encoded version number.
*/
encode: function encode(data, version) {
encode: function(data, version) {
if ((version < 0x10) || (version >= 0x80)) {
throw new CodeError("Version-value: invalid version " + version);
}
@ -1227,7 +1227,7 @@ this.UriValue = {
*
* @return Decoded uri string.
*/
decode: function decode(data) {
decode: function(data) {
let str = "";
try {
// A End-of-string is also a CTL, which should cause a error.
@ -1254,7 +1254,7 @@ this.TypeValue = {
*
* @return Decoded content type string.
*/
decode: function decode(data) {
decode: function(data) {
let numOrStr = ConstrainedEncoding.decode(data);
if (typeof numOrStr == "string") {
return numOrStr.toLowerCase();
@ -1276,7 +1276,7 @@ this.TypeValue = {
* @param type
* A content type string.
*/
encode: function encode(data, type) {
encode: function(data, type) {
let entry = WSP_WELL_KNOWN_CONTENT_TYPES[type.toLowerCase()];
if (entry) {
ConstrainedEncoding.encode(data, entry.number);
@ -1321,7 +1321,7 @@ this.Parameter = {
* @throws NotWellKnownEncodingError if decoded well-known parameter number
* is not registered or supported.
*/
decodeTypedParameter: function decodeTypedParameter(data) {
decodeTypedParameter: function(data) {
let numOrArray = IntegerValue.decode(data);
// `decodeIntegerValue` can return a array, which doesn't apply here.
if (typeof numOrArray != "number") {
@ -1369,7 +1369,7 @@ this.Parameter = {
* if something wrong. The `name` property must be a string, but the
* `value` property can be many different types depending on `name`.
*/
decodeUntypedParameter: function decodeUntypedParameter(data) {
decodeUntypedParameter: function(data) {
let name = TokenText.decode(data);
let begin = data.offset, value;
@ -1400,7 +1400,7 @@ this.Parameter = {
* if something wrong. The `name` property must be a string, but the
* `value` property can be many different types depending on `name`.
*/
decode: function decode(data) {
decode: function(data) {
let begin = data.offset;
try {
return this.decodeTypedParameter(data);
@ -1418,7 +1418,7 @@ this.Parameter = {
*
* @return An array of decoded objects.
*/
decodeMultiple: function decodeMultiple(data, end) {
decodeMultiple: function(data, end) {
let params = null, param;
while (data.offset < end) {
@ -1444,7 +1444,7 @@ this.Parameter = {
* @param param
* An object containing `name` and `value` properties.
*/
encodeTypedParameter: function decodeTypedParameter(data, param) {
encodeTypedParameter: function(data, param) {
let entry = WSP_WELL_KNOWN_PARAMS[param.name.toLowerCase()];
if (!entry) {
throw new NotWellKnownEncodingError(
@ -1462,7 +1462,7 @@ this.Parameter = {
* @param param
* An object containing `name` and `value` properties.
*/
encodeUntypedParameter: function encodeUntypedParameter(data, param) {
encodeUntypedParameter: function(data, param) {
TokenText.encode(data, param.name);
encodeAlternatives(data, param.value, null, IntegerValue, TextValue);
},
@ -1473,7 +1473,7 @@ this.Parameter = {
* @param param
* An array of parameter objects.
*/
encodeMultiple: function encodeMultiple(data, params) {
encodeMultiple: function(data, params) {
for (let name in params) {
this.encode(data, {name: name, value: params[name]});
}
@ -1485,7 +1485,7 @@ this.Parameter = {
* @param param
* An object containing `name` and `value` properties.
*/
encode: function encode(data, param) {
encode: function(data, param) {
let begin = data.offset;
try {
this.encodeTypedParameter(data, param);
@ -1512,7 +1512,7 @@ this.Header = {
* but the `value` property can be many different types depending on
* `name`.
*/
decodeMessageHeader: function decodeMessageHeader(data) {
decodeMessageHeader: function(data) {
return decodeAlternatives(data, null, WellKnownHeader, ApplicationHeader);
},
@ -1525,12 +1525,12 @@ this.Header = {
* but the `value` property can be many different types depending on
* `name`.
*/
decode: function decode(data) {
decode: function(data) {
// TODO: support header code page shift-sequence
return this.decodeMessageHeader(data);
},
encodeMessageHeader: function encodeMessageHeader(data, header) {
encodeMessageHeader: function(data, header) {
encodeAlternatives(data, header, null, WellKnownHeader, ApplicationHeader);
},
@ -1541,7 +1541,7 @@ this.Header = {
* An object containing two attributes: a string-typed `name` and a
* `value` of arbitrary type.
*/
encode: function encode(data, header) {
encode: function(data, header) {
// TODO: support header code page shift-sequence
this.encodeMessageHeader(data, header);
},
@ -1566,7 +1566,7 @@ this.WellKnownHeader = {
* @throws NotWellKnownEncodingError if decoded well-known header field
* number is not registered or supported.
*/
decode: function decode(data) {
decode: function(data) {
let index = ShortInteger.decode(data);
let entry = WSP_HEADER_FIELDS[index];
@ -1601,7 +1601,7 @@ this.WellKnownHeader = {
* An object containing two attributes: a string-typed `name` and a
* `value` of arbitrary type.
*/
encode: function encode(data, header) {
encode: function(data, header) {
let entry = WSP_HEADER_FIELDS[header.name.toLowerCase()];
if (!entry) {
throw new NotWellKnownEncodingError(
@ -1629,7 +1629,7 @@ this.ApplicationHeader = {
* but the `value` property can be many different types depending on
* `name`.
*/
decode: function decode(data) {
decode: function(data) {
let name = TokenText.decode(data);
let begin = data.offset, value;
@ -1660,7 +1660,7 @@ this.ApplicationHeader = {
*
* @throws CodeError if got an empty header name.
*/
encode: function encode(data, header) {
encode: function(data, header) {
if (!header.name) {
throw new CodeError("Application-header: empty header name");
}
@ -1686,7 +1686,7 @@ this.FieldName = {
* @throws NotWellKnownEncodingError if decoded well-known header field
* number is not registered or supported.
*/
decode: function decode(data) {
decode: function(data) {
let begin = data.offset;
try {
return TokenText.decode(data).toLowerCase();
@ -1710,7 +1710,7 @@ this.FieldName = {
* @param name
* A field name string.
*/
encode: function encode(data, name) {
encode: function(data, name) {
let entry = WSP_HEADER_FIELDS[name.toLowerCase()];
if (entry) {
ShortInteger.encode(data, entry.number);
@ -1735,7 +1735,7 @@ this.AcceptCharsetValue = {
*
* @return A object with a property `charset` of string "*".
*/
decodeAnyCharset: function decodeAnyCharset(data) {
decodeAnyCharset: function(data) {
Octet.decodeEqualTo(data, 128);
return {charset: "*"};
},
@ -1750,7 +1750,7 @@ this.AcceptCharsetValue = {
* @throws NotWellKnownEncodingError if decoded well-known charset number is
* not registered or supported.
*/
decodeConstrainedCharset: function decodeConstrainedCharset(data) {
decodeConstrainedCharset: function(data) {
let begin = data.offset;
try {
return this.decodeAnyCharset(data);
@ -1780,7 +1780,7 @@ this.AcceptCharsetValue = {
* @return A object with a string property `charset` and a optional integer
* property `q`.
*/
decodeAcceptCharsetGeneralForm: function decodeAcceptCharsetGeneralForm(data) {
decodeAcceptCharsetGeneralForm: function(data) {
let length = ValueLength.decode(data);
let begin = data.offset;
@ -1812,7 +1812,7 @@ this.AcceptCharsetValue = {
* @return A object with a string property `charset` and a optional integer
* property `q`.
*/
decode: function decode(data) {
decode: function(data) {
let begin = data.offset;
try {
return this.decodeConstrainedCharset(data);
@ -1828,7 +1828,7 @@ this.AcceptCharsetValue = {
* @param value
* An object with a string property `charset`.
*/
encodeAnyCharset: function encodeAnyCharset(data, value) {
encodeAnyCharset: function(data, value) {
if (!value || !value.charset || (value.charset === "*")) {
Octet.encode(data, 128);
return;
@ -1854,7 +1854,7 @@ this.WellKnownCharset = {
* @throws NotWellKnownEncodingError if decoded well-known charset number
* is not registered or supported.
*/
decode: function decode(data) {
decode: function(data) {
let begin = data.offset;
try {
@ -1884,7 +1884,7 @@ this.WellKnownCharset = {
* A wrapped object to store encoded raw data.
* @param value
*/
encode: function encode(data, value) {
encode: function(data, value) {
let begin = data.offset;
try {
AcceptCharsetValue.encodeAnyCharset(data, value);
@ -1929,7 +1929,7 @@ this.ContentTypeValue = {
* @throws NotWellKnownEncodingError if decoded well-known content type number
* is not registered or supported.
*/
decodeConstrainedMedia: function decodeConstrainedMedia(data) {
decodeConstrainedMedia: function(data) {
return {
media: TypeValue.decode(data),
params: null,
@ -1946,7 +1946,7 @@ this.ContentTypeValue = {
* @throws NotWellKnownEncodingError if decoded well-known content type
* number is not registered or supported.
*/
decodeMedia: function decodeMedia(data) {
decodeMedia: function(data) {
let begin = data.offset, number;
try {
number = IntegerValue.decode(data);
@ -1979,7 +1979,7 @@ this.ContentTypeValue = {
* string, and the `params` property is a hash map from a string to
* an value of unspecified type.
*/
decodeMediaType: function decodeMediaType(data, end) {
decodeMediaType: function(data, end) {
let media = this.decodeMedia(data);
let params = Parameter.decodeMultiple(data, end);
@ -1998,7 +1998,7 @@ this.ContentTypeValue = {
* string, and the `params` property is null or a hash map from a
* string to an value of unspecified type.
*/
decodeContentGeneralForm: function decodeContentGeneralForm(data) {
decodeContentGeneralForm: function(data) {
let length = ValueLength.decode(data);
let end = data.offset + length;
@ -2020,7 +2020,7 @@ this.ContentTypeValue = {
* string, and the `params` property is null or a hash map from a
* string to an value of unspecified type.
*/
decode: function decode(data) {
decode: function(data) {
let begin = data.offset;
try {
@ -2037,7 +2037,7 @@ this.ContentTypeValue = {
* @param value
* An object containing `media` and `params` properties.
*/
encodeConstrainedMedia: function encodeConstrainedMedia(data, value) {
encodeConstrainedMedia: function(data, value) {
if (value.params) {
throw new CodeError("Constrained-media: should use general form instead");
}
@ -2051,7 +2051,7 @@ this.ContentTypeValue = {
* @param value
* An object containing `media` and `params` properties.
*/
encodeMediaType: function encodeMediaType(data, value) {
encodeMediaType: function(data, value) {
let entry = WSP_WELL_KNOWN_CONTENT_TYPES[value.media.toLowerCase()];
if (entry) {
IntegerValue.encode(data, entry.number);
@ -2068,7 +2068,7 @@ this.ContentTypeValue = {
* @param value
* An object containing `media` and `params` properties.
*/
encodeContentGeneralForm: function encodeContentGeneralForm(data, value) {
encodeContentGeneralForm: function(data, value) {
let begin = data.offset;
this.encodeMediaType(data, value);
@ -2087,7 +2087,7 @@ this.ContentTypeValue = {
* @param value
* An object containing `media` and `params` properties.
*/
encode: function encode(data, value) {
encode: function(data, value) {
let begin = data.offset;
try {
@ -2116,7 +2116,7 @@ this.ApplicationIdValue = {
* @throws NotWellKnownEncodingError if decoded well-known application id
* number is not registered or supported.
*/
decode: function decode(data) {
decode: function(data) {
let begin = data.offset;
try {
return UriValue.decode(data);
@ -2150,7 +2150,7 @@ this.PduHelper = {
*
* @return Decoded string.
*/
decodeStringContent: function decodeStringContent(data, charset) {
decodeStringContent: function(data, charset) {
let conv = Cc["@mozilla.org/intl/scriptableunicodeconverter"]
.createInstance(Ci.nsIScriptableUnicodeConverter);
@ -2176,7 +2176,7 @@ this.PduHelper = {
*
* @return An encoded UInt8Array of string content.
*/
encodeStringContent: function encodeStringContent(strContent, charset) {
encodeStringContent: function(strContent, charset) {
let conv = Cc["@mozilla.org/intl/scriptableunicodeconverter"]
.createInstance(Ci.nsIScriptableUnicodeConverter);
@ -2207,7 +2207,7 @@ this.PduHelper = {
*
* @return A object containing decoded header fields as its attributes.
*/
parseHeaders: function parseHeaders(data, end, headers) {
parseHeaders: function(data, end, headers) {
if (!headers) {
headers = {};
}
@ -2241,7 +2241,7 @@ this.PduHelper = {
*
* @see WAP-230-WSP-20010705-a clause 8.2.4
*/
parsePushHeaders: function parsePushHeaders(data, msg) {
parsePushHeaders: function(data, msg) {
if (!msg.headers) {
msg.headers = {};
}
@ -2264,7 +2264,7 @@ this.PduHelper = {
*
* @see WAP-230-WSP-20010705-a section 8.5
*/
parseMultiPart: function parseMultiPart(data) {
parseMultiPart: function(data) {
let nEntries = UintVar.decode(data);
if (!nEntries) {
return null;
@ -2355,7 +2355,7 @@ this.PduHelper = {
*
* @return Parsed WSP PDU object or null in case of errors found.
*/
parse: function parse(data, isSessionless, msg) {
parse: function(data, isSessionless, msg) {
if (!msg) {
msg = {
type: null,
@ -2391,7 +2391,7 @@ this.PduHelper = {
* @param length
* Max number of octets to be coverted into an input stream.
*/
appendArrayToMultiStream: function appendArrayToMultiStream(multiStream, array, length) {
appendArrayToMultiStream: function(multiStream, array, length) {
let storageStream = Cc["@mozilla.org/storagestream;1"]
.createInstance(Ci.nsIStorageStream);
storageStream.init(4096, length, null);
@ -2413,7 +2413,7 @@ this.PduHelper = {
*
* @see WAP-230-WSP-20010705-a section 8.5
*/
composeMultiPart: function composeMultiPart(multiStream, parts) {
composeMultiPart: function(multiStream, parts) {
// Encode multipart header
{
let data = {array: [], offset: 0};
@ -2481,7 +2481,7 @@ this.PduHelper = {
// Deprecated items should only be supported for backward compatibility
// purpose.
// @see WAP-230-WSP-20010705-a Appendix A. Assigned Numbers.
this.WSP_HEADER_FIELDS = (function () {
this.WSP_HEADER_FIELDS = (function() {
let names = {};
function add(name, number, coder) {
let entry = {
@ -2577,7 +2577,7 @@ this.WSP_HEADER_FIELDS = (function () {
// WSP Content Type Assignments
// @see http://www.openmobilealliance.org/tech/omna/omna-wsp-content-type.aspx
this.WSP_WELL_KNOWN_CONTENT_TYPES = (function () {
this.WSP_WELL_KNOWN_CONTENT_TYPES = (function() {
let types = {};
function add(type, number) {
@ -2702,7 +2702,7 @@ this.WSP_WELL_KNOWN_CONTENT_TYPES = (function () {
// Note: Items commented out are either deprecated or not implemented.
// Deprecated items should not be used.
// @see WAP-230-WSP-20010705-a Appendix A. Assigned Numbers.
this.WSP_WELL_KNOWN_PARAMS = (function () {
this.WSP_WELL_KNOWN_PARAMS = (function() {
let params = {};
function add(name, number, coder) {
@ -2757,7 +2757,7 @@ this.WSP_WELL_KNOWN_PARAMS = (function () {
// WSP Character Set Assignments
// @see WAP-230-WSP-20010705-a Appendix A. Assigned Numbers.
// @see http://www.iana.org/assignments/character-sets
this.WSP_WELL_KNOWN_CHARSETS = (function () {
this.WSP_WELL_KNOWN_CHARSETS = (function() {
let charsets = {};
function add(name, number, converter) {
@ -2804,7 +2804,7 @@ this.WSP_WELL_KNOWN_CHARSETS = (function () {
// OMNA PUSH Application ID
// @see http://www.openmobilealliance.org/tech/omna/omna-push-app-id.aspx
this.OMNA_PUSH_APPLICATION_IDS = (function () {
this.OMNA_PUSH_APPLICATION_IDS = (function() {
let ids = {};
function add(urn, number) {
@ -2824,11 +2824,11 @@ this.OMNA_PUSH_APPLICATION_IDS = (function () {
let debug;
if (DEBUG) {
debug = function (s) {
debug = function(s) {
dump("-@- WspPduHelper: " + s + "\n");
};
} else {
debug = function (s) {};
debug = function(s) {};
}
this.EXPORTED_SYMBOLS = ALL_CONST_SYMBOLS.concat([

View File

@ -24,7 +24,7 @@ function sendSmsToEmulator(from, text) {
++pendingEmulatorCmdCount;
let cmd = "sms send " + from + " " + text;
runEmulatorCmd(cmd, function (result) {
runEmulatorCmd(cmd, function(result) {
--pendingEmulatorCmdCount;
is(result[0], "OK", "Emulator response");

View File

@ -19,7 +19,7 @@ function setPrefAndVerify(prefKey, setVal, service, attrName, expectedVal, defer
let prefVal = Services.prefs.getIntPref(prefKey);
is(prefVal, setVal, "'" + prefKey + "' set to " + setVal);
window.setTimeout(function () {
window.setTimeout(function() {
let defaultVal = service[attrName];
is(defaultVal, expectedVal, attrName);
@ -30,7 +30,7 @@ function setPrefAndVerify(prefKey, setVal, service, attrName, expectedVal, defer
function getNumRadioInterfaces() {
let deferred = Promise.defer();
window.setTimeout(function () {
window.setTimeout(function() {
let numRil = Services.prefs.getIntPref(PREF_RIL_NUM_RADIO_INTERFACES);
log("numRil = " + numRil);
@ -43,7 +43,7 @@ function getNumRadioInterfaces() {
function getService(contractId, ifaceName) {
let deferred = Promise.defer();
window.setTimeout(function () {
window.setTimeout(function() {
log("Getting service for " + ifaceName);
let service = Cc[contractId].getService(Ci[ifaceName]);
ok(service, "service.constructor is " + service.constructor);
@ -61,7 +61,7 @@ function checkInitialEquality(attrName, prefKey, service) {
let origPrefVal = Services.prefs.getIntPref(prefKey);
ok(isFinite(origPrefVal), "default '" + prefKey + "' value");
window.setTimeout(function () {
window.setTimeout(function() {
let defaultVal = service[attrName];
is(defaultVal, origPrefVal, attrName);
@ -96,7 +96,7 @@ function checkValueChange(attrName, prefKey, numRil, service) {
// Set to (numRil - 1) and verify defaultVal equals.
setPrefAndVerify(prefKey, numRil - 1, service, attrName, numRil - 1, deferred);
} else {
window.setTimeout(function () {
window.setTimeout(function() {
deferred.resolve(service);
}, 0);
}
@ -112,7 +112,7 @@ function verify(contractId, ifaceName, attrName, prefKey, numRil) {
.then(checkSetToNegtiveValue.bind(null, attrName, prefKey))
.then(checkSetToOverflowedValue.bind(null, attrName, prefKey, numRil))
.then(checkValueChange.bind(null, attrName, prefKey, numRil))
.then(function () {
.then(function() {
// Reset.
Services.prefs.clearUserPref(prefKey);

View File

@ -18,7 +18,7 @@ function sendSmsToEmulator(from, text) {
++pendingEmulatorCmdCount;
let cmd = "sms send " + from + " " + text;
runEmulatorCmd(cmd, function (result) {
runEmulatorCmd(cmd, function(result) {
--pendingEmulatorCmdCount;
is(result[0], "OK", "Emulator response");
@ -31,11 +31,11 @@ let tasks = {
_tasks: [],
_nextTaskIndex: 0,
push: function push(func) {
push: function(func) {
this._tasks.push(func);
},
next: function next() {
next: function() {
let index = this._nextTaskIndex++;
let task = this._tasks[index];
try {
@ -49,11 +49,11 @@ let tasks = {
}
},
finish: function finish() {
finish: function() {
this._tasks[this._tasks.length - 1]();
},
run: function run() {
run: function() {
this.next();
}
};
@ -86,7 +86,7 @@ function deleteAllMessages(next) {
let request = manager.delete(message.id);
request.onsuccess = deleteAll.bind(null, messages);
request.onerror = function (event) {
request.onerror = function(event) {
ok(false, "failed to delete all messages");
tasks.finish();
}
@ -185,7 +185,7 @@ tasks.push(function testDeliveryAndNumber() {
let filter = new MozSmsFilter();
filter.delivery = "sent";
filter.numbers = ["5555315550"];
getAllMessages(function (messages) {
getAllMessages(function(messages) {
// Only { delivery: "sent", receiver: "+15555315550", read: true }
is(messages.length, 1, "message count");
for (let i = 0; i < messages.length; i++) {
@ -196,7 +196,7 @@ tasks.push(function testDeliveryAndNumber() {
}
}
getAllMessages(function (messages_r) {
getAllMessages(function(messages_r) {
is(messages.length, messages_r.length, "message count");
for (let i = 0; i < messages_r.length; i++) {
is(messages_r[i].id, messages[messages.length - 1 - i].id, "message id");
@ -212,7 +212,7 @@ tasks.push(function testDeliveryAndNumberNotFound() {
let filter = new MozSmsFilter();
filter.delivery = "sent";
filter.numbers = [INVALID_NUMBER];
getAllMessages(function (messages) {
getAllMessages(function(messages) {
is(messages.length, 0, "message count");
tasks.next();
@ -224,7 +224,7 @@ tasks.push(function testDeliveryAndRead() {
let filter = new MozSmsFilter();
filter.delivery = "received";
filter.read = true;
getAllMessages(function (messages) {
getAllMessages(function(messages) {
// { delivery: "received", sender: "5555315550", read: true },
// { delivery: "received", sender: "5555315552", read: true },
// { delivery: "received", sender: "5555315554", read: true },
@ -237,7 +237,7 @@ tasks.push(function testDeliveryAndRead() {
is(message.read, filter.read, "message read");
}
getAllMessages(function (messages_r) {
getAllMessages(function(messages_r) {
is(messages.length, messages_r.length, "message count");
for (let i = 0; i < messages_r.length; i++) {
is(messages_r[i].id, messages[messages.length - 1 - i].id, "message id");
@ -253,7 +253,7 @@ tasks.push(function testDeliveryAndReadNotFound() {
let filter = new MozSmsFilter();
filter.delivery = "sent";
filter.read = false;
getAllMessages(function (messages) {
getAllMessages(function(messages) {
is(messages.length, 0, "message count");
tasks.next();
@ -265,7 +265,7 @@ tasks.push(function testDeliveryAndThreadId() {
let filter = new MozSmsFilter();
filter.delivery = "sent";
filter.threadId = threadIds[0];
getAllMessages(function (messages) {
getAllMessages(function(messages) {
// { delivery: "sent", receiver: "+15555315550", threadId: threadIds[0]}
is(messages.length, 1, "message count");
for (let i = 0; i < messages.length; i++) {
@ -274,7 +274,7 @@ tasks.push(function testDeliveryAndThreadId() {
is(message.threadId, filter.threadId, "message threadId");
}
getAllMessages(function (messages_r) {
getAllMessages(function(messages_r) {
is(messages.length, messages_r.length, "message count");
for (let i = 0; i < messages_r.length; i++) {
is(messages_r[i].id, messages[messages.length - 1 - i].id, "message id");
@ -290,7 +290,7 @@ tasks.push(function testDeliveryAndThreadIdNotFound() {
let filter = new MozSmsFilter();
filter.delivery = "sent";
filter.threadId = INVALID_THREAD_ID;
getAllMessages(function (messages) {
getAllMessages(function(messages) {
is(messages.length, 0, "message count");
tasks.next();
@ -302,7 +302,7 @@ tasks.push(function testNumberAndRead() {
let filter = new MozSmsFilter();
filter.numbers = ["5555315550"];
filter.read = true;
getAllMessages(function (messages) {
getAllMessages(function(messages) {
// { delivery: "sent", receiver: "+15555315550", read: true }
// { delivery: "received", sender: "5555315550", read: true }
is(messages.length, 2, "message count");
@ -314,7 +314,7 @@ tasks.push(function testNumberAndRead() {
is(message.read, filter.read, "message read");
}
getAllMessages(function (messages_r) {
getAllMessages(function(messages_r) {
is(messages.length, messages_r.length, "message count");
for (let i = 0; i < messages_r.length; i++) {
is(messages_r[i].id, messages[messages.length - 1 - i].id, "message id");
@ -330,7 +330,7 @@ tasks.push(function testNumberAndReadNotFound() {
let filter = new MozSmsFilter();
filter.numbers = [INVALID_NUMBER];
filter.read = true;
getAllMessages(function (messages) {
getAllMessages(function(messages) {
is(messages.length, 0, "message count");
tasks.next();
@ -342,7 +342,7 @@ tasks.push(function testNumberAndThreadId() {
let filter = new MozSmsFilter();
filter.numbers = ["5555315550"];
filter.threadId = threadIds[0];
getAllMessages(function (messages) {
getAllMessages(function(messages) {
// { delivery: "sent", receiver: "+15555315550", read: true }
// { delivery: "received", sender: "5555315550", read: true }
is(messages.length, 2, "message count");
@ -354,7 +354,7 @@ tasks.push(function testNumberAndThreadId() {
is(message.threadId, filter.threadId, "message threadId");
}
getAllMessages(function (messages_r) {
getAllMessages(function(messages_r) {
is(messages.length, messages_r.length, "message count");
for (let i = 0; i < messages_r.length; i++) {
is(messages_r[i].id, messages[messages.length - 1 - i].id, "message id");
@ -370,7 +370,7 @@ tasks.push(function testNumberAndThreadIdNotFound() {
let filter = new MozSmsFilter();
filter.numbers = [INVALID_NUMBER];
filter.threadId = INVALID_THREAD_ID;
getAllMessages(function (messages) {
getAllMessages(function(messages) {
is(messages.length, 0, "message count");
tasks.next();
@ -381,7 +381,7 @@ tasks.push(function testMultipleNumbers() {
log("Checking number == 5555315550 || number == 5555315551");
let filter = new MozSmsFilter();
filter.numbers = ["5555315550", "5555315551"];
getAllMessages(function (messages) {
getAllMessages(function(messages) {
// { delivery: "sent", receiver: "+15555315550", read: true }
// { delivery: "received", sender: "5555315550", read: true }
// { delivery: "sent", receiver: "+15555315551", read: true }
@ -403,7 +403,7 @@ tasks.push(function testMultipleNumbersNotFound() {
log("Checking number == INVALID_NUMBER || number == INVALID_NUMBER2");
let filter = new MozSmsFilter();
filter.numbers = [INVALID_NUMBER, INVALID_NUMBER2];
getAllMessages(function (messages) {
getAllMessages(function(messages) {
is(messages.length, 0, "message count");
tasks.next();
@ -415,7 +415,7 @@ tasks.push(function testDeliveryAndMultipleNumbers() {
let filter = new MozSmsFilter();
filter.delivery = "sent";
filter.numbers = ["5555315550", "5555315551"];
getAllMessages(function (messages) {
getAllMessages(function(messages) {
// { delivery: "sent", receiver: "+15555315550", read: true }
// { delivery: "sent", receiver: "+15555315551", read: true }
is(messages.length, 2, "message count");
@ -437,7 +437,7 @@ tasks.push(function testMultipleNumbersAndRead() {
let filter = new MozSmsFilter();
filter.numbers = ["5555315550", "5555315551"];
filter.read = true;
getAllMessages(function (messages) {
getAllMessages(function(messages) {
// { delivery: "sent", receiver: "+15555315550", read: true }
// { delivery: "received", sender: "5555315550", read: true }
// { delivery: "sent", receiver: "+15555315551", read: true }
@ -460,7 +460,7 @@ tasks.push(function testMultipleNumbersAndThreadId() {
let filter = new MozSmsFilter();
filter.numbers = ["5555315550", "5555315551"];
filter.threadId = threadIds[0];
getAllMessages(function (messages) {
getAllMessages(function(messages) {
// { delivery: "sent", receiver: "+15555315550", read: true }
// { delivery: "received", sender: "5555315550", read: true }
is(messages.length, 2, "message count");
@ -481,7 +481,7 @@ tasks.push(function testNationalNumber() {
log("Checking number = 5555315550");
let filter = new MozSmsFilter();
filter.numbers = ["5555315550"];
getAllMessages(function (messages) {
getAllMessages(function(messages) {
// { delivery: "sent", receiver: "+15555315550", read: true }
// { delivery: "received", sender: "5555315550", read: true }
is(messages.length, 2, "message count");
@ -500,7 +500,7 @@ tasks.push(function testInternationalNumber() {
log("Checking number = +15555315550");
let filter = new MozSmsFilter();
filter.numbers = ["+15555315550"];
getAllMessages(function (messages) {
getAllMessages(function(messages) {
// { delivery: "sent", receiver: "+15555315550", read: true }
// { delivery: "received", sender: "5555315550", read: true }
is(messages.length, 2, "message count");
@ -520,7 +520,7 @@ tasks.push(function testReadAndThreadId() {
let filter = new MozSmsFilter();
filter.read = true;
filter.threadId = threadIds[0];
getAllMessages(function (messages) {
getAllMessages(function(messages) {
// { delivery: "sent", receiver: "+15555315550", read: true }
// { delivery: "received", sender: "5555315550", read: true }
is(messages.length, 2, "message count");
@ -530,7 +530,7 @@ tasks.push(function testReadAndThreadId() {
is(message.threadId, filter.threadId, "message threadId");
}
getAllMessages(function (messages_r) {
getAllMessages(function(messages_r) {
is(messages.length, messages_r.length, "message count");
for (let i = 0; i < messages_r.length; i++) {
is(messages_r[i].id, messages[messages.length - 1 - i].id, "message id");
@ -546,7 +546,7 @@ tasks.push(function testReadAndThreadIdNotFound() {
let filter = new MozSmsFilter();
filter.read = true;
filter.threadId = INVALID_THREAD_ID;
getAllMessages(function (messages) {
getAllMessages(function(messages) {
is(messages.length, 0, "message count");
tasks.next();

View File

@ -15,7 +15,7 @@ function sendSmsToEmulator(from, text) {
++pendingEmulatorCmdCount;
let cmd = "sms send " + from + " " + text;
runEmulatorCmd(cmd, function (result) {
runEmulatorCmd(cmd, function(result) {
--pendingEmulatorCmdCount;
is(result[0], "OK", "Emulator response");
@ -28,11 +28,11 @@ let tasks = {
_tasks: [],
_nextTaskIndex: 0,
push: function push(func) {
push: function(func) {
this._tasks.push(func);
},
next: function next() {
next: function() {
let index = this._nextTaskIndex++;
let task = this._tasks[index];
try {
@ -46,11 +46,11 @@ let tasks = {
}
},
finish: function finish() {
finish: function() {
this._tasks[this._tasks.length - 1]();
},
run: function run() {
run: function() {
this.next();
}
};
@ -85,7 +85,7 @@ function deleteAllMessages() {
let request = manager.delete(message.id);
request.onsuccess = deleteAll.bind(null, messages);
request.onerror = function (event) {
request.onerror = function(event) {
ok(false, "failed to delete all messages");
tasks.finish();
}
@ -97,7 +97,7 @@ function checkMessage(needle, secondary) {
let filter = new MozSmsFilter();
filter.numbers = [needle];
getAllMessages(function (messages) {
getAllMessages(function(messages) {
is(messages.length, 2, "should have exactly 2 messages");
// Check the messages are sent to/received from either 'needle' or
@ -167,9 +167,9 @@ tasks.push(function populateMessages() {
sendMessage(count);
});
tasks.push(function () {
tasks.push(function() {
log("Verifying number of messages in database");
getAllMessages(function (messages) {
getAllMessages(function(messages) {
is(messages.length, NUM_THREADS * 2,
"should have exactly " + (NUM_THREADS * 2) + " messages");

View File

@ -19,11 +19,11 @@ let tasks = {
_tasks: [],
_nextTaskIndex: 0,
push: function push(func) {
push: function(func) {
this._tasks.push(func);
},
next: function next() {
next: function() {
let index = this._nextTaskIndex++;
let task = this._tasks[index];
try {
@ -37,17 +37,17 @@ let tasks = {
}
},
finish: function finish() {
finish: function() {
this._tasks[this._tasks.length - 1]();
},
run: function run() {
run: function() {
this.next();
}
};
function addTest(text, segments, charsPerSegment, charsAvailableInLastSegment) {
tasks.push(function () {
tasks.push(function() {
log("Testing '" + text + "' ...");
let domRequest = manager.getSegmentInfoForText(text);
ok(domRequest, "DOMRequest object returned.");
@ -78,7 +78,7 @@ function addTest(text, segments, charsPerSegment, charsAvailableInLastSegment) {
}
function addTestThrows(text) {
tasks.push(function () {
tasks.push(function() {
log("Testing '" + text + "' ...");
try {
let domRequest = manager.getSegmentInfoForText(text);

View File

@ -15,7 +15,7 @@ function sendSmsToEmulator(from, text, callback) {
++pendingEmulatorCmdCount;
let cmd = "sms send " + from + " " + text;
runEmulatorCmd(cmd, function (result) {
runEmulatorCmd(cmd, function(result) {
--pendingEmulatorCmdCount;
callback(result[0] == "OK");
@ -28,11 +28,11 @@ let tasks = {
_tasks: [],
_nextTaskIndex: 0,
push: function push(func) {
push: function(func) {
this._tasks.push(func);
},
next: function next() {
next: function() {
let index = this._nextTaskIndex++;
let task = this._tasks[index];
try {
@ -46,11 +46,11 @@ let tasks = {
}
},
finish: function finish() {
finish: function() {
this._tasks[this._tasks.length - 1]();
},
run: function run() {
run: function() {
this.next();
}
};
@ -83,7 +83,7 @@ function deleteAllMessages() {
let request = manager.delete(message.id);
request.onsuccess = deleteAll.bind(null, messages);
request.onerror = function (event) {
request.onerror = function(event) {
ok(false, "failed to delete all messages");
tasks.finish();
}
@ -91,7 +91,7 @@ function deleteAllMessages() {
}
function sendMessage(to, body) {
manager.onsent = function () {
manager.onsent = function() {
manager.onsent = null;
tasks.next();
};
@ -100,11 +100,11 @@ function sendMessage(to, body) {
}
function receiveMessage(from, body) {
manager.onreceived = function () {
manager.onreceived = function() {
manager.onreceived = null;
tasks.next();
};
sendSmsToEmulator(from, body, function (success) {
sendSmsToEmulator(from, body, function(success) {
if (!success) {
tasks.finish();
}
@ -118,7 +118,7 @@ function getAllThreads(callback) {
ok(cursor instanceof DOMCursor,
"cursor is instanceof " + cursor.constructor);
cursor.onsuccess = function (event) {
cursor.onsuccess = function(event) {
if (!cursor.done) {
threads.push(cursor.result);
cursor.continue();
@ -156,7 +156,7 @@ function checkThread(bodies, lastBody, unreadCount, participants,
// Check whether the thread does contain all the messages it supposed to have.
let filter = new MozSmsFilter;
filter.threadId = thread.id;
getAllMessages(function (messages) {
getAllMessages(function(messages) {
is(messages.length, bodies.length, "messages.length and bodies.length");
for (let message of messages) {
@ -174,7 +174,7 @@ function checkThread(bodies, lastBody, unreadCount, participants,
tasks.push(deleteAllMessages);
tasks.push(getAllThreads.bind(null, function (threads) {
tasks.push(getAllThreads.bind(null, function(threads) {
is(threads.length, 0, "Empty thread list at beginning.");
tasks.next();
}));
@ -373,7 +373,7 @@ checkFuncs.push(checkThread.bind(null, ["thread 18-1", "thread 18-2"],
"thread 18-2", 0, ["555211018"]));
// Check threads.
tasks.push(getAllThreads.bind(null, function (threads) {
tasks.push(getAllThreads.bind(null, function(threads) {
is(threads.length, checkFuncs.length, "number of threads got");
(function callback() {
@ -388,7 +388,7 @@ tasks.push(getAllThreads.bind(null, function (threads) {
tasks.push(deleteAllMessages);
tasks.push(getAllThreads.bind(null, function (threads) {
tasks.push(getAllThreads.bind(null, function(threads) {
is(threads.length, 0, "Empty thread list at the end.");
tasks.next();
}));

View File

@ -14,11 +14,11 @@ let tasks = {
_tasks: [],
_nextTaskIndex: 0,
push: function push(func) {
push: function(func) {
this._tasks.push(func);
},
next: function next() {
next: function() {
let index = this._nextTaskIndex++;
let task = this._tasks[index];
try {
@ -32,11 +32,11 @@ let tasks = {
}
},
finish: function finish() {
finish: function() {
this._tasks[this._tasks.length - 1]();
},
run: function run() {
run: function() {
this.next();
}
};
@ -71,7 +71,7 @@ function deleteAllMessages() {
let request = manager.delete(message.id);
request.onsuccess = deleteAll.bind(null, messages);
request.onerror = function (event) {
request.onerror = function(event) {
ok(false, "failed to delete all messages");
tasks.finish();
}
@ -112,7 +112,7 @@ function testInvalidAddressForMMS(aInvalidAddrs) {
};
}
tasks.push(function () {
tasks.push(function() {
log("Verifying initial state.");
manager = window.navigator.mozMobileMessage;

View File

@ -22,7 +22,7 @@ function sendSmsToEmulator(from, text) {
++pendingEmulatorCmdCount;
let cmd = "sms send " + from + " " + text;
runEmulatorCmd(cmd, function (result) {
runEmulatorCmd(cmd, function(result) {
--pendingEmulatorCmdCount;
is(result[0], "OK", "Emulator response");
@ -35,11 +35,11 @@ let tasks = {
_tasks: [],
_nextTaskIndex: 0,
push: function push(func) {
push: function(func) {
this._tasks.push(func);
},
next: function next() {
next: function() {
let index = this._nextTaskIndex++;
let task = this._tasks[index];
try {
@ -53,11 +53,11 @@ let tasks = {
}
},
finish: function finish() {
finish: function() {
this._tasks[this._tasks.length - 1]();
},
run: function run() {
run: function() {
this.next();
}
};

View File

@ -26,7 +26,7 @@ function sendSmsPduToEmulator(pdu) {
++pendingEmulatorCmdCount;
let cmd = "sms pdu " + pdu;
runEmulatorCmd(cmd, function (result) {
runEmulatorCmd(cmd, function(result) {
--pendingEmulatorCmdCount;
is(result[0], "OK", "Emulator response");

View File

@ -14,11 +14,11 @@ let tasks = {
_tasks: [],
_nextTaskIndex: 0,
push: function push(func) {
push: function(func) {
this._tasks.push(func);
},
next: function next() {
next: function() {
let index = this._nextTaskIndex++;
let task = this._tasks[index];
try {
@ -32,11 +32,11 @@ let tasks = {
}
},
finish: function finish() {
finish: function() {
this._tasks[this._tasks.length - 1]();
},
run: function run() {
run: function() {
this.next();
}
};
@ -71,14 +71,14 @@ function deleteAllMessages() {
let request = manager.delete(message.id);
request.onsuccess = deleteAll.bind(null, messages);
request.onerror = function (event) {
request.onerror = function(event) {
ok(false, "failed to delete all messages");
tasks.finish();
}
});
}
tasks.push(function () {
tasks.push(function() {
log("Verifying initial state.");
manager = window.navigator.mozMobileMessage;
@ -88,10 +88,10 @@ tasks.push(function () {
tasks.next();
});
tasks.push(function () {
tasks.push(function() {
log("MmsMessage.attachments should be an empty array.");
manager.onfailed = function (event) {
manager.onfailed = function(event) {
manager.onfailed = null;
let message = event.message;

View File

@ -11,7 +11,7 @@ function sendSmsToEmulator(from, text) {
++pendingEmulatorCmdCount;
let cmd = "sms send " + from + " " + text;
runEmulatorCmd(cmd, function (result) {
runEmulatorCmd(cmd, function(result) {
--pendingEmulatorCmdCount;
is(result[0], "OK", "Emulator response");
@ -24,11 +24,11 @@ let tasks = {
_tasks: [],
_nextTaskIndex: 0,
push: function push(func) {
push: function(func) {
this._tasks.push(func);
},
next: function next() {
next: function() {
let index = this._nextTaskIndex++;
let task = this._tasks[index];
try {
@ -42,11 +42,11 @@ let tasks = {
}
},
finish: function finish() {
finish: function() {
this._tasks[this._tasks.length - 1]();
},
run: function run() {
run: function() {
this.next();
}
};
@ -79,7 +79,7 @@ function deleteAllMessages() {
let request = manager.delete(message.id);
request.onsuccess = deleteAll.bind(null, messages);
request.onerror = function (event) {
request.onerror = function(event) {
ok(false, "failed to delete all messages");
tasks.finish();
}
@ -109,7 +109,7 @@ function validate(number, normalizedNumber) {
}
let manager = window.navigator.mozMobileMessage;
tasks.push(function () {
tasks.push(function() {
log("Verifying initial state.");
ok(manager instanceof MozMobileMessageManager,
"manager is instance of " + manager.constructor);

View File

@ -30,11 +30,11 @@ let tasks = {
_tasks: [],
_nextTaskIndex: 0,
push: function push(func) {
push: function(func) {
this._tasks.push(func);
},
next: function next() {
next: function() {
let index = this._nextTaskIndex++;
let task = this._tasks[index];
try {
@ -48,17 +48,17 @@ let tasks = {
}
},
finish: function finish() {
finish: function() {
this._tasks[this._tasks.length - 1]();
},
run: function run() {
run: function() {
this.next();
}
};
function addTest(text, strict7BitEncoding, expected) {
tasks.push(function () {
tasks.push(function() {
if (strict7BitEncoding != currentStrict7BitEncoding) {
currentStrict7BitEncoding = strict7BitEncoding;
SpecialPowers.setBoolPref("dom.sms.strict7BitEncoding",

View File

@ -16,11 +16,11 @@ let tasks = {
_tasks: [],
_nextTaskIndex: 0,
push: function push(func) {
push: function(func) {
this._tasks.push(func);
},
next: function next() {
next: function() {
let index = this._nextTaskIndex++;
let task = this._tasks[index];
try {
@ -34,11 +34,11 @@ let tasks = {
}
},
finish: function finish() {
finish: function() {
this._tasks[this._tasks.length - 1]();
},
run: function run() {
run: function() {
this.next();
}
};

View File

@ -137,11 +137,11 @@ let tasks = {
_tasks: [],
_nextTaskIndex: 0,
push: function push(func) {
push: function(func) {
this._tasks.push(func);
},
next: function next() {
next: function() {
let index = this._nextTaskIndex++;
let task = this._tasks[index];
try {
@ -155,11 +155,11 @@ let tasks = {
}
},
finish: function finish() {
finish: function() {
this._tasks[this._tasks.length - 1]();
},
run: function run() {
run: function() {
this.next();
}
};
@ -213,7 +213,7 @@ function testBug877141() {
testStrict7BitEncodingHelper(sent, sent);
}
tasks.push(function () {
tasks.push(function() {
log("Testing with dom.sms.strict7BitEncoding enabled");
SpecialPowers.setBoolPref("dom.sms.strict7BitEncoding", true);
tasks.next();
@ -221,7 +221,7 @@ tasks.push(function () {
// Test for combined string.
tasks.push(function () {
tasks.push(function() {
let sent = "", received = "";
for (let c in GSM_SMS_STRICT_7BIT_CHARMAP) {
sent += c;
@ -232,7 +232,7 @@ tasks.push(function () {
// When strict7BitEncoding is enabled, we should replace characters that
// can't be encoded with GSM 7-Bit alphabets with '*'.
tasks.push(function () {
tasks.push(function() {
// "Happy New Year" in Chinese.
let sent = "\u65b0\u5e74\u5feb\u6a02", received = "****";
testStrict7BitEncodingHelper(sent, received);
@ -240,14 +240,14 @@ tasks.push(function () {
tasks.push(testBug877141);
tasks.push(function () {
tasks.push(function() {
log("Testing with dom.sms.strict7BitEncoding disabled");
SpecialPowers.setBoolPref("dom.sms.strict7BitEncoding", false);
tasks.next();
});
// Test for combined string.
tasks.push(function () {
tasks.push(function() {
let sent = "";
for (let c in GSM_SMS_STRICT_7BIT_CHARMAP) {
sent += c;
@ -255,7 +255,7 @@ tasks.push(function () {
testStrict7BitEncodingHelper(sent, sent);
});
tasks.push(function () {
tasks.push(function() {
// "Happy New Year" in Chinese.
let sent = "\u65b0\u5e74\u5feb\u6a02";
testStrict7BitEncodingHelper(sent, sent);

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