mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-13 05:15:45 +00:00
Merge mozilla-central into services-central
This commit is contained in:
commit
33bad983f5
@ -12,28 +12,6 @@
|
||||
#include "nsString.h"
|
||||
|
||||
extern "C" {
|
||||
|
||||
static gboolean
|
||||
setRunAttributesCB(AtkEditableText *aText, AtkAttributeSet *aAttribSet,
|
||||
gint aStartOffset, gint aEndOffset)
|
||||
{
|
||||
AccessibleWrap* accWrap = GetAccessibleWrap(ATK_OBJECT(aText));
|
||||
if (!accWrap)
|
||||
return FALSE;
|
||||
|
||||
nsCOMPtr<nsIAccessibleEditableText> accText;
|
||||
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleEditableText),
|
||||
getter_AddRefs(accText));
|
||||
NS_ENSURE_TRUE(accText, FALSE);
|
||||
|
||||
nsCOMPtr<nsISupports> attrSet;
|
||||
/* how to insert attributes into nsISupports ??? */
|
||||
|
||||
nsresult rv = accText->SetAttributes(aStartOffset, aEndOffset,
|
||||
attrSet);
|
||||
return NS_FAILED(rv) ? FALSE : TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
setTextContentsCB(AtkEditableText *aText, const gchar *aString)
|
||||
{
|
||||
@ -41,16 +19,14 @@ setTextContentsCB(AtkEditableText *aText, const gchar *aString)
|
||||
if (!accWrap)
|
||||
return;
|
||||
|
||||
nsCOMPtr<nsIAccessibleEditableText> accText;
|
||||
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleEditableText),
|
||||
getter_AddRefs(accText));
|
||||
if (!accText)
|
||||
return;
|
||||
HyperTextAccessible* text = accWrap->AsHyperText();
|
||||
if (!text || !text->IsTextRole())
|
||||
return;
|
||||
|
||||
MAI_LOG_DEBUG(("EditableText: setTextContentsCB, aString=%s", aString));
|
||||
MAI_LOG_DEBUG(("EditableText: setTextContentsCB, aString=%s", aString));
|
||||
|
||||
NS_ConvertUTF8toUTF16 strContent(aString);
|
||||
accText->SetTextContents(strContent);
|
||||
NS_ConvertUTF8toUTF16 strContent(aString);
|
||||
text->SetTextContents(strContent);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -61,24 +37,15 @@ insertTextCB(AtkEditableText *aText,
|
||||
if (!accWrap)
|
||||
return;
|
||||
|
||||
nsCOMPtr<nsIAccessibleEditableText> accText;
|
||||
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleEditableText),
|
||||
getter_AddRefs(accText));
|
||||
if (!accText)
|
||||
return;
|
||||
HyperTextAccessible* text = accWrap->AsHyperText();
|
||||
if (!text || !text->IsTextRole())
|
||||
return;
|
||||
|
||||
NS_ConvertUTF8toUTF16 strContent(aString, aLength);
|
||||
NS_ConvertUTF8toUTF16 strContent(aString, aLength);
|
||||
text->InsertText(strContent, *aPosition);
|
||||
|
||||
// interface changed in nsIAccessibleEditableText.idl ???
|
||||
//
|
||||
// int32_t pos = *aPosition;
|
||||
// nsresult rv = accText->InsertText(strContent, aLength, &pos);
|
||||
// *aPosition = pos;
|
||||
|
||||
accText->InsertText(strContent, *aPosition);
|
||||
|
||||
MAI_LOG_DEBUG(("EditableText: insert aString=%s, aLength=%d, aPosition=%d",
|
||||
aString, aLength, *aPosition));
|
||||
MAI_LOG_DEBUG(("EditableText: insert aString=%s, aLength=%d, aPosition=%d",
|
||||
aString, aLength, *aPosition));
|
||||
}
|
||||
|
||||
static void
|
||||
@ -88,15 +55,13 @@ copyTextCB(AtkEditableText *aText, gint aStartPos, gint aEndPos)
|
||||
if (!accWrap)
|
||||
return;
|
||||
|
||||
nsCOMPtr<nsIAccessibleEditableText> accText;
|
||||
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleEditableText),
|
||||
getter_AddRefs(accText));
|
||||
if (!accText)
|
||||
return;
|
||||
HyperTextAccessible* text = accWrap->AsHyperText();
|
||||
if (!text || !text->IsTextRole())
|
||||
return;
|
||||
|
||||
MAI_LOG_DEBUG(("EditableText: copyTextCB, aStartPos=%d, aEndPos=%d",
|
||||
aStartPos, aEndPos));
|
||||
accText->CopyText(aStartPos, aEndPos);
|
||||
MAI_LOG_DEBUG(("EditableText: copyTextCB, aStartPos=%d, aEndPos=%d",
|
||||
aStartPos, aEndPos));
|
||||
text->CopyText(aStartPos, aEndPos);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -106,14 +71,13 @@ cutTextCB(AtkEditableText *aText, gint aStartPos, gint aEndPos)
|
||||
if (!accWrap)
|
||||
return;
|
||||
|
||||
nsCOMPtr<nsIAccessibleEditableText> accText;
|
||||
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleEditableText),
|
||||
getter_AddRefs(accText));
|
||||
if (!accText)
|
||||
return;
|
||||
MAI_LOG_DEBUG(("EditableText: cutTextCB, aStartPos=%d, aEndPos=%d",
|
||||
aStartPos, aEndPos));
|
||||
accText->CutText(aStartPos, aEndPos);
|
||||
HyperTextAccessible* text = accWrap->AsHyperText();
|
||||
if (!text || !text->IsTextRole())
|
||||
return;
|
||||
|
||||
MAI_LOG_DEBUG(("EditableText: cutTextCB, aStartPos=%d, aEndPos=%d",
|
||||
aStartPos, aEndPos));
|
||||
text->CutText(aStartPos, aEndPos);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -123,15 +87,13 @@ deleteTextCB(AtkEditableText *aText, gint aStartPos, gint aEndPos)
|
||||
if (!accWrap)
|
||||
return;
|
||||
|
||||
nsCOMPtr<nsIAccessibleEditableText> accText;
|
||||
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleEditableText),
|
||||
getter_AddRefs(accText));
|
||||
if (!accText)
|
||||
return;
|
||||
HyperTextAccessible* text = accWrap->AsHyperText();
|
||||
if (!text || !text->IsTextRole())
|
||||
return;
|
||||
|
||||
MAI_LOG_DEBUG(("EditableText: deleteTextCB, aStartPos=%d, aEndPos=%d",
|
||||
aStartPos, aEndPos));
|
||||
accText->DeleteText(aStartPos, aEndPos);
|
||||
MAI_LOG_DEBUG(("EditableText: deleteTextCB, aStartPos=%d, aEndPos=%d",
|
||||
aStartPos, aEndPos));
|
||||
text->DeleteText(aStartPos, aEndPos);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -141,14 +103,12 @@ pasteTextCB(AtkEditableText *aText, gint aPosition)
|
||||
if (!accWrap)
|
||||
return;
|
||||
|
||||
nsCOMPtr<nsIAccessibleEditableText> accText;
|
||||
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleEditableText),
|
||||
getter_AddRefs(accText));
|
||||
if (!accText)
|
||||
return;
|
||||
HyperTextAccessible* text = accWrap->AsHyperText();
|
||||
if (!text || !text->IsTextRole())
|
||||
return;
|
||||
|
||||
MAI_LOG_DEBUG(("EditableText: pasteTextCB, aPosition=%d", aPosition));
|
||||
accText->PasteText(aPosition);
|
||||
MAI_LOG_DEBUG(("EditableText: pasteTextCB, aPosition=%d", aPosition));
|
||||
text->PasteText(aPosition);
|
||||
}
|
||||
}
|
||||
|
||||
@ -159,7 +119,6 @@ editableTextInterfaceInitCB(AtkEditableTextIface* aIface)
|
||||
if (NS_UNLIKELY(!aIface))
|
||||
return;
|
||||
|
||||
aIface->set_run_attributes = setRunAttributesCB;
|
||||
aIface->set_text_contents = setTextContentsCB;
|
||||
aIface->insert_text = insertTextCB;
|
||||
aIface->copy_text = copyTextCB;
|
||||
|
@ -34,13 +34,12 @@ getTextCB(AtkText *aText, gint aStartOffset, gint aEndOffset)
|
||||
if (!accWrap)
|
||||
return nullptr;
|
||||
|
||||
nsCOMPtr<nsIAccessibleText> accText;
|
||||
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleText),
|
||||
getter_AddRefs(accText));
|
||||
NS_ENSURE_TRUE(accText, nullptr);
|
||||
HyperTextAccessible* text = accWrap->AsHyperText();
|
||||
if (!text || !text->IsTextRole())
|
||||
return nullptr;
|
||||
|
||||
nsAutoString autoStr;
|
||||
nsresult rv = accText->GetText(aStartOffset, aEndOffset, autoStr);
|
||||
nsresult rv = text->GetText(aStartOffset, aEndOffset, autoStr);
|
||||
NS_ENSURE_SUCCESS(rv, nullptr);
|
||||
|
||||
ConvertTexttoAsterisks(accWrap, autoStr);
|
||||
@ -59,20 +58,20 @@ getTextAfterOffsetCB(AtkText *aText, gint aOffset,
|
||||
if (!accWrap)
|
||||
return nullptr;
|
||||
|
||||
nsCOMPtr<nsIAccessibleText> accText;
|
||||
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleText),
|
||||
getter_AddRefs(accText));
|
||||
NS_ENSURE_TRUE(accText, nullptr);
|
||||
HyperTextAccessible* text = accWrap->AsHyperText();
|
||||
if (!text || !text->IsTextRole())
|
||||
return nullptr;
|
||||
|
||||
nsAutoString autoStr;
|
||||
int32_t startOffset = 0, endOffset = 0;
|
||||
nsresult rv =
|
||||
accText->GetTextAfterOffset(aOffset, aBoundaryType,
|
||||
&startOffset, &endOffset, autoStr);
|
||||
*aStartOffset = startOffset;
|
||||
*aEndOffset = endOffset;
|
||||
nsAutoString autoStr;
|
||||
int32_t startOffset = 0, endOffset = 0;
|
||||
nsresult rv =
|
||||
text->GetTextAfterOffset(aOffset, aBoundaryType,
|
||||
&startOffset, &endOffset, autoStr);
|
||||
|
||||
NS_ENSURE_SUCCESS(rv, nullptr);
|
||||
*aStartOffset = startOffset;
|
||||
*aEndOffset = endOffset;
|
||||
|
||||
NS_ENSURE_SUCCESS(rv, nullptr);
|
||||
|
||||
ConvertTexttoAsterisks(accWrap, autoStr);
|
||||
NS_ConvertUTF16toUTF8 cautoStr(autoStr);
|
||||
@ -88,16 +87,15 @@ getTextAtOffsetCB(AtkText *aText, gint aOffset,
|
||||
if (!accWrap)
|
||||
return nullptr;
|
||||
|
||||
nsCOMPtr<nsIAccessibleText> accText;
|
||||
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleText),
|
||||
getter_AddRefs(accText));
|
||||
NS_ENSURE_TRUE(accText, nullptr);
|
||||
HyperTextAccessible* text = accWrap->AsHyperText();
|
||||
if (!text || !text->IsTextRole())
|
||||
return nullptr;
|
||||
|
||||
nsAutoString autoStr;
|
||||
int32_t startOffset = 0, endOffset = 0;
|
||||
nsresult rv =
|
||||
accText->GetTextAtOffset(aOffset, aBoundaryType,
|
||||
&startOffset, &endOffset, autoStr);
|
||||
text->GetTextAtOffset(aOffset, aBoundaryType,
|
||||
&startOffset, &endOffset, autoStr);
|
||||
*aStartOffset = startOffset;
|
||||
*aEndOffset = endOffset;
|
||||
|
||||
@ -115,15 +113,14 @@ getCharacterAtOffsetCB(AtkText* aText, gint aOffset)
|
||||
if (!accWrap)
|
||||
return 0;
|
||||
|
||||
nsCOMPtr<nsIAccessibleText> accText;
|
||||
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleText),
|
||||
getter_AddRefs(accText));
|
||||
NS_ENSURE_TRUE(accText, 0);
|
||||
HyperTextAccessible* text = accWrap->AsHyperText();
|
||||
if (!text || !text->IsTextRole())
|
||||
return 0;
|
||||
|
||||
// PRUnichar is unsigned short in Mozilla
|
||||
// gnuichar is guint32 in glib
|
||||
PRUnichar uniChar = 0;
|
||||
nsresult rv = accText->GetCharacterAtOffset(aOffset, &uniChar);
|
||||
nsresult rv = text->GetCharacterAtOffset(aOffset, &uniChar);
|
||||
if (NS_FAILED(rv))
|
||||
return 0;
|
||||
|
||||
@ -143,16 +140,15 @@ getTextBeforeOffsetCB(AtkText *aText, gint aOffset,
|
||||
if (!accWrap)
|
||||
return nullptr;
|
||||
|
||||
nsCOMPtr<nsIAccessibleText> accText;
|
||||
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleText),
|
||||
getter_AddRefs(accText));
|
||||
NS_ENSURE_TRUE(accText, nullptr);
|
||||
HyperTextAccessible* text = accWrap->AsHyperText();
|
||||
if (!text || !text->IsTextRole())
|
||||
return nullptr;
|
||||
|
||||
nsAutoString autoStr;
|
||||
int32_t startOffset = 0, endOffset = 0;
|
||||
nsresult rv =
|
||||
accText->GetTextBeforeOffset(aOffset, aBoundaryType,
|
||||
&startOffset, &endOffset, autoStr);
|
||||
text->GetTextBeforeOffset(aOffset, aBoundaryType,
|
||||
&startOffset, &endOffset, autoStr);
|
||||
*aStartOffset = startOffset;
|
||||
*aEndOffset = endOffset;
|
||||
|
||||
@ -170,13 +166,12 @@ getCaretOffsetCB(AtkText *aText)
|
||||
if (!accWrap)
|
||||
return 0;
|
||||
|
||||
nsCOMPtr<nsIAccessibleText> accText;
|
||||
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleText),
|
||||
getter_AddRefs(accText));
|
||||
NS_ENSURE_TRUE(accText, 0);
|
||||
HyperTextAccessible* text = accWrap->AsHyperText();
|
||||
if (!text || !text->IsTextRole())
|
||||
return 0;
|
||||
|
||||
int32_t offset;
|
||||
nsresult rv = accText->GetCaretOffset(&offset);
|
||||
nsresult rv = text->GetCaretOffset(&offset);
|
||||
return (NS_FAILED(rv)) ? 0 : static_cast<gint>(offset);
|
||||
}
|
||||
|
||||
@ -192,16 +187,15 @@ getRunAttributesCB(AtkText *aText, gint aOffset,
|
||||
if (!accWrap)
|
||||
return nullptr;
|
||||
|
||||
nsCOMPtr<nsIAccessibleText> accText;
|
||||
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleText),
|
||||
getter_AddRefs(accText));
|
||||
NS_ENSURE_TRUE(accText, nullptr);
|
||||
HyperTextAccessible* text = accWrap->AsHyperText();
|
||||
if (!text || !text->IsTextRole())
|
||||
return nullptr;
|
||||
|
||||
nsCOMPtr<nsIPersistentProperties> attributes;
|
||||
int32_t startOffset = 0, endOffset = 0;
|
||||
nsresult rv = accText->GetTextAttributes(false, aOffset,
|
||||
&startOffset, &endOffset,
|
||||
getter_AddRefs(attributes));
|
||||
nsresult rv = text->GetTextAttributes(false, aOffset,
|
||||
&startOffset, &endOffset,
|
||||
getter_AddRefs(attributes));
|
||||
NS_ENSURE_SUCCESS(rv, nullptr);
|
||||
|
||||
*aStartOffset = startOffset;
|
||||
@ -217,13 +211,12 @@ getDefaultAttributesCB(AtkText *aText)
|
||||
if (!accWrap)
|
||||
return nullptr;
|
||||
|
||||
nsCOMPtr<nsIAccessibleText> accText;
|
||||
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleText),
|
||||
getter_AddRefs(accText));
|
||||
NS_ENSURE_TRUE(accText, nullptr);
|
||||
HyperTextAccessible* text = accWrap->AsHyperText();
|
||||
if (!text || !text->IsTextRole())
|
||||
return nullptr;
|
||||
|
||||
nsCOMPtr<nsIPersistentProperties> attributes;
|
||||
nsresult rv = accText->GetDefaultTextAttributes(getter_AddRefs(attributes));
|
||||
nsresult rv = text->GetDefaultTextAttributes(getter_AddRefs(attributes));
|
||||
if (NS_FAILED(rv))
|
||||
return nullptr;
|
||||
|
||||
@ -240,11 +233,9 @@ getCharacterExtentsCB(AtkText *aText, gint aOffset,
|
||||
if(!accWrap || !aX || !aY || !aWidth || !aHeight)
|
||||
return;
|
||||
|
||||
nsCOMPtr<nsIAccessibleText> accText;
|
||||
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleText),
|
||||
getter_AddRefs(accText));
|
||||
if (!accText)
|
||||
return;
|
||||
HyperTextAccessible* text = accWrap->AsHyperText();
|
||||
if (!text || !text->IsTextRole())
|
||||
return;
|
||||
|
||||
int32_t extY = 0, extX = 0;
|
||||
int32_t extWidth = 0, extHeight = 0;
|
||||
@ -258,9 +249,9 @@ getCharacterExtentsCB(AtkText *aText, gint aOffset,
|
||||
#ifdef DEBUG
|
||||
nsresult rv =
|
||||
#endif
|
||||
accText->GetCharacterExtents(aOffset, &extX, &extY,
|
||||
&extWidth, &extHeight,
|
||||
geckoCoordType);
|
||||
text->GetCharacterExtents(aOffset, &extX, &extY,
|
||||
&extWidth, &extHeight,
|
||||
geckoCoordType);
|
||||
*aX = extX;
|
||||
*aY = extY;
|
||||
*aWidth = extWidth;
|
||||
@ -277,11 +268,9 @@ getRangeExtentsCB(AtkText *aText, gint aStartOffset, gint aEndOffset,
|
||||
if(!accWrap || !aRect)
|
||||
return;
|
||||
|
||||
nsCOMPtr<nsIAccessibleText> accText;
|
||||
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleText),
|
||||
getter_AddRefs(accText));
|
||||
if (!accText)
|
||||
return;
|
||||
HyperTextAccessible* text = accWrap->AsHyperText();
|
||||
if (!text || !text->IsTextRole())
|
||||
return;
|
||||
|
||||
int32_t extY = 0, extX = 0;
|
||||
int32_t extWidth = 0, extHeight = 0;
|
||||
@ -295,10 +284,10 @@ getRangeExtentsCB(AtkText *aText, gint aStartOffset, gint aEndOffset,
|
||||
#ifdef DEBUG
|
||||
nsresult rv =
|
||||
#endif
|
||||
accText->GetRangeExtents(aStartOffset, aEndOffset,
|
||||
&extX, &extY,
|
||||
&extWidth, &extHeight,
|
||||
geckoCoordType);
|
||||
text->GetRangeExtents(aStartOffset, aEndOffset,
|
||||
&extX, &extY,
|
||||
&extWidth, &extHeight,
|
||||
geckoCoordType);
|
||||
aRect->x = extX;
|
||||
aRect->y = extY;
|
||||
aRect->width = extWidth;
|
||||
@ -328,10 +317,9 @@ getOffsetAtPointCB(AtkText *aText,
|
||||
if (!accWrap)
|
||||
return -1;
|
||||
|
||||
nsCOMPtr<nsIAccessibleText> accText;
|
||||
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleText),
|
||||
getter_AddRefs(accText));
|
||||
NS_ENSURE_TRUE(accText, -1);
|
||||
HyperTextAccessible* text = accWrap->AsHyperText();
|
||||
if (!text || !text->IsTextRole())
|
||||
return -1;
|
||||
|
||||
int32_t offset = 0;
|
||||
uint32_t geckoCoordType;
|
||||
@ -340,7 +328,7 @@ getOffsetAtPointCB(AtkText *aText,
|
||||
else
|
||||
geckoCoordType = nsIAccessibleCoordinateType::COORDTYPE_WINDOW_RELATIVE;
|
||||
|
||||
accText->GetOffsetAtPoint(aX, aY, geckoCoordType, &offset);
|
||||
text->GetOffsetAtPoint(aX, aY, geckoCoordType, &offset);
|
||||
return static_cast<gint>(offset);
|
||||
}
|
||||
|
||||
@ -351,13 +339,12 @@ getTextSelectionCountCB(AtkText *aText)
|
||||
if (!accWrap)
|
||||
return 0;
|
||||
|
||||
nsCOMPtr<nsIAccessibleText> accText;
|
||||
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleText),
|
||||
getter_AddRefs(accText));
|
||||
NS_ENSURE_TRUE(accText, 0);
|
||||
HyperTextAccessible* text = accWrap->AsHyperText();
|
||||
if (!text || !text->IsTextRole())
|
||||
return 0;
|
||||
|
||||
int32_t selectionCount;
|
||||
nsresult rv = accText->GetSelectionCount(&selectionCount);
|
||||
nsresult rv = text->GetSelectionCount(&selectionCount);
|
||||
|
||||
return NS_FAILED(rv) ? 0 : selectionCount;
|
||||
}
|
||||
@ -370,14 +357,13 @@ getTextSelectionCB(AtkText *aText, gint aSelectionNum,
|
||||
if (!accWrap)
|
||||
return nullptr;
|
||||
|
||||
nsCOMPtr<nsIAccessibleText> accText;
|
||||
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleText),
|
||||
getter_AddRefs(accText));
|
||||
NS_ENSURE_TRUE(accText, nullptr);
|
||||
HyperTextAccessible* text = accWrap->AsHyperText();
|
||||
if (!text || !text->IsTextRole())
|
||||
return nullptr;
|
||||
|
||||
int32_t startOffset = 0, endOffset = 0;
|
||||
nsresult rv = accText->GetSelectionBounds(aSelectionNum,
|
||||
&startOffset, &endOffset);
|
||||
nsresult rv = text->GetSelectionBounds(aSelectionNum,
|
||||
&startOffset, &endOffset);
|
||||
|
||||
*aStartOffset = startOffset;
|
||||
*aEndOffset = endOffset;
|
||||
@ -397,12 +383,11 @@ addTextSelectionCB(AtkText *aText,
|
||||
if (!accWrap)
|
||||
return FALSE;
|
||||
|
||||
nsCOMPtr<nsIAccessibleText> accText;
|
||||
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleText),
|
||||
getter_AddRefs(accText));
|
||||
NS_ENSURE_TRUE(accText, FALSE);
|
||||
HyperTextAccessible* text = accWrap->AsHyperText();
|
||||
if (!text || !text->IsTextRole())
|
||||
return false;
|
||||
|
||||
nsresult rv = accText->AddSelection(aStartOffset, aEndOffset);
|
||||
nsresult rv = text->AddSelection(aStartOffset, aEndOffset);
|
||||
|
||||
return NS_SUCCEEDED(rv) ? TRUE : FALSE;
|
||||
}
|
||||
@ -415,12 +400,11 @@ removeTextSelectionCB(AtkText *aText,
|
||||
if (!accWrap)
|
||||
return FALSE;
|
||||
|
||||
nsCOMPtr<nsIAccessibleText> accText;
|
||||
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleText),
|
||||
getter_AddRefs(accText));
|
||||
NS_ENSURE_TRUE(accText, FALSE);
|
||||
HyperTextAccessible* text = accWrap->AsHyperText();
|
||||
if (!text || !text->IsTextRole())
|
||||
return false;
|
||||
|
||||
nsresult rv = accText->RemoveSelection(aSelectionNum);
|
||||
nsresult rv = text->RemoveSelection(aSelectionNum);
|
||||
|
||||
return NS_SUCCEEDED(rv) ? TRUE : FALSE;
|
||||
}
|
||||
@ -433,13 +417,12 @@ setTextSelectionCB(AtkText *aText, gint aSelectionNum,
|
||||
if (!accWrap)
|
||||
return FALSE;
|
||||
|
||||
nsCOMPtr<nsIAccessibleText> accText;
|
||||
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleText),
|
||||
getter_AddRefs(accText));
|
||||
NS_ENSURE_TRUE(accText, FALSE);
|
||||
HyperTextAccessible* text = accWrap->AsHyperText();
|
||||
if (!text || !text->IsTextRole())
|
||||
return false;
|
||||
|
||||
nsresult rv = accText->SetSelectionBounds(aSelectionNum,
|
||||
aStartOffset, aEndOffset);
|
||||
nsresult rv = text->SetSelectionBounds(aSelectionNum,
|
||||
aStartOffset, aEndOffset);
|
||||
return NS_SUCCEEDED(rv) ? TRUE : FALSE;
|
||||
}
|
||||
|
||||
@ -450,12 +433,11 @@ setCaretOffsetCB(AtkText *aText, gint aOffset)
|
||||
if (!accWrap)
|
||||
return FALSE;
|
||||
|
||||
nsCOMPtr<nsIAccessibleText> accText;
|
||||
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleText),
|
||||
getter_AddRefs(accText));
|
||||
NS_ENSURE_TRUE(accText, FALSE);
|
||||
HyperTextAccessible* text = accWrap->AsHyperText();
|
||||
if (!text || !text->IsTextRole())
|
||||
return false;
|
||||
|
||||
nsresult rv = accText->SetCaretOffset(aOffset);
|
||||
nsresult rv = text->SetCaretOffset(aOffset);
|
||||
return NS_SUCCEEDED(rv) ? TRUE : FALSE;
|
||||
}
|
||||
}
|
||||
|
@ -546,5 +546,9 @@ pref("dom.disable_window_open_dialog_feature", true);
|
||||
// Screen reader support
|
||||
pref("accessibility.accessfu.activate", 2);
|
||||
|
||||
// Enable hit-target fluffing
|
||||
pref("ui.touch.radius.enabled", true);
|
||||
pref("ui.mouse.radius.enabled", true);
|
||||
|
||||
// Disable native prompt
|
||||
pref("browser.prompt.allowNative", false);
|
||||
|
@ -112,9 +112,14 @@ let FormAssistant = {
|
||||
|
||||
let json = msg.json;
|
||||
switch (msg.name) {
|
||||
case "Forms:Input:Value":
|
||||
case "Forms:Input:Value": {
|
||||
target.value = json.value;
|
||||
|
||||
let event = content.document.createEvent('HTMLEvents');
|
||||
event.initEvent('input', true, false);
|
||||
target.dispatchEvent(event);
|
||||
break;
|
||||
}
|
||||
|
||||
case "Forms:Select:Choice":
|
||||
let options = target.options;
|
||||
|
@ -182,7 +182,7 @@
|
||||
if (domain[0] != "[") {
|
||||
try {
|
||||
baseDomain = Services.eTLD.getBaseDomainFromHost(domain);
|
||||
if (!domain.contains(baseDomain)) {
|
||||
if (!domain.endsWith(baseDomain)) {
|
||||
// getBaseDomainFromHost converts its resultant to ACE.
|
||||
let IDNService = Cc["@mozilla.org/network/idn-service;1"]
|
||||
.getService(Ci.nsIIDNService);
|
||||
|
@ -72,8 +72,14 @@ XPCOMUtils.defineLazyServiceGetter(this, "faviconSvc",
|
||||
"nsIFaviconService");
|
||||
|
||||
// nsIURI -> imgIContainer
|
||||
function _imageFromURI(uri, callback) {
|
||||
function _imageFromURI(uri, privateMode, callback) {
|
||||
let channel = ioSvc.newChannelFromURI(uri);
|
||||
try {
|
||||
channel.QueryInterface(Ci.nsIPrivateBrowsingChannel);
|
||||
channel.setPrivate(privateMode);
|
||||
} catch (e) {
|
||||
// Ignore channels which do not support nsIPrivateBrowsingChannel
|
||||
}
|
||||
NetUtil.asyncFetch(channel, function(inputStream, resultCode) {
|
||||
if (!Components.isSuccessCode(resultCode))
|
||||
return;
|
||||
@ -92,11 +98,11 @@ function _imageFromURI(uri, callback) {
|
||||
}
|
||||
|
||||
// string? -> imgIContainer
|
||||
function getFaviconAsImage(iconurl, callback) {
|
||||
function getFaviconAsImage(iconurl, privateMode, callback) {
|
||||
if (iconurl)
|
||||
_imageFromURI(NetUtil.newURI(iconurl), callback);
|
||||
_imageFromURI(NetUtil.newURI(iconurl), privateMode, callback);
|
||||
else
|
||||
_imageFromURI(faviconSvc.defaultFavicon, callback);
|
||||
_imageFromURI(faviconSvc.defaultFavicon, privateMode, callback);
|
||||
}
|
||||
|
||||
// Snaps the given rectangle to be pixel-aligned at the given scale
|
||||
@ -436,7 +442,7 @@ TabWindow.prototype = {
|
||||
preview.visible = AeroPeek.enabled;
|
||||
preview.active = this.tabbrowser.selectedTab == tab;
|
||||
// Grab the default favicon
|
||||
getFaviconAsImage(null, function (img) {
|
||||
getFaviconAsImage(null, this.win.gPrivateBrowsingUI.privateWindow, function (img) {
|
||||
// It is possible that we've already gotten the real favicon, so make sure
|
||||
// we have not set one before setting this default one.
|
||||
if (!preview.icon)
|
||||
@ -535,7 +541,7 @@ TabWindow.prototype = {
|
||||
//// Browser progress listener
|
||||
onLinkIconAvailable: function (aBrowser, aIconURL) {
|
||||
let self = this;
|
||||
getFaviconAsImage(aIconURL, function (img) {
|
||||
getFaviconAsImage(aIconURL, this.win.gPrivateBrowsingUI.privateWindow, function (img) {
|
||||
let index = self.tabbrowser.browsers.indexOf(aBrowser);
|
||||
// Only add it if we've found the index. The tab could have closed!
|
||||
if (index != -1)
|
||||
|
@ -32,6 +32,14 @@
|
||||
fun:__tls_get_addr
|
||||
...
|
||||
}
|
||||
{
|
||||
See bug 793611
|
||||
Memcheck:Leak
|
||||
fun:memalign
|
||||
fun:tls_get_addr_tail
|
||||
fun:___tls_get_addr
|
||||
...
|
||||
}
|
||||
|
||||
#################
|
||||
# Other leaks #
|
||||
@ -44,15 +52,14 @@
|
||||
fun:_ZN8JSObject25allocateSlowArrayElementsEP9JSContext
|
||||
...
|
||||
}
|
||||
# Suppressing the suppression(s) to get Valgrind stacks with line numbers
|
||||
#{
|
||||
# Bug 793533
|
||||
# Memcheck:Leak
|
||||
# fun:malloc
|
||||
# fun:moz_xmalloc
|
||||
# fun:_Z22xpc_CreateGlobalObjectP9JSContextP7JSClassP12nsIPrincipalP11nsISupportsbPP8JSObjectPP13JSCompartment
|
||||
# ...
|
||||
#}
|
||||
{
|
||||
Bug 793533
|
||||
Memcheck:Leak
|
||||
fun:malloc
|
||||
fun:moz_xmalloc
|
||||
fun:_Z22xpc_CreateGlobalObjectP9JSContextP7JSClassP12nsIPrincipalP11nsISupportsbPP8JSObjectPP13JSCompartment
|
||||
...
|
||||
}
|
||||
{
|
||||
Bug 793536 (all 64-bit systems)
|
||||
Memcheck:Leak
|
||||
@ -79,6 +86,7 @@
|
||||
fun:_ZN13CrashReporter14SetupExtraDataEP7nsIFileRK19nsACString_internal
|
||||
...
|
||||
}
|
||||
# Suppressing the suppression(s) to get Valgrind stacks with line numbers
|
||||
#{
|
||||
# Bug 793601
|
||||
# Memcheck:Leak
|
||||
@ -139,6 +147,17 @@
|
||||
fun:start_thread
|
||||
fun:clone
|
||||
}
|
||||
{
|
||||
Bug 793608 variant
|
||||
Memcheck:Leak
|
||||
fun:malloc
|
||||
fun:__libc_res_nsend
|
||||
fun:__libc_res_nquery
|
||||
fun:__libc_res_nquerydomain
|
||||
fun:__libc_res_nsearch
|
||||
obj:*
|
||||
...
|
||||
}
|
||||
{
|
||||
Bug 793615
|
||||
Memcheck:Leak
|
||||
|
@ -15,3 +15,41 @@
|
||||
obj:/usr/lib/libgnomevfs-2.so.0.2400.2
|
||||
...
|
||||
}
|
||||
{
|
||||
Bug 793598
|
||||
Memcheck:Leak
|
||||
...
|
||||
obj:/lib/libdbus-1.so.3.4.0
|
||||
...
|
||||
}
|
||||
{
|
||||
Bug 793600
|
||||
Memcheck:Leak
|
||||
fun:realloc
|
||||
obj:/usr/lib/libfontconfig.so.1.4.4
|
||||
...
|
||||
fun:FcDefaultSubstitute
|
||||
fun:_ZN17gfxPangoFontGroup11MakeFontSetEP14_PangoLanguagedP9nsAutoRefI10_FcPatternE
|
||||
...
|
||||
}
|
||||
{
|
||||
Bug 794366
|
||||
Memcheck:Leak
|
||||
...
|
||||
obj:/usr/lib/libgtk-x11-2.0.so.0.1800.9
|
||||
...
|
||||
}
|
||||
{
|
||||
Bug 794368
|
||||
Memcheck:Leak
|
||||
...
|
||||
obj:/usr/lib/libXrandr.so.2.2.0
|
||||
...
|
||||
}
|
||||
{
|
||||
Bug 794373
|
||||
Memcheck:Leak
|
||||
...
|
||||
obj:/lib/libgobject-2.0.so.0.2200.5
|
||||
...
|
||||
}
|
||||
|
@ -27,7 +27,7 @@
|
||||
Memcheck:Leak
|
||||
fun:realloc
|
||||
obj:/usr/lib64/libfontconfig.so.1.4.4
|
||||
obj:/usr/lib64/libfontconfig.so.1.4.4
|
||||
...
|
||||
fun:FcDefaultSubstitute
|
||||
fun:_ZN17gfxPangoFontGroup11MakeFontSetEP14_PangoLanguagedP9nsAutoRefI10_FcPatternE
|
||||
...
|
||||
|
@ -83,8 +83,12 @@ nsSecurityNameSet::InitializeNameSet(nsIScriptContext* aScriptContext)
|
||||
JSObject *obj = global;
|
||||
JSObject *proto;
|
||||
JSAutoRequest ar(cx);
|
||||
while ((proto = JS_GetPrototype(obj)) != nullptr)
|
||||
for (;;) {
|
||||
MOZ_ALWAYS_TRUE(JS_GetPrototype(cx, obj, &proto));
|
||||
if (!proto)
|
||||
break;
|
||||
obj = proto;
|
||||
}
|
||||
JSClass *objectClass = JS_GetClass(obj);
|
||||
|
||||
JS::Value v;
|
||||
|
@ -60,6 +60,11 @@ endif
|
||||
# MacOS X 10.4 sends "no autoconf*" errors to stdout, discard those via grep
|
||||
AUTOCONF ?= $(shell which autoconf-2.13 autoconf2.13 autoconf213 2>/dev/null | grep -v '^no autoconf' | head -1)
|
||||
|
||||
# See if the autoconf package was installed through fink
|
||||
ifeq (,$(strip $(AUTOCONF)))
|
||||
AUTOCONF = $(shell which fink >/dev/null 2>&1 && echo `which fink`/../../lib/autoconf2.13/bin/autoconf)
|
||||
endif
|
||||
|
||||
ifeq (,$(strip $(AUTOCONF)))
|
||||
AUTOCONF=$(error Could not find autoconf 2.13)
|
||||
endif
|
||||
|
@ -185,7 +185,7 @@ if test -n "$gonkdir" ; then
|
||||
RANLIB="$gonk_toolchain_prefix"ranlib
|
||||
STRIP="$gonk_toolchain_prefix"strip
|
||||
|
||||
STLPORT_CPPFLAGS="-I$gonkdir/ndk/sources/cxx-stl/stlport/stlport/"
|
||||
STLPORT_CPPFLAGS="-I$gonkdir/ndk/sources/cxx-stl/stlport/stlport/ -I$gonkdir/external/stlport/stlport/"
|
||||
STLPORT_LIBS="-lstlport"
|
||||
|
||||
case "$target_cpu" in
|
||||
|
@ -182,7 +182,7 @@ LOCAL_INCLUDES += \
|
||||
-I$(topsrcdir)/js/xpconnect/src \
|
||||
-I$(topsrcdir)/layout/generic \
|
||||
-I$(topsrcdir)/layout/style \
|
||||
-I$(topsrcdir)/layout/svg/base/src \
|
||||
-I$(topsrcdir)/layout/svg \
|
||||
-I$(topsrcdir)/layout/xul/base/src \
|
||||
-I$(topsrcdir)/netwerk/base/src \
|
||||
$(NULL)
|
||||
|
@ -905,7 +905,7 @@ nsFrameScriptExecutor::TryCacheLoadAndCompileScript(const nsAString& aURL,
|
||||
options.setNoScriptRval(true)
|
||||
.setFileAndLine(url.get(), 1)
|
||||
.setPrincipals(nsJSPrincipals::get(mPrincipal));
|
||||
JS::RootedObject empty(mCx, NULL);
|
||||
js::RootedObject empty(mCx, NULL);
|
||||
JSScript* script = JS::Compile(mCx, empty, options,
|
||||
dataString.get(), dataString.Length());
|
||||
|
||||
|
@ -1592,7 +1592,6 @@ WebGLContext::GetSupportedExtensions(Nullable< nsTArray<nsString> > &retval)
|
||||
arr.AppendElement(NS_LITERAL_STRING("OES_standard_derivatives"));
|
||||
if (IsExtensionSupported(EXT_texture_filter_anisotropic)) {
|
||||
arr.AppendElement(NS_LITERAL_STRING("EXT_texture_filter_anisotropic"));
|
||||
arr.AppendElement(NS_LITERAL_STRING("MOZ_EXT_texture_filter_anisotropic"));
|
||||
}
|
||||
if (IsExtensionSupported(WEBGL_lose_context))
|
||||
arr.AppendElement(NS_LITERAL_STRING("MOZ_WEBGL_lose_context"));
|
||||
|
@ -24,4 +24,6 @@ DOMCI_DATA(WebGLExtensionStandardDerivatives, void)
|
||||
DOMCI_DATA(WebGLExtensionTextureFilterAnisotropic, void)
|
||||
DOMCI_DATA(WebGLExtensionLoseContext, void)
|
||||
DOMCI_DATA(WebGLExtensionCompressedTextureS3TC, void)
|
||||
DOMCI_DATA(WebGLExtensionCompressedTextureATC, void)
|
||||
DOMCI_DATA(WebGLExtensionCompressedTexturePVRTC, void)
|
||||
DOMCI_DATA(WebGLExtensionDepthTexture, void)
|
||||
|
@ -62,6 +62,8 @@ AudioBuffer::~AudioBuffer()
|
||||
bool
|
||||
AudioBuffer::InitializeBuffers(uint32_t aNumberOfChannels, JSContext* aJSContext)
|
||||
{
|
||||
NS_HOLD_JS_OBJECTS(this, AudioBuffer);
|
||||
|
||||
if (!mChannels.SetCapacity(aNumberOfChannels)) {
|
||||
return false;
|
||||
}
|
||||
@ -73,8 +75,6 @@ AudioBuffer::InitializeBuffers(uint32_t aNumberOfChannels, JSContext* aJSContext
|
||||
mChannels.AppendElement(array);
|
||||
}
|
||||
|
||||
NS_HOLD_JS_OBJECTS(this, AudioBuffer);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -213,7 +213,7 @@ nsSMILAnimationController::Traverse(
|
||||
}
|
||||
}
|
||||
|
||||
/*static*/ PR_CALLBACK PLDHashOperator
|
||||
/*static*/ PLDHashOperator
|
||||
nsSMILAnimationController::CompositorTableEntryTraverse(
|
||||
nsSMILCompositor* aCompositor,
|
||||
void* aArg)
|
||||
@ -303,7 +303,7 @@ nsSMILAnimationController::MaybeStartSampling(nsRefreshDriver* aRefreshDriver)
|
||||
//----------------------------------------------------------------------
|
||||
// Sample-related methods and callbacks
|
||||
|
||||
PR_CALLBACK PLDHashOperator
|
||||
PLDHashOperator
|
||||
TransferCachedBaseValue(nsSMILCompositor* aCompositor,
|
||||
void* aData)
|
||||
{
|
||||
@ -319,7 +319,7 @@ TransferCachedBaseValue(nsSMILCompositor* aCompositor,
|
||||
return PL_DHASH_NEXT;
|
||||
}
|
||||
|
||||
PR_CALLBACK PLDHashOperator
|
||||
PLDHashOperator
|
||||
RemoveCompositorFromTable(nsSMILCompositor* aCompositor,
|
||||
void* aData)
|
||||
{
|
||||
@ -329,7 +329,7 @@ RemoveCompositorFromTable(nsSMILCompositor* aCompositor,
|
||||
return PL_DHASH_NEXT;
|
||||
}
|
||||
|
||||
PR_CALLBACK PLDHashOperator
|
||||
PLDHashOperator
|
||||
DoClearAnimationEffects(nsSMILCompositor* aCompositor,
|
||||
void* /*aData*/)
|
||||
{
|
||||
@ -337,7 +337,7 @@ DoClearAnimationEffects(nsSMILCompositor* aCompositor,
|
||||
return PL_DHASH_NEXT;
|
||||
}
|
||||
|
||||
PR_CALLBACK PLDHashOperator
|
||||
PLDHashOperator
|
||||
DoComposeAttribute(nsSMILCompositor* aCompositor,
|
||||
void* /*aData*/)
|
||||
{
|
||||
@ -467,7 +467,7 @@ nsSMILAnimationController::RewindElements()
|
||||
mChildContainerTable.EnumerateEntries(ClearRewindNeeded, nullptr);
|
||||
}
|
||||
|
||||
/*static*/ PR_CALLBACK PLDHashOperator
|
||||
/*static*/ PLDHashOperator
|
||||
nsSMILAnimationController::RewindNeeded(TimeContainerPtrKey* aKey,
|
||||
void* aData)
|
||||
{
|
||||
@ -484,7 +484,7 @@ nsSMILAnimationController::RewindNeeded(TimeContainerPtrKey* aKey,
|
||||
return PL_DHASH_NEXT;
|
||||
}
|
||||
|
||||
/*static*/ PR_CALLBACK PLDHashOperator
|
||||
/*static*/ PLDHashOperator
|
||||
nsSMILAnimationController::RewindAnimation(AnimationElementPtrKey* aKey,
|
||||
void* aData)
|
||||
{
|
||||
@ -497,7 +497,7 @@ nsSMILAnimationController::RewindAnimation(AnimationElementPtrKey* aKey,
|
||||
return PL_DHASH_NEXT;
|
||||
}
|
||||
|
||||
/*static*/ PR_CALLBACK PLDHashOperator
|
||||
/*static*/ PLDHashOperator
|
||||
nsSMILAnimationController::ClearRewindNeeded(TimeContainerPtrKey* aKey,
|
||||
void* aData)
|
||||
{
|
||||
@ -582,7 +582,7 @@ nsSMILAnimationController::DoMilestoneSamples()
|
||||
}
|
||||
}
|
||||
|
||||
/*static*/ PR_CALLBACK PLDHashOperator
|
||||
/*static*/ PLDHashOperator
|
||||
nsSMILAnimationController::GetNextMilestone(TimeContainerPtrKey* aKey,
|
||||
void* aData)
|
||||
{
|
||||
@ -607,7 +607,7 @@ nsSMILAnimationController::GetNextMilestone(TimeContainerPtrKey* aKey,
|
||||
return PL_DHASH_NEXT;
|
||||
}
|
||||
|
||||
/*static*/ PR_CALLBACK PLDHashOperator
|
||||
/*static*/ PLDHashOperator
|
||||
nsSMILAnimationController::GetMilestoneElements(TimeContainerPtrKey* aKey,
|
||||
void* aData)
|
||||
{
|
||||
@ -629,7 +629,7 @@ nsSMILAnimationController::GetMilestoneElements(TimeContainerPtrKey* aKey,
|
||||
return PL_DHASH_NEXT;
|
||||
}
|
||||
|
||||
/*static*/ PR_CALLBACK PLDHashOperator
|
||||
/*static*/ PLDHashOperator
|
||||
nsSMILAnimationController::SampleTimeContainer(TimeContainerPtrKey* aKey,
|
||||
void* aData)
|
||||
{
|
||||
@ -652,7 +652,7 @@ nsSMILAnimationController::SampleTimeContainer(TimeContainerPtrKey* aKey,
|
||||
return PL_DHASH_NEXT;
|
||||
}
|
||||
|
||||
/*static*/ PR_CALLBACK PLDHashOperator
|
||||
/*static*/ PLDHashOperator
|
||||
nsSMILAnimationController::SampleAnimation(AnimationElementPtrKey* aKey,
|
||||
void* aData)
|
||||
{
|
||||
|
@ -2318,7 +2318,7 @@ nsSMILTimedElement::AreEndTimesDependentOn(
|
||||
//----------------------------------------------------------------------
|
||||
// Hashtable callback functions
|
||||
|
||||
/* static */ PR_CALLBACK PLDHashOperator
|
||||
/* static */ PLDHashOperator
|
||||
nsSMILTimedElement::NotifyNewIntervalCallback(TimeValueSpecPtrKey* aKey,
|
||||
void* aData)
|
||||
{
|
||||
|
@ -151,7 +151,7 @@ INCLUDES += \
|
||||
-I$(srcdir)/../../../base/src \
|
||||
-I$(srcdir)/../../../../layout/generic \
|
||||
-I$(srcdir)/../../../../layout/xul/base/src \
|
||||
-I$(srcdir)/../../../../layout/svg/base/src \
|
||||
-I$(srcdir)/../../../../layout/svg \
|
||||
-I$(srcdir)/../../../../layout/style \
|
||||
-I$(srcdir)/../../../events/src \
|
||||
-I$(srcdir)/../../../html/content/src \
|
||||
|
@ -171,7 +171,7 @@ InstallXBLField(JSContext* cx,
|
||||
{
|
||||
JSAutoCompartment ac(cx, callee);
|
||||
|
||||
JS::Rooted<JSObject*> xblProto(cx);
|
||||
js::Rooted<JSObject*> xblProto(cx);
|
||||
xblProto = &js::GetFunctionNativeReserved(callee, XBLPROTO_SLOT).toObject();
|
||||
|
||||
JS::Value name = js::GetFunctionNativeReserved(callee, FIELD_SLOT);
|
||||
@ -217,11 +217,11 @@ FieldGetterImpl(JSContext *cx, JS::CallArgs args)
|
||||
const JS::Value &thisv = args.thisv();
|
||||
MOZ_ASSERT(ValueHasISupportsPrivate(thisv));
|
||||
|
||||
JS::Rooted<JSObject*> thisObj(cx, &thisv.toObject());
|
||||
js::Rooted<JSObject*> thisObj(cx, &thisv.toObject());
|
||||
|
||||
bool installed = false;
|
||||
JS::Rooted<JSObject*> callee(cx, &args.calleev().toObject());
|
||||
JS::Rooted<jsid> id(cx);
|
||||
js::Rooted<JSObject*> callee(cx, &args.calleev().toObject());
|
||||
js::Rooted<jsid> id(cx);
|
||||
if (!InstallXBLField(cx, callee, thisObj, id.address(), &installed)) {
|
||||
return false;
|
||||
}
|
||||
@ -231,7 +231,7 @@ FieldGetterImpl(JSContext *cx, JS::CallArgs args)
|
||||
return true;
|
||||
}
|
||||
|
||||
JS::Rooted<JS::Value> v(cx);
|
||||
js::Rooted<JS::Value> v(cx);
|
||||
if (!JS_GetPropertyById(cx, thisObj, id, v.address())) {
|
||||
return false;
|
||||
}
|
||||
@ -253,16 +253,16 @@ FieldSetterImpl(JSContext *cx, JS::CallArgs args)
|
||||
const JS::Value &thisv = args.thisv();
|
||||
MOZ_ASSERT(ValueHasISupportsPrivate(thisv));
|
||||
|
||||
JS::Rooted<JSObject*> thisObj(cx, &thisv.toObject());
|
||||
js::Rooted<JSObject*> thisObj(cx, &thisv.toObject());
|
||||
|
||||
bool installed = false;
|
||||
JS::Rooted<JSObject*> callee(cx, &args.calleev().toObject());
|
||||
JS::Rooted<jsid> id(cx);
|
||||
js::Rooted<JSObject*> callee(cx, &args.calleev().toObject());
|
||||
js::Rooted<jsid> id(cx);
|
||||
if (!InstallXBLField(cx, callee, thisObj, id.address(), &installed)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
JS::Rooted<JS::Value> v(cx,
|
||||
js::Rooted<JS::Value> v(cx,
|
||||
args.length() > 0 ? args[0] : JS::UndefinedValue());
|
||||
return JS_SetPropertyById(cx, thisObj, id, v.address());
|
||||
}
|
||||
@ -300,9 +300,9 @@ XBLResolve(JSContext *cx, JSHandleObject obj, JSHandleId id, unsigned flags,
|
||||
|
||||
// We have a field: now install a getter/setter pair which will resolve the
|
||||
// field onto the actual object, when invoked.
|
||||
JS::Rooted<JSObject*> global(cx, JS_GetGlobalForObject(cx, obj));
|
||||
js::Rooted<JSObject*> global(cx, JS_GetGlobalForObject(cx, obj));
|
||||
|
||||
JS::Rooted<JSObject*> get(cx);
|
||||
js::Rooted<JSObject*> get(cx);
|
||||
get = ::JS_GetFunctionObject(js::NewFunctionByIdWithReserved(cx, FieldGetter,
|
||||
0, 0, global,
|
||||
id));
|
||||
@ -313,7 +313,7 @@ XBLResolve(JSContext *cx, JSHandleObject obj, JSHandleId id, unsigned flags,
|
||||
js::SetFunctionNativeReserved(get, FIELD_SLOT,
|
||||
JS::StringValue(JSID_TO_STRING(id)));
|
||||
|
||||
JS::Rooted<JSObject*> set(cx);
|
||||
js::Rooted<JSObject*> set(cx);
|
||||
set = ::JS_GetFunctionObject(js::NewFunctionByIdWithReserved(cx, FieldSetter,
|
||||
1, 0, global,
|
||||
id));
|
||||
@ -1217,7 +1217,9 @@ nsXBLBinding::ChangeDocument(nsIDocument* aOldDocument, nsIDocument* aNewDocumen
|
||||
JSAutoCompartment ac(cx, scriptObject);
|
||||
|
||||
for ( ; true; base = proto) { // Will break out on null proto
|
||||
proto = ::JS_GetPrototype(base);
|
||||
if (!JS_GetPrototype(cx, base, &proto)) {
|
||||
return;
|
||||
}
|
||||
if (!proto) {
|
||||
break;
|
||||
}
|
||||
@ -1249,7 +1251,10 @@ nsXBLBinding::ChangeDocument(nsIDocument* aOldDocument, nsIDocument* aNewDocumen
|
||||
|
||||
// Alright! This is the right prototype. Pull it out of the
|
||||
// proto chain.
|
||||
JSObject* grandProto = ::JS_GetPrototype(proto);
|
||||
JSObject* grandProto;
|
||||
if (!JS_GetPrototype(cx, proto, &grandProto)) {
|
||||
return;
|
||||
}
|
||||
::JS_SetPrototype(cx, base, grandProto);
|
||||
break;
|
||||
}
|
||||
@ -1346,7 +1351,9 @@ nsXBLBinding::DoInitJSClass(JSContext *cx, JSObject *global, JSObject *obj,
|
||||
|
||||
if (obj) {
|
||||
// Retrieve the current prototype of obj.
|
||||
parent_proto = ::JS_GetPrototype(obj);
|
||||
if (!JS_GetPrototype(cx, obj, &parent_proto)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
if (parent_proto) {
|
||||
// We need to create a unique classname based on aClassName and
|
||||
// parent_proto. Append a space (an invalid URI character) to ensure that
|
||||
|
@ -98,7 +98,9 @@ nsXBLDocGlobalObject::doCheckAccess(JSContext *cx, JSObject *obj, jsid id, uint3
|
||||
// Make sure to actually operate on our object, and not some object further
|
||||
// down on the proto chain.
|
||||
while (JS_GetClass(obj) != &nsXBLDocGlobalObject::gSharedGlobalClass) {
|
||||
obj = ::JS_GetPrototype(obj);
|
||||
if (!::JS_GetPrototype(cx, obj, &obj)) {
|
||||
return JS_FALSE;
|
||||
}
|
||||
if (!obj) {
|
||||
::JS_ReportError(cx, "Invalid access to a global object property.");
|
||||
return JS_FALSE;
|
||||
|
@ -497,10 +497,20 @@ let DOMApplicationRegistry = {
|
||||
if (!(aMsgName in this.children)) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.children[aMsgName].forEach(function _doBroadcast(aMsgMgr) {
|
||||
aMsgMgr.sendAsyncMessage(aMsgName, aContent);
|
||||
});
|
||||
let i;
|
||||
for (i = this.children[aMsgName].length - 1; i >= 0; i -= 1) {
|
||||
let msgMgr = this.children[aMsgName][i];
|
||||
try {
|
||||
msgMgr.sendAsyncMessage(aMsgName, aContent);
|
||||
} catch (e) {
|
||||
// Remove once 777508 lands.
|
||||
let index;
|
||||
if ((index = this.children[aMsgName].indexOf(msgMgr)) != -1) {
|
||||
this.children[aMsgName].splice(index, 1);
|
||||
dump("Remove dead MessageManager!\n");
|
||||
}
|
||||
}
|
||||
};
|
||||
},
|
||||
|
||||
_getAppDir: function(aId) {
|
||||
|
@ -1905,14 +1905,14 @@ static const JSClass *sObjectClass = nullptr;
|
||||
* Set our JSClass pointer for the Object class
|
||||
*/
|
||||
static void
|
||||
FindObjectClass(JSObject* aGlobalObject)
|
||||
FindObjectClass(JSContext* cx, JSObject* aGlobalObject)
|
||||
{
|
||||
NS_ASSERTION(!sObjectClass,
|
||||
"Double set of sObjectClass");
|
||||
JSObject *obj, *proto = aGlobalObject;
|
||||
do {
|
||||
obj = proto;
|
||||
proto = js::GetObjectProto(obj);
|
||||
js::GetObjectProto(cx, obj, &proto);
|
||||
} while (proto);
|
||||
|
||||
sObjectClass = js::GetObjectJSClass(obj);
|
||||
@ -5126,14 +5126,17 @@ nsDOMClassInfo::PostCreatePrototype(JSContext * cx, JSObject * proto)
|
||||
// sObjectClass, so compute it here. We assume that nobody has had a
|
||||
// chance to monkey around with proto's prototype chain before this.
|
||||
if (!sObjectClass) {
|
||||
FindObjectClass(proto);
|
||||
FindObjectClass(cx, proto);
|
||||
NS_ASSERTION(sObjectClass && !strcmp(sObjectClass->name, "Object"),
|
||||
"Incorrect object class!");
|
||||
}
|
||||
|
||||
NS_ASSERTION(::JS_GetPrototype(proto) &&
|
||||
JS_GetClass(::JS_GetPrototype(proto)) == sObjectClass,
|
||||
"Hmm, somebody did something evil?");
|
||||
#ifdef DEBUG
|
||||
JSObject *proto2;
|
||||
JS_GetPrototype(cx, proto, &proto2);
|
||||
NS_ASSERTION(proto2 && JS_GetClass(proto2) == sObjectClass,
|
||||
"Hmm, somebody did something evil?");
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG
|
||||
if (mData->mHasClassInterface && mData->mProtoChainInterface &&
|
||||
@ -5462,7 +5465,10 @@ nsWindowSH::GlobalScopePolluterNewResolve(JSContext *cx, JSHandleObject obj,
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
JSObject *proto = ::JS_GetPrototype(obj);
|
||||
JSObject *proto;
|
||||
if (!::JS_GetPrototype(cx, obj, &proto)) {
|
||||
return JS_FALSE;
|
||||
}
|
||||
JSBool hasProp;
|
||||
|
||||
if (!proto || !::JS_HasPropertyById(cx, proto, id, &hasProp) ||
|
||||
@ -5505,14 +5511,21 @@ nsWindowSH::GlobalScopePolluterNewResolve(JSContext *cx, JSHandleObject obj,
|
||||
}
|
||||
|
||||
// static
|
||||
void
|
||||
JSBool
|
||||
nsWindowSH::InvalidateGlobalScopePolluter(JSContext *cx, JSObject *obj)
|
||||
{
|
||||
JSObject *proto;
|
||||
|
||||
JSAutoRequest ar(cx);
|
||||
|
||||
while ((proto = ::JS_GetPrototype(obj))) {
|
||||
for (;;) {
|
||||
if (!::JS_GetPrototype(cx, obj, &proto)) {
|
||||
return JS_FALSE;
|
||||
}
|
||||
if (!proto) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (JS_GetClass(proto) == &sGlobalScopePolluterClass) {
|
||||
nsIHTMLDocument *doc = (nsIHTMLDocument *)::JS_GetPrivate(proto);
|
||||
|
||||
@ -5520,15 +5533,22 @@ nsWindowSH::InvalidateGlobalScopePolluter(JSContext *cx, JSObject *obj)
|
||||
|
||||
::JS_SetPrivate(proto, nullptr);
|
||||
|
||||
JSObject *proto_proto;
|
||||
if (!::JS_GetPrototype(cx, proto, &proto_proto)) {
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
// Pull the global scope polluter out of the prototype chain so
|
||||
// that it can be freed.
|
||||
::JS_SplicePrototype(cx, obj, ::JS_GetPrototype(proto));
|
||||
::JS_SplicePrototype(cx, obj, proto_proto);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
obj = proto;
|
||||
}
|
||||
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
// static
|
||||
@ -5554,7 +5574,13 @@ nsWindowSH::InstallGlobalScopePolluter(JSContext *cx, JSObject *obj,
|
||||
// Find the place in the prototype chain where we want this global
|
||||
// scope polluter (right before Object.prototype).
|
||||
|
||||
while ((proto = ::JS_GetPrototype(o))) {
|
||||
for (;;) {
|
||||
if (!::JS_GetPrototype(cx, o, &proto)) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
if (!proto) {
|
||||
break;
|
||||
}
|
||||
if (JS_GetClass(proto) == sObjectClass) {
|
||||
// Set the global scope polluters prototype to Object.prototype
|
||||
::JS_SplicePrototype(cx, gsp, proto);
|
||||
@ -6322,8 +6348,14 @@ nsDOMConstructor::HasInstance(nsIXPConnectWrappedNative *wrapper,
|
||||
|
||||
JSObject *dot_prototype = JSVAL_TO_OBJECT(val);
|
||||
|
||||
JSObject *proto = JS_GetPrototype(dom_obj);
|
||||
for ( ; proto; proto = JS_GetPrototype(proto)) {
|
||||
JSObject *proto = dom_obj;
|
||||
for (;;) {
|
||||
if (!JS_GetPrototype(cx, proto, &proto)) {
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
if (!proto) {
|
||||
break;
|
||||
}
|
||||
if (proto == dot_prototype) {
|
||||
*bp = true;
|
||||
break;
|
||||
@ -6682,7 +6714,10 @@ ResolvePrototype(nsIXPConnect *aXPConnect, nsGlobalWindow *aWin, JSContext *cx,
|
||||
|
||||
if (dot_prototype) {
|
||||
JSAutoCompartment ac(cx, dot_prototype);
|
||||
JSObject *xpc_proto_proto = ::JS_GetPrototype(dot_prototype);
|
||||
JSObject *xpc_proto_proto;
|
||||
if (!::JS_GetPrototype(cx, dot_prototype, &xpc_proto_proto)) {
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
if (proto &&
|
||||
(!xpc_proto_proto ||
|
||||
@ -7076,7 +7111,7 @@ static JSBool
|
||||
LocationSetterUnwrapper(JSContext *cx, JSHandleObject obj_, JSHandleId id, JSBool strict,
|
||||
JSMutableHandleValue vp)
|
||||
{
|
||||
JS::RootedObject obj(cx, obj_);
|
||||
js::RootedObject obj(cx, obj_);
|
||||
|
||||
JSObject *wrapped = XPCWrapper::UnsafeUnwrapSecurityWrapper(obj);
|
||||
if (wrapped) {
|
||||
@ -7091,8 +7126,8 @@ nsWindowSH::NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
||||
JSObject *obj_, jsid id_, uint32_t flags,
|
||||
JSObject **objp, bool *_retval)
|
||||
{
|
||||
JS::RootedObject obj(cx, obj_);
|
||||
JS::RootedId id(cx, id_);
|
||||
js::RootedObject obj(cx, obj_);
|
||||
js::RootedId id(cx, id_);
|
||||
|
||||
nsGlobalWindow *win = nsGlobalWindow::FromWrapper(wrapper);
|
||||
|
||||
@ -7314,7 +7349,7 @@ nsWindowSH::NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
||||
|
||||
// Resolve special classes.
|
||||
for (uint32_t i = 0; i < ArrayLength(sOtherResolveFuncs); i++) {
|
||||
JS::RootedObject tmp(cx, *objp);
|
||||
js::RootedObject tmp(cx, *objp);
|
||||
if (!sOtherResolveFuncs[i](cx, obj, id, flags, &tmp)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
@ -7500,7 +7535,11 @@ nsWindowSH::NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
||||
wrapper->GetJSObject(&realObj);
|
||||
|
||||
if (obj == realObj) {
|
||||
JSObject *proto = js::GetObjectProto(obj);
|
||||
JSObject *proto;
|
||||
if (!js::GetObjectProto(cx, obj, &proto)) {
|
||||
*_retval = JS_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
if (proto) {
|
||||
JSObject *pobj = NULL;
|
||||
jsval val;
|
||||
@ -8424,7 +8463,10 @@ nsNamedArraySH::NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
||||
}
|
||||
|
||||
JSAutoCompartment ac(cx, realObj);
|
||||
JSObject *proto = ::JS_GetPrototype(realObj);
|
||||
JSObject *proto;
|
||||
if (!::JS_GetPrototype(cx, realObj, &proto)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
if (proto) {
|
||||
JSBool hasProp;
|
||||
@ -8939,7 +8981,9 @@ nsHTMLDocumentSH::DocumentAllGetProperty(JSContext *cx, JSHandleObject obj_,
|
||||
}
|
||||
|
||||
while (js::GetObjectJSClass(obj) != &sHTMLDocumentAllClass) {
|
||||
obj = js::GetObjectProto(obj);
|
||||
if (!js::GetObjectProto(cx, obj, &obj)) {
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
if (!obj) {
|
||||
NS_ERROR("The JS engine lies!");
|
||||
@ -9033,7 +9077,7 @@ nsHTMLDocumentSH::DocumentAllNewResolve(JSContext *cx, JSHandleObject obj, JSHan
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
JS::RootedValue v(cx);
|
||||
js::RootedValue v(cx);
|
||||
|
||||
if (sItem_id == id || sNamedItem_id == id) {
|
||||
// Define the item() or namedItem() method.
|
||||
@ -9138,14 +9182,17 @@ nsHTMLDocumentSH::CallToGetPropMapper(JSContext *cx, unsigned argc, jsval *vp)
|
||||
}
|
||||
|
||||
|
||||
static inline JSObject *
|
||||
GetDocumentAllHelper(JSObject *obj)
|
||||
static inline bool
|
||||
GetDocumentAllHelper(JSContext *cx, JSObject *obj, JSObject **result)
|
||||
{
|
||||
while (obj && JS_GetClass(obj) != &sHTMLDocumentAllHelperClass) {
|
||||
obj = ::JS_GetPrototype(obj);
|
||||
if (!::JS_GetPrototype(cx, obj, &obj)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return obj;
|
||||
*result = obj;
|
||||
return true;
|
||||
}
|
||||
|
||||
static inline void *
|
||||
@ -9171,7 +9218,10 @@ nsHTMLDocumentSH::DocumentAllHelperGetProperty(JSContext *cx, JSHandleObject obj
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
JSObject *helper = GetDocumentAllHelper(obj);
|
||||
JSObject *helper;
|
||||
if (!GetDocumentAllHelper(cx, obj, &helper)) {
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
if (!helper) {
|
||||
NS_ERROR("Uh, how'd we get here?");
|
||||
@ -9229,7 +9279,10 @@ nsHTMLDocumentSH::DocumentAllHelperNewResolve(JSContext *cx, JSHandleObject obj,
|
||||
{
|
||||
if (nsDOMClassInfo::sAll_id == id) {
|
||||
// document.all is resolved for the first time. Define it.
|
||||
JSObject *helper = GetDocumentAllHelper(obj);
|
||||
JSObject *helper;
|
||||
if (!GetDocumentAllHelper(cx, obj, &helper)) {
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
if (helper) {
|
||||
if (!::JS_DefineProperty(cx, helper, "all", JSVAL_VOID, nullptr, nullptr,
|
||||
@ -9253,7 +9306,10 @@ nsHTMLDocumentSH::DocumentAllTagsNewResolve(JSContext *cx, JSHandleObject obj,
|
||||
if (JSID_IS_STRING(id)) {
|
||||
nsDocument *doc = GetDocument(obj);
|
||||
|
||||
JSObject *proto = ::JS_GetPrototype(obj);
|
||||
JSObject *proto;
|
||||
if (!::JS_GetPrototype(cx, obj, &proto)) {
|
||||
return JS_FALSE;
|
||||
}
|
||||
if (NS_UNLIKELY(!proto)) {
|
||||
return JS_TRUE;
|
||||
}
|
||||
@ -9332,9 +9388,19 @@ nsHTMLDocumentSH::NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
||||
nsIDocument *doc = static_cast<nsIDocument*>(wrapper->Native());
|
||||
|
||||
if (doc->GetCompatibilityMode() == eCompatibility_NavQuirks) {
|
||||
JSObject *helper = GetDocumentAllHelper(::JS_GetPrototype(obj));
|
||||
JSObject *proto;
|
||||
if (!::JS_GetPrototype(cx, obj, &proto)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
JSObject *proto = ::JS_GetPrototype(helper ? helper : obj);
|
||||
JSObject *helper;
|
||||
if (!GetDocumentAllHelper(cx, proto, &helper)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
if (!::JS_GetPrototype(cx, helper ? helper : obj, &proto)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
// Check if the property all is defined on obj's (or helper's
|
||||
// if obj doesn't exist) prototype, if it is, don't expose our
|
||||
@ -9349,11 +9415,14 @@ nsHTMLDocumentSH::NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
||||
// Our helper's prototype now has an "all" property, remove
|
||||
// the helper out of the prototype chain to prevent
|
||||
// shadowing of the now defined "all" property.
|
||||
JSObject *tmp = obj, *tmpProto;
|
||||
JSObject *tmp = obj, *tmpProto = tmp;
|
||||
|
||||
while ((tmpProto = ::JS_GetPrototype(tmp)) != helper) {
|
||||
do {
|
||||
tmp = tmpProto;
|
||||
}
|
||||
if (!::JS_GetPrototype(cx, tmp, &tmpProto)) {
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
} while (tmpProto != helper);
|
||||
|
||||
::JS_SetPrototype(cx, tmp, proto);
|
||||
}
|
||||
@ -9367,8 +9436,11 @@ nsHTMLDocumentSH::NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
||||
// Print a warning so developers can stop using document.all
|
||||
PrintWarningOnConsole(cx, "DocumentAllUsed");
|
||||
|
||||
if (!::JS_GetPrototype(cx, obj, &proto)) {
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
helper = ::JS_NewObject(cx, &sHTMLDocumentAllHelperClass,
|
||||
::JS_GetPrototype(obj),
|
||||
proto,
|
||||
::JS_GetGlobalForObject(cx, obj));
|
||||
|
||||
if (!helper) {
|
||||
@ -9938,7 +10010,10 @@ nsHTMLPluginObjElementSH::GetProperty(nsIXPConnectWrappedNative *wrapper,
|
||||
{
|
||||
JSAutoRequest ar(cx);
|
||||
|
||||
JSObject *pi_obj = ::JS_GetPrototype(obj);
|
||||
JSObject *pi_obj;
|
||||
if (!::JS_GetPrototype(cx, obj, &pi_obj)) {
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
if (NS_UNLIKELY(!pi_obj)) {
|
||||
return NS_OK;
|
||||
}
|
||||
@ -9967,7 +10042,10 @@ nsHTMLPluginObjElementSH::SetProperty(nsIXPConnectWrappedNative *wrapper,
|
||||
{
|
||||
JSAutoRequest ar(cx);
|
||||
|
||||
JSObject *pi_obj = ::JS_GetPrototype(obj);
|
||||
JSObject *pi_obj;
|
||||
if (!::JS_GetPrototype(cx, obj, &pi_obj)) {
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
if (NS_UNLIKELY(!pi_obj)) {
|
||||
return NS_OK;
|
||||
}
|
||||
@ -10043,7 +10121,9 @@ nsHTMLPluginObjElementSH::GetPluginJSObject(JSContext *cx, JSObject *obj,
|
||||
if (plugin_inst) {
|
||||
plugin_inst->GetJSObject(cx, plugin_obj);
|
||||
if (*plugin_obj) {
|
||||
*plugin_proto = ::JS_GetPrototype(*plugin_obj);
|
||||
if (!::JS_GetPrototype(cx, *plugin_obj, plugin_proto)) {
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -10388,7 +10468,10 @@ nsStorage2SH::NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
JSObject *proto = ::JS_GetPrototype(realObj);
|
||||
JSObject *proto;
|
||||
if (!::JS_GetPrototype(cx, realObj, &proto)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
JSBool hasProp;
|
||||
|
||||
if (proto &&
|
||||
|
@ -420,7 +420,7 @@ public:
|
||||
JSMutableHandleValue vp);
|
||||
static JSBool SecurityCheckOnSetProp(JSContext *cx, JSHandleObject obj, JSHandleId id,
|
||||
JSBool strict, JSMutableHandleValue vp);
|
||||
static void InvalidateGlobalScopePolluter(JSContext *cx, JSObject *obj);
|
||||
static JSBool InvalidateGlobalScopePolluter(JSContext *cx, JSObject *obj);
|
||||
static nsresult InstallGlobalScopePolluter(JSContext *cx, JSObject *obj,
|
||||
nsIHTMLDocument *doc);
|
||||
static nsIClassInfo *doCreate(nsDOMClassInfoData* aData)
|
||||
|
@ -1967,7 +1967,7 @@ nsDOMWindowUtils::GetParent(const JS::Value& aObject,
|
||||
return NS_ERROR_XPC_BAD_CONVERT_JS;
|
||||
}
|
||||
|
||||
JS::Rooted<JSObject*> parent(aCx, JS_GetParent(JSVAL_TO_OBJECT(aObject)));
|
||||
js::Rooted<JSObject*> parent(aCx, JS_GetParent(JSVAL_TO_OBJECT(aObject)));
|
||||
*aParent = OBJECT_TO_JSVAL(parent);
|
||||
|
||||
// Outerize if necessary.
|
||||
|
@ -625,7 +625,11 @@ static JSObject*
|
||||
NewOuterWindowProxy(JSContext *cx, JSObject *parent)
|
||||
{
|
||||
JSAutoCompartment ac(cx, parent);
|
||||
JSObject *obj = js::Wrapper::New(cx, parent, js::GetObjectProto(parent), parent,
|
||||
JSObject *proto;
|
||||
if (!js::GetObjectProto(cx, parent, &proto))
|
||||
return nullptr;
|
||||
|
||||
JSObject *obj = js::Wrapper::New(cx, parent, proto, parent,
|
||||
&nsOuterWindowProxy::singleton);
|
||||
NS_ASSERTION(js::GetObjectClass(obj)->ext.innerObject, "bad class");
|
||||
return obj;
|
||||
@ -1683,7 +1687,11 @@ nsGlobalWindow::SetOuterObject(JSContext* aCx, JSObject* aOuterObject)
|
||||
|
||||
// Set up the prototype for the outer object.
|
||||
JSObject* inner = JS_GetParent(aOuterObject);
|
||||
JS_SetPrototype(aCx, aOuterObject, JS_GetPrototype(inner));
|
||||
JSObject* proto;
|
||||
if (!JS_GetPrototype(aCx, inner, &proto)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
JS_SetPrototype(aCx, aOuterObject, proto);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
@ -1852,7 +1860,9 @@ nsGlobalWindow::SetNewDocument(nsIDocument* aDocument,
|
||||
|
||||
if (aDocument != oldDoc) {
|
||||
xpc_UnmarkGrayObject(currentInner->mJSObject);
|
||||
nsWindowSH::InvalidateGlobalScopePolluter(cx, currentInner->mJSObject);
|
||||
if (!nsWindowSH::InvalidateGlobalScopePolluter(cx, currentInner->mJSObject)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
// We're reusing the inner window, but this still counts as a navigation,
|
||||
@ -1988,7 +1998,8 @@ nsGlobalWindow::SetNewDocument(nsIDocument* aDocument,
|
||||
|
||||
JS_SetParent(cx, mJSObject, newInnerWindow->mJSObject);
|
||||
|
||||
SetOuterObject(cx, mJSObject);
|
||||
rv = SetOuterObject(cx, mJSObject);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
JSCompartment *compartment = js::GetObjectCompartment(mJSObject);
|
||||
xpc::CompartmentPrivate *priv =
|
||||
@ -2045,9 +2056,13 @@ nsGlobalWindow::SetNewDocument(nsIDocument* aDocument,
|
||||
// the global object's compartment as its default compartment,
|
||||
// so update that now since it might have changed.
|
||||
JS_SetGlobalObject(cx, mJSObject);
|
||||
NS_ASSERTION(JS_GetPrototype(mJSObject) ==
|
||||
JS_GetPrototype(newInnerJSObject),
|
||||
#ifdef DEBUG
|
||||
JSObject *proto1, *proto2;
|
||||
JS_GetPrototype(cx, mJSObject, &proto1);
|
||||
JS_GetPrototype(cx, newInnerJSObject, &proto2);
|
||||
NS_ASSERTION(proto1 == proto2,
|
||||
"outer and inner globals should have the same prototype");
|
||||
#endif
|
||||
|
||||
nsCOMPtr<nsIContent> frame = do_QueryInterface(GetFrameElementInternal());
|
||||
if (frame) {
|
||||
|
@ -1307,7 +1307,7 @@ nsJSContext::EvaluateStringWithValue(const nsAString& aScript,
|
||||
options.setFileAndLine(aURL, aLineNo)
|
||||
.setVersion(JSVersion(aVersion))
|
||||
.setPrincipals(nsJSPrincipals::get(principal));
|
||||
JS::RootedObject rootedScope(mContext, aScopeObject);
|
||||
js::RootedObject rootedScope(mContext, aScopeObject);
|
||||
ok = JS::Evaluate(mContext, rootedScope, options, PromiseFlatString(aScript).get(),
|
||||
aScript.Length(), &val);
|
||||
|
||||
@ -1495,7 +1495,7 @@ nsJSContext::EvaluateString(const nsAString& aScript,
|
||||
XPCAutoRequest ar(mContext);
|
||||
JSAutoCompartment ac(mContext, aScopeObject);
|
||||
|
||||
JS::RootedObject rootedScope(mContext, aScopeObject);
|
||||
js::RootedObject rootedScope(mContext, aScopeObject);
|
||||
JS::CompileOptions options(mContext);
|
||||
options.setFileAndLine(aURL, aLineNo)
|
||||
.setPrincipals(nsJSPrincipals::get(principal))
|
||||
@ -1585,7 +1585,7 @@ nsJSContext::CompileScript(const PRUnichar* aText,
|
||||
.setFileAndLine(aURL, aLineNo)
|
||||
.setVersion(JSVersion(aVersion))
|
||||
.setSourcePolicy(sp);
|
||||
JS::RootedObject rootedScope(mContext, scopeObject);
|
||||
js::RootedObject rootedScope(mContext, scopeObject);
|
||||
JSScript* script = JS::Compile(mContext,
|
||||
rootedScope,
|
||||
options,
|
||||
@ -1763,7 +1763,7 @@ nsJSContext::CompileEventHandler(nsIAtom *aName,
|
||||
JS::CompileOptions options(mContext);
|
||||
options.setVersion(JSVersion(aVersion))
|
||||
.setFileAndLine(aURL, aLineNo);
|
||||
JS::RootedObject empty(mContext, NULL);
|
||||
js::RootedObject empty(mContext, NULL);
|
||||
JSFunction* fun = JS::CompileFunction(mContext, empty, options, nsAtomCString(aName).get(),
|
||||
aArgCount, aArgNames,
|
||||
PromiseFlatString(aBody).get(), aBody.Length());
|
||||
@ -1816,7 +1816,7 @@ nsJSContext::CompileFunction(JSObject* aTarget,
|
||||
}
|
||||
}
|
||||
|
||||
JS::RootedObject target(mContext, aShared ? NULL : aTarget);
|
||||
js::RootedObject target(mContext, aShared ? NULL : aTarget);
|
||||
|
||||
XPCAutoRequest ar(mContext);
|
||||
|
||||
|
@ -591,7 +591,10 @@ bool
|
||||
GetPropertyOnPrototype(JSContext* cx, JSObject* proxy, jsid id, bool* found,
|
||||
JS::Value* vp)
|
||||
{
|
||||
JSObject* proto = js::GetObjectProto(proxy);
|
||||
JSObject* proto;
|
||||
if (!js::GetObjectProto(cx, proxy, &proto)) {
|
||||
return false;
|
||||
}
|
||||
if (!proto) {
|
||||
*found = false;
|
||||
return true;
|
||||
|
@ -759,13 +759,16 @@ class CGClassHasInstanceHook(CGAbstractStaticMethod):
|
||||
JSObject *objProto = &protov.toObject();
|
||||
|
||||
JSObject* instance = &vp.toObject();
|
||||
JSObject* proto = JS_GetPrototype(instance);
|
||||
JSObject* proto;
|
||||
if (!JS_GetPrototype(cx, instance, &proto))
|
||||
return false;
|
||||
while (proto) {
|
||||
if (proto == objProto) {
|
||||
*bp = true;
|
||||
return true;
|
||||
}
|
||||
proto = JS_GetPrototype(proto);
|
||||
if (!JS_GetPrototype(cx, proto, &proto))
|
||||
return false;
|
||||
}
|
||||
|
||||
nsISupports* native =
|
||||
@ -3450,7 +3453,7 @@ class CGAbstractBindingMethod(CGAbstractStaticMethod):
|
||||
|
||||
def getThis(self):
|
||||
return CGIndenter(
|
||||
CGGeneric("JS::RootedObject obj(cx, JS_THIS_OBJECT(cx, vp));\n"
|
||||
CGGeneric("js::RootedObject obj(cx, JS_THIS_OBJECT(cx, vp));\n"
|
||||
"if (!obj) {\n"
|
||||
" return false;\n"
|
||||
"}\n"
|
||||
@ -5017,7 +5020,10 @@ if (expando) {
|
||||
""" + get + """
|
||||
// No need to worry about name getters here, so just check the proto.
|
||||
|
||||
JSObject *proto = js::GetObjectProto(proxy);
|
||||
JSObject *proto;
|
||||
if (!js::GetObjectProto(cx, proxy, &proto)) {
|
||||
return false;
|
||||
}
|
||||
if (proto) {
|
||||
JSBool isPresent;
|
||||
if (!JS_GetElementIfPresent(cx, proto, index, proxy, vp, &isPresent)) {
|
||||
|
@ -97,7 +97,10 @@ DOMProxyHandler::getPropertyDescriptor(JSContext* cx, JSObject* proxy, jsid id,
|
||||
return true;
|
||||
}
|
||||
|
||||
JSObject* proto = js::GetObjectProto(proxy);
|
||||
JSObject* proto;
|
||||
if (!js::GetObjectProto(cx, proxy, &proto)) {
|
||||
return false;
|
||||
}
|
||||
if (!proto) {
|
||||
desc->obj = NULL;
|
||||
return true;
|
||||
@ -151,7 +154,10 @@ DOMProxyHandler::delete_(JSContext* cx, JSObject* proxy, jsid id, bool* bp)
|
||||
bool
|
||||
DOMProxyHandler::enumerate(JSContext* cx, JSObject* proxy, AutoIdVector& props)
|
||||
{
|
||||
JSObject* proto = JS_GetPrototype(proxy);
|
||||
JSObject* proto;
|
||||
if (!JS_GetPrototype(cx, proxy, &proto)) {
|
||||
return false;
|
||||
}
|
||||
return getOwnPropertyNames(cx, proxy, props) &&
|
||||
(!proto || js::GetPropertyNames(cx, proto, 0, &props));
|
||||
}
|
||||
@ -177,7 +183,10 @@ DOMProxyHandler::has(JSContext* cx, JSObject* proxy, jsid id, bool* bp)
|
||||
}
|
||||
|
||||
// OK, now we have to look at the proto
|
||||
JSObject *proto = js::GetObjectProto(proxy);
|
||||
JSObject *proto;
|
||||
if (!js::GetObjectProto(cx, proxy, &proto)) {
|
||||
return false;
|
||||
}
|
||||
if (!proto) {
|
||||
return true;
|
||||
}
|
||||
|
80
dom/bluetooth/BluetoothHfpManager.cpp
Normal file
80
dom/bluetooth/BluetoothHfpManager.cpp
Normal file
@ -0,0 +1,80 @@
|
||||
/* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
|
||||
/* vim: set ts=2 et sw=2 tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "BluetoothHfpManager.h"
|
||||
|
||||
#include "BluetoothReplyRunnable.h"
|
||||
#include "BluetoothService.h"
|
||||
#include "BluetoothServiceUuid.h"
|
||||
|
||||
USING_BLUETOOTH_NAMESPACE
|
||||
using namespace mozilla::ipc;
|
||||
|
||||
static nsRefPtr<BluetoothHfpManager> sInstance = nullptr;
|
||||
|
||||
BluetoothHfpManager::BluetoothHfpManager()
|
||||
{
|
||||
}
|
||||
|
||||
BluetoothHfpManager::~BluetoothHfpManager()
|
||||
{
|
||||
}
|
||||
|
||||
//static
|
||||
BluetoothHfpManager*
|
||||
BluetoothHfpManager::Get()
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
if (sInstance == nullptr) {
|
||||
sInstance = new BluetoothHfpManager();
|
||||
}
|
||||
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
// Virtual function of class SocketConsumer
|
||||
void
|
||||
BluetoothHfpManager::ReceiveSocketData(UnixSocketRawData* aMessage)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
}
|
||||
|
||||
bool
|
||||
BluetoothHfpManager::Connect(const nsAString& aDeviceObjectPath,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
BluetoothService* bs = BluetoothService::Get();
|
||||
if (!bs) {
|
||||
NS_WARNING("BluetoothService not available!");
|
||||
return false;
|
||||
}
|
||||
|
||||
nsString serviceUuidStr =
|
||||
NS_ConvertUTF8toUTF16(mozilla::dom::bluetooth::BluetoothServiceUuidStr::Handsfree);
|
||||
|
||||
nsRefPtr<BluetoothReplyRunnable> runnable = aRunnable;
|
||||
|
||||
nsresult rv = bs->GetSocketViaService(aDeviceObjectPath,
|
||||
serviceUuidStr,
|
||||
BluetoothSocketType::RFCOMM,
|
||||
true,
|
||||
false,
|
||||
this,
|
||||
runnable);
|
||||
|
||||
runnable.forget();
|
||||
return NS_FAILED(rv) ? false : true;
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothHfpManager::Disconnect()
|
||||
{
|
||||
CloseSocket();
|
||||
}
|
||||
|
35
dom/bluetooth/BluetoothHfpManager.h
Normal file
35
dom/bluetooth/BluetoothHfpManager.h
Normal file
@ -0,0 +1,35 @@
|
||||
/* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
|
||||
/* vim: set ts=2 et sw=2 tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef mozilla_dom_bluetooth_bluetoothhfpmanager_h__
|
||||
#define mozilla_dom_bluetooth_bluetoothhfpmanager_h__
|
||||
|
||||
#include "BluetoothCommon.h"
|
||||
#include "mozilla/ipc/UnixSocket.h"
|
||||
|
||||
BEGIN_BLUETOOTH_NAMESPACE
|
||||
|
||||
class BluetoothReplyRunnable;
|
||||
|
||||
class BluetoothHfpManager : public mozilla::ipc::UnixSocketConsumer
|
||||
{
|
||||
public:
|
||||
~BluetoothHfpManager();
|
||||
|
||||
static BluetoothHfpManager* Get();
|
||||
void ReceiveSocketData(mozilla::ipc::UnixSocketRawData* aMessage);
|
||||
|
||||
bool Connect(const nsAString& aDeviceObjectPath,
|
||||
BluetoothReplyRunnable* aRunnable);
|
||||
void Disconnect();
|
||||
|
||||
private:
|
||||
BluetoothHfpManager();
|
||||
};
|
||||
|
||||
END_BLUETOOTH_NAMESPACE
|
||||
|
||||
#endif
|
@ -52,6 +52,7 @@ CPPSRCS += \
|
||||
BluetoothParent.cpp \
|
||||
BluetoothServiceChildProcess.cpp \
|
||||
BluetoothUnixSocketConnector.cpp \
|
||||
BluetoothHfpManager.cpp \
|
||||
$(NULL)
|
||||
|
||||
XPIDLSRCS = \
|
||||
|
@ -46,13 +46,10 @@ DOMFMRadioChild.prototype = {
|
||||
|
||||
// nsIDOMGlobalPropertyInitializer implementation
|
||||
init: function(aWindow) {
|
||||
let principal = aWindow.document.nodePrincipal;
|
||||
let secMan = Cc["@mozilla.org/scriptsecuritymanager;1"]
|
||||
.getService(Ci.nsIScriptSecurityManager);
|
||||
|
||||
let perm = (principal == secMan.getSystemPrincipal()) ?
|
||||
Ci.nsIPermissionManager.ALLOW_ACTION :
|
||||
Services.perms.testExactPermission(principal.URI, "fmradio");
|
||||
let perm = Services.perms.testExactPermissionFromPrincipal(aWindow.document.nodePrincipal, "fmradio");
|
||||
this._hasPrivileges = perm == Ci.nsIPermissionManager.ALLOW_ACTION;
|
||||
|
||||
if (!this._hasPrivileges) {
|
||||
|
@ -348,7 +348,7 @@ KeyPath::ExtractKeyAsJSVal(JSContext* aCx, const JS::Value& aValue,
|
||||
}
|
||||
|
||||
const uint32_t len = mStrings.Length();
|
||||
JS::RootedObject arrayObj(aCx, JS_NewArrayObject(aCx, len, nullptr));
|
||||
js::RootedObject arrayObj(aCx, JS_NewArrayObject(aCx, len, nullptr));
|
||||
if (!arrayObj) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
@ -50,12 +50,24 @@ SystemMessageInternal.prototype = {
|
||||
sendMessage: function sendMessage(aType, aMessage, aPageURI, aManifestURI) {
|
||||
debug("Broadcasting " + aType + " " + JSON.stringify(aMessage));
|
||||
if (this._listeners[aManifestURI.spec]) {
|
||||
this._listeners[aManifestURI.spec].forEach(function sendMsg(aListener) {
|
||||
aListener.sendAsyncMessage("SystemMessageManager:Message",
|
||||
{ type: aType,
|
||||
msg: aMessage,
|
||||
manifest: aManifestURI.spec })
|
||||
});
|
||||
let i;
|
||||
let listener;
|
||||
for (i = this._listeners[aManifestURI.spec].length - 1; i >= 0; i -= 1) {
|
||||
listener = this._listeners[aManifestURI.spec][i];
|
||||
try {
|
||||
listener.sendAsyncMessage("SystemMessageManager:Message",
|
||||
{ type: aType,
|
||||
msg: aMessage,
|
||||
manifest: aManifestURI.spec })
|
||||
} catch (e) {
|
||||
// Remove once 777508 lands.
|
||||
let index;
|
||||
if ((index = this._listeners[aManifestURI.spec].indexOf(listener)) != -1) {
|
||||
this._listeners[aManifestURI.spec].splice(index, 1);
|
||||
dump("Remove dead MessageManager!\n");
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
this._pages.forEach(function sendMess_openPage(aPage) {
|
||||
@ -75,12 +87,23 @@ SystemMessageInternal.prototype = {
|
||||
this._pages.forEach(function(aPage) {
|
||||
if (aPage.type == aType) {
|
||||
if (this._listeners[aPage.manifest]) {
|
||||
this._listeners[aPage.manifest].forEach(function sendMsg(aListener) {
|
||||
aListener.sendAsyncMessage("SystemMessageManager:Message",
|
||||
{ type: aType,
|
||||
msg: aMessage,
|
||||
manifest: aPage.manifest})
|
||||
});
|
||||
let i;
|
||||
for (i = this._listeners[aPage.manifest].length - 1; i >= 0; i -= 1) {
|
||||
let listener = this._listeners[aPage.manifest][i];
|
||||
try {
|
||||
listener.sendAsyncMessage("SystemMessageManager:Message",
|
||||
{ type: aType,
|
||||
msg: aMessage,
|
||||
manifest: aPage.manifest})
|
||||
} catch (e) {
|
||||
// Remove once 777508 lands.
|
||||
let index;
|
||||
if ((index = this._listeners[aPage.manifest].indexOf(listener)) != -1) {
|
||||
this._listeners[aPage.manifest].splice(index, 1);
|
||||
dump("Remove dead MessageManager!\n");
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
this._processPage(aPage, aMessage);
|
||||
}
|
||||
|
@ -58,6 +58,9 @@ jclass anp_system_loadJavaClass(NPP instance, const char* className)
|
||||
jstring jclassName = env->NewStringUTF(className);
|
||||
jstring jlibName = env->NewStringUTF(libName.get());
|
||||
jobject obj = env->CallStaticObjectMethod(cls, method, jclassName, jlibName);
|
||||
env->DeleteLocalRef(jlibName);
|
||||
env->DeleteLocalRef(jclassName);
|
||||
env->DeleteLocalRef(cls);
|
||||
return reinterpret_cast<jclass>(obj);
|
||||
}
|
||||
|
||||
|
@ -1142,7 +1142,9 @@ GetNPObjectWrapper(JSContext *cx, JSObject *obj, bool wrapResult = true)
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
obj = ::JS_GetPrototype(obj);
|
||||
if (!::JS_GetPrototype(cx, obj, &obj)) {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
@ -2054,12 +2056,20 @@ nsJSNPRuntime::OnPluginDestroy(NPP npp)
|
||||
// be only one, but remove all instances found in case the page put
|
||||
// more than one of the plugin's scriptable objects on the prototype
|
||||
// chain).
|
||||
while (obj && (proto = ::JS_GetPrototype(obj))) {
|
||||
while (obj) {
|
||||
if (!::JS_GetPrototype(cx, obj, &proto)) {
|
||||
return;
|
||||
}
|
||||
if (!proto) {
|
||||
break;
|
||||
}
|
||||
// Unwrap while checking the jsclass - if the prototype is a wrapper for
|
||||
// an NP object, that counts too.
|
||||
if (JS_GetClass(js::UnwrapObject(proto)) == &sNPObjectJSWrapperClass) {
|
||||
// We found an NPObject on the proto chain, get its prototype...
|
||||
proto = ::JS_GetPrototype(proto);
|
||||
if (!::JS_GetPrototype(cx, proto, &proto)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// ... and pull it out of the chain.
|
||||
::JS_SetPrototype(cx, obj, proto);
|
||||
|
@ -2223,6 +2223,7 @@ _getvalue(NPP npp, NPNVariable variable, void *result)
|
||||
jfieldID field = env->GetStaticFieldID(cls, "mAppContext",
|
||||
"Lorg/mozilla/gecko/GeckoApp;");
|
||||
jobject ret = env->GetStaticObjectField(cls, field);
|
||||
env->DeleteLocalRef(cls);
|
||||
int32_t* i = reinterpret_cast<int32_t*>(result);
|
||||
*i = reinterpret_cast<int32_t>(ret);
|
||||
return NPERR_NO_ERROR;
|
||||
|
@ -6,3 +6,4 @@ qemu = true
|
||||
[test_between_emulators.py]
|
||||
[test_incoming.js]
|
||||
[test_outgoing.js]
|
||||
[test_message_classes.js]
|
||||
|
235
dom/sms/tests/marionette/test_message_classes.js
Normal file
235
dom/sms/tests/marionette/test_message_classes.js
Normal file
@ -0,0 +1,235 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
MARIONETTE_TIMEOUT = 60000;
|
||||
|
||||
const PDU_SMSC = "00"; // No SMSC Address
|
||||
const PDU_FIRST_OCTET = "00"; // RP:no, UDHI:no, SRI:no, MMS:no, MTI:SMS-DELIVER
|
||||
const PDU_SENDER = "0191F1"; // +1
|
||||
const PDU_PID_NORMAL = "00";
|
||||
const PDU_PID_ANSI_136_R_DATA = "7C";
|
||||
const PDU_PID_USIM_DATA_DOWNLOAD = "7F";
|
||||
const PDU_TIMESTAMP = "00101000000000"; // 2000/01/01
|
||||
const PDU_UDL = "01";
|
||||
const PDU_UD = "41";
|
||||
|
||||
SpecialPowers.addPermission("sms", true, document);
|
||||
|
||||
let sms = window.navigator.mozSms;
|
||||
ok(sms instanceof MozSmsManager);
|
||||
|
||||
let pendingEmulatorCmdCount = 0;
|
||||
function sendSmsPduToEmulator(pdu) {
|
||||
++pendingEmulatorCmdCount;
|
||||
|
||||
let cmd = "sms pdu " + pdu;
|
||||
runEmulatorCmd(cmd, function (result) {
|
||||
--pendingEmulatorCmdCount;
|
||||
|
||||
is(result[0], "OK", "Emulator response");
|
||||
});
|
||||
}
|
||||
|
||||
const TIMESTAMP = Date.UTC(2000, 0, 1);
|
||||
function checkMessage(message, id) {
|
||||
ok(message instanceof MozSmsMessage,
|
||||
"message is instanceof " + message.constructor);
|
||||
if (id == null) {
|
||||
ok(message.id > 0, "message.id");
|
||||
} else {
|
||||
is(message.id, -1, "message.id");
|
||||
}
|
||||
is(message.delivery, "received", "message.delivery");
|
||||
is(message.sender, "+1", "message.sender");
|
||||
is(message.body, "A", "message.body");
|
||||
ok(message.timestamp instanceof Date,
|
||||
"message.timestamp is instanceof " + message.timestamp.constructor);
|
||||
is(message.timestamp.getTime(), TIMESTAMP, "message.timestamp");
|
||||
is(message.read, false, "message.read");
|
||||
}
|
||||
|
||||
function test_message_class_0() {
|
||||
let allDCSs = [
|
||||
"10", // General Group: 00xx
|
||||
"50", // Automatica Deletion Group: 01xx
|
||||
"F0" // (no name) Group: 1111
|
||||
];
|
||||
|
||||
function do_test(dcsIndex) {
|
||||
sms.addEventListener("received", function onReceived(event) {
|
||||
sms.removeEventListener("received", onReceived);
|
||||
|
||||
let message = event.message;
|
||||
checkMessage(message, -1);
|
||||
|
||||
// Make sure the message is not stored.
|
||||
let request = sms.getMessages(null, false);
|
||||
request.onsuccess = function onsuccess() {
|
||||
let cursor = request.result;
|
||||
if (cursor.message) {
|
||||
// Here we check whether there is any message of the same sender.
|
||||
isnot(cursor.message.sender, message.sender, "cursor.message.sender");
|
||||
|
||||
cursor.continue();
|
||||
return;
|
||||
}
|
||||
|
||||
// All messages checked. Done.
|
||||
++dcsIndex;
|
||||
if (dcsIndex >= allDCSs.length) {
|
||||
window.setTimeout(test_message_class_1, 0);
|
||||
} else {
|
||||
window.setTimeout(do_test.bind(null, dcsIndex), 0);
|
||||
}
|
||||
};
|
||||
request.onerror = function onerror() {
|
||||
ok(false, "Can't fetch messages from SMS database");
|
||||
};
|
||||
});
|
||||
|
||||
let dcs = allDCSs[dcsIndex];
|
||||
log(" Testing DCS " + dcs);
|
||||
let pdu = PDU_SMSC + PDU_FIRST_OCTET + PDU_SENDER + PDU_PID_NORMAL +
|
||||
dcs + PDU_TIMESTAMP + PDU_UDL + PDU_UD;
|
||||
|
||||
sendSmsPduToEmulator(pdu);
|
||||
}
|
||||
|
||||
log("Checking Message Class 0");
|
||||
do_test(0);
|
||||
}
|
||||
|
||||
function doTestMessageClassGeneric(allDCSs, next) {
|
||||
function do_test(dcsIndex) {
|
||||
sms.addEventListener("received", function onReceived(event) {
|
||||
sms.removeEventListener("received", onReceived);
|
||||
|
||||
// Make sure we can correctly receive the message
|
||||
checkMessage(event.message);
|
||||
|
||||
++dcsIndex;
|
||||
if (dcsIndex >= allDCSs.length) {
|
||||
window.setTimeout(next, 0);
|
||||
} else {
|
||||
window.setTimeout(do_test.bind(null, dcsIndex), 0);
|
||||
}
|
||||
});
|
||||
|
||||
let dcs = allDCSs[dcsIndex];
|
||||
log(" Testing DCS " + dcs);
|
||||
let pdu = PDU_SMSC + PDU_FIRST_OCTET + PDU_SENDER + PDU_PID_NORMAL +
|
||||
dcs + PDU_TIMESTAMP + PDU_UDL + PDU_UD;
|
||||
|
||||
sendSmsPduToEmulator(pdu);
|
||||
}
|
||||
|
||||
do_test(0);
|
||||
}
|
||||
|
||||
function test_message_class_1() {
|
||||
let allDCSs = [
|
||||
"11", // General Group: 00xx
|
||||
"51", // Automatica Deletion Group: 01xx
|
||||
"F1" // (no name) Group: 1111
|
||||
];
|
||||
|
||||
log("Checking Message Class 1");
|
||||
doTestMessageClassGeneric(allDCSs, test_message_class_2);
|
||||
}
|
||||
|
||||
function test_message_class_2() {
|
||||
let allDCSs = [
|
||||
"12", // General Group: 00xx
|
||||
"52", // Automatica Deletion Group: 01xx
|
||||
"F2" // (no name) Group: 1111
|
||||
];
|
||||
|
||||
let allPIDs = [
|
||||
PDU_PID_NORMAL,
|
||||
PDU_PID_ANSI_136_R_DATA,
|
||||
PDU_PID_USIM_DATA_DOWNLOAD
|
||||
];
|
||||
|
||||
function do_test_dcs(dcsIndex) {
|
||||
function do_test_pid(pidIndex) {
|
||||
function onReceived(event) {
|
||||
if (pidIndex == 0) {
|
||||
// Make sure we can correctly receive the message
|
||||
checkMessage(event.message);
|
||||
|
||||
next();
|
||||
return;
|
||||
}
|
||||
|
||||
// TODO: Bug 792798 - B2G SMS: develop test cases for Message Class 2
|
||||
// Since we have "data download via SMS Point-to-Point" service enabled
|
||||
// but no working implementation in emulator SIM, all class 2 messages
|
||||
// bug normal ones should goto `dataDownloadViaSMSPP()` and we should
|
||||
// not receive the message in content page.
|
||||
ok(false, "SMS-PP messages shouldn't be sent to content");
|
||||
}
|
||||
|
||||
function next() {
|
||||
sms.removeEventListener("received", onReceived);
|
||||
|
||||
++pidIndex;
|
||||
if (pidIndex >= allPIDs.length) {
|
||||
++dcsIndex;
|
||||
if (dcsIndex >= allDCSs.length) {
|
||||
window.setTimeout(test_message_class_3, 0);
|
||||
} else {
|
||||
window.setTimeout(do_test_dcs.bind(null, dcsIndex), 0);
|
||||
}
|
||||
} else {
|
||||
window.setTimeout(do_test_pid.bind(null, pidIndex), 0);
|
||||
}
|
||||
}
|
||||
|
||||
sms.addEventListener("received", onReceived);
|
||||
|
||||
if (pidIndex != 0) {
|
||||
// Wait for three seconds to ensure we don't receive the message.
|
||||
window.setTimeout(next, 3000);
|
||||
}
|
||||
|
||||
let pid = allPIDs[pidIndex];
|
||||
log(" Testing PID " + pid);
|
||||
|
||||
let pdu = PDU_SMSC + PDU_FIRST_OCTET + PDU_SENDER + pid + dcs +
|
||||
PDU_TIMESTAMP + PDU_UDL + PDU_UD;
|
||||
|
||||
sendSmsPduToEmulator(pdu);
|
||||
}
|
||||
|
||||
let dcs = allDCSs[dcsIndex];
|
||||
log(" Testing DCS " + dcs);
|
||||
|
||||
do_test_pid(0);
|
||||
}
|
||||
|
||||
log("Checking Message Class 2");
|
||||
do_test_dcs(0);
|
||||
}
|
||||
|
||||
function test_message_class_3() {
|
||||
let allDCSs = [
|
||||
"13", // General Group: 00xx
|
||||
"53", // Automatica Deletion Group: 01xx
|
||||
"F3" // (no name) Group: 1111
|
||||
];
|
||||
|
||||
log("Checking Message Class 3");
|
||||
doTestMessageClassGeneric(allDCSs, cleanUp);
|
||||
}
|
||||
|
||||
function cleanUp() {
|
||||
if (pendingEmulatorCmdCount) {
|
||||
window.setTimeout(cleanUp, 100);
|
||||
return;
|
||||
}
|
||||
|
||||
SpecialPowers.removePermission("sms", document);
|
||||
finish();
|
||||
}
|
||||
|
||||
test_message_class_0();
|
@ -500,7 +500,7 @@ nsJSON::LegacyDecodeToJSVal(const nsAString &str, JSContext *cx, jsval *result)
|
||||
{
|
||||
JSAutoRequest ar(cx);
|
||||
|
||||
JS::RootedValue reviver(cx, JS::NullValue()), value(cx);
|
||||
js::RootedValue reviver(cx, JS::NullValue()), value(cx);
|
||||
|
||||
if (!js::ParseJSONWithReviver(cx, static_cast<const jschar*>(PromiseFlatString(str).get()),
|
||||
str.Length(), reviver,
|
||||
@ -570,7 +570,7 @@ nsJSONListener::OnStopRequest(nsIRequest *aRequest, nsISupports *aContext,
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
JS::RootedValue reviver(mCx, JS::NullValue()), value(mCx);
|
||||
js::RootedValue reviver(mCx, JS::NullValue()), value(mCx);
|
||||
|
||||
const jschar* chars = reinterpret_cast<const jschar*>(mBufferedChars.Elements());
|
||||
JSBool ok = js::ParseJSONWithReviver(mCx, chars,
|
||||
|
@ -146,6 +146,8 @@ function NetworkManager() {
|
||||
settingsLock.get(SETTINGS_USB_PREFIX, this);
|
||||
settingsLock.get(SETTINGS_USB_DHCPSERVER_STARTIP, this);
|
||||
settingsLock.get(SETTINGS_USB_DHCPSERVER_ENDIP, this);
|
||||
|
||||
this.setAndConfigureActive();
|
||||
}
|
||||
NetworkManager.prototype = {
|
||||
classID: NETWORKMANAGER_CID,
|
||||
@ -172,8 +174,9 @@ NetworkManager.prototype = {
|
||||
debug("Network " + network.name + " changed state to " + network.state);
|
||||
switch (network.state) {
|
||||
case Ci.nsINetworkInterface.NETWORK_STATE_CONNECTED:
|
||||
// Add host route on secondary APN
|
||||
if (network.type == Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_MMS ||
|
||||
// Add host route for data calls
|
||||
if (network.type == Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE ||
|
||||
network.type == Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_MMS ||
|
||||
network.type == Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_SUPL) {
|
||||
this.addHostRoute(network);
|
||||
}
|
||||
@ -183,8 +186,9 @@ NetworkManager.prototype = {
|
||||
this.setAndConfigureActive();
|
||||
break;
|
||||
case Ci.nsINetworkInterface.NETWORK_STATE_DISCONNECTED:
|
||||
// Remove host route on secondary APN
|
||||
if (network.type == Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_MMS ||
|
||||
// Remove host route for data calls
|
||||
if (network.type == Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE ||
|
||||
network.type == Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_MMS ||
|
||||
network.type == Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_SUPL) {
|
||||
this.removeHostRoute(network);
|
||||
}
|
||||
@ -216,8 +220,9 @@ NetworkManager.prototype = {
|
||||
Cr.NS_ERROR_INVALID_ARG);
|
||||
}
|
||||
this.networkInterfaces[network.name] = network;
|
||||
// Add host route on secondary APN
|
||||
if (network.type == Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_MMS ||
|
||||
// Add host route for data calls
|
||||
if (network.type == Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE ||
|
||||
network.type == Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_MMS ||
|
||||
network.type == Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_SUPL) {
|
||||
this.addHostRoute(network);
|
||||
}
|
||||
@ -239,8 +244,9 @@ NetworkManager.prototype = {
|
||||
Cr.NS_ERROR_INVALID_ARG);
|
||||
}
|
||||
delete this.networkInterfaces[network.name];
|
||||
// Remove host route on secondary APN
|
||||
if (network.type == Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_MMS ||
|
||||
// Remove host route for data calls
|
||||
if (network.type == Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE ||
|
||||
network.type == Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_MMS ||
|
||||
network.type == Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_SUPL) {
|
||||
this.removeHostRoute(network);
|
||||
}
|
||||
@ -258,7 +264,8 @@ NetworkManager.prototype = {
|
||||
set preferredNetworkType(val) {
|
||||
if ([Ci.nsINetworkInterface.NETWORK_TYPE_WIFI,
|
||||
Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE,
|
||||
Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_MMS].indexOf(val) == -1) {
|
||||
Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_MMS,
|
||||
Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_SUPL].indexOf(val) == -1) {
|
||||
throw "Invalid network type";
|
||||
}
|
||||
this._preferredNetworkType = val;
|
||||
|
@ -28,6 +28,8 @@ const DEBUG = RIL.DEBUG_RIL;
|
||||
|
||||
const RADIOINTERFACELAYER_CID =
|
||||
Components.ID("{2d831c8d-6017-435b-a80c-e5d422810cea}");
|
||||
const RILNETWORKINTERFACE_CID =
|
||||
Components.ID("{3bdd52a9-3965-4130-b569-0ac5afed045e}");
|
||||
|
||||
const nsIAudioManager = Ci.nsIAudioManager;
|
||||
const nsIRadioInterfaceLayer = Ci.nsIRadioInterfaceLayer;
|
||||
@ -93,6 +95,10 @@ XPCOMUtils.defineLazyServiceGetter(this, "gSystemMessenger",
|
||||
"@mozilla.org/system-message-internal;1",
|
||||
"nsISystemMessagesInternal");
|
||||
|
||||
XPCOMUtils.defineLazyServiceGetter(this, "gNetworkManager",
|
||||
"@mozilla.org/network/manager;1",
|
||||
"nsINetworkManager");
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "WAP", function () {
|
||||
let WAP = {};
|
||||
Cu.import("resource://gre/modules/WapPushManager.js", WAP);
|
||||
@ -150,6 +156,10 @@ XPCOMUtils.defineLazyGetter(this, "gAudioManager", function getAudioManager() {
|
||||
|
||||
|
||||
function RadioInterfaceLayer() {
|
||||
this.dataNetworkInterface = new RILNetworkInterface(this, Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE);
|
||||
this.mmsNetworkInterface = new RILNetworkInterface(this, Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_MMS);
|
||||
this.suplNetworkInterface = new RILNetworkInterface(this, Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_SUPL);
|
||||
|
||||
debug("Starting RIL Worker");
|
||||
this.worker = new ChromeWorker("resource://gre/modules/ril_worker.js");
|
||||
this.worker.onerror = this.onerror.bind(this);
|
||||
@ -189,7 +199,7 @@ function RadioInterfaceLayer() {
|
||||
let lock = gSettingsService.createLock();
|
||||
lock.get("ril.radio.disabled", this);
|
||||
|
||||
// Read the APN data form the setting DB.
|
||||
// Read the APN data from the settings DB.
|
||||
lock.get("ril.data.apn", this);
|
||||
lock.get("ril.data.user", this);
|
||||
lock.get("ril.data.passwd", this);
|
||||
@ -205,6 +215,21 @@ function RadioInterfaceLayer() {
|
||||
"ril.data.httpProxyHost",
|
||||
"ril.data.httpProxyPort"];
|
||||
|
||||
// Read secondary APNs from the settings DB.
|
||||
lock.get("ril.mms.apn", this);
|
||||
lock.get("ril.mms.user", this);
|
||||
lock.get("ril.mms.passwd", this);
|
||||
lock.get("ril.mms.httpProxyHost", this);
|
||||
lock.get("ril.mms.httpProxyPort", this);
|
||||
lock.get("ril.mms.mmsc", this);
|
||||
lock.get("ril.mms.mmsproxy", this);
|
||||
lock.get("ril.mms.mmsport", this);
|
||||
lock.get("ril.supl.apn", this);
|
||||
lock.get("ril.supl.user", this);
|
||||
lock.get("ril.supl.passwd", this);
|
||||
lock.get("ril.supl.httpProxyHost", this);
|
||||
lock.get("ril.supl.httpProxyPort", this);
|
||||
|
||||
// Read the desired setting of call waiting from the settings DB.
|
||||
lock.get("ril.callwaiting.enabled", this);
|
||||
|
||||
@ -619,7 +644,7 @@ RadioInterfaceLayer.prototype = {
|
||||
dataInfo.type = newInfo.type;
|
||||
// For the data connection, the `connected` flag indicates whether
|
||||
// there's an active data call.
|
||||
dataInfo.connected = RILNetworkInterface.connected;
|
||||
dataInfo.connected = this.dataNetworkInterface.connected;
|
||||
|
||||
// Make sure we also reset the operator and signal strength information
|
||||
// if we drop off the network.
|
||||
@ -646,14 +671,12 @@ RadioInterfaceLayer.prototype = {
|
||||
* Handle data errors
|
||||
*/
|
||||
handleDataCallError: function handleDataCallError(message) {
|
||||
if (message.apn != this.dataCallSettings["apn"]) {
|
||||
return;
|
||||
// Notify data call error only for data APN
|
||||
if (message.apn == this.dataCallSettings["apn"]) {
|
||||
ppmm.broadcastAsyncMessage("RIL:DataError", message);
|
||||
}
|
||||
|
||||
// 3G Network revoked the data connection, possible unavailable APN
|
||||
RILNetworkInterface.reset();
|
||||
// Notify datacall error
|
||||
ppmm.broadcastAsyncMessage("RIL:DataError", message);
|
||||
this._deliverDataCallCallback("dataCallError", [message]);
|
||||
},
|
||||
|
||||
handleSignalStrengthChange: function handleSignalStrengthChange(message) {
|
||||
@ -797,12 +820,18 @@ RadioInterfaceLayer.prototype = {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this.dataCallSettings["enabled"] && RILNetworkInterface.connected) {
|
||||
debug("Data call settings: disconnect data call.");
|
||||
RILNetworkInterface.disconnect();
|
||||
if (this.dataNetworkInterface.state == RIL.GECKO_NETWORK_STATE_CONNECTING ||
|
||||
this.dataNetworkInterface.state == RIL.GECKO_NETWORK_STATE_DISCONNECTING) {
|
||||
debug("Nothing to do during connecting/disconnecting in progress.");
|
||||
return;
|
||||
}
|
||||
if (!this.dataCallSettings["enabled"] || RILNetworkInterface.connected) {
|
||||
|
||||
if (!this.dataCallSettings["enabled"] && this.dataNetworkInterface.connected) {
|
||||
debug("Data call settings: disconnect data call.");
|
||||
this.dataNetworkInterface.disconnect();
|
||||
return;
|
||||
}
|
||||
if (!this.dataCallSettings["enabled"] || this.dataNetworkInterface.connected) {
|
||||
debug("Data call settings: nothing to do.");
|
||||
return;
|
||||
}
|
||||
@ -822,7 +851,7 @@ RadioInterfaceLayer.prototype = {
|
||||
}
|
||||
|
||||
debug("Data call settings: connect data call.");
|
||||
RILNetworkInterface.connect(this.dataCallSettings);
|
||||
this.dataNetworkInterface.connect(this.dataCallSettings);
|
||||
},
|
||||
|
||||
/**
|
||||
@ -1004,9 +1033,12 @@ RadioInterfaceLayer.prototype = {
|
||||
return;
|
||||
}
|
||||
|
||||
let id = gSmsDatabaseService.saveReceivedMessage(message.sender || null,
|
||||
message.fullBody || null,
|
||||
message.timestamp);
|
||||
let id = -1;
|
||||
if (message.messageClass != RIL.PDU_DCS_MSG_CLASS_0) {
|
||||
id = gSmsDatabaseService.saveReceivedMessage(message.sender || null,
|
||||
message.fullBody || null,
|
||||
message.timestamp);
|
||||
}
|
||||
let sms = gSmsService.createSmsMessage(id,
|
||||
DOM_SMS_DELIVERY_RECEIVED,
|
||||
message.sender || null,
|
||||
@ -1110,7 +1142,8 @@ RadioInterfaceLayer.prototype = {
|
||||
handleDataCallState: function handleDataCallState(datacall) {
|
||||
let data = this.rilContext.data;
|
||||
|
||||
if (datacall.ifname) {
|
||||
if (datacall.ifname &&
|
||||
datacall.apn == this.dataCallSettings["apn"]) {
|
||||
data.connected = (datacall.state == RIL.GECKO_NETWORK_STATE_CONNECTED);
|
||||
ppmm.broadcastAsyncMessage("RIL:DataInfoChanged", data);
|
||||
}
|
||||
@ -1189,7 +1222,10 @@ RadioInterfaceLayer.prototype = {
|
||||
for each (let msgname in RIL_IPC_MSG_NAMES) {
|
||||
ppmm.removeMessageListener(msgname, this);
|
||||
}
|
||||
RILNetworkInterface.shutdown();
|
||||
// Shutdown all RIL network interfaces
|
||||
this.dataNetworkInterface.shutdown();
|
||||
this.mmsNetworkInterface.shutdown();
|
||||
this.suplNetworkInterface.shutdown();
|
||||
ppmm = null;
|
||||
Services.obs.removeObserver(this, "xpcom-shutdown");
|
||||
Services.obs.removeObserver(this, kMozSettingsChangedObserverTopic);
|
||||
@ -1212,6 +1248,8 @@ RadioInterfaceLayer.prototype = {
|
||||
|
||||
// APN data for making data calls.
|
||||
dataCallSettings: {},
|
||||
dataCallSettingsMMS: {},
|
||||
dataCallSettingsSUPL: {},
|
||||
_dataCallSettingsToRead: [],
|
||||
_oldRilDataEnabledState: null,
|
||||
|
||||
@ -1242,6 +1280,25 @@ RadioInterfaceLayer.prototype = {
|
||||
}
|
||||
this.updateRILNetworkInterface();
|
||||
break;
|
||||
case "ril.mms.apn":
|
||||
case "ril.mms.user":
|
||||
case "ril.mms.passwd":
|
||||
case "ril.mms.httpProxyHost":
|
||||
case "ril.mms.httpProxyPort":
|
||||
case "ril.mms.mmsc":
|
||||
case "ril.mms.mmsproxy":
|
||||
case "ril.mms.mmsport":
|
||||
key = aName.slice(8);
|
||||
this.dataCallSettingsMMS[key] = aResult;
|
||||
break;
|
||||
case "ril.supl.apn":
|
||||
case "ril.supl.user":
|
||||
case "ril.supl.passwd":
|
||||
case "ril.supl.httpProxyHost":
|
||||
case "ril.supl.httpProxyPort":
|
||||
key = aName.slice(9);
|
||||
this.dataCallSettingsSUPL[key] = aResult;
|
||||
break;
|
||||
case "ril.callwaiting.enabled":
|
||||
this._callWaitingEnabled = aResult;
|
||||
this.setCallWaitingEnabled(this._callWaitingEnabled);
|
||||
@ -1838,6 +1895,74 @@ RadioInterfaceLayer.prototype = {
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Determine whether secondary APN goes through default APN.
|
||||
*/
|
||||
usingDefaultAPN: function usingDefaultAPN(apntype) {
|
||||
switch (apntype) {
|
||||
case "mms":
|
||||
return (this.dataCallSettingsMMS["apn"] == this.dataCallSettings["apn"]);
|
||||
case "supl":
|
||||
return (this.dataCallSettingsSUPL["apn"] == this.dataCallSettings["apn"]);
|
||||
return false;
|
||||
}
|
||||
},
|
||||
|
||||
setupDataCallByType: function setupDataCallByType(apntype) {
|
||||
if (apntype != "default" && this.usingDefaultAPN(apntype)) {
|
||||
debug("Secondary APN type " + apntype + " goes through default APN, nothing to do.");
|
||||
return;
|
||||
}
|
||||
switch (apntype) {
|
||||
case "default":
|
||||
this.dataNetworkInterface.connect(this.dataCallSettings);
|
||||
break;
|
||||
case "mms":
|
||||
this.mmsNetworkInterface.connect(this.dataCallSettingsMMS);
|
||||
break;
|
||||
case "supl":
|
||||
this.suplNetworkInterface.connect(this.dataCallSettingsSUPL);
|
||||
break;
|
||||
default:
|
||||
debug("Unsupported APN type " + apntype);
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
deactivateDataCallByType: function deactivateDataCallByType(apntype) {
|
||||
if (apntype != "default" && this.usingDefaultAPN(apntype)) {
|
||||
debug("Secondary APN type " + apntype + " goes through default APN, nothing to do.");
|
||||
return;
|
||||
}
|
||||
switch (apntype) {
|
||||
case "default":
|
||||
this.dataNetworkInterface.disconnect();
|
||||
break;
|
||||
case "mms":
|
||||
this.mmsNetworkInterface.disconnect();
|
||||
break;
|
||||
case "supl":
|
||||
this.suplNetworkInterface.disconnect();
|
||||
break;
|
||||
default:
|
||||
debug("Unsupported APN type " + apntype);
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
getDataCallStateByType: function getDataCallStateByType(apntype) {
|
||||
switch (apntype) {
|
||||
case "default":
|
||||
return this.dataNetworkInterface.state;
|
||||
case "mms":
|
||||
return this.mmsNetworkInterface.state;
|
||||
case "supl":
|
||||
return this.suplNetworkInterface.state;
|
||||
default:
|
||||
return RIL.GECKO_NETWORK_STATE_UNKNOWN;
|
||||
}
|
||||
},
|
||||
|
||||
setupDataCall: function setupDataCall(radioTech, apn, user, passwd, chappap, pdptype) {
|
||||
this.worker.postMessage({rilMessageType: "setupDataCall",
|
||||
radioTech: radioTech,
|
||||
@ -1886,8 +2011,18 @@ RadioInterfaceLayer.prototype = {
|
||||
}
|
||||
};
|
||||
|
||||
let RILNetworkInterface = {
|
||||
function RILNetworkInterface(ril, type)
|
||||
{
|
||||
this.mRIL = ril;
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
RILNetworkInterface.prototype = {
|
||||
classID: RILNETWORKINTERFACE_CID,
|
||||
classInfo: XPCOMUtils.generateCI({classID: RILNETWORKINTERFACE_CID,
|
||||
classDescription: "RILNetworkInterface",
|
||||
interfaces: [Ci.nsINetworkInterface,
|
||||
Ci.nsIRIODataCallback]}),
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsINetworkInterface,
|
||||
Ci.nsIRILDataCallback]),
|
||||
|
||||
@ -1939,8 +2074,20 @@ let RILNetworkInterface = {
|
||||
|
||||
// nsIRILDataCallback
|
||||
|
||||
dataCallError: function dataCallError(message) {
|
||||
if (message.apn != this.dataCallSettings["apn"]) {
|
||||
return;
|
||||
}
|
||||
debug("Data call error on APN: " + message.apn);
|
||||
this.reset();
|
||||
},
|
||||
|
||||
dataCallStateChanged: function dataCallStateChanged(datacall) {
|
||||
debug("Data call ID: " + datacall.cid + ", interface name: " + datacall.ifname);
|
||||
if (datacall.apn != this.dataCallSettings["apn"]) {
|
||||
return;
|
||||
}
|
||||
debug("Data call ID: " + datacall.cid + ", interface name: " +
|
||||
datacall.ifname + ", APN name: " + datacall.apn);
|
||||
if (this.connecting &&
|
||||
(datacall.state == RIL.GECKO_NETWORK_STATE_CONNECTING ||
|
||||
datacall.state == RIL.GECKO_NETWORK_STATE_CONNECTED)) {
|
||||
@ -1956,9 +2103,7 @@ let RILNetworkInterface = {
|
||||
this.dns2 = datacall.dns[1];
|
||||
}
|
||||
if (!this.registeredAsNetworkInterface) {
|
||||
let networkManager = Cc["@mozilla.org/network/manager;1"]
|
||||
.getService(Ci.nsINetworkManager);
|
||||
networkManager.registerNetworkInterface(this);
|
||||
gNetworkManager.registerNetworkInterface(this);
|
||||
this.registeredAsNetworkInterface = true;
|
||||
}
|
||||
}
|
||||
@ -1970,6 +2115,21 @@ let RILNetworkInterface = {
|
||||
}
|
||||
|
||||
this.state = datacall.state;
|
||||
|
||||
// In case the data setting changed while the datacall was being started or
|
||||
// ended, let's re-check the setting and potentially adjust the datacall
|
||||
// state again.
|
||||
if (this == this.mRIL.dataNetworkInterface) {
|
||||
this.mRIL.updateRILNetworkInterface();
|
||||
}
|
||||
|
||||
if (this.state == RIL.GECKO_NETWORK_STATE_UNKNOWN &&
|
||||
this.registeredAsNetworkInterface) {
|
||||
gNetworkManager.unregisterNetworkInterface(this);
|
||||
this.registeredAsNetworkInterface = false;
|
||||
return;
|
||||
}
|
||||
|
||||
Services.obs.notifyObservers(this,
|
||||
kNetworkInterfaceStateChangedTopic,
|
||||
null);
|
||||
@ -1989,13 +2149,6 @@ let RILNetworkInterface = {
|
||||
// APN failed connections. Retry counter
|
||||
apnRetryCounter: 0,
|
||||
|
||||
get mRIL() {
|
||||
delete this.mRIL;
|
||||
return this.mRIL = Cc["@mozilla.org/telephony/system-worker-manager;1"]
|
||||
.getService(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIRadioInterfaceLayer);
|
||||
},
|
||||
|
||||
get connected() {
|
||||
return this.state == RIL.GECKO_NETWORK_STATE_CONNECTED;
|
||||
},
|
||||
@ -2015,6 +2168,11 @@ let RILNetworkInterface = {
|
||||
this.dataCallSettings = options;
|
||||
}
|
||||
|
||||
if (!this.dataCallSettings["apn"]) {
|
||||
debug("APN name is empty, nothing to do.");
|
||||
return;
|
||||
}
|
||||
|
||||
this.httpProxyHost = this.dataCallSettings["httpProxyHost"];
|
||||
this.httpProxyPort = this.dataCallSettings["httpProxyPort"];
|
||||
|
||||
@ -2066,7 +2224,7 @@ let RILNetworkInterface = {
|
||||
|
||||
// Entry method for timer events. Used to reconnect to a failed APN
|
||||
notify: function(timer) {
|
||||
RILNetworkInterface.connect();
|
||||
this.connect();
|
||||
},
|
||||
|
||||
shutdown: function() {
|
||||
|
@ -230,7 +230,7 @@ interface nsIRilContext : nsISupports
|
||||
readonly attribute nsIDOMMozMobileConnectionInfo data;
|
||||
};
|
||||
|
||||
[scriptable, uuid(0a05f286-608d-4d2e-ab72-16bd36e93c15)]
|
||||
[scriptable, uuid(a90fef2c-44aa-4f2b-a0ee-a590e9dd345e)]
|
||||
interface nsIRadioInterfaceLayer : nsISupports
|
||||
{
|
||||
const unsigned short CALL_STATE_UNKNOWN = 0;
|
||||
@ -256,6 +256,9 @@ interface nsIRadioInterfaceLayer : nsISupports
|
||||
/**
|
||||
* PDP APIs
|
||||
*/
|
||||
void setupDataCallByType(in DOMString apntype);
|
||||
void deactivateDataCallByType(in DOMString apntype);
|
||||
long getDataCallStateByType(in DOMString apntype);
|
||||
void setupDataCall(in long radioTech,
|
||||
in DOMString apn,
|
||||
in DOMString user,
|
||||
|
@ -449,6 +449,13 @@ const EF_TYPE_TRANSPARENT = 0;
|
||||
const EF_TYPE_LINEAR_FIXED = 1;
|
||||
const EF_TYPE_CYCLIC = 3;
|
||||
|
||||
// Status code of EFsms
|
||||
// see 3GPP TS 51.011 clause 10.5.3
|
||||
const EFSMS_STATUS_FREE = 0x00;
|
||||
const EFSMS_STATUS_READ = 0x01;
|
||||
const EFSMS_STATUS_TO_BE_READ = 0x03;
|
||||
const EFSMS_STATUS_TO_BE_SENT = 0x07;
|
||||
|
||||
// For retrieving MSISDN, TS 151.011 clause 10.5.5
|
||||
const MSISDN_FOOTER_SIZE_BYTES = 14;
|
||||
const MSISDN_MAX_NUMBER_SIZE_BYTES = 10;
|
||||
@ -471,6 +478,7 @@ const EF_PATH_ADF_USIM = "7fff";
|
||||
// see GSM11.11 and TS 51.011 clause 9.4, and ISO 7816-4
|
||||
const ICC_STATUS_NORMAL_ENDING = 0x90;
|
||||
const ICC_STATUS_NORMAL_ENDING_WITH_EXTRA = 0x91;
|
||||
const ICC_STATUS_SAT_BUSY = 0x93;
|
||||
const ICC_STATUS_WITH_SIM_DATA = 0x9e;
|
||||
const ICC_STATUS_WITH_RESPONSE_DATA = 0x9f;
|
||||
const ICC_STATUS_ERROR_WRONG_LENGTH = 0x67;
|
||||
@ -516,6 +524,7 @@ const ICC_USIM_EFCCP1_TAG = 0xcb;
|
||||
// Tags for Ber Tlv.
|
||||
const BER_UNKNOWN_TAG = 0x00;
|
||||
const BER_PROACTIVE_COMMAND_TAG = 0xd0;
|
||||
const BER_SMS_PP_DOWNLOAD_TAG = 0xd1;
|
||||
const BER_MENU_SELECTION_TAG = 0xd3;
|
||||
const BER_EVENT_DOWNLOAD_TAG = 0xd6;
|
||||
|
||||
@ -529,6 +538,7 @@ const COMPREHENSIONTLV_TAG_RESULT = 0x03;
|
||||
const COMPREHENSIONTLV_TAG_DURATION = 0x04;
|
||||
const COMPREHENSIONTLV_TAG_ALPHA_ID = 0x05;
|
||||
const COMPREHENSIONTLV_TAG_ADDRESS = 0x06;
|
||||
const COMPREHENSIONTLV_TAG_SMS_TPDU = 0x0b;
|
||||
const COMPREHENSIONTLV_TAG_TEXT_STRING = 0x0d;
|
||||
const COMPREHENSIONTLV_TAG_ITEM = 0x0f;
|
||||
const COMPREHENSIONTLV_TAG_ITEM_ID = 0x10;
|
||||
@ -728,12 +738,14 @@ const GECKO_ICC_SERVICES = {
|
||||
ADN: 2,
|
||||
FDN: 3,
|
||||
SDN: 18,
|
||||
DATA_DOWNLOAD_SMS_PP: 26,
|
||||
BDN: 31
|
||||
},
|
||||
usim: {
|
||||
FDN: 2,
|
||||
SDN: 4,
|
||||
BDN: 6
|
||||
BDN: 6,
|
||||
DATA_DOWNLOAD_SMS_PP: 28
|
||||
}
|
||||
};
|
||||
|
||||
@ -825,8 +837,16 @@ const PDU_PI_PROTOCOL_IDENTIFIER = 0x01;
|
||||
const PDU_PI_RESERVED = 0x78;
|
||||
|
||||
// FCS - Failure Cause
|
||||
const PDU_FCS_OK = 0x00;
|
||||
const PDU_FCS_UNSPECIFIED = 0xFF;
|
||||
// 0...127 see 3GPP TS 24.011 clause E.2
|
||||
// 128...255 see 3GPP TS 23.040 clause 9.2.3.22
|
||||
// others see 3GPP TS 27.005 clause 3.2.5
|
||||
const PDU_FCS_OK = 0x00;
|
||||
const PDU_FCS_PROTOCOL_ERROR = 0x6F;
|
||||
const PDU_FCS_MEMORY_CAPACITY_EXCEEDED = 0XD3;
|
||||
const PDU_FCS_USAT_BUSY = 0XD4;
|
||||
const PDU_FCS_USIM_DATA_DOWNLOAD_ERROR = 0xD5;
|
||||
const PDU_FCS_RESERVED = 0xE0;
|
||||
const PDU_FCS_UNSPECIFIED = 0xFF;
|
||||
|
||||
// ST - Status
|
||||
// Bit 7..0 = 000xxxxx, short message transaction completed
|
||||
@ -902,13 +922,13 @@ const PDU_PID_USIM_DATA_DOWNLOAD = 0x7F;
|
||||
const PDU_DCS_MSG_CODING_7BITS_ALPHABET = 0x00;
|
||||
const PDU_DCS_MSG_CODING_8BITS_ALPHABET = 0x04;
|
||||
const PDU_DCS_MSG_CODING_16BITS_ALPHABET = 0x08;
|
||||
const PDU_DCS_MSG_CLASS_ME_SPECIFIC = 0xF1;
|
||||
const PDU_DCS_MSG_CLASS_SIM_SPECIFIC = 0xF2;
|
||||
const PDU_DCS_MSG_CLASS_TE_SPECIFIC = 0xF3;
|
||||
const PDU_DCS_MSG_CLASS_UNKNOWN = 0xFF;
|
||||
const PDU_DCS_MSG_CLASS_0 = 0x00;
|
||||
const PDU_DCS_MSG_CLASS_ME_SPECIFIC = 0x01;
|
||||
const PDU_DCS_MSG_CLASS_SIM_SPECIFIC = 0x02;
|
||||
const PDU_DCS_MSG_CLASS_TE_SPECIFIC = 0x03;
|
||||
const PDU_DCS_CODING_GROUP_BITS = 0xF0;
|
||||
const PDU_DCS_CODING_GROUP_7BITS_DISCARD = 0xC0;
|
||||
const PDU_DCS_CODING_GROUP_7BITS_STORE = 0xD0;
|
||||
const PDU_DCS_CODING_GROUP_16BITS_STORE = 0xE0;
|
||||
const PDU_DCS_MSG_CLASS_BITS = 0x03;
|
||||
const PDU_DCS_MWI_ACTIVE_BITS = 0x08;
|
||||
const PDU_DCS_MWI_ACTIVE_VALUE = 0x08;
|
||||
const PDU_DCS_MWI_TYPE_BITS = 0x03;
|
||||
|
@ -312,10 +312,22 @@ let Buf = {
|
||||
* Functions for writing data to the outgoing buffer.
|
||||
*/
|
||||
|
||||
writeUint8: function writeUint8(value) {
|
||||
if (this.outgoingIndex >= this.OUTGOING_BUFFER_LENGTH) {
|
||||
this.growOutgoingBuffer(this.outgoingIndex + 1);
|
||||
/**
|
||||
* Ensure position specified is writable.
|
||||
*
|
||||
* @param index
|
||||
* Data position in outgoing parcel, valid from 0 to
|
||||
* this.OUTGOING_BUFFER_LENGTH.
|
||||
*/
|
||||
ensureOutgoingAvailable: function ensureOutgoingAvailable(index) {
|
||||
if (index >= this.OUTGOING_BUFFER_LENGTH) {
|
||||
this.growOutgoingBuffer(index + 1);
|
||||
}
|
||||
},
|
||||
|
||||
writeUint8: function writeUint8(value) {
|
||||
this.ensureOutgoingAvailable(this.outgoingIndex);
|
||||
|
||||
this.outgoingBytes[this.outgoingIndex] = value;
|
||||
this.outgoingIndex++;
|
||||
},
|
||||
@ -376,6 +388,38 @@ let Buf = {
|
||||
this.outgoingIndex = currentIndex;
|
||||
},
|
||||
|
||||
copyIncomingToOutgoing: function copyIncomingToOutgoing(length) {
|
||||
if (!length || (length < 0)) {
|
||||
return;
|
||||
}
|
||||
|
||||
let translatedReadIndexEnd = this.currentParcelSize - this.readAvailable + length - 1;
|
||||
this.ensureIncomingAvailable(translatedReadIndexEnd);
|
||||
|
||||
let translatedWriteIndexEnd = this.outgoingIndex + length - 1
|
||||
this.ensureOutgoingAvailable(translatedWriteIndexEnd);
|
||||
|
||||
let newIncomingReadIndex = this.incomingReadIndex + length;
|
||||
if (newIncomingReadIndex < this.INCOMING_BUFFER_LENGTH) {
|
||||
// Reading won't cause wrapping, go ahead with builtin copy.
|
||||
this.outgoingBytes.set(this.incomingBytes.subarray(this.incomingReadIndex, newIncomingReadIndex),
|
||||
this.outgoingIndex);
|
||||
} else {
|
||||
// Not so lucky.
|
||||
newIncomingReadIndex %= this.INCOMING_BUFFER_LENGTH;
|
||||
this.outgoingBytes.set(this.incomingBytes.subarray(this.incomingReadIndex, this.INCOMING_BUFFER_LENGTH),
|
||||
this.outgoingIndex);
|
||||
if (newIncomingReadIndex) {
|
||||
let firstPartLength = this.INCOMING_BUFFER_LENGTH - this.incomingReadIndex;
|
||||
this.outgoingBytes.set(this.incomingBytes.subarray(0, newIncomingReadIndex),
|
||||
this.outgoingIndex + firstPartLength);
|
||||
}
|
||||
}
|
||||
|
||||
this.incomingReadIndex = newIncomingReadIndex;
|
||||
this.readAvailable -= length;
|
||||
this.outgoingIndex += length;
|
||||
},
|
||||
|
||||
/**
|
||||
* Parcel management
|
||||
@ -2928,13 +2972,20 @@ let RIL = {
|
||||
}
|
||||
|
||||
if (!updatedDataCall) {
|
||||
delete this.currentDataCalls[currentDataCall.callIndex];
|
||||
currentDataCall.state = GECKO_NETWORK_STATE_DISCONNECTED;
|
||||
currentDataCall.rilMessageType = "datacallstatechange";
|
||||
this.sendDOMMessage(currentDataCall);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (updatedDataCall && !updatedDataCall.ifname) {
|
||||
delete this.currentDataCalls[currentDataCall.cid];
|
||||
currentDataCall.state = GECKO_NETWORK_STATE_UNKNOWN;
|
||||
currentDataCall.rilMessageType = "datacallstatechange";
|
||||
this.sendDOMMessage(currentDataCall);
|
||||
continue;
|
||||
}
|
||||
|
||||
this._setDataCallGeckoState(updatedDataCall);
|
||||
if (updatedDataCall.state != currentDataCall.state) {
|
||||
currentDataCall.status = updatedDataCall.status;
|
||||
@ -2946,6 +2997,9 @@ let RIL = {
|
||||
}
|
||||
|
||||
for each (let newDataCall in datacalls) {
|
||||
if (!newDataCall.ifname) {
|
||||
continue;
|
||||
}
|
||||
this.currentDataCalls[newDataCall.cid] = newDataCall;
|
||||
this._setDataCallGeckoState(newDataCall);
|
||||
if (newDataCallOptions) {
|
||||
@ -3036,6 +3090,164 @@ let RIL = {
|
||||
network.mnc = mnc;
|
||||
},
|
||||
|
||||
/**
|
||||
* @param message A decoded SMS-DELIVER message.
|
||||
*
|
||||
* @see 3GPP TS 31.111 section 7.1.1
|
||||
*/
|
||||
dataDownloadViaSMSPP: function dataDownloadViaSMSPP(message) {
|
||||
let options = {
|
||||
pid: message.pid,
|
||||
dcs: message.dcs,
|
||||
encoding: message.encoding,
|
||||
};
|
||||
Buf.newParcel(REQUEST_STK_SEND_ENVELOPE_WITH_STATUS, options);
|
||||
|
||||
Buf.seekIncoming(-1 * (Buf.currentParcelSize - Buf.readAvailable
|
||||
- 2 * UINT32_SIZE)); // Skip response_type & request_type.
|
||||
let messageStringLength = Buf.readUint32(); // In semi-octets
|
||||
let smscLength = GsmPDUHelper.readHexOctet(); // In octets, inclusive of TOA
|
||||
let tpduLength = (messageStringLength / 2) - (smscLength + 1); // In octets
|
||||
|
||||
// Device identities: 4 bytes
|
||||
// Address: 0 or (2 + smscLength)
|
||||
// SMS TPDU: (2 or 3) + tpduLength
|
||||
let berLen = 4 +
|
||||
(smscLength ? (2 + smscLength) : 0) +
|
||||
(tpduLength <= 127 ? 2 : 3) + tpduLength; // In octets
|
||||
|
||||
let parcelLength = (berLen <= 127 ? 2 : 3) + berLen; // In octets
|
||||
Buf.writeUint32(parcelLength * 2); // In semi-octets
|
||||
|
||||
// Write a BER-TLV
|
||||
GsmPDUHelper.writeHexOctet(BER_SMS_PP_DOWNLOAD_TAG);
|
||||
if (berLen > 127) {
|
||||
GsmPDUHelper.writeHexOctet(0x81);
|
||||
}
|
||||
GsmPDUHelper.writeHexOctet(berLen);
|
||||
|
||||
// Device Identifies-TLV
|
||||
GsmPDUHelper.writeHexOctet(COMPREHENSIONTLV_TAG_DEVICE_ID |
|
||||
COMPREHENSIONTLV_FLAG_CR);
|
||||
GsmPDUHelper.writeHexOctet(0x02);
|
||||
GsmPDUHelper.writeHexOctet(STK_DEVICE_ID_NETWORK);
|
||||
GsmPDUHelper.writeHexOctet(STK_DEVICE_ID_SIM);
|
||||
|
||||
// Address-TLV
|
||||
if (smscLength) {
|
||||
GsmPDUHelper.writeHexOctet(COMPREHENSIONTLV_TAG_ADDRESS);
|
||||
GsmPDUHelper.writeHexOctet(smscLength);
|
||||
Buf.copyIncomingToOutgoing(PDU_HEX_OCTET_SIZE * smscLength);
|
||||
}
|
||||
|
||||
// SMS TPDU-TLV
|
||||
GsmPDUHelper.writeHexOctet(COMPREHENSIONTLV_TAG_SMS_TPDU |
|
||||
COMPREHENSIONTLV_FLAG_CR);
|
||||
if (tpduLength > 127) {
|
||||
GsmPDUHelper.writeHexOctet(0x81);
|
||||
}
|
||||
GsmPDUHelper.writeHexOctet(tpduLength);
|
||||
Buf.copyIncomingToOutgoing(PDU_HEX_OCTET_SIZE * tpduLength);
|
||||
|
||||
// Write 2 string delimitors for the total string length must be even.
|
||||
Buf.writeStringDelimiter(0);
|
||||
|
||||
Buf.sendParcel();
|
||||
},
|
||||
|
||||
/**
|
||||
* @param success A boolean value indicating the result of previous
|
||||
* SMS-DELIVER message handling.
|
||||
* @param responsePduLen ICC IO response PDU length in octets.
|
||||
* @param options An object that contains four attributes: `pid`, `dcs`,
|
||||
* `encoding` and `responsePduLen`.
|
||||
*
|
||||
* @see 3GPP TS 23.040 section 9.2.2.1a
|
||||
*/
|
||||
acknowledgeIncomingGsmSmsWithPDU: function acknowledgeIncomingGsmSmsWithPDU(success, responsePduLen, options) {
|
||||
Buf.newParcel(REQUEST_ACKNOWLEDGE_INCOMING_GSM_SMS_WITH_PDU);
|
||||
|
||||
// Two strings.
|
||||
Buf.writeUint32(2);
|
||||
|
||||
// String 1: Success
|
||||
Buf.writeString(success ? "1" : "0");
|
||||
|
||||
// String 2: RP-ACK/RP-ERROR PDU
|
||||
Buf.writeUint32(2 * (responsePduLen + (success ? 5 : 6))); // In semi-octet
|
||||
// 1. TP-MTI & TP-UDHI
|
||||
GsmPDUHelper.writeHexOctet(PDU_MTI_SMS_DELIVER);
|
||||
if (!success) {
|
||||
// 2. TP-FCS
|
||||
GsmPDUHelper.writeHexOctet(PDU_FCS_USIM_DATA_DOWNLOAD_ERROR);
|
||||
}
|
||||
// 3. TP-PI
|
||||
GsmPDUHelper.writeHexOctet(PDU_PI_USER_DATA_LENGTH |
|
||||
PDU_PI_DATA_CODING_SCHEME |
|
||||
PDU_PI_PROTOCOL_IDENTIFIER);
|
||||
// 4. TP-PID
|
||||
GsmPDUHelper.writeHexOctet(options.pid);
|
||||
// 5. TP-DCS
|
||||
GsmPDUHelper.writeHexOctet(options.dcs);
|
||||
// 6. TP-UDL
|
||||
if (options.encoding == PDU_DCS_MSG_CODING_7BITS_ALPHABET) {
|
||||
GsmPDUHelper.writeHexOctet(Math.floor(responsePduLen * 8 / 7));
|
||||
} else {
|
||||
GsmPDUHelper.writeHexOctet(responsePduLen);
|
||||
}
|
||||
// TP-UD
|
||||
Buf.copyIncomingToOutgoing(PDU_HEX_OCTET_SIZE * responsePduLen);
|
||||
// Write 2 string delimitors for the total string length must be even.
|
||||
Buf.writeStringDelimiter(0);
|
||||
|
||||
Buf.sendParcel();
|
||||
},
|
||||
|
||||
/**
|
||||
* @param message A decoded SMS-DELIVER message.
|
||||
*/
|
||||
writeSmsToSIM: function writeSmsToSIM(message) {
|
||||
Buf.newParcel(REQUEST_WRITE_SMS_TO_SIM);
|
||||
|
||||
// Write EFsms Status
|
||||
Buf.writeUint32(EFSMS_STATUS_FREE);
|
||||
|
||||
Buf.seekIncoming(-1 * (Buf.currentParcelSize - Buf.readAvailable
|
||||
- 2 * UINT32_SIZE)); // Skip response_type & request_type.
|
||||
let messageStringLength = Buf.readUint32(); // In semi-octets
|
||||
let smscLength = GsmPDUHelper.readHexOctet(); // In octets, inclusive of TOA
|
||||
let pduLength = (messageStringLength / 2) - (smscLength + 1); // In octets
|
||||
|
||||
// 1. Write PDU first.
|
||||
if (smscLength > 0) {
|
||||
Buf.seekIncoming(smscLength * PDU_HEX_OCTET_SIZE);
|
||||
}
|
||||
// Write EFsms PDU string length
|
||||
Buf.writeUint32(2 * pduLength); // In semi-octets
|
||||
if (pduLength) {
|
||||
Buf.copyIncomingToOutgoing(PDU_HEX_OCTET_SIZE * pduLength);
|
||||
}
|
||||
// Write 2 string delimitors for the total string length must be even.
|
||||
Buf.writeStringDelimiter(0);
|
||||
|
||||
// 2. Write SMSC
|
||||
// Write EFsms SMSC string length
|
||||
Buf.writeUint32(2 * (smscLength + 1)); // Plus smscLength itself, in semi-octets
|
||||
// Write smscLength
|
||||
GsmPDUHelper.writeHexOctet(smscLength);
|
||||
// Write TOA & SMSC Address
|
||||
if (smscLength) {
|
||||
Buf.seekIncoming(-1 * (Buf.currentParcelSize - Buf.readAvailable
|
||||
- 2 * UINT32_SIZE // Skip response_type, request_type.
|
||||
- 2 * PDU_HEX_OCTET_SIZE)); // Skip messageStringLength & smscLength.
|
||||
Buf.copyIncomingToOutgoing(PDU_HEX_OCTET_SIZE * smscLength);
|
||||
}
|
||||
// Write 2 string delimitors for the total string length must be even.
|
||||
Buf.writeStringDelimiter(0);
|
||||
|
||||
Buf.sendParcel();
|
||||
},
|
||||
|
||||
/**
|
||||
* Helper for processing received SMS parcel data.
|
||||
*
|
||||
@ -3084,6 +3296,47 @@ let RIL = {
|
||||
return PDU_FCS_OK;
|
||||
}
|
||||
|
||||
if (message.messageClass == PDU_DCS_MSG_CLASS_SIM_SPECIFIC) {
|
||||
switch (message.epid) {
|
||||
case PDU_PID_ANSI_136_R_DATA:
|
||||
case PDU_PID_USIM_DATA_DOWNLOAD:
|
||||
if (this.isICCServiceAvailable("DATA_DOWNLOAD_SMS_PP")) {
|
||||
// `If the service "data download via SMS Point-to-Point" is
|
||||
// allocated and activated in the (U)SIM Service Table, ... then the
|
||||
// ME shall pass the message transparently to the UICC using the
|
||||
// ENVELOPE (SMS-PP DOWNLOAD).` ~ 3GPP TS 31.111 7.1.1.1
|
||||
this.dataDownloadViaSMSPP(message);
|
||||
|
||||
// `the ME shall not display the message, or alert the user of a
|
||||
// short message waiting.` ~ 3GPP TS 31.111 7.1.1.1
|
||||
return PDU_FCS_RESERVED;
|
||||
}
|
||||
|
||||
// If the service "data download via SMS-PP" is not available in the
|
||||
// (U)SIM Service Table, ..., then the ME shall store the message in
|
||||
// EFsms in accordance with TS 31.102` ~ 3GPP TS 31.111 7.1.1.1
|
||||
default:
|
||||
this.writeSmsToSIM(message);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: Bug 739143: B2G SMS: Support SMS Storage Full event
|
||||
if ((message.messageClass != PDU_DCS_MSG_CLASS_0) && !true) {
|
||||
// `When a mobile terminated message is class 0..., the MS shall display
|
||||
// the message immediately and send a ACK to the SC ..., irrespective of
|
||||
// whether there is memory available in the (U)SIM or ME.` ~ 3GPP 23.038
|
||||
// clause 4.
|
||||
|
||||
if (message.messageClass == PDU_DCS_MSG_CLASS_SIM_SPECIFIC) {
|
||||
// `If all the short message storage at the MS is already in use, the
|
||||
// MS shall return "memory capacity exceeded".` ~ 3GPP 23.038 clause 4.
|
||||
return PDU_FCS_MEMORY_CAPACITY_EXCEEDED;
|
||||
}
|
||||
|
||||
return PDU_FCS_UNSPECIFIED;
|
||||
}
|
||||
|
||||
if (message.header && (message.header.segmentMaxSeq > 1)) {
|
||||
message = this._processReceivedSmsSegment(message);
|
||||
} else {
|
||||
@ -3101,6 +3354,12 @@ let RIL = {
|
||||
this.sendDOMMessage(message);
|
||||
}
|
||||
|
||||
if (message.messageClass == PDU_DCS_MSG_CLASS_SIM_SPECIFIC) {
|
||||
// `MS shall ensure that the message has been to the SMS data field in
|
||||
// the (U)SIM before sending an ACK to the SC.` ~ 3GPP 23.038 clause 4
|
||||
return PDU_FCS_RESERVED;
|
||||
}
|
||||
|
||||
return PDU_FCS_OK;
|
||||
},
|
||||
|
||||
@ -3822,7 +4081,7 @@ RIL[REQUEST_DEACTIVATE_DATA_CALL] = function REQUEST_DEACTIVATE_DATA_CALL(length
|
||||
|
||||
let datacall = this.currentDataCalls[options.cid];
|
||||
delete this.currentDataCalls[options.cid];
|
||||
datacall.state = GECKO_NETWORK_STATE_DISCONNECTED;
|
||||
datacall.state = GECKO_NETWORK_STATE_UNKNOWN;
|
||||
datacall.rilMessageType = "datacallstatechange";
|
||||
this.sendDOMMessage(datacall);
|
||||
};
|
||||
@ -4006,7 +4265,17 @@ RIL[REQUEST_OEM_HOOK_RAW] = null;
|
||||
RIL[REQUEST_OEM_HOOK_STRINGS] = null;
|
||||
RIL[REQUEST_SCREEN_STATE] = null;
|
||||
RIL[REQUEST_SET_SUPP_SVC_NOTIFICATION] = null;
|
||||
RIL[REQUEST_WRITE_SMS_TO_SIM] = null;
|
||||
RIL[REQUEST_WRITE_SMS_TO_SIM] = function REQUEST_WRITE_SMS_TO_SIM(length, options) {
|
||||
if (options.rilRequestError) {
|
||||
// `The MS shall return a "protocol error, unspecified" error message if
|
||||
// the short message cannot be stored in the (U)SIM, and there is other
|
||||
// message storage available at the MS` ~ 3GPP TS 23.038 section 4. Here
|
||||
// we assume we always have indexed db as another storage.
|
||||
this.acknowledgeSMS(false, PDU_FCS_PROTOCOL_ERROR);
|
||||
} else {
|
||||
this.acknowledgeSMS(true, PDU_FCS_OK);
|
||||
}
|
||||
};
|
||||
RIL[REQUEST_DELETE_SMS_ON_SIM] = null;
|
||||
RIL[REQUEST_SET_BAND_MODE] = null;
|
||||
RIL[REQUEST_QUERY_AVAILABLE_BAND_MODE] = null;
|
||||
@ -4053,6 +4322,33 @@ RIL[REQUEST_GET_SMSC_ADDRESS] = function REQUEST_GET_SMSC_ADDRESS(length, option
|
||||
RIL[REQUEST_SET_SMSC_ADDRESS] = null;
|
||||
RIL[REQUEST_REPORT_SMS_MEMORY_STATUS] = null;
|
||||
RIL[REQUEST_REPORT_STK_SERVICE_IS_RUNNING] = null;
|
||||
RIL[REQUEST_ACKNOWLEDGE_INCOMING_GSM_SMS_WITH_PDU] = null;
|
||||
RIL[REQUEST_STK_SEND_ENVELOPE_WITH_STATUS] = function REQUEST_STK_SEND_ENVELOPE_WITH_STATUS(length, options) {
|
||||
if (options.rilRequestError) {
|
||||
this.acknowledgeSMS(false, PDU_FCS_UNSPECIFIED);
|
||||
return;
|
||||
}
|
||||
|
||||
let sw1 = Buf.readUint32();
|
||||
let sw2 = Buf.readUint32();
|
||||
if ((sw1 == ICC_STATUS_SAT_BUSY) && (sw2 == 0x00)) {
|
||||
this.acknowledgeSMS(false, PDU_FCS_USAT_BUSY);
|
||||
return;
|
||||
}
|
||||
|
||||
let success = ((sw1 == ICC_STATUS_NORMAL_ENDING) && (sw2 == 0x00))
|
||||
|| (sw1 == ICC_STATUS_NORMAL_ENDING_WITH_EXTRA);
|
||||
|
||||
let messageStringLength = Buf.readUint32(); // In semi-octets
|
||||
let responsePduLen = messageStringLength / 2; // In octets
|
||||
if (!responsePduLen) {
|
||||
this.acknowledgeSMS(success, success ? PDU_FCS_OK
|
||||
: PDU_FCS_USIM_DATA_DOWNLOAD_ERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
this.acknowledgeIncomingGsmSmsWithPDU(success, responsePduLen, options);
|
||||
};
|
||||
RIL[UNSOLICITED_RESPONSE_RADIO_STATE_CHANGED] = function UNSOLICITED_RESPONSE_RADIO_STATE_CHANGED() {
|
||||
let radioState = Buf.readUint32();
|
||||
|
||||
@ -4122,7 +4418,10 @@ RIL[UNSOLICITED_RESPONSE_VOICE_NETWORK_STATE_CHANGED] = function UNSOLICITED_RES
|
||||
};
|
||||
RIL[UNSOLICITED_RESPONSE_NEW_SMS] = function UNSOLICITED_RESPONSE_NEW_SMS(length) {
|
||||
let result = this._processSmsDeliver(length);
|
||||
this.acknowledgeSMS(result == PDU_FCS_OK, result);
|
||||
if (result != PDU_FCS_RESERVED) {
|
||||
// Not reserved FCS values, send ACK now.
|
||||
this.acknowledgeSMS(result == PDU_FCS_OK, result);
|
||||
}
|
||||
};
|
||||
RIL[UNSOLICITED_RESPONSE_NEW_SMS_STATUS_REPORT] = function UNSOLICITED_RESPONSE_NEW_SMS_STATUS_REPORT(length) {
|
||||
let result = this._processSmsStatusReport(length);
|
||||
@ -5099,6 +5398,8 @@ let GsmPDUHelper = {
|
||||
// Bit 7..0 = 01xxxxxx
|
||||
switch (msg.epid) {
|
||||
case PDU_PID_SHORT_MESSAGE_TYPE_0:
|
||||
case PDU_PID_ANSI_136_R_DATA:
|
||||
case PDU_PID_USIM_DATA_DOWNLOAD:
|
||||
return;
|
||||
case PDU_PID_RETURN_CALL_MESSAGE:
|
||||
// Level 1 of message waiting indication:
|
||||
@ -5130,14 +5431,23 @@ let GsmPDUHelper = {
|
||||
let dcs = this.readHexOctet();
|
||||
if (DEBUG) debug("PDU: read dcs: " + dcs);
|
||||
|
||||
// Level 2 of message waiting indication
|
||||
this.readMessageWaitingFromDCS(msg, dcs);
|
||||
|
||||
// No message class by default.
|
||||
let messageClass = PDU_DCS_MSG_CLASS_UNKNOWN;
|
||||
// 7 bit is the default fallback encoding.
|
||||
let encoding = PDU_DCS_MSG_CODING_7BITS_ALPHABET;
|
||||
switch (dcs & 0xC0) {
|
||||
case 0x0:
|
||||
// bits 7..4 = 00xx
|
||||
switch (dcs & PDU_DCS_CODING_GROUP_BITS) {
|
||||
case 0x40: // bits 7..4 = 01xx
|
||||
case 0x50:
|
||||
case 0x60:
|
||||
case 0x70:
|
||||
// Bit 5..0 are coded exactly the same as Group 00xx
|
||||
case 0x00: // bits 7..4 = 00xx
|
||||
case 0x10:
|
||||
case 0x20:
|
||||
case 0x30:
|
||||
if (dcs & 0x10) {
|
||||
messageClass = dcs & PDU_DCS_MSG_CLASS_BITS;
|
||||
}
|
||||
switch (dcs & 0x0C) {
|
||||
case 0x4:
|
||||
encoding = PDU_DCS_MSG_CODING_8BITS_ALPHABET;
|
||||
@ -5147,19 +5457,51 @@ let GsmPDUHelper = {
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 0xC0:
|
||||
// bits 7..4 = 11xx
|
||||
switch (dcs & 0x30) {
|
||||
case 0x20:
|
||||
encoding = PDU_DCS_MSG_CODING_16BITS_ALPHABET;
|
||||
break;
|
||||
case 0x30:
|
||||
if (dcs & 0x04) {
|
||||
encoding = PDU_DCS_MSG_CODING_8BITS_ALPHABET;
|
||||
|
||||
case 0xE0: // bits 7..4 = 1110
|
||||
encoding = PDU_DCS_MSG_CODING_16BITS_ALPHABET;
|
||||
// Bit 3..0 are coded exactly the same as Message Waiting Indication
|
||||
// Group 1101.
|
||||
case 0xC0: // bits 7..4 = 1100
|
||||
case 0xD0: // bits 7..4 = 1101
|
||||
// Indiciates voicemail indicator set or clear
|
||||
let active = (dcs & PDU_DCS_MWI_ACTIVE_BITS) == PDU_DCS_MWI_ACTIVE_VALUE;
|
||||
|
||||
// If TP-UDH is present, these values will be overwritten
|
||||
switch (dcs & PDU_DCS_MWI_TYPE_BITS) {
|
||||
case PDU_DCS_MWI_TYPE_VOICEMAIL:
|
||||
let mwi = msg.mwi;
|
||||
if (!mwi) {
|
||||
mwi = msg.mwi = {};
|
||||
}
|
||||
|
||||
mwi.active = active;
|
||||
mwi.discard = (dcs & PDU_DCS_CODING_GROUP_BITS) == 0xC0;
|
||||
mwi.msgCount = active ? GECKO_VOICEMAIL_MESSAGE_COUNT_UNKNOWN : 0;
|
||||
|
||||
if (DEBUG) {
|
||||
debug("MWI in DCS received for voicemail: " + JSON.stringify(mwi));
|
||||
}
|
||||
break;
|
||||
case PDU_DCS_MWI_TYPE_FAX:
|
||||
if (DEBUG) debug("MWI in DCS received for fax");
|
||||
break;
|
||||
case PDU_DCS_MWI_TYPE_EMAIL:
|
||||
if (DEBUG) debug("MWI in DCS received for email");
|
||||
break;
|
||||
default:
|
||||
if (DEBUG) debug("MWI in DCS received for \"other\"");
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case 0xF0: // bits 7..4 = 1111
|
||||
if (dcs & 0x04) {
|
||||
encoding = PDU_DCS_MSG_CODING_8BITS_ALPHABET;
|
||||
}
|
||||
messageClass = dcs & PDU_DCS_MSG_CLASS_BITS;
|
||||
break;
|
||||
|
||||
default:
|
||||
// Falling back to default encoding.
|
||||
break;
|
||||
@ -5167,52 +5509,11 @@ let GsmPDUHelper = {
|
||||
|
||||
msg.dcs = dcs;
|
||||
msg.encoding = encoding;
|
||||
msg.messageClass = messageClass;
|
||||
|
||||
if (DEBUG) debug("PDU: message encoding is " + encoding + " bit.");
|
||||
},
|
||||
|
||||
readMessageWaitingFromDCS: function readMessageWaitingFromDCS(msg, dcs) {
|
||||
// 0xC0 == 7 bit, don't store
|
||||
// 0xD0 == 7 bit, store
|
||||
// 0xE0 == UCS-2, store
|
||||
let codingGroup = dcs & PDU_DCS_CODING_GROUP_BITS;
|
||||
|
||||
if (codingGroup == PDU_DCS_CODING_GROUP_7BITS_DISCARD ||
|
||||
codingGroup == PDU_DCS_CODING_GROUP_7BITS_STORE ||
|
||||
codingGroup == PDU_DCS_CODING_GROUP_16BITS_STORE) {
|
||||
|
||||
// Indiciates voicemail indicator set or clear
|
||||
let active = (dcs & PDU_DCS_MWI_ACTIVE_BITS) == PDU_DCS_MWI_ACTIVE_VALUE;
|
||||
|
||||
// If TP-UDH is present, these values will be overwritten
|
||||
switch (dcs & PDU_DCS_MWI_TYPE_BITS) {
|
||||
case PDU_DCS_MWI_TYPE_VOICEMAIL:
|
||||
let mwi = msg.mwi;
|
||||
if (!mwi) {
|
||||
mwi = msg.mwi = {};
|
||||
}
|
||||
|
||||
mwi.active = active;
|
||||
mwi.discard = codingGroup == PDU_DCS_CODING_GROUP_7BITS_DISCARD;
|
||||
mwi.msgCount = active ? GECKO_VOICEMAIL_MESSAGE_COUNT_UNKNOWN : 0;
|
||||
|
||||
if (DEBUG) {
|
||||
debug("MWI in DCS received for voicemail: " + JSON.stringify(mwi));
|
||||
}
|
||||
break;
|
||||
case PDU_DCS_MWI_TYPE_FAX:
|
||||
if (DEBUG) debug("MWI in DCS received for fax");
|
||||
break;
|
||||
case PDU_DCS_MWI_TYPE_EMAIL:
|
||||
if (DEBUG) debug("MWI in DCS received for email");
|
||||
break;
|
||||
default:
|
||||
if (DEBUG) debug("MWI in DCS received for \"other\"");
|
||||
break;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Read GSM TP-Service-Centre-Time-Stamp(TP-SCTS).
|
||||
*
|
||||
|
@ -54,6 +54,111 @@ add_test(function test_nl_single_shift_tables_validity() {
|
||||
run_next_test();
|
||||
});
|
||||
|
||||
/**
|
||||
* Verify GsmPDUHelper#readDataCodingScheme.
|
||||
*/
|
||||
add_test(function test_GsmPDUHelper_readDataCodingScheme() {
|
||||
let worker = newWorker({
|
||||
postRILMessage: function fakePostRILMessage(data) {
|
||||
// Do nothing
|
||||
},
|
||||
postMessage: function fakePostMessage(message) {
|
||||
// Do nothing
|
||||
}
|
||||
});
|
||||
|
||||
let helper = worker.GsmPDUHelper;
|
||||
function test_dcs(dcs, encoding, messageClass, mwi) {
|
||||
helper.readHexOctet = function () {
|
||||
return dcs;
|
||||
}
|
||||
|
||||
let msg = {};
|
||||
helper.readDataCodingScheme(msg);
|
||||
|
||||
do_check_eq(msg.dcs, dcs);
|
||||
do_check_eq(msg.encoding, encoding);
|
||||
do_check_eq(msg.messageClass, messageClass);
|
||||
do_check_eq(msg.mwi == null, mwi == null);
|
||||
if (mwi != null) {
|
||||
do_check_eq(msg.mwi.active, mwi.active);
|
||||
do_check_eq(msg.mwi.discard, mwi.discard);
|
||||
do_check_eq(msg.mwi.msgCount, mwi.msgCount);
|
||||
}
|
||||
}
|
||||
|
||||
// Group 00xx
|
||||
// Bit 3 and 2 indicate the character set being used.
|
||||
test_dcs(0x00, PDU_DCS_MSG_CODING_7BITS_ALPHABET, PDU_DCS_MSG_CLASS_UNKNOWN);
|
||||
test_dcs(0x04, PDU_DCS_MSG_CODING_8BITS_ALPHABET, PDU_DCS_MSG_CLASS_UNKNOWN);
|
||||
test_dcs(0x08, PDU_DCS_MSG_CODING_16BITS_ALPHABET, PDU_DCS_MSG_CLASS_UNKNOWN);
|
||||
test_dcs(0x0C, PDU_DCS_MSG_CODING_7BITS_ALPHABET, PDU_DCS_MSG_CLASS_UNKNOWN);
|
||||
// Bit 4, if set to 0, indicates that bits 1 to 0 are reserved and have no
|
||||
// message class meaning.
|
||||
test_dcs(0x01, PDU_DCS_MSG_CODING_7BITS_ALPHABET, PDU_DCS_MSG_CLASS_UNKNOWN);
|
||||
test_dcs(0x02, PDU_DCS_MSG_CODING_7BITS_ALPHABET, PDU_DCS_MSG_CLASS_UNKNOWN);
|
||||
test_dcs(0x03, PDU_DCS_MSG_CODING_7BITS_ALPHABET, PDU_DCS_MSG_CLASS_UNKNOWN);
|
||||
// Bit 4, if set to 1, indicates that bits 1 to 0 have a message class meaning.
|
||||
test_dcs(0x10, PDU_DCS_MSG_CODING_7BITS_ALPHABET, PDU_DCS_MSG_CLASS_0);
|
||||
test_dcs(0x11, PDU_DCS_MSG_CODING_7BITS_ALPHABET, PDU_DCS_MSG_CLASS_ME_SPECIFIC);
|
||||
test_dcs(0x12, PDU_DCS_MSG_CODING_7BITS_ALPHABET, PDU_DCS_MSG_CLASS_SIM_SPECIFIC);
|
||||
test_dcs(0x13, PDU_DCS_MSG_CODING_7BITS_ALPHABET, PDU_DCS_MSG_CLASS_TE_SPECIFIC);
|
||||
|
||||
// Group 01xx
|
||||
test_dcs(0x50, PDU_DCS_MSG_CODING_7BITS_ALPHABET, PDU_DCS_MSG_CLASS_0);
|
||||
|
||||
// Group 1000..1011: reserved
|
||||
test_dcs(0x8F, PDU_DCS_MSG_CODING_7BITS_ALPHABET, PDU_DCS_MSG_CLASS_UNKNOWN);
|
||||
test_dcs(0x9F, PDU_DCS_MSG_CODING_7BITS_ALPHABET, PDU_DCS_MSG_CLASS_UNKNOWN);
|
||||
test_dcs(0xAF, PDU_DCS_MSG_CODING_7BITS_ALPHABET, PDU_DCS_MSG_CLASS_UNKNOWN);
|
||||
test_dcs(0xBF, PDU_DCS_MSG_CODING_7BITS_ALPHABET, PDU_DCS_MSG_CLASS_UNKNOWN);
|
||||
|
||||
// Group 1100: Message Waiting Indication Group: Discard Message
|
||||
// Bit 3 indicates Indication Sense:
|
||||
test_dcs(0xC0, PDU_DCS_MSG_CODING_7BITS_ALPHABET, PDU_DCS_MSG_CLASS_UNKNOWN,
|
||||
{active: false, discard: true, msgCount: 0});
|
||||
test_dcs(0xC8, PDU_DCS_MSG_CODING_7BITS_ALPHABET, PDU_DCS_MSG_CLASS_UNKNOWN,
|
||||
{active: true, discard: true, msgCount: -1});
|
||||
// Bit 2 is reserved, and set to 0:
|
||||
test_dcs(0xCC, PDU_DCS_MSG_CODING_7BITS_ALPHABET, PDU_DCS_MSG_CLASS_UNKNOWN,
|
||||
{active: true, discard: true, msgCount: -1});
|
||||
|
||||
// Group 1101: Message Waiting Indication Group: Store Message
|
||||
// Bit 3 indicates Indication Sense:
|
||||
test_dcs(0xD0, PDU_DCS_MSG_CODING_7BITS_ALPHABET, PDU_DCS_MSG_CLASS_UNKNOWN,
|
||||
{active: false, discard: false, msgCount: 0});
|
||||
test_dcs(0xD8, PDU_DCS_MSG_CODING_7BITS_ALPHABET, PDU_DCS_MSG_CLASS_UNKNOWN,
|
||||
{active: true, discard: false, msgCount: -1});
|
||||
// Bit 2 is reserved, and set to 0:
|
||||
test_dcs(0xDC, PDU_DCS_MSG_CODING_7BITS_ALPHABET, PDU_DCS_MSG_CLASS_UNKNOWN,
|
||||
{active: true, discard: false, msgCount: -1});
|
||||
|
||||
// Group 1110: Message Waiting Indication Group: Store Message, UCS2
|
||||
// Bit 3 indicates Indication Sense:
|
||||
test_dcs(0xE0, PDU_DCS_MSG_CODING_16BITS_ALPHABET, PDU_DCS_MSG_CLASS_UNKNOWN,
|
||||
{active: false, discard: false, msgCount: 0});
|
||||
test_dcs(0xE8, PDU_DCS_MSG_CODING_16BITS_ALPHABET, PDU_DCS_MSG_CLASS_UNKNOWN,
|
||||
{active: true, discard: false, msgCount: -1});
|
||||
// Bit 2 is reserved, and set to 0:
|
||||
test_dcs(0xEC, PDU_DCS_MSG_CODING_16BITS_ALPHABET, PDU_DCS_MSG_CLASS_UNKNOWN,
|
||||
{active: true, discard: false, msgCount: -1});
|
||||
|
||||
// Group 1111
|
||||
test_dcs(0xF0, PDU_DCS_MSG_CODING_7BITS_ALPHABET, PDU_DCS_MSG_CLASS_0);
|
||||
test_dcs(0xF1, PDU_DCS_MSG_CODING_7BITS_ALPHABET, PDU_DCS_MSG_CLASS_ME_SPECIFIC);
|
||||
test_dcs(0xF2, PDU_DCS_MSG_CODING_7BITS_ALPHABET, PDU_DCS_MSG_CLASS_SIM_SPECIFIC);
|
||||
test_dcs(0xF3, PDU_DCS_MSG_CODING_7BITS_ALPHABET, PDU_DCS_MSG_CLASS_TE_SPECIFIC);
|
||||
test_dcs(0xF4, PDU_DCS_MSG_CODING_8BITS_ALPHABET, PDU_DCS_MSG_CLASS_0);
|
||||
test_dcs(0xF5, PDU_DCS_MSG_CODING_8BITS_ALPHABET, PDU_DCS_MSG_CLASS_ME_SPECIFIC);
|
||||
test_dcs(0xF6, PDU_DCS_MSG_CODING_8BITS_ALPHABET, PDU_DCS_MSG_CLASS_SIM_SPECIFIC);
|
||||
test_dcs(0xF7, PDU_DCS_MSG_CODING_8BITS_ALPHABET, PDU_DCS_MSG_CLASS_TE_SPECIFIC);
|
||||
// Bit 3 is reserved and should be set to 0, but if it doesn't we should
|
||||
// ignore it.
|
||||
test_dcs(0xF8, PDU_DCS_MSG_CODING_7BITS_ALPHABET, PDU_DCS_MSG_CLASS_0);
|
||||
|
||||
run_next_test();
|
||||
});
|
||||
|
||||
/**
|
||||
* Verify RadioInterfaceLayer#_countGsm7BitSeptets() and
|
||||
* GsmPDUHelper#writeStringAsSeptets() algorithm match each other.
|
||||
|
@ -48,7 +48,7 @@ TimeManager::Set(const JS::Value& date, JSContext* ctx) {
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
hal::AdjustSystemClock(JS_DoubleToInt32(dateMSec - nowMSec));
|
||||
hal::AdjustSystemClock(dateMSec - nowMSec);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -585,7 +585,7 @@ ScriptExecutorRunnable::WorkerRun(JSContext* aCx, WorkerPrivate* aWorkerPrivate)
|
||||
}
|
||||
}
|
||||
|
||||
JS::RootedObject global(aCx, JS_GetGlobalObject(aCx));
|
||||
js::RootedObject global(aCx, JS_GetGlobalObject(aCx));
|
||||
NS_ASSERTION(global, "Must have a global by now!");
|
||||
|
||||
JSPrincipals* principal = GetWorkerPrincipal();
|
||||
|
@ -3815,7 +3815,7 @@ WorkerPrivate::RunExpiredTimeouts(JSContext* aCx)
|
||||
bool retval = true;
|
||||
|
||||
AutoPtrComparator<TimeoutInfo> comparator = GetAutoPtrComparator(mTimeouts);
|
||||
JS::RootedObject global(aCx, JS_GetGlobalObject(aCx));
|
||||
js::RootedObject global(aCx, JS_GetGlobalObject(aCx));
|
||||
JSPrincipals* principal = GetWorkerPrincipal();
|
||||
|
||||
// We want to make sure to run *something*, even if the timer fired a little
|
||||
|
@ -201,7 +201,7 @@ nsresult EvaluateAdminConfigScript(const char *js_buffer, size_t length,
|
||||
JS::CompileOptions options(autoconfig_cx);
|
||||
options.setPrincipals(nsJSPrincipals::get(principal))
|
||||
.setFileAndLine(filename, 1);
|
||||
JS::RootedObject glob(autoconfig_cx, autoconfig_glob);
|
||||
js::RootedObject glob(autoconfig_cx, autoconfig_glob);
|
||||
ok = JS::Evaluate(autoconfig_cx, glob, options, js_buffer, length, nullptr);
|
||||
JS_EndRequest(autoconfig_cx);
|
||||
|
||||
|
@ -190,6 +190,8 @@ gdi-RGB24-ARGB32.patch: bug 788794
|
||||
|
||||
dwrite-font-printing.patch: bug 468568; don't substitute a GDI font for a DWrite font if the name tables aren't equal
|
||||
|
||||
d2d-gradient-ensure-stops.patch: bug 792903, ensure we don't set num_stops to 0
|
||||
|
||||
==== pixman patches ====
|
||||
|
||||
pixman-android-cpu-detect.patch: Add CPU detection support for Android, where we can't reliably access /proc/self/auxv.
|
||||
|
@ -1646,7 +1646,10 @@ _cairo_d2d_create_linear_gradient_brush(cairo_d2d_surface_t *d2dsurf,
|
||||
min_dist = MAX(-min_dist, 0);
|
||||
|
||||
// Repeats after gradient start.
|
||||
int after_repeat = (int)ceil(max_dist / gradient_length);
|
||||
// It's possible for max_dist and min_dist to both be zero, in which case
|
||||
// we'll set num_stops to 0 and crash D2D. Let's just ensure after_repeat
|
||||
// is at least 1.
|
||||
int after_repeat = MAX((int)ceil(max_dist / gradient_length), 1);
|
||||
int before_repeat = (int)ceil(min_dist / gradient_length);
|
||||
num_stops *= (after_repeat + before_repeat);
|
||||
|
||||
|
32
gfx/cairo/d2d-gradient-ensure-stops.patch
Normal file
32
gfx/cairo/d2d-gradient-ensure-stops.patch
Normal file
@ -0,0 +1,32 @@
|
||||
# HG changeset patch
|
||||
# User Robert O'Callahan <robert@ocallahan.org>
|
||||
# Date 1348618772 -43200
|
||||
# Node ID 55ccbc8d52e69b020f2ba493e92ad2e214388df0
|
||||
# Parent e0d69219dd2b3b2826d186dc99c673b879409ea6
|
||||
Bug 792903. Prevent num_stops from being set to zero. r=bas
|
||||
|
||||
diff --git a/gfx/cairo/cairo/src/cairo-d2d-surface.cpp b/gfx/cairo/cairo/src/cairo-d2d-surface.cpp
|
||||
--- a/gfx/cairo/cairo/src/cairo-d2d-surface.cpp
|
||||
+++ b/gfx/cairo/cairo/src/cairo-d2d-surface.cpp
|
||||
@@ -1641,17 +1641,20 @@ static RefPtr<ID2D1Brush>
|
||||
min_dist = MIN(_cairo_d2d_dot_product(u, _cairo_d2d_subtract_point(top_left, p1)),
|
||||
_cairo_d2d_dot_product(u, _cairo_d2d_subtract_point(top_right, p1)));
|
||||
min_dist = MIN(min_dist, _cairo_d2d_dot_product(u, _cairo_d2d_subtract_point(bottom_left, p1)));
|
||||
min_dist = MIN(min_dist, _cairo_d2d_dot_product(u, _cairo_d2d_subtract_point(bottom_right, p1)));
|
||||
|
||||
min_dist = MAX(-min_dist, 0);
|
||||
|
||||
// Repeats after gradient start.
|
||||
- int after_repeat = (int)ceil(max_dist / gradient_length);
|
||||
+ // It's possible for max_dist and min_dist to both be zero, in which case
|
||||
+ // we'll set num_stops to 0 and crash D2D. Let's just ensure after_repeat
|
||||
+ // is at least 1.
|
||||
+ int after_repeat = MAX((int)ceil(max_dist / gradient_length), 1);
|
||||
int before_repeat = (int)ceil(min_dist / gradient_length);
|
||||
num_stops *= (after_repeat + before_repeat);
|
||||
|
||||
p2.x = p1.x + u.x * after_repeat * gradient_length;
|
||||
p2.y = p1.y + u.y * after_repeat * gradient_length;
|
||||
p1.x = p1.x - u.x * before_repeat * gradient_length;
|
||||
p1.y = p1.y - u.y * before_repeat * gradient_length;
|
||||
|
@ -16,6 +16,10 @@ gfxAlphaBoxBlur::gfxAlphaBoxBlur()
|
||||
|
||||
gfxAlphaBoxBlur::~gfxAlphaBoxBlur()
|
||||
{
|
||||
// Drop references to mContext and mImageSurface before we delete mBlur,
|
||||
// because the image surface points to data in mBlur.
|
||||
mContext = nullptr;
|
||||
mImageSurface = nullptr;
|
||||
delete mBlur;
|
||||
}
|
||||
|
||||
|
@ -207,7 +207,7 @@ gfxPlatformFontList::InitOtherFamilyNames()
|
||||
mFontFamilies.Enumerate(gfxPlatformFontList::InitOtherFamilyNamesProc, this);
|
||||
}
|
||||
|
||||
PLDHashOperator PR_CALLBACK
|
||||
PLDHashOperator
|
||||
gfxPlatformFontList::InitOtherFamilyNamesProc(nsStringHashKey::KeyType aKey,
|
||||
nsRefPtr<gfxFontFamily>& aFamilyEntry,
|
||||
void* userArg)
|
||||
@ -227,7 +227,7 @@ gfxPlatformFontList::InitFaceNameLists()
|
||||
mFontFamilies.Enumerate(gfxPlatformFontList::InitFaceNameListsProc, this);
|
||||
}
|
||||
|
||||
PLDHashOperator PR_CALLBACK
|
||||
PLDHashOperator
|
||||
gfxPlatformFontList::InitFaceNameListsProc(nsStringHashKey::KeyType aKey,
|
||||
nsRefPtr<gfxFontFamily>& aFamilyEntry,
|
||||
void* userArg)
|
||||
@ -308,7 +308,7 @@ struct FontListData {
|
||||
nsTArray<nsString>& mListOfFonts;
|
||||
};
|
||||
|
||||
PLDHashOperator PR_CALLBACK
|
||||
PLDHashOperator
|
||||
gfxPlatformFontList::HashEnumFuncForFamilies(nsStringHashKey::KeyType aKey,
|
||||
nsRefPtr<gfxFontFamily>& aFamilyEntry,
|
||||
void *aUserArg)
|
||||
@ -358,9 +358,9 @@ struct FontFamilyListData {
|
||||
: mFamilyArray(aFamilyArray)
|
||||
{}
|
||||
|
||||
static PLDHashOperator PR_CALLBACK AppendFamily(nsStringHashKey::KeyType aKey,
|
||||
nsRefPtr<gfxFontFamily>& aFamilyEntry,
|
||||
void *aUserArg)
|
||||
static PLDHashOperator AppendFamily(nsStringHashKey::KeyType aKey,
|
||||
nsRefPtr<gfxFontFamily>& aFamilyEntry,
|
||||
void *aUserArg)
|
||||
{
|
||||
FontFamilyListData *data = static_cast<FontFamilyListData*>(aUserArg);
|
||||
data->mFamilyArray.AppendElement(aFamilyEntry);
|
||||
@ -461,7 +461,7 @@ gfxPlatformFontList::SystemFindFontForChar(const uint32_t aCh,
|
||||
return fontEntry;
|
||||
}
|
||||
|
||||
PLDHashOperator PR_CALLBACK
|
||||
PLDHashOperator
|
||||
gfxPlatformFontList::FindFontForCharProc(nsStringHashKey::KeyType aKey, nsRefPtr<gfxFontFamily>& aFamilyEntry,
|
||||
void *userArg)
|
||||
{
|
||||
|
@ -441,7 +441,7 @@ NotifySystemTimeChange(const hal::SystemTimeChange& aReason)
|
||||
}
|
||||
|
||||
void
|
||||
AdjustSystemClock(int32_t aDeltaMilliseconds)
|
||||
AdjustSystemClock(int64_t aDeltaMilliseconds)
|
||||
{
|
||||
AssertMainThread();
|
||||
PROXY_IF_SANDBOXED(AdjustSystemClock(aDeltaMilliseconds));
|
||||
|
@ -242,7 +242,7 @@ void NotifyNetworkChange(const hal::NetworkInformation& aNetworkInfo);
|
||||
* Adjusting system clock.
|
||||
* @param aDeltaMilliseconds The difference compared with current system clock.
|
||||
*/
|
||||
void AdjustSystemClock(int32_t aDeltaMilliseconds);
|
||||
void AdjustSystemClock(int64_t aDeltaMilliseconds);
|
||||
|
||||
/**
|
||||
* Set timezone
|
||||
|
@ -11,7 +11,7 @@ namespace mozilla {
|
||||
namespace hal_impl {
|
||||
|
||||
void
|
||||
AdjustSystemClock(int32_t aDeltaMilliseconds)
|
||||
AdjustSystemClock(int64_t aDeltaMilliseconds)
|
||||
{}
|
||||
|
||||
void
|
||||
|
@ -351,8 +351,8 @@ GetCurrentBatteryInformation(hal::BatteryInformation *aBatteryInfo)
|
||||
chargingFile = fopen("/sys/class/power_supply/battery/status", "r");
|
||||
if (chargingFile) {
|
||||
char status[16];
|
||||
fscanf(chargingFile, "%s", &status);
|
||||
if (!strcmp(status, "Charging") || !strcmp(status, "Full")) {
|
||||
char *str = fgets(status, sizeof(status), chargingFile);
|
||||
if (str && (!strcmp(str, "Charging\n") || !strcmp(str, "Full\n"))) {
|
||||
// no way here to know if we're charging from USB or AC.
|
||||
chargingSrc = BATTERY_CHARGING_USB;
|
||||
} else {
|
||||
@ -615,7 +615,7 @@ sys_clock_settime(clockid_t clk_id, const struct timespec *tp)
|
||||
}
|
||||
|
||||
void
|
||||
AdjustSystemClock(int32_t aDeltaMilliseconds)
|
||||
AdjustSystemClock(int64_t aDeltaMilliseconds)
|
||||
{
|
||||
if (aDeltaMilliseconds == 0) {
|
||||
return;
|
||||
@ -626,8 +626,8 @@ AdjustSystemClock(int32_t aDeltaMilliseconds)
|
||||
// Preventing context switch before setting system clock
|
||||
sched_yield();
|
||||
clock_gettime(CLOCK_REALTIME, &now);
|
||||
now.tv_sec += aDeltaMilliseconds/1000;
|
||||
now.tv_nsec += (aDeltaMilliseconds%1000)*NsecPerMsec;
|
||||
now.tv_sec += aDeltaMilliseconds / 1000;
|
||||
now.tv_nsec += (aDeltaMilliseconds % 1000) * NsecPerMsec;
|
||||
if (now.tv_nsec >= NsecPerSec)
|
||||
{
|
||||
now.tv_sec += 1;
|
||||
|
@ -131,7 +131,7 @@ parent:
|
||||
sync GetScreenBrightness() returns (double brightness);
|
||||
SetScreenBrightness(double brightness);
|
||||
|
||||
AdjustSystemClock(int32_t aDeltaMilliseconds);
|
||||
AdjustSystemClock(int64_t aDeltaMilliseconds);
|
||||
SetTimezone(nsCString aTimezoneSpec);
|
||||
sync GetTimezone()
|
||||
returns (nsCString aTimezoneSpec);
|
||||
|
@ -184,7 +184,7 @@ GetLight(hal::LightType light, hal::LightConfiguration* aConfig)
|
||||
}
|
||||
|
||||
void
|
||||
AdjustSystemClock(int32_t aDeltaMilliseconds)
|
||||
AdjustSystemClock(int64_t aDeltaMilliseconds)
|
||||
{
|
||||
Hal()->SendAdjustSystemClock(aDeltaMilliseconds);
|
||||
}
|
||||
@ -592,7 +592,7 @@ public:
|
||||
}
|
||||
|
||||
virtual bool
|
||||
RecvAdjustSystemClock(const int32_t &aDeltaMilliseconds) MOZ_OVERRIDE
|
||||
RecvAdjustSystemClock(const int64_t &aDeltaMilliseconds) MOZ_OVERRIDE
|
||||
{
|
||||
if (!AssertAppProcessPermission(this, "time")) {
|
||||
return false;
|
||||
|
@ -43,7 +43,7 @@ LOCAL_INCLUDES += \
|
||||
$(NULL)
|
||||
|
||||
# Because VectorImage.cpp includes nsSVGUtils.h and nsSVGEffects.h
|
||||
LOCAL_INCLUDES += -I$(topsrcdir)/layout/svg/base/src
|
||||
LOCAL_INCLUDES += -I$(topsrcdir)/layout/svg
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
include $(topsrcdir)/ipc/chromium/chromium-config.mk
|
||||
|
@ -422,14 +422,14 @@ ObjectWrapperChild::AnswerNewEnumerateInit(/* no in-parameters */
|
||||
return false;
|
||||
AutoObjectRooter tvr(cx, state);
|
||||
|
||||
for (JSObject* proto = mObj;
|
||||
proto;
|
||||
proto = JS_GetPrototype(proto))
|
||||
{
|
||||
for (JSObject* proto = mObj; proto; ) {
|
||||
AutoIdArray ids(cx, JS_Enumerate(cx, proto));
|
||||
for (size_t i = 0; i < ids.length(); ++i)
|
||||
JS_DefinePropertyById(cx, state, ids[i], JSVAL_VOID,
|
||||
NULL, NULL, JSPROP_ENUMERATE | JSPROP_SHARED);
|
||||
|
||||
if (!JS_GetPrototype(cx, proto, &proto))
|
||||
return false;
|
||||
}
|
||||
|
||||
InfallibleTArray<nsString>* strIds;
|
||||
|
@ -184,11 +184,12 @@ ObjectWrapperParent::GetJSObject(JSContext* cx) const
|
||||
}
|
||||
|
||||
static ObjectWrapperParent*
|
||||
Unwrap(JSObject* obj)
|
||||
Unwrap(JSContext* cx, JSObject* obj)
|
||||
{
|
||||
while (js::GetObjectClass(obj) != &ObjectWrapperParent::sCPOW_JSClass)
|
||||
if (!(obj = js::GetObjectProto(obj)))
|
||||
while (js::GetObjectClass(obj) != &ObjectWrapperParent::sCPOW_JSClass) {
|
||||
if (!js::GetObjectProto(cx, obj, &obj) || !obj)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ObjectWrapperParent* self =
|
||||
static_cast<ObjectWrapperParent*>(JS_GetPrivate(obj));
|
||||
@ -218,7 +219,7 @@ ObjectWrapperParent::jsval_to_JSVariant(JSContext* cx, jsval from,
|
||||
case JSTYPE_OBJECT:
|
||||
{
|
||||
PObjectWrapperParent* powp;
|
||||
if (!JSObject_to_PObjectWrapperParent(JSVAL_TO_OBJECT(from), &powp))
|
||||
if (!JSObject_to_PObjectWrapperParent(cx, JSVAL_TO_OBJECT(from), &powp))
|
||||
return with_error(cx, false, "Cannot pass parent-created object to child");
|
||||
*to = powp;
|
||||
}
|
||||
@ -282,13 +283,13 @@ ObjectWrapperParent::jsval_from_JSVariant(JSContext* cx, const JSVariant& from,
|
||||
|
||||
/*static*/ bool
|
||||
ObjectWrapperParent::
|
||||
JSObject_to_PObjectWrapperParent(JSObject* from, PObjectWrapperParent** to)
|
||||
JSObject_to_PObjectWrapperParent(JSContext* cx, JSObject* from, PObjectWrapperParent** to)
|
||||
{
|
||||
if (!from) {
|
||||
*to = NULL;
|
||||
return true;
|
||||
}
|
||||
ObjectWrapperParent* owp = Unwrap(from);
|
||||
ObjectWrapperParent* owp = Unwrap(cx, from);
|
||||
if (!owp)
|
||||
return false;
|
||||
*to = owp;
|
||||
@ -315,7 +316,7 @@ jsval_from_PObjectWrapperParent(JSContext* cx,
|
||||
const PObjectWrapperParent* from,
|
||||
jsval* to)
|
||||
{
|
||||
JS::RootedObject obj(cx);
|
||||
js::RootedObject obj(cx);
|
||||
if (!JSObject_from_PObjectWrapperParent(cx, from, &obj))
|
||||
return false;
|
||||
*to = OBJECT_TO_JSVAL(obj);
|
||||
@ -360,7 +361,7 @@ ObjectWrapperParent::CPOW_AddProperty(JSContext *cx, JSHandleObject obj, JSHandl
|
||||
CPOW_LOG(("Calling CPOW_AddProperty (%s)...",
|
||||
JSVAL_TO_CSTR(cx, id)));
|
||||
|
||||
ObjectWrapperParent* self = Unwrap(obj);
|
||||
ObjectWrapperParent* self = Unwrap(cx, obj);
|
||||
if (!self)
|
||||
return with_error(cx, JS_FALSE, "Unwrapping failed in CPOW_AddProperty");
|
||||
|
||||
@ -387,7 +388,7 @@ ObjectWrapperParent::CPOW_GetProperty(JSContext *cx, JSHandleObject obj, JSHandl
|
||||
CPOW_LOG(("Calling CPOW_GetProperty (%s)...",
|
||||
JSVAL_TO_CSTR(cx, id)));
|
||||
|
||||
ObjectWrapperParent* self = Unwrap(obj);
|
||||
ObjectWrapperParent* self = Unwrap(cx, obj);
|
||||
if (!self)
|
||||
return with_error(cx, JS_FALSE, "Unwrapping failed in CPOW_GetProperty");
|
||||
|
||||
@ -414,7 +415,7 @@ ObjectWrapperParent::CPOW_SetProperty(JSContext *cx, JSHandleObject obj, JSHandl
|
||||
CPOW_LOG(("Calling CPOW_SetProperty (%s)...",
|
||||
JSVAL_TO_CSTR(cx, id)));
|
||||
|
||||
ObjectWrapperParent* self = Unwrap(obj);
|
||||
ObjectWrapperParent* self = Unwrap(cx, obj);
|
||||
if (!self)
|
||||
return with_error(cx, JS_FALSE, "Unwrapping failed in CPOW_SetProperty");
|
||||
|
||||
@ -443,7 +444,7 @@ ObjectWrapperParent::CPOW_DelProperty(JSContext *cx, JSHandleObject obj, JSHandl
|
||||
CPOW_LOG(("Calling CPOW_DelProperty (%s)...",
|
||||
JSVAL_TO_CSTR(cx, id)));
|
||||
|
||||
ObjectWrapperParent* self = Unwrap(obj);
|
||||
ObjectWrapperParent* self = Unwrap(cx, obj);
|
||||
if (!self)
|
||||
return with_error(cx, JS_FALSE, "Unwrapping failed in CPOW_DelProperty");
|
||||
|
||||
@ -524,7 +525,7 @@ ObjectWrapperParent::CPOW_NewEnumerate(JSContext *cx, JSHandleObject obj,
|
||||
{
|
||||
CPOW_LOG(("Calling CPOW_NewEnumerate..."));
|
||||
|
||||
ObjectWrapperParent* self = Unwrap(obj);
|
||||
ObjectWrapperParent* self = Unwrap(cx, obj);
|
||||
if (!self)
|
||||
return with_error(cx, JS_FALSE, "Unwrapping failed in CPOW_NewEnumerate");
|
||||
|
||||
@ -550,7 +551,7 @@ ObjectWrapperParent::CPOW_NewResolve(JSContext *cx, JSHandleObject obj, JSHandle
|
||||
CPOW_LOG(("Calling CPOW_NewResolve (%s)...",
|
||||
JSVAL_TO_CSTR(cx, id)));
|
||||
|
||||
ObjectWrapperParent* self = Unwrap(obj);
|
||||
ObjectWrapperParent* self = Unwrap(cx, obj);
|
||||
if (!self)
|
||||
return with_error(cx, JS_FALSE, "Unwrapping failed in CPOW_NewResolve");
|
||||
|
||||
@ -572,7 +573,7 @@ ObjectWrapperParent::CPOW_NewResolve(JSContext *cx, JSHandleObject obj, JSHandle
|
||||
|
||||
if (objp) {
|
||||
AutoResolveFlag arf(objp);
|
||||
JS::RootedObject obj2(cx, objp);
|
||||
js::RootedObject obj2(cx, objp);
|
||||
JS_DefinePropertyById(cx, obj2, id, JSVAL_VOID, NULL, NULL,
|
||||
JSPROP_ENUMERATE);
|
||||
}
|
||||
@ -586,7 +587,7 @@ ObjectWrapperParent::CPOW_Convert(JSContext *cx, JSHandleObject obj, JSType type
|
||||
CPOW_LOG(("Calling CPOW_Convert (to %s)...",
|
||||
JS_GetTypeName(cx, type)));
|
||||
|
||||
ObjectWrapperParent* self = Unwrap(obj);
|
||||
ObjectWrapperParent* self = Unwrap(cx, obj);
|
||||
if (!self)
|
||||
return with_error(cx, JS_FALSE, "Unwrapping failed in CPOW_Convert");
|
||||
|
||||
@ -600,7 +601,9 @@ ObjectWrapperParent::CPOW_Finalize(js::FreeOp* fop, JSObject* obj)
|
||||
{
|
||||
CPOW_LOG(("Calling CPOW_Finalize..."));
|
||||
|
||||
ObjectWrapperParent* self = Unwrap(obj);
|
||||
MOZ_ASSERT(js::GetObjectClass(obj) == &ObjectWrapperParent::sCPOW_JSClass);
|
||||
ObjectWrapperParent* self =
|
||||
static_cast<ObjectWrapperParent*>(JS_GetPrivate(obj));
|
||||
if (self) {
|
||||
self->mObj = NULL;
|
||||
unused << ObjectWrapperParent::Send__delete__(self);
|
||||
@ -617,13 +620,13 @@ ObjectWrapperParent::CPOW_Call(JSContext* cx, unsigned argc, jsval* vp)
|
||||
return JS_FALSE;
|
||||
|
||||
ObjectWrapperParent* function =
|
||||
Unwrap(JSVAL_TO_OBJECT(JS_CALLEE(cx, vp)));
|
||||
Unwrap(cx, JSVAL_TO_OBJECT(JS_CALLEE(cx, vp)));
|
||||
if (!function)
|
||||
return with_error(cx, JS_FALSE, "Could not unwrap CPOW function");
|
||||
|
||||
AutoCheckOperation aco(cx, function);
|
||||
|
||||
ObjectWrapperParent* receiver = Unwrap(thisobj);
|
||||
ObjectWrapperParent* receiver = Unwrap(cx, thisobj);
|
||||
if (!receiver) {
|
||||
// Substitute child global for parent global object.
|
||||
// TODO First make sure we're really replacing the global object?
|
||||
@ -652,7 +655,7 @@ ObjectWrapperParent::CPOW_Construct(JSContext* cx, unsigned argc, jsval* vp)
|
||||
{
|
||||
CPOW_LOG(("Calling CPOW_Construct..."));
|
||||
|
||||
ObjectWrapperParent* constructor = Unwrap(JSVAL_TO_OBJECT(JS_CALLEE(cx, vp)));
|
||||
ObjectWrapperParent* constructor = Unwrap(cx, JSVAL_TO_OBJECT(JS_CALLEE(cx, vp)));
|
||||
if (!constructor)
|
||||
return with_error(cx, JS_FALSE, "Could not unwrap CPOW constructor function");
|
||||
|
||||
@ -680,7 +683,7 @@ ObjectWrapperParent::CPOW_HasInstance(JSContext *cx, JSHandleObject obj, JSMutab
|
||||
|
||||
*bp = JS_FALSE;
|
||||
|
||||
ObjectWrapperParent* self = Unwrap(obj);
|
||||
ObjectWrapperParent* self = Unwrap(cx, obj);
|
||||
if (!self)
|
||||
return with_error(cx, JS_FALSE, "Unwrapping failed in CPOW_HasInstance");
|
||||
|
||||
@ -705,14 +708,14 @@ ObjectWrapperParent::CPOW_Equality(JSContext *cx, JSHandleObject obj, JSHandleVa
|
||||
|
||||
*bp = JS_FALSE;
|
||||
|
||||
ObjectWrapperParent* self = Unwrap(obj);
|
||||
ObjectWrapperParent* self = Unwrap(cx, obj);
|
||||
if (!self)
|
||||
return with_error(cx, JS_FALSE, "Unwrapping failed in CPOW_Equality");
|
||||
|
||||
if (JSVAL_IS_PRIMITIVE(v))
|
||||
return JS_TRUE;
|
||||
|
||||
ObjectWrapperParent* other = Unwrap(JSVAL_TO_OBJECT(v));
|
||||
ObjectWrapperParent* other = Unwrap(cx, JSVAL_TO_OBJECT(v));
|
||||
if (!other)
|
||||
return JS_TRUE;
|
||||
|
||||
|
@ -104,7 +104,7 @@ private:
|
||||
static bool jsval_from_JSVariant(JSContext* cx, const JSVariant& from,
|
||||
jsval* to);
|
||||
static bool
|
||||
JSObject_to_PObjectWrapperParent(JSObject* from, PObjectWrapperParent** to);
|
||||
JSObject_to_PObjectWrapperParent(JSContext* cx, JSObject* from, PObjectWrapperParent** to);
|
||||
static bool
|
||||
JSObject_from_PObjectWrapperParent(JSContext* cx,
|
||||
const PObjectWrapperParent* from,
|
||||
|
@ -614,6 +614,7 @@ jsd_GetValueFunction(JSDContext* jsdc, JSDValue* jsdval)
|
||||
JSDValue*
|
||||
jsd_GetValuePrototype(JSDContext* jsdc, JSDValue* jsdval)
|
||||
{
|
||||
JSContext* cx = jsdc->dumbContext;
|
||||
if(!(CHECK_BIT_FLAG(jsdval->flags, GOT_PROTO)))
|
||||
{
|
||||
JSObject* obj;
|
||||
@ -623,7 +624,8 @@ jsd_GetValuePrototype(JSDContext* jsdc, JSDValue* jsdval)
|
||||
if(JSVAL_IS_PRIMITIVE(jsdval->val))
|
||||
return NULL;
|
||||
obj = JSVAL_TO_OBJECT(jsdval->val);
|
||||
proto = JS_GetPrototype(obj);
|
||||
if(!JS_GetPrototype(cx, obj, &proto))
|
||||
return NULL;
|
||||
if(!proto)
|
||||
return NULL;
|
||||
jsdval->proto = jsd_NewValue(jsdc, OBJECT_TO_JSVAL(proto));
|
||||
@ -665,6 +667,7 @@ JSDValue*
|
||||
jsd_GetValueConstructor(JSDContext* jsdc, JSDValue* jsdval)
|
||||
{
|
||||
JSCompartment* oldCompartment = NULL;
|
||||
JSContext* cx = jsdc->dumbContext;
|
||||
|
||||
if(!(CHECK_BIT_FLAG(jsdval->flags, GOT_CTOR)))
|
||||
{
|
||||
@ -676,7 +679,8 @@ jsd_GetValueConstructor(JSDContext* jsdc, JSDValue* jsdval)
|
||||
if(JSVAL_IS_PRIMITIVE(jsdval->val))
|
||||
return NULL;
|
||||
obj = JSVAL_TO_OBJECT(jsdval->val);
|
||||
proto = JS_GetPrototype(obj);
|
||||
if(!JS_GetPrototype(cx, obj, &proto))
|
||||
return NULL;
|
||||
if(!proto)
|
||||
return NULL;
|
||||
JS_BeginRequest(jsdc->dumbContext);
|
||||
|
@ -717,7 +717,9 @@ InitCTypeClass(JSContext* cx, HandleObject parent)
|
||||
return NULL;
|
||||
|
||||
RootedObject ctor(cx, JS_GetFunctionObject(fun));
|
||||
RootedObject fnproto(cx, JS_GetPrototype(ctor));
|
||||
RootedObject fnproto(cx);
|
||||
if (!JS_GetPrototype(cx, ctor, fnproto.address()))
|
||||
return NULL;
|
||||
JS_ASSERT(ctor);
|
||||
JS_ASSERT(fnproto);
|
||||
|
||||
@ -1928,11 +1930,15 @@ ConvertToJS(JSContext* cx,
|
||||
if (!numeric_limits<type>::is_signed) { \
|
||||
value = *static_cast<type*>(data); \
|
||||
/* Get ctypes.UInt64.prototype from ctypes.CType.prototype. */ \
|
||||
proto = CType::GetProtoFromType(typeObj, SLOT_UINT64PROTO); \
|
||||
proto = CType::GetProtoFromType(cx, typeObj, SLOT_UINT64PROTO); \
|
||||
if (!proto) \
|
||||
return false; \
|
||||
} else { \
|
||||
value = int64_t(*static_cast<type*>(data)); \
|
||||
/* Get ctypes.Int64.prototype from ctypes.CType.prototype. */ \
|
||||
proto = CType::GetProtoFromType(typeObj, SLOT_INT64PROTO); \
|
||||
proto = CType::GetProtoFromType(cx, typeObj, SLOT_INT64PROTO); \
|
||||
if (!proto) \
|
||||
return false; \
|
||||
} \
|
||||
\
|
||||
JSObject* obj = Int64Base::Construct(cx, proto, value, \
|
||||
@ -3357,17 +3363,20 @@ CType::GetProtoFromCtor(JSObject* obj, CTypeProtoSlot slot)
|
||||
}
|
||||
|
||||
JSObject*
|
||||
CType::GetProtoFromType(JSObject* obj, CTypeProtoSlot slot)
|
||||
CType::GetProtoFromType(JSContext* cx, JSObject* obj, CTypeProtoSlot slot)
|
||||
{
|
||||
JS_ASSERT(IsCType(obj));
|
||||
|
||||
// Get the prototype of the type object.
|
||||
JSObject* proto = JS_GetPrototype(obj);
|
||||
JSObject* proto;
|
||||
if (!JS_GetPrototype(cx, obj, &proto))
|
||||
return NULL;
|
||||
JS_ASSERT(proto);
|
||||
JS_ASSERT(CType::IsCTypeProto(proto));
|
||||
|
||||
// Get the requested ctypes.{Pointer,Array,Struct,Function}Type.prototype.
|
||||
jsval result = JS_GetReservedSlot(proto, slot);
|
||||
JS_ASSERT(!JSVAL_IS_PRIMITIVE(result));
|
||||
return JSVAL_TO_OBJECT(result);
|
||||
}
|
||||
|
||||
@ -3538,7 +3547,11 @@ CType::HasInstance(JSContext* cx, JSHandleObject obj, JSMutableHandleValue v, JS
|
||||
return JS_TRUE;
|
||||
|
||||
JSObject* proto = JSVAL_TO_OBJECT(v);
|
||||
while ((proto = JS_GetPrototype(proto))) {
|
||||
for (;;) {
|
||||
if (!JS_GetPrototype(cx, proto, &proto))
|
||||
return JS_FALSE;
|
||||
if (!proto)
|
||||
break;
|
||||
if (proto == prototype) {
|
||||
*bp = JS_TRUE;
|
||||
break;
|
||||
@ -3552,15 +3565,16 @@ CType::GetGlobalCTypes(JSContext* cx, JSObject* obj)
|
||||
{
|
||||
JS_ASSERT(CType::IsCType(obj));
|
||||
|
||||
JSObject *objTypeProto = JS_GetPrototype(obj);
|
||||
if (!objTypeProto) {
|
||||
}
|
||||
JSObject *objTypeProto;
|
||||
if (!JS_GetPrototype(cx, obj, &objTypeProto))
|
||||
return NULL;
|
||||
JS_ASSERT(objTypeProto);
|
||||
JS_ASSERT(CType::IsCTypeProto(objTypeProto));
|
||||
|
||||
jsval valCTypes = JS_GetReservedSlot(objTypeProto, SLOT_CTYPES);
|
||||
JS_ASSERT(!JSVAL_IS_PRIMITIVE(valCTypes));
|
||||
|
||||
JS_ASSERT(!JSVAL_IS_PRIMITIVE(valCTypes));
|
||||
return JSVAL_TO_OBJECT(valCTypes);
|
||||
}
|
||||
|
||||
@ -3653,8 +3667,12 @@ PointerType::CreateInternal(JSContext* cx, HandleObject baseType)
|
||||
// of this type, or ctypes.FunctionType.prototype for function pointers.
|
||||
CTypeProtoSlot slotId = CType::GetTypeCode(baseType) == TYPE_function ?
|
||||
SLOT_FUNCTIONDATAPROTO : SLOT_POINTERDATAPROTO;
|
||||
RootedObject dataProto(cx, CType::GetProtoFromType(baseType, slotId));
|
||||
RootedObject typeProto(cx, CType::GetProtoFromType(baseType, SLOT_POINTERPROTO));
|
||||
RootedObject dataProto(cx, CType::GetProtoFromType(cx, baseType, slotId));
|
||||
if (!dataProto)
|
||||
return NULL;
|
||||
RootedObject typeProto(cx, CType::GetProtoFromType(cx, baseType, SLOT_POINTERPROTO));
|
||||
if (!typeProto)
|
||||
return NULL;
|
||||
|
||||
// Create a new CType object with the common properties and slots.
|
||||
JSObject* typeObj = CType::Create(cx, typeProto, dataProto, TYPE_pointer,
|
||||
@ -3971,8 +3989,12 @@ ArrayType::CreateInternal(JSContext* cx,
|
||||
{
|
||||
// Get ctypes.ArrayType.prototype and the common prototype for CData objects
|
||||
// of this type, from ctypes.CType.prototype.
|
||||
RootedObject typeProto(cx, CType::GetProtoFromType(baseType, SLOT_ARRAYPROTO));
|
||||
RootedObject dataProto(cx, CType::GetProtoFromType(baseType, SLOT_ARRAYDATAPROTO));
|
||||
RootedObject typeProto(cx, CType::GetProtoFromType(cx, baseType, SLOT_ARRAYPROTO));
|
||||
if (!typeProto)
|
||||
return NULL;
|
||||
RootedObject dataProto(cx, CType::GetProtoFromType(cx, baseType, SLOT_ARRAYDATAPROTO));
|
||||
if (!dataProto)
|
||||
return NULL;
|
||||
|
||||
// Determine the size of the array from the base type, if possible.
|
||||
// The size of the base type must be defined.
|
||||
@ -4515,7 +4537,9 @@ StructType::DefineInternal(JSContext* cx, JSObject* typeObj_, JSObject* fieldsOb
|
||||
|
||||
// Get the common prototype for CData objects of this type from
|
||||
// ctypes.CType.prototype.
|
||||
RootedObject dataProto(cx, CType::GetProtoFromType(typeObj, SLOT_STRUCTDATAPROTO));
|
||||
RootedObject dataProto(cx, CType::GetProtoFromType(cx, typeObj, SLOT_STRUCTDATAPROTO));
|
||||
if (!dataProto)
|
||||
return JS_FALSE;
|
||||
|
||||
// Set up the 'prototype' and 'prototype.constructor' properties.
|
||||
// The prototype will reflect the struct fields as properties on CData objects
|
||||
@ -5372,10 +5396,14 @@ FunctionType::CreateInternal(JSContext* cx,
|
||||
|
||||
// Get ctypes.FunctionType.prototype and the common prototype for CData objects
|
||||
// of this type, from ctypes.CType.prototype.
|
||||
RootedObject typeProto(cx, CType::GetProtoFromType(fninfo->mReturnType,
|
||||
RootedObject typeProto(cx, CType::GetProtoFromType(cx, fninfo->mReturnType,
|
||||
SLOT_FUNCTIONPROTO));
|
||||
RootedObject dataProto(cx, CType::GetProtoFromType(fninfo->mReturnType,
|
||||
if (!typeProto)
|
||||
return NULL;
|
||||
RootedObject dataProto(cx, CType::GetProtoFromType(cx, fninfo->mReturnType,
|
||||
SLOT_FUNCTIONDATAPROTO));
|
||||
if (!dataProto)
|
||||
return NULL;
|
||||
|
||||
// Create a new CType object with the common properties and slots.
|
||||
JSObject* typeObj = CType::Create(cx, typeProto, dataProto, TYPE_function,
|
||||
@ -5590,6 +5618,8 @@ FunctionType::Call(JSContext* cx,
|
||||
|
||||
// Store the error value for later consultation with |ctypes.getStatus|
|
||||
JSObject *objCTypes = CType::GetGlobalCTypes(cx, typeObj);
|
||||
if (!objCTypes)
|
||||
return false;
|
||||
|
||||
JS_SetReservedSlot(objCTypes, SLOT_ERRNO, INT_TO_JSVAL(errnoStatus));
|
||||
#if defined(XP_WIN)
|
||||
@ -5740,7 +5770,9 @@ CClosure::Create(JSContext* cx,
|
||||
|
||||
// Get the prototype of the FunctionType object, of class CTypeProto,
|
||||
// which stores our JSContext for use with the closure.
|
||||
JSObject* proto = JS_GetPrototype(typeObj);
|
||||
JSObject* proto;
|
||||
if (!JS_GetPrototype(cx, typeObj, &proto))
|
||||
return NULL;
|
||||
JS_ASSERT(proto);
|
||||
JS_ASSERT(CType::IsCTypeProto(proto));
|
||||
|
||||
@ -6906,6 +6938,8 @@ CDataFinalizer::Methods::Dispose(JSContext* cx, unsigned argc, jsval *vp)
|
||||
JS_ASSERT(!JSVAL_IS_PRIMITIVE(valType));
|
||||
|
||||
JSObject *objCTypes = CType::GetGlobalCTypes(cx, JSVAL_TO_OBJECT(valType));
|
||||
if (!objCTypes)
|
||||
return JS_FALSE;
|
||||
|
||||
jsval valCodePtrType = JS_GetReservedSlot(obj, SLOT_DATAFINALIZER_CODETYPE);
|
||||
JS_ASSERT(!JSVAL_IS_PRIMITIVE(valCodePtrType));
|
||||
|
@ -428,7 +428,7 @@ namespace CType {
|
||||
ffi_type* GetFFIType(JSContext* cx, JSObject* obj);
|
||||
JSString* GetName(JSContext* cx, JSHandleObject obj);
|
||||
JSObject* GetProtoFromCtor(JSObject* obj, CTypeProtoSlot slot);
|
||||
JSObject* GetProtoFromType(JSObject* obj, CTypeProtoSlot slot);
|
||||
JSObject* GetProtoFromType(JSContext* cx, JSObject* obj, CTypeProtoSlot slot);
|
||||
JSCTypesCallbacks* GetCallbacksFromType(JSObject* obj);
|
||||
}
|
||||
|
||||
|
@ -845,17 +845,17 @@ class TokenStream
|
||||
void updateFlagsForEOL();
|
||||
|
||||
Token tokens[ntokens];/* circular token buffer */
|
||||
JS::SkipRoot tokensRoot; /* prevent overwriting of token buffer */
|
||||
js::SkipRoot tokensRoot; /* prevent overwriting of token buffer */
|
||||
unsigned cursor; /* index of last parsed token */
|
||||
unsigned lookahead; /* count of lookahead tokens */
|
||||
unsigned lineno; /* current line number */
|
||||
unsigned flags; /* flags -- see above */
|
||||
const jschar *linebase; /* start of current line; points into userbuf */
|
||||
const jschar *prevLinebase; /* start of previous line; NULL if on the first line */
|
||||
JS::SkipRoot linebaseRoot;
|
||||
JS::SkipRoot prevLinebaseRoot;
|
||||
js::SkipRoot linebaseRoot;
|
||||
js::SkipRoot prevLinebaseRoot;
|
||||
TokenBuf userbuf; /* user input buffer */
|
||||
JS::SkipRoot userbufRoot;
|
||||
js::SkipRoot userbufRoot;
|
||||
const char *filename; /* input filename or null */
|
||||
jschar *sourceMap; /* source map's filename or null */
|
||||
void *listenerTSData;/* listener data for this TokenStream */
|
||||
|
@ -889,7 +889,7 @@ ScanTypeObject(GCMarker *gcmarker, types::TypeObject *type)
|
||||
}
|
||||
}
|
||||
|
||||
if (type->proto)
|
||||
if (TaggedProto(type->proto).isObject())
|
||||
PushMarkStack(gcmarker, type->proto);
|
||||
|
||||
if (type->singleton && !type->lazy())
|
||||
@ -914,7 +914,7 @@ MarkChildren(JSTracer *trc, types::TypeObject *type)
|
||||
MarkId(trc, &prop->id, "type_prop");
|
||||
}
|
||||
|
||||
if (type->proto)
|
||||
if (TaggedProto(type->proto).isObject())
|
||||
MarkObject(trc, &type->proto, "type_proto");
|
||||
|
||||
if (type->singleton && !type->lazy())
|
||||
|
109
js/src/gc/Root.h
109
js/src/gc/Root.h
@ -17,14 +17,6 @@
|
||||
|
||||
#include "jspubtd.h"
|
||||
|
||||
namespace js {
|
||||
namespace gc {
|
||||
struct Cell;
|
||||
} /* namespace gc */
|
||||
} /* namespace js */
|
||||
|
||||
namespace JS {
|
||||
|
||||
/*
|
||||
* Moving GC Stack Rooting
|
||||
*
|
||||
@ -68,12 +60,25 @@ namespace JS {
|
||||
* separate rooting analysis.
|
||||
*/
|
||||
|
||||
template <typename T> class MutableHandle;
|
||||
namespace js {
|
||||
|
||||
template <typename T> class Rooted;
|
||||
|
||||
template <typename T>
|
||||
struct RootMethods { };
|
||||
|
||||
template <typename T>
|
||||
class HandleBase {};
|
||||
|
||||
template <typename T>
|
||||
class MutableHandleBase {};
|
||||
|
||||
} /* namespace js */
|
||||
|
||||
namespace JS {
|
||||
|
||||
template <typename T> class MutableHandle;
|
||||
|
||||
/*
|
||||
* Handle provides an implicit constructor for NullPtr so that, given:
|
||||
* foo(Handle<JSObject*> h);
|
||||
@ -89,9 +94,6 @@ struct NullPtr
|
||||
template <typename T>
|
||||
class MutableHandle;
|
||||
|
||||
template <typename T>
|
||||
class HandleBase {};
|
||||
|
||||
/*
|
||||
* Reference to a T that has been rooted elsewhere. This is most useful
|
||||
* as a parameter type, which guarantees that the T lvalue is properly
|
||||
@ -101,7 +103,7 @@ class HandleBase {};
|
||||
* specialization, define a HandleBase<T> specialization containing them.
|
||||
*/
|
||||
template <typename T>
|
||||
class Handle : public HandleBase<T>
|
||||
class Handle : public js::HandleBase<T>
|
||||
{
|
||||
public:
|
||||
/* Creates a handle from a handle of a type convertible to T. */
|
||||
@ -142,7 +144,7 @@ class Handle : public HandleBase<T>
|
||||
*/
|
||||
template <typename S>
|
||||
inline
|
||||
Handle(Rooted<S> &root,
|
||||
Handle(js::Rooted<S> &root,
|
||||
typename mozilla::EnableIf<mozilla::IsConvertible<S, T>::value, int>::Type dummy = 0);
|
||||
|
||||
/* Construct a read only handle from a mutable handle. */
|
||||
@ -173,9 +175,6 @@ typedef Handle<JSString*> HandleString;
|
||||
typedef Handle<jsid> HandleId;
|
||||
typedef Handle<Value> HandleValue;
|
||||
|
||||
template <typename T>
|
||||
class MutableHandleBase {};
|
||||
|
||||
/*
|
||||
* Similar to a handle, but the underlying storage can be changed. This is
|
||||
* useful for outparams.
|
||||
@ -185,7 +184,7 @@ class MutableHandleBase {};
|
||||
* them.
|
||||
*/
|
||||
template <typename T>
|
||||
class MutableHandle : public MutableHandleBase<T>
|
||||
class MutableHandle : public js::MutableHandleBase<T>
|
||||
{
|
||||
public:
|
||||
template <typename S>
|
||||
@ -197,12 +196,12 @@ class MutableHandle : public MutableHandleBase<T>
|
||||
|
||||
template <typename S>
|
||||
inline
|
||||
MutableHandle(Rooted<S> *root,
|
||||
MutableHandle(js::Rooted<S> *root,
|
||||
typename mozilla::EnableIf<mozilla::IsConvertible<S, T>::value, int>::Type dummy = 0);
|
||||
|
||||
void set(T v)
|
||||
{
|
||||
JS_ASSERT(!RootMethods<T>::poisoned(v));
|
||||
JS_ASSERT(!js::RootMethods<T>::poisoned(v));
|
||||
*ptr = v;
|
||||
}
|
||||
|
||||
@ -252,6 +251,10 @@ typedef JSString * RawString;
|
||||
typedef jsid RawId;
|
||||
typedef Value RawValue;
|
||||
|
||||
} /* namespace JS */
|
||||
|
||||
namespace js {
|
||||
|
||||
/*
|
||||
* InternalHandle is a handle to an internal pointer into a gcthing. Use
|
||||
* InternalHandle when you have a pointer to a direct field of a gcthing, or
|
||||
@ -279,7 +282,7 @@ class InternalHandle<T*> : public InternalHandleBase
|
||||
* field in question, and a pointer to the field.
|
||||
*/
|
||||
template<typename H>
|
||||
InternalHandle(const Handle<H> &handle, T *field)
|
||||
InternalHandle(const JS::Handle<H> &handle, T *field)
|
||||
: holder((void**)handle.address()), offset(uintptr_t(field) - uintptr_t(handle.get()))
|
||||
{
|
||||
}
|
||||
@ -319,8 +322,6 @@ class InternalHandle<T*> : public InternalHandleBase
|
||||
}
|
||||
};
|
||||
|
||||
extern mozilla::ThreadLocal<JSRuntime *> TlsRuntime;
|
||||
|
||||
/*
|
||||
* By default, pointers should use the inheritance hierarchy to find their
|
||||
* ThingRootKind. Some pointer types are explicitly set in jspubtd.h so that
|
||||
@ -454,30 +455,6 @@ class Rooted : public RootedBase<T>
|
||||
Rooted(const Rooted &) MOZ_DELETE;
|
||||
};
|
||||
|
||||
template<typename T> template <typename S>
|
||||
inline
|
||||
Handle<T>::Handle(Rooted<S> &root,
|
||||
typename mozilla::EnableIf<mozilla::IsConvertible<S, T>::value, int>::Type dummy)
|
||||
{
|
||||
ptr = reinterpret_cast<const T *>(root.address());
|
||||
}
|
||||
|
||||
template<typename T> template <typename S>
|
||||
inline
|
||||
Handle<T>::Handle(MutableHandle<S> &root,
|
||||
typename mozilla::EnableIf<mozilla::IsConvertible<S, T>::value, int>::Type dummy)
|
||||
{
|
||||
ptr = reinterpret_cast<const T *>(root.address());
|
||||
}
|
||||
|
||||
template<typename T> template <typename S>
|
||||
inline
|
||||
MutableHandle<T>::MutableHandle(Rooted<S> *root,
|
||||
typename mozilla::EnableIf<mozilla::IsConvertible<S, T>::value, int>::Type dummy)
|
||||
{
|
||||
ptr = root->address();
|
||||
}
|
||||
|
||||
typedef Rooted<JSObject*> RootedObject;
|
||||
typedef Rooted<JSFunction*> RootedFunction;
|
||||
typedef Rooted<JSScript*> RootedScript;
|
||||
@ -545,6 +522,34 @@ class SkipRoot
|
||||
JS_DECL_USE_GUARD_OBJECT_NOTIFIER
|
||||
};
|
||||
|
||||
} /* namespace js */
|
||||
|
||||
namespace JS {
|
||||
|
||||
template<typename T> template <typename S>
|
||||
inline
|
||||
Handle<T>::Handle(js::Rooted<S> &root,
|
||||
typename mozilla::EnableIf<mozilla::IsConvertible<S, T>::value, int>::Type dummy)
|
||||
{
|
||||
ptr = reinterpret_cast<const T *>(root.address());
|
||||
}
|
||||
|
||||
template<typename T> template <typename S>
|
||||
inline
|
||||
Handle<T>::Handle(MutableHandle<S> &root,
|
||||
typename mozilla::EnableIf<mozilla::IsConvertible<S, T>::value, int>::Type dummy)
|
||||
{
|
||||
ptr = reinterpret_cast<const T *>(root.address());
|
||||
}
|
||||
|
||||
template<typename T> template <typename S>
|
||||
inline
|
||||
MutableHandle<T>::MutableHandle(js::Rooted<S> *root,
|
||||
typename mozilla::EnableIf<mozilla::IsConvertible<S, T>::value, int>::Type dummy)
|
||||
{
|
||||
ptr = root->address();
|
||||
}
|
||||
|
||||
JS_FRIEND_API(void) EnterAssertNoGCScope();
|
||||
JS_FRIEND_API(void) LeaveAssertNoGCScope();
|
||||
JS_FRIEND_API(bool) InNoGCScope();
|
||||
@ -580,6 +585,10 @@ CheckStackRoots(JSContext *cx);
|
||||
|
||||
JS_FRIEND_API(bool) NeedRelaxedRootChecks();
|
||||
|
||||
} /* namespace JS */
|
||||
|
||||
namespace js {
|
||||
|
||||
/*
|
||||
* Hook for dynamic root analysis. Checks the native stack and poisons
|
||||
* references to GC things which have not been rooted.
|
||||
@ -596,6 +605,10 @@ inline void MaybeCheckStackRoots(JSContext *cx, bool relax = true)
|
||||
#endif
|
||||
}
|
||||
|
||||
namespace gc {
|
||||
struct Cell;
|
||||
} /* namespace gc */
|
||||
|
||||
/* Base class for automatic read-only object rooting during compilation. */
|
||||
class CompilerRootNode
|
||||
{
|
||||
@ -614,7 +627,7 @@ class CompilerRootNode
|
||||
js::gc::Cell *ptr;
|
||||
};
|
||||
|
||||
} /* namespace JS */
|
||||
} /* namespace js */
|
||||
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
@ -35,7 +35,7 @@ class CompilerRoot : public CompilerRootNode
|
||||
public:
|
||||
// Sets the pointer and inserts into root list. The pointer becomes read-only.
|
||||
void setRoot(T root) {
|
||||
JS::CompilerRootNode *&rootList = GetIonContext()->temp->rootList();
|
||||
CompilerRootNode *&rootList = GetIonContext()->temp->rootList();
|
||||
|
||||
JS_ASSERT(!ptr);
|
||||
ptr = root;
|
||||
|
@ -23,7 +23,7 @@ class TempAllocator
|
||||
void *mark_;
|
||||
|
||||
// Linked list of GCThings rooted by this allocator.
|
||||
JS::CompilerRootNode *rootList_;
|
||||
CompilerRootNode *rootList_;
|
||||
|
||||
public:
|
||||
TempAllocator(LifoAlloc *lifoAlloc)
|
||||
@ -57,7 +57,7 @@ class TempAllocator
|
||||
return lifoAlloc_;
|
||||
}
|
||||
|
||||
JS::CompilerRootNode *&rootList()
|
||||
CompilerRootNode *&rootList()
|
||||
{
|
||||
return rootList_;
|
||||
}
|
||||
|
@ -113,6 +113,7 @@ class IonFrameIterator
|
||||
return type_ == IonFrame_JS;
|
||||
}
|
||||
bool isNative() const;
|
||||
bool isOOLNativeGetter() const;
|
||||
bool isDOMExit() const;
|
||||
bool isEntry() const {
|
||||
return type_ == IonFrame_Entry;
|
||||
|
@ -82,11 +82,20 @@ IonFrameIterator::frameSize() const
|
||||
|
||||
// Returns the JSScript associated with the topmost Ion frame.
|
||||
inline JSScript *
|
||||
GetTopIonJSScript(JSContext *cx)
|
||||
GetTopIonJSScript(JSContext *cx, const SafepointIndex **safepointIndexOut, void **returnAddrOut)
|
||||
{
|
||||
IonFrameIterator iter(cx->runtime->ionTop);
|
||||
JS_ASSERT(iter.type() == IonFrame_Exit);
|
||||
++iter;
|
||||
|
||||
// If needed, grab the safepoint index.
|
||||
if (safepointIndexOut)
|
||||
*safepointIndexOut = iter.safepoint();
|
||||
|
||||
JS_ASSERT(iter.returnAddressToFp() != NULL);
|
||||
if (returnAddrOut)
|
||||
*returnAddrOut = (void *) iter.returnAddressToFp();
|
||||
|
||||
JS_ASSERT(iter.type() == IonFrame_JS);
|
||||
IonJSFrameLayout *frame = static_cast<IonJSFrameLayout*>(iter.current());
|
||||
switch (GetCalleeTokenTag(frame->calleeToken())) {
|
||||
|
@ -117,6 +117,14 @@ IonFrameIterator::isNative() const
|
||||
return exitFrame()->footer()->ionCode() == NULL;
|
||||
}
|
||||
|
||||
bool
|
||||
IonFrameIterator::isOOLNativeGetter() const
|
||||
{
|
||||
if (type_ != IonFrame_Exit)
|
||||
return false;
|
||||
return exitFrame()->footer()->ionCode() == ION_FRAME_OOL_NATIVE_GETTER;
|
||||
}
|
||||
|
||||
bool
|
||||
IonFrameIterator::isDOMExit() const
|
||||
{
|
||||
@ -530,6 +538,13 @@ MarkIonExitFrame(JSTracer *trc, const IonFrameIterator &frame)
|
||||
return;
|
||||
}
|
||||
|
||||
if (frame.isOOLNativeGetter()) {
|
||||
IonOOLNativeGetterExitFrameLayout *oolgetter = frame.exitFrame()->oolNativeGetterExit();
|
||||
gc::MarkValueRoot(trc, oolgetter->vp(), "ion-ool-getter-callee");
|
||||
gc::MarkValueRoot(trc, oolgetter->vp() + 1, "ion-ool-getter-this");
|
||||
return;
|
||||
}
|
||||
|
||||
if (frame.isDOMExit()) {
|
||||
IonDOMExitFrameLayout *dom = frame.exitFrame()->DOMExit();
|
||||
gc::MarkObjectRoot(trc, dom->thisObjAddress(), "ion-dom-args");
|
||||
|
@ -257,7 +257,9 @@ namespace js {
|
||||
namespace ion {
|
||||
|
||||
JSScript *
|
||||
GetTopIonJSScript(JSContext *cx);
|
||||
GetTopIonJSScript(JSContext *cx,
|
||||
const SafepointIndex **safepointIndexOut = NULL,
|
||||
void **returnAddrOut = NULL);
|
||||
|
||||
void
|
||||
GetPcScript(JSContext *cx, JSScript **scriptRes, jsbytecode **pcRes);
|
||||
|
@ -156,6 +156,7 @@ class IonOsrFrameLayout : public IonJSFrameLayout
|
||||
};
|
||||
|
||||
class IonNativeExitFrameLayout;
|
||||
class IonOOLNativeGetterExitFrameLayout;
|
||||
class IonDOMExitFrameLayout;
|
||||
|
||||
// this is the frame layout when we are exiting ion code, and about to enter EABI code
|
||||
@ -192,6 +193,9 @@ class IonExitFrameLayout : public IonCommonFrameLayout
|
||||
inline bool isNativeExit() {
|
||||
return footer()->ionCode() == NULL;
|
||||
}
|
||||
inline bool isOOLNativeGetterExit() {
|
||||
return footer()->ionCode() == ION_FRAME_OOL_NATIVE_GETTER;
|
||||
}
|
||||
inline bool isDomExit() {
|
||||
IonCode *code = footer()->ionCode();
|
||||
return
|
||||
@ -205,6 +209,10 @@ class IonExitFrameLayout : public IonCommonFrameLayout
|
||||
JS_ASSERT(isNativeExit());
|
||||
return reinterpret_cast<IonNativeExitFrameLayout *>(footer());
|
||||
}
|
||||
inline IonOOLNativeGetterExitFrameLayout *oolNativeGetterExit() {
|
||||
JS_ASSERT(isOOLNativeGetterExit());
|
||||
return reinterpret_cast<IonOOLNativeGetterExitFrameLayout *>(footer());
|
||||
}
|
||||
inline IonDOMExitFrameLayout *DOMExit() {
|
||||
JS_ASSERT(isDomExit());
|
||||
return reinterpret_cast<IonDOMExitFrameLayout *>(footer());
|
||||
@ -240,6 +248,36 @@ class IonNativeExitFrameLayout
|
||||
}
|
||||
};
|
||||
|
||||
class IonOOLNativeGetterExitFrameLayout
|
||||
{
|
||||
IonExitFooterFrame footer_;
|
||||
IonExitFrameLayout exit_;
|
||||
|
||||
// We need to split the Value into 2 fields of 32 bits, otherwise the C++
|
||||
// compiler may add some padding between the fields.
|
||||
uint32_t loCalleeResult_;
|
||||
uint32_t hiCalleeResult_;
|
||||
|
||||
// The frame includes the object argument.
|
||||
uint32_t loThis_;
|
||||
uint32_t hiThis_;
|
||||
|
||||
public:
|
||||
static inline size_t Size() {
|
||||
return sizeof(IonOOLNativeGetterExitFrameLayout);
|
||||
}
|
||||
|
||||
static size_t offsetOfResult() {
|
||||
return offsetof(IonOOLNativeGetterExitFrameLayout, loCalleeResult_);
|
||||
}
|
||||
inline Value *vp() {
|
||||
return reinterpret_cast<Value*>(&loCalleeResult_);
|
||||
}
|
||||
inline uintptr_t argc() const {
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
|
||||
class IonDOMExitFrameLayout
|
||||
{
|
||||
IonExitFooterFrame footer_;
|
||||
|
@ -44,5 +44,6 @@
|
||||
#define ION_FRAME_DOMGETTER ((IonCode *)0x1)
|
||||
#define ION_FRAME_DOMSETTER ((IonCode *)0x2)
|
||||
#define ION_FRAME_DOMMETHOD ((IonCode *)0x3)
|
||||
#define ION_FRAME_OOL_NATIVE_GETTER ((IonCode *)0x4)
|
||||
|
||||
#endif
|
||||
|
@ -141,6 +141,7 @@ class IonExitFooterFrame
|
||||
};
|
||||
|
||||
class IonNativeExitFrameLayout;
|
||||
class IonOOLNativeGetterExitFrameLayout;
|
||||
class IonDOMExitFrameLayout;
|
||||
|
||||
class IonExitFrameLayout : public IonCommonFrameLayout
|
||||
@ -189,6 +190,11 @@ class IonExitFrameLayout : public IonCommonFrameLayout
|
||||
JS_ASSERT(isNativeExit());
|
||||
return reinterpret_cast<IonNativeExitFrameLayout *>(footer());
|
||||
}
|
||||
inline IonOOLNativeGetterExitFrameLayout *oolNativeGetterExit() {
|
||||
// see CodeGenerator::visitCallNative
|
||||
JS_ASSERT(footer()->ionCode() == ION_FRAME_OOL_NATIVE_GETTER);
|
||||
return reinterpret_cast<IonOOLNativeGetterExitFrameLayout *>(footer());
|
||||
}
|
||||
inline IonDOMExitFrameLayout *DOMExit() {
|
||||
JS_ASSERT(isDomExit());
|
||||
return reinterpret_cast<IonDOMExitFrameLayout *>(footer());
|
||||
@ -223,6 +229,37 @@ class IonNativeExitFrameLayout
|
||||
}
|
||||
};
|
||||
|
||||
class IonOOLNativeGetterExitFrameLayout
|
||||
{
|
||||
IonExitFooterFrame footer_;
|
||||
IonExitFrameLayout exit_;
|
||||
|
||||
// We need to split the Value into 2 fields of 32 bits, otherwise the C++
|
||||
// compiler may add some padding between the fields.
|
||||
uint32_t loCalleeResult_;
|
||||
uint32_t hiCalleeResult_;
|
||||
|
||||
// The frame includes the object argument.
|
||||
uint32_t loThisResult_;
|
||||
uint32_t hiThisResult_;
|
||||
|
||||
public:
|
||||
static inline size_t Size() {
|
||||
return sizeof(IonOOLNativeGetterExitFrameLayout);
|
||||
}
|
||||
|
||||
static size_t offsetOfResult() {
|
||||
return offsetof(IonOOLNativeGetterExitFrameLayout, loCalleeResult_);
|
||||
}
|
||||
|
||||
inline Value *vp() {
|
||||
return reinterpret_cast<Value*>(&loCalleeResult_);
|
||||
}
|
||||
inline uintptr_t argc() const {
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
|
||||
class IonDOMExitFrameLayout
|
||||
{
|
||||
protected: // only to silence a clang warning about unused private fields
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
BEGIN_TEST(selfTest_NaNsAreSame)
|
||||
{
|
||||
JS::RootedValue v1(cx), v2(cx);
|
||||
js::RootedValue v1(cx), v2(cx);
|
||||
EVAL("0/0", v1.address()); // NaN
|
||||
CHECK_SAME(v1, v1);
|
||||
|
||||
|
@ -34,15 +34,15 @@ JSClass addPropertyClass = {
|
||||
|
||||
BEGIN_TEST(testAddPropertyHook)
|
||||
{
|
||||
JS::RootedObject obj(cx, JS_NewObject(cx, NULL, NULL, NULL));
|
||||
js::RootedObject obj(cx, JS_NewObject(cx, NULL, NULL, NULL));
|
||||
CHECK(obj);
|
||||
JS::RootedValue proto(cx, OBJECT_TO_JSVAL(obj));
|
||||
js::RootedValue proto(cx, OBJECT_TO_JSVAL(obj));
|
||||
JS_InitClass(cx, global, obj, &addPropertyClass, NULL, 0, NULL, NULL, NULL,
|
||||
NULL);
|
||||
|
||||
obj = JS_NewArrayObject(cx, 0, NULL);
|
||||
CHECK(obj);
|
||||
JS::RootedValue arr(cx, OBJECT_TO_JSVAL(obj));
|
||||
js::RootedValue arr(cx, OBJECT_TO_JSVAL(obj));
|
||||
|
||||
CHECK(JS_DefineProperty(cx, global, "arr", arr,
|
||||
JS_PropertyStub, JS_StrictPropertyStub,
|
||||
@ -51,8 +51,8 @@ BEGIN_TEST(testAddPropertyHook)
|
||||
for (int i = 0; i < expectedCount; ++i) {
|
||||
obj = JS_NewObject(cx, &addPropertyClass, NULL, NULL);
|
||||
CHECK(obj);
|
||||
JS::RootedValue vobj(cx, OBJECT_TO_JSVAL(obj));
|
||||
JS::RootedObject arrObj(cx, JSVAL_TO_OBJECT(arr));
|
||||
js::RootedValue vobj(cx, OBJECT_TO_JSVAL(obj));
|
||||
js::RootedObject arrObj(cx, JSVAL_TO_OBJECT(arr));
|
||||
CHECK(JS_DefineElement(cx, arrObj, i, vobj,
|
||||
JS_PropertyStub, JS_StrictPropertyStub,
|
||||
JSPROP_ENUMERATE));
|
||||
|
@ -11,8 +11,8 @@
|
||||
|
||||
BEGIN_TEST(testArrayBuffer_bug720949_steal)
|
||||
{
|
||||
JS::RootedObject buf_len1(cx), buf_len200(cx);
|
||||
JS::RootedObject tarray_len1(cx), tarray_len200(cx);
|
||||
js::RootedObject buf_len1(cx), buf_len200(cx);
|
||||
js::RootedObject tarray_len1(cx), tarray_len200(cx);
|
||||
|
||||
uint32_t sizes[NUM_TEST_BUFFERS] = { sizeof(uint32_t), 200 * sizeof(uint32_t) };
|
||||
JS::HandleObject testBuf[NUM_TEST_BUFFERS] = { buf_len1, buf_len200 };
|
||||
@ -71,11 +71,11 @@ BEGIN_TEST(testArrayBuffer_bug720949_steal)
|
||||
CHECK_SAME(v, JSVAL_VOID);
|
||||
|
||||
// Transfer to a new ArrayBuffer
|
||||
JS::RootedObject dst(cx, JS_NewArrayBufferWithContents(cx, contents));
|
||||
js::RootedObject dst(cx, JS_NewArrayBufferWithContents(cx, contents));
|
||||
CHECK(JS_IsArrayBufferObject(dst, cx));
|
||||
data = JS_GetArrayBufferData(obj, cx);
|
||||
|
||||
JS::RootedObject dstview(cx, JS_NewInt32ArrayWithBuffer(cx, dst, 0, -1));
|
||||
js::RootedObject dstview(cx, JS_NewInt32ArrayWithBuffer(cx, dst, 0, -1));
|
||||
CHECK(dstview != NULL);
|
||||
|
||||
CHECK_EQUAL(JS_GetArrayBufferByteLength(dst, cx), size);
|
||||
@ -99,7 +99,7 @@ static void GC(JSContext *cx)
|
||||
// Varying number of views of a buffer, to test the neutering weak pointers
|
||||
BEGIN_TEST(testArrayBuffer_bug720949_viewList)
|
||||
{
|
||||
JS::RootedObject buffer(cx);
|
||||
js::RootedObject buffer(cx);
|
||||
|
||||
// No views
|
||||
buffer = JS_NewArrayBuffer(cx, 2000);
|
||||
@ -109,7 +109,7 @@ BEGIN_TEST(testArrayBuffer_bug720949_viewList)
|
||||
// One view.
|
||||
{
|
||||
buffer = JS_NewArrayBuffer(cx, 2000);
|
||||
JS::RootedObject view(cx, JS_NewUint8ArrayWithBuffer(cx, buffer, 0, -1));
|
||||
js::RootedObject view(cx, JS_NewUint8ArrayWithBuffer(cx, buffer, 0, -1));
|
||||
void *contents;
|
||||
CHECK(JS_StealArrayBufferContents(cx, buffer, &contents));
|
||||
CHECK(contents != NULL);
|
||||
@ -127,8 +127,8 @@ BEGIN_TEST(testArrayBuffer_bug720949_viewList)
|
||||
{
|
||||
buffer = JS_NewArrayBuffer(cx, 2000);
|
||||
|
||||
JS::RootedObject view1(cx, JS_NewUint8ArrayWithBuffer(cx, buffer, 0, -1));
|
||||
JS::RootedObject view2(cx, JS_NewUint8ArrayWithBuffer(cx, buffer, 1, 200));
|
||||
js::RootedObject view1(cx, JS_NewUint8ArrayWithBuffer(cx, buffer, 0, -1));
|
||||
js::RootedObject view2(cx, JS_NewUint8ArrayWithBuffer(cx, buffer, 1, 200));
|
||||
|
||||
// Remove, re-add a view
|
||||
view2 = NULL;
|
||||
|
@ -14,8 +14,8 @@ BEGIN_TEST(test_BindCallable)
|
||||
EVAL("(function() { return this.somename; })", &func);
|
||||
CHECK(func.isObject());
|
||||
|
||||
JS::RootedObject funcObj(cx, JSVAL_TO_OBJECT(func));
|
||||
JS::RootedObject vObj(cx, JSVAL_TO_OBJECT(v));
|
||||
js::RootedObject funcObj(cx, JSVAL_TO_OBJECT(func));
|
||||
js::RootedObject vObj(cx, JSVAL_TO_OBJECT(v));
|
||||
JSObject* newCallable = JS_BindCallable(cx, funcObj, vObj);
|
||||
CHECK(newCallable);
|
||||
|
||||
|
@ -12,6 +12,8 @@
|
||||
#include "jsobj.h"
|
||||
#include "jswrapper.h"
|
||||
|
||||
#include "jsobjinlines.h"
|
||||
|
||||
struct OuterWrapper : js::DirectWrapper
|
||||
{
|
||||
OuterWrapper() : DirectWrapper(0) {}
|
||||
@ -30,7 +32,7 @@ static JSObject *
|
||||
wrap(JSContext *cx, JS::HandleObject toWrap, JS::HandleObject target)
|
||||
{
|
||||
JSAutoCompartment ac(cx, target);
|
||||
JS::RootedObject wrapper(cx, toWrap);
|
||||
js::RootedObject wrapper(cx, toWrap);
|
||||
if (!JS_WrapObject(cx, wrapper.address()))
|
||||
return NULL;
|
||||
return wrapper;
|
||||
@ -39,7 +41,7 @@ wrap(JSContext *cx, JS::HandleObject toWrap, JS::HandleObject target)
|
||||
static JSObject *
|
||||
SameCompartmentWrap(JSContext *cx, JSObject *objArg)
|
||||
{
|
||||
JS::RootedObject obj(cx, objArg);
|
||||
js::RootedObject obj(cx, objArg);
|
||||
JS_GC(JS_GetRuntime(cx));
|
||||
return obj;
|
||||
}
|
||||
@ -47,8 +49,8 @@ SameCompartmentWrap(JSContext *cx, JSObject *objArg)
|
||||
static JSObject *
|
||||
PreWrap(JSContext *cx, JSObject *scopeArg, JSObject *objArg, unsigned flags)
|
||||
{
|
||||
JS::RootedObject scope(cx, scopeArg);
|
||||
JS::RootedObject obj(cx, objArg);
|
||||
js::RootedObject scope(cx, scopeArg);
|
||||
js::RootedObject obj(cx, objArg);
|
||||
JS_GC(JS_GetRuntime(cx));
|
||||
return obj;
|
||||
}
|
||||
@ -56,34 +58,34 @@ PreWrap(JSContext *cx, JSObject *scopeArg, JSObject *objArg, unsigned flags)
|
||||
static JSObject *
|
||||
Wrap(JSContext *cx, JSObject *objArg, JSObject *protoArg, JSObject *parentArg, unsigned flags)
|
||||
{
|
||||
JS::RootedObject obj(cx, objArg);
|
||||
JS::RootedObject proto(cx, protoArg);
|
||||
JS::RootedObject parent(cx, parentArg);
|
||||
js::RootedObject obj(cx, objArg);
|
||||
js::RootedObject proto(cx, protoArg);
|
||||
js::RootedObject parent(cx, parentArg);
|
||||
return js::Wrapper::New(cx, obj, proto, parent, &js::CrossCompartmentWrapper::singleton);
|
||||
}
|
||||
|
||||
BEGIN_TEST(testBug604087)
|
||||
{
|
||||
JS::RootedObject outerObj(cx, js::Wrapper::New(cx, global, global->getProto(), global,
|
||||
js::RootedObject outerObj(cx, js::Wrapper::New(cx, global, global->getProto(), global,
|
||||
&OuterWrapper::singleton));
|
||||
JS::RootedObject compartment2(cx, JS_NewGlobalObject(cx, getGlobalClass(), NULL));
|
||||
JS::RootedObject compartment3(cx, JS_NewGlobalObject(cx, getGlobalClass(), NULL));
|
||||
JS::RootedObject compartment4(cx, JS_NewGlobalObject(cx, getGlobalClass(), NULL));
|
||||
js::RootedObject compartment2(cx, JS_NewGlobalObject(cx, getGlobalClass(), NULL));
|
||||
js::RootedObject compartment3(cx, JS_NewGlobalObject(cx, getGlobalClass(), NULL));
|
||||
js::RootedObject compartment4(cx, JS_NewGlobalObject(cx, getGlobalClass(), NULL));
|
||||
|
||||
JS::RootedObject c2wrapper(cx, wrap(cx, outerObj, compartment2));
|
||||
js::RootedObject c2wrapper(cx, wrap(cx, outerObj, compartment2));
|
||||
CHECK(c2wrapper);
|
||||
js::SetProxyExtra(c2wrapper, 0, js::Int32Value(2));
|
||||
|
||||
JS::RootedObject c3wrapper(cx, wrap(cx, outerObj, compartment3));
|
||||
js::RootedObject c3wrapper(cx, wrap(cx, outerObj, compartment3));
|
||||
CHECK(c3wrapper);
|
||||
js::SetProxyExtra(c3wrapper, 0, js::Int32Value(3));
|
||||
|
||||
JS::RootedObject c4wrapper(cx, wrap(cx, outerObj, compartment4));
|
||||
js::RootedObject c4wrapper(cx, wrap(cx, outerObj, compartment4));
|
||||
CHECK(c4wrapper);
|
||||
js::SetProxyExtra(c4wrapper, 0, js::Int32Value(4));
|
||||
compartment4 = c4wrapper = NULL;
|
||||
|
||||
JS::RootedObject next(cx);
|
||||
js::RootedObject next(cx);
|
||||
{
|
||||
JSAutoCompartment ac(cx, compartment2);
|
||||
next = js::Wrapper::New(cx, compartment2, compartment2->getProto(), compartment2,
|
||||
|
@ -44,10 +44,10 @@ CustomMethod(JSContext *cx, unsigned argc, Value *vp)
|
||||
BEGIN_TEST(test_CallNonGenericMethodOnProxy)
|
||||
{
|
||||
// Create the first global object and compartment
|
||||
JS::RootedObject globalA(cx, JS_NewGlobalObject(cx, getGlobalClass(), NULL));
|
||||
js::RootedObject globalA(cx, JS_NewGlobalObject(cx, getGlobalClass(), NULL));
|
||||
CHECK(globalA);
|
||||
|
||||
JS::RootedObject customA(cx, JS_NewObject(cx, &CustomClass, NULL, NULL));
|
||||
js::RootedObject customA(cx, JS_NewObject(cx, &CustomClass, NULL, NULL));
|
||||
CHECK(customA);
|
||||
JS_SetReservedSlot(customA, CUSTOM_SLOT, Int32Value(17));
|
||||
|
||||
@ -60,12 +60,12 @@ BEGIN_TEST(test_CallNonGenericMethodOnProxy)
|
||||
|
||||
// Now create the second global object and compartment...
|
||||
{
|
||||
JS::RootedObject globalB(cx, JS_NewGlobalObject(cx, getGlobalClass(), NULL));
|
||||
js::RootedObject globalB(cx, JS_NewGlobalObject(cx, getGlobalClass(), NULL));
|
||||
CHECK(globalB);
|
||||
|
||||
// ...and enter it.
|
||||
JSAutoCompartment enter(cx, globalB);
|
||||
JS::RootedObject customB(cx, JS_NewObject(cx, &CustomClass, NULL, NULL));
|
||||
js::RootedObject customB(cx, JS_NewObject(cx, &CustomClass, NULL, NULL));
|
||||
CHECK(customB);
|
||||
JS_SetReservedSlot(customB, CUSTOM_SLOT, Int32Value(42));
|
||||
|
||||
@ -76,7 +76,7 @@ BEGIN_TEST(test_CallNonGenericMethodOnProxy)
|
||||
CHECK(JS_CallFunction(cx, customB, customMethodB, 0, NULL, &rval));
|
||||
CHECK_SAME(rval, Int32Value(42));
|
||||
|
||||
JS::RootedObject wrappedCustomA(cx, customA);
|
||||
js::RootedObject wrappedCustomA(cx, customA);
|
||||
CHECK(JS_WrapObject(cx, wrappedCustomA.address()));
|
||||
|
||||
jsval rval2;
|
||||
|
@ -63,7 +63,7 @@ BEGIN_TEST(testClassGetter_isCalled)
|
||||
EXEC("function check() { var o = new PTest(); o.test_fn(); o.test_value1; o.test_value2; o.test_value1; }");
|
||||
|
||||
for (int i = 1; i < 9; i++) {
|
||||
JS::RootedValue rval(cx);
|
||||
js::RootedValue rval(cx);
|
||||
CHECK(JS_CallFunctionName(cx, global, "check", 0, NULL, rval.address()));
|
||||
CHECK_SAME(INT_TO_JSVAL(called_test_fn), INT_TO_JSVAL(i));
|
||||
CHECK_SAME(INT_TO_JSVAL(called_test_prop_get), INT_TO_JSVAL(4 * i));
|
||||
|
@ -13,8 +13,8 @@
|
||||
|
||||
BEGIN_TEST(test_cloneScript)
|
||||
{
|
||||
JS::RootedObject A(cx, createGlobal());
|
||||
JS::RootedObject B(cx, createGlobal());
|
||||
js::RootedObject A(cx, createGlobal());
|
||||
js::RootedObject B(cx, createGlobal());
|
||||
|
||||
CHECK(A);
|
||||
CHECK(B);
|
||||
@ -28,7 +28,7 @@ BEGIN_TEST(test_cloneScript)
|
||||
"}\n"
|
||||
"(sum);\n";
|
||||
|
||||
JS::RootedObject obj(cx);
|
||||
js::RootedObject obj(cx);
|
||||
|
||||
// compile for A
|
||||
{
|
||||
@ -90,8 +90,8 @@ BEGIN_TEST(test_cloneScriptWithPrincipals)
|
||||
JSPrincipals *principalsB = new Principals();
|
||||
AutoDropPrincipals dropB(rt, principalsB);
|
||||
|
||||
JS::RootedObject A(cx, createGlobal(principalsA));
|
||||
JS::RootedObject B(cx, createGlobal(principalsB));
|
||||
js::RootedObject A(cx, createGlobal(principalsA));
|
||||
js::RootedObject B(cx, createGlobal(principalsB));
|
||||
|
||||
CHECK(A);
|
||||
CHECK(B);
|
||||
@ -99,7 +99,7 @@ BEGIN_TEST(test_cloneScriptWithPrincipals)
|
||||
const char *argnames[] = { "arg" };
|
||||
const char *source = "return function() { return arg; }";
|
||||
|
||||
JS::RootedObject obj(cx);
|
||||
js::RootedObject obj(cx);
|
||||
|
||||
// Compile in A
|
||||
{
|
||||
@ -119,7 +119,7 @@ BEGIN_TEST(test_cloneScriptWithPrincipals)
|
||||
// Clone into B
|
||||
{
|
||||
JSAutoCompartment b(cx, B);
|
||||
JS::RootedObject cloned(cx);
|
||||
js::RootedObject cloned(cx);
|
||||
CHECK(cloned = JS_CloneFunctionObject(cx, obj, B));
|
||||
|
||||
JSFunction *fun;
|
||||
|
@ -6,16 +6,18 @@
|
||||
#include "jsobj.h"
|
||||
#include "vm/String.h"
|
||||
|
||||
#include "jsobjinlines.h"
|
||||
|
||||
BEGIN_TEST(testConservativeGC)
|
||||
{
|
||||
#ifndef JSGC_USE_EXACT_ROOTING
|
||||
JS::RootedValue v2(cx);
|
||||
js::RootedValue v2(cx);
|
||||
EVAL("({foo: 'bar'});", v2.address());
|
||||
CHECK(v2.isObject());
|
||||
char objCopy[sizeof(JSObject)];
|
||||
js_memcpy(&objCopy, JSVAL_TO_OBJECT(v2), sizeof(JSObject));
|
||||
|
||||
JS::RootedValue v3(cx);
|
||||
js::RootedValue v3(cx);
|
||||
EVAL("String(Math.PI);", v3.address());
|
||||
CHECK(JSVAL_IS_STRING(v3));
|
||||
char strCopy[sizeof(JSString)];
|
||||
@ -24,13 +26,13 @@ BEGIN_TEST(testConservativeGC)
|
||||
jsval tmp;
|
||||
EVAL("({foo2: 'bar2'});", &tmp);
|
||||
CHECK(tmp.isObject());
|
||||
JS::RootedObject obj2(cx, JSVAL_TO_OBJECT(tmp));
|
||||
js::RootedObject obj2(cx, JSVAL_TO_OBJECT(tmp));
|
||||
char obj2Copy[sizeof(JSObject)];
|
||||
js_memcpy(&obj2Copy, obj2, sizeof(JSObject));
|
||||
|
||||
EVAL("String(Math.sqrt(3));", &tmp);
|
||||
CHECK(JSVAL_IS_STRING(tmp));
|
||||
JS::RootedString str2(cx, JSVAL_TO_STRING(tmp));
|
||||
js::RootedString str2(cx, JSVAL_TO_STRING(tmp));
|
||||
char str2Copy[sizeof(JSString)];
|
||||
js_memcpy(&str2Copy, str2, sizeof(JSString));
|
||||
|
||||
|
@ -20,7 +20,7 @@ IterNext(JSContext *cx, unsigned argc, jsval *vp)
|
||||
static JSObject *
|
||||
IterHook(JSContext *cx, JS::HandleObject obj, JSBool keysonly)
|
||||
{
|
||||
JS::RootedObject iterObj(cx, JS_NewObject(cx, NULL, NULL, NULL));
|
||||
js::RootedObject iterObj(cx, JS_NewObject(cx, NULL, NULL, NULL));
|
||||
if (!iterObj)
|
||||
return NULL;
|
||||
if (!JS_DefineFunction(cx, iterObj, "next", IterNext, 0, 0))
|
||||
|
@ -117,7 +117,7 @@ ThrowHook(JSContext *cx, JSScript *, jsbytecode *, jsval *rval, void *closure)
|
||||
JS_ASSERT(!closure);
|
||||
called = true;
|
||||
|
||||
JS::RootedObject global(cx, JS_GetGlobalForScopeChain(cx));
|
||||
js::RootedObject global(cx, JS_GetGlobalForScopeChain(cx));
|
||||
|
||||
char text[] = "new Error()";
|
||||
jsval _;
|
||||
@ -150,7 +150,7 @@ END_TEST(testDebugger_throwHook)
|
||||
BEGIN_TEST(testDebugger_debuggerObjectVsDebugMode)
|
||||
{
|
||||
CHECK(JS_DefineDebuggerObject(cx, global));
|
||||
JS::RootedObject debuggee(cx, JS_NewGlobalObject(cx, getGlobalClass(), NULL));
|
||||
js::RootedObject debuggee(cx, JS_NewGlobalObject(cx, getGlobalClass(), NULL));
|
||||
CHECK(debuggee);
|
||||
|
||||
{
|
||||
@ -159,7 +159,7 @@ BEGIN_TEST(testDebugger_debuggerObjectVsDebugMode)
|
||||
CHECK(JS_InitStandardClasses(cx, debuggee));
|
||||
}
|
||||
|
||||
JS::RootedObject debuggeeWrapper(cx, debuggee);
|
||||
js::RootedObject debuggeeWrapper(cx, debuggee);
|
||||
CHECK(JS_WrapObject(cx, debuggeeWrapper.address()));
|
||||
jsval v = OBJECT_TO_JSVAL(debuggeeWrapper);
|
||||
CHECK(JS_SetProperty(cx, global, "debuggee", &v));
|
||||
@ -190,14 +190,14 @@ BEGIN_TEST(testDebugger_newScriptHook)
|
||||
{
|
||||
// Test that top-level indirect eval fires the newScript hook.
|
||||
CHECK(JS_DefineDebuggerObject(cx, global));
|
||||
JS::RootedObject g(cx, JS_NewGlobalObject(cx, getGlobalClass(), NULL));
|
||||
js::RootedObject g(cx, JS_NewGlobalObject(cx, getGlobalClass(), NULL));
|
||||
CHECK(g);
|
||||
{
|
||||
JSAutoCompartment ae(cx, g);
|
||||
CHECK(JS_InitStandardClasses(cx, g));
|
||||
}
|
||||
|
||||
JS::RootedObject gWrapper(cx, g);
|
||||
js::RootedObject gWrapper(cx, g);
|
||||
CHECK(JS_WrapObject(cx, gWrapper.address()));
|
||||
jsval v = OBJECT_TO_JSVAL(gWrapper);
|
||||
CHECK(JS_SetProperty(cx, global, "g", &v));
|
||||
|
@ -12,7 +12,7 @@ BEGIN_TEST(testDeepFreeze_bug535703)
|
||||
{
|
||||
jsval v;
|
||||
EVAL("var x = {}; x;", &v);
|
||||
JS::RootedObject obj(cx, JSVAL_TO_OBJECT(v));
|
||||
js::RootedObject obj(cx, JSVAL_TO_OBJECT(v));
|
||||
CHECK(JS_DeepFreezeObject(cx, obj)); // don't crash
|
||||
EVAL("Object.isFrozen(x)", &v);
|
||||
CHECK_SAME(v, JSVAL_TRUE);
|
||||
@ -29,7 +29,7 @@ BEGIN_TEST(testDeepFreeze_deep)
|
||||
EVAL("a", &a);
|
||||
EVAL("o", &o);
|
||||
|
||||
JS::RootedObject aobj(cx, JSVAL_TO_OBJECT(a));
|
||||
js::RootedObject aobj(cx, JSVAL_TO_OBJECT(a));
|
||||
CHECK(JS_DeepFreezeObject(cx, aobj));
|
||||
|
||||
jsval b;
|
||||
@ -48,7 +48,7 @@ BEGIN_TEST(testDeepFreeze_loop)
|
||||
EVAL("x", &x);
|
||||
EVAL("y", &y);
|
||||
|
||||
JS::RootedObject xobj(cx, JSVAL_TO_OBJECT(x));
|
||||
js::RootedObject xobj(cx, JSVAL_TO_OBJECT(x));
|
||||
CHECK(JS_DeepFreezeObject(cx, xobj));
|
||||
|
||||
jsval b;
|
||||
|
@ -18,22 +18,22 @@ static const char PROPERTY_NAME[] = "foo";
|
||||
|
||||
BEGIN_TEST(testDefineGetterSetterNonEnumerable)
|
||||
{
|
||||
JS::RootedValue vobj(cx);
|
||||
JS::RootedObject obj(cx, JS_NewObject(cx, NULL, NULL, NULL));
|
||||
js::RootedValue vobj(cx);
|
||||
js::RootedObject obj(cx, JS_NewObject(cx, NULL, NULL, NULL));
|
||||
CHECK(obj);
|
||||
vobj = OBJECT_TO_JSVAL(obj);
|
||||
|
||||
JSFunction *funGet = JS_NewFunction(cx, native, 0, 0, NULL, "get");
|
||||
CHECK(funGet);
|
||||
JS::RootedObject funGetObj(cx, JS_GetFunctionObject(funGet));
|
||||
JS::RootedValue vget(cx, OBJECT_TO_JSVAL(funGetObj));
|
||||
js::RootedObject funGetObj(cx, JS_GetFunctionObject(funGet));
|
||||
js::RootedValue vget(cx, OBJECT_TO_JSVAL(funGetObj));
|
||||
|
||||
JSFunction *funSet = JS_NewFunction(cx, native, 1, 0, NULL, "set");
|
||||
CHECK(funSet);
|
||||
JS::RootedObject funSetObj(cx, JS_GetFunctionObject(funSet));
|
||||
JS::RootedValue vset(cx, OBJECT_TO_JSVAL(funSetObj));
|
||||
js::RootedObject funSetObj(cx, JS_GetFunctionObject(funSet));
|
||||
js::RootedValue vset(cx, OBJECT_TO_JSVAL(funSetObj));
|
||||
|
||||
JS::RootedObject vObject(cx, JSVAL_TO_OBJECT(vobj));
|
||||
js::RootedObject vObject(cx, JSVAL_TO_OBJECT(vobj));
|
||||
CHECK(JS_DefineProperty(cx, vObject, PROPERTY_NAME,
|
||||
JSVAL_VOID,
|
||||
JS_DATA_TO_FUNC_PTR(JSPropertyOp, (JSObject*) funGetObj),
|
||||
|
@ -10,13 +10,13 @@
|
||||
|
||||
BEGIN_TEST(testDefineProperty_bug564344)
|
||||
{
|
||||
JS::RootedValue x(cx);
|
||||
js::RootedValue x(cx);
|
||||
EVAL("function f() {}\n"
|
||||
"var x = {p: f};\n"
|
||||
"x.p(); // brand x's scope\n"
|
||||
"x;", x.address());
|
||||
|
||||
JS::RootedObject obj(cx, JSVAL_TO_OBJECT(x));
|
||||
js::RootedObject obj(cx, JSVAL_TO_OBJECT(x));
|
||||
for (int i = 0; i < 2; i++)
|
||||
CHECK(JS_DefineProperty(cx, obj, "q", JSVAL_VOID, NULL, NULL, JSPROP_SHARED));
|
||||
return true;
|
||||
|
@ -26,7 +26,7 @@ BEGIN_TEST(testErrorCopying_columnCopied)
|
||||
//0123456789012345678901234567
|
||||
EXEC("function check() { Object; foo; }");
|
||||
|
||||
JS::RootedValue rval(cx);
|
||||
js::RootedValue rval(cx);
|
||||
JS_SetErrorReporter(cx, my_ErrorReporter);
|
||||
CHECK(!JS_CallFunctionName(cx, global, "check", 0, NULL, rval.address()));
|
||||
CHECK(column == 27);
|
||||
|
@ -10,12 +10,12 @@
|
||||
|
||||
BEGIN_TEST(testFunctionProperties)
|
||||
{
|
||||
JS::RootedValue x(cx);
|
||||
js::RootedValue x(cx);
|
||||
EVAL("(function f() {})", x.address());
|
||||
|
||||
JS::RootedObject obj(cx, JSVAL_TO_OBJECT(x));
|
||||
js::RootedObject obj(cx, JSVAL_TO_OBJECT(x));
|
||||
|
||||
JS::RootedValue y(cx);
|
||||
js::RootedValue y(cx);
|
||||
CHECK(JS_GetProperty(cx, obj, "arguments", y.address()));
|
||||
CHECK_SAME(y, JSVAL_NULL);
|
||||
|
||||
|
@ -21,7 +21,7 @@ BEGIN_TEST(testGCOutOfMemory)
|
||||
{
|
||||
JS_SetErrorReporter(cx, ErrorCounter);
|
||||
|
||||
JS::RootedValue root(cx);
|
||||
js::RootedValue root(cx);
|
||||
|
||||
static const char source[] =
|
||||
"var max = 0; (function() {"
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user