Bug 771401 - Change PRTime in IDL to signed long long. r=bholley sr=bsmedberg
authorMakoto Kato <m_kato@ga2.so-net.ne.jp>
Thu, 19 Jul 2012 18:53:30 +0900
changeset 99758 e09cf80010c4bf1f688f1e60b59c2e0399de19b5
parent 99757 1986d30771e97af2f63dc55825c9ca1e6152987d
child 99759 8adec1d5233ca65275fbeff1ab4f82535d1c779e
push id12176
push userm_kato@ga2.so-net.ne.jp
push dateThu, 19 Jul 2012 09:54:17 +0000
treeherdermozilla-inbound@e09cf80010c4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbholley, bsmedberg
bugs771401
milestone17.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 771401 - Change PRTime in IDL to signed long long. r=bholley sr=bsmedberg
js/xpconnect/tests/components/js/xpctest_attributes.js
js/xpconnect/tests/components/native/xpctest_attributes.cpp
js/xpconnect/tests/components/native/xpctest_private.h
js/xpconnect/tests/idl/xpctest_attributes.idl
js/xpconnect/tests/unit/test_attributes.js
xpcom/base/nsrootidl.idl
--- a/js/xpconnect/tests/components/js/xpctest_attributes.js
+++ b/js/xpconnect/tests/components/js/xpctest_attributes.js
@@ -12,17 +12,20 @@ TestObjectReadWrite.prototype = {
   classID: Components.ID("{8ff41d9c-66e9-4453-924a-7d8de0a5e966}"),
 
   /* nsIXPCTestObjectReadWrite */
   stringProperty: "XPConnect Read-Writable String",
   booleanProperty: true,
   shortProperty: 32767,
   longProperty: 2147483647,
   floatProperty: 5.5,
-  charProperty: "X"
+  charProperty: "X",
+  // timeProperty is PRTime and signed type.
+  // So it has to allow negative value.
+  timeProperty: -1
 };
 
 
 function TestObjectReadOnly() {}
 TestObjectReadOnly.prototype = {
 
   /* Boilerplate */
   QueryInterface: XPCOMUtils.generateQI([Components.interfaces["nsIXPCTestObjectReadOnly"]]),
@@ -30,13 +33,16 @@ TestObjectReadOnly.prototype = {
   classID: Components.ID("{916c4247-253d-4ed0-a425-adfedf53ecc8}"),
 
   /* nsIXPCTestObjectReadOnly */
   strReadOnly: "XPConnect Read-Only String",
   boolReadOnly: true,
   shortReadOnly: 32767,
   longReadOnly: 2147483647,
   floatReadOnly: 5.5,
-  charReadOnly: "X"
+  charReadOnly: "X",
+  // timeProperty is PRTime and signed type.
+  // So it has to allow negative value.
+  timeReadOnly: -1
 };
 
 
 var NSGetFactory = XPCOMUtils.generateNSGetFactory([TestObjectReadWrite, TestObjectReadOnly]);
--- a/js/xpconnect/tests/components/native/xpctest_attributes.cpp
+++ b/js/xpconnect/tests/components/native/xpctest_attributes.cpp
@@ -9,16 +9,19 @@
 NS_IMPL_ISUPPORTS1(xpcTestObjectReadOnly, nsIXPCTestObjectReadOnly)
 
 xpcTestObjectReadOnly :: xpcTestObjectReadOnly() {
     boolProperty = true;
     shortProperty = 32767;
     longProperty =  2147483647;
     floatProperty = 5.5f;
     charProperty = 'X';
+    // timeProperty is PRTime and signed type.
+    // So it has to allow negative value.
+    timeProperty = -1;
 }
 
 NS_IMETHODIMP xpcTestObjectReadOnly :: GetStrReadOnly(char * *aStrReadOnly){
     char aString[] = "XPConnect Read-Only String";
 
     if (!aStrReadOnly)
         return NS_ERROR_NULL_POINTER;
     *aStrReadOnly = (char*) nsMemory::Clone(aString,
@@ -41,27 +44,34 @@ NS_IMETHODIMP xpcTestObjectReadOnly :: G
 NS_IMETHODIMP xpcTestObjectReadOnly :: GetFloatReadOnly(float *aFloatReadOnly){
     *aFloatReadOnly = floatProperty;
     return NS_OK;
 }
 NS_IMETHODIMP xpcTestObjectReadOnly :: GetCharReadOnly(char *aCharReadOnly){
     *aCharReadOnly = charProperty;
     return NS_OK;
 }
+NS_IMETHODIMP xpcTestObjectReadOnly :: GetTimeReadOnly(PRTime *aTimeReadOnly){
+    *aTimeReadOnly = timeProperty;
+    return NS_OK;
+}
 
 NS_IMPL_ISUPPORTS1(xpcTestObjectReadWrite, nsIXPCTestObjectReadWrite)
 
 xpcTestObjectReadWrite :: xpcTestObjectReadWrite() {
     const char s[] = "XPConnect Read-Writable String";
     stringProperty = (char*) nsMemory::Clone(s, sizeof(char)*(strlen(s)+1));
     boolProperty = true;
     shortProperty = 32767;
     longProperty =  2147483647;
     floatProperty = 5.5f;
     charProperty = 'X';
+    // timeProperty is PRTime and signed type.
+    // So it has to allow negative value.
+    timeProperty = -1;
 }
 
 xpcTestObjectReadWrite :: ~xpcTestObjectReadWrite()
 {
     nsMemory::Free(stringProperty);
 }
 
 NS_IMETHODIMP xpcTestObjectReadWrite :: GetStringProperty(char * *aStringProperty) {
@@ -114,8 +124,16 @@ NS_IMETHODIMP xpcTestObjectReadWrite :: 
 NS_IMETHODIMP xpcTestObjectReadWrite :: GetCharProperty(char *aCharProperty) {
     *aCharProperty = charProperty;
     return NS_OK;
 }
 NS_IMETHODIMP xpcTestObjectReadWrite :: SetCharProperty(char aCharProperty) {
     charProperty = aCharProperty;
     return NS_OK;
 }
+NS_IMETHODIMP xpcTestObjectReadWrite :: GetTimeProperty(PRTime *aTimeProperty) {
+    *aTimeProperty = timeProperty;
+    return NS_OK;
+}
+NS_IMETHODIMP xpcTestObjectReadWrite :: SetTimeProperty(PRTime aTimeProperty) {
+    timeProperty = aTimeProperty;
+    return NS_OK;
+}
--- a/js/xpconnect/tests/components/native/xpctest_private.h
+++ b/js/xpconnect/tests/components/native/xpctest_private.h
@@ -24,16 +24,17 @@ class xpcTestObjectReadOnly MOZ_FINAL : 
   xpcTestObjectReadOnly();
 
  private:
     bool    boolProperty;
     PRInt16 shortProperty;
     PRInt32 longProperty;
     float   floatProperty;
     char    charProperty;
+    PRTime  timeProperty;
 };
 
 class xpcTestObjectReadWrite MOZ_FINAL : public nsIXPCTestObjectReadWrite {
   public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSIXPCTESTOBJECTREADWRITE
 
   xpcTestObjectReadWrite();
@@ -41,16 +42,17 @@ class xpcTestObjectReadWrite MOZ_FINAL :
 
  private:
      bool boolProperty;
      PRInt16 shortProperty;
      PRInt32 longProperty;
      float floatProperty;
      char charProperty;
      char *stringProperty;
+     PRTime timeProperty;
 };
 
 class nsXPCTestParams MOZ_FINAL : public nsIXPCTestParams
 {
 public:
     NS_DECL_ISUPPORTS
     NS_DECL_NSIXPCTESTPARAMS
 
--- a/js/xpconnect/tests/idl/xpctest_attributes.idl
+++ b/js/xpconnect/tests/idl/xpctest_attributes.idl
@@ -5,27 +5,29 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsISupports.idl"
 /*
  *	This defines the interface for a test object.
  *
  */
 
-[scriptable, uuid(29e950a0-0134-44bc-b947-5e0ee95c8f7e)]
+[scriptable, uuid(42fbd9f6-b12d-47ef-b7a1-02d73c11fe53)]
 interface nsIXPCTestObjectReadOnly : nsISupports {
 	readonly attribute string  strReadOnly;
 	readonly attribute boolean boolReadOnly;
 	readonly attribute short   shortReadOnly;
 	readonly attribute long    longReadOnly;
 	readonly attribute float   floatReadOnly;
 	readonly attribute char    charReadOnly;
+	readonly attribute PRTime  timeReadOnly;
 };
 
-[scriptable, uuid(492609a7-2582-436b-b0ef-92e29bb9e143)]
+[scriptable, uuid(f07529b0-a479-4954-aba5-ab3142c6b1cb)]
 interface nsIXPCTestObjectReadWrite : nsISupports {
 	attribute string  stringProperty;
 	attribute boolean booleanProperty;
 	attribute short   shortProperty;
 	attribute long    longProperty;
 	attribute float   floatProperty;
 	attribute char    charProperty;
+	attribute PRTime  timeProperty;
 };
--- a/js/xpconnect/tests/unit/test_attributes.js
+++ b/js/xpconnect/tests/unit/test_attributes.js
@@ -25,32 +25,35 @@ function test_component_readwrite(contra
 
   // Test the initial values.
   do_check_eq("XPConnect Read-Writable String", o.stringProperty);
   do_check_eq(true, o.booleanProperty);
   do_check_eq(32767, o.shortProperty);
   do_check_eq(2147483647, o.longProperty);
   do_check_true(5.25 < o.floatProperty && 5.75 > o.floatProperty);
   do_check_eq("X", o.charProperty);
+  do_check_eq(-1, o.timeProperty);
 
   // Write new values.
   o.stringProperty = "another string";
   o.booleanProperty = false;
   o.shortProperty = -12345;
   o.longProperty = 1234567890;
   o.floatProperty = 10.2;
   o.charProperty = "Z";
+  o.timeProperty = 1;
 
   // Test the new values.
   do_check_eq("another string", o.stringProperty);
   do_check_eq(false, o.booleanProperty);
   do_check_eq(-12345, o.shortProperty);
   do_check_eq(1234567890, o.longProperty);
   do_check_true(10.15 < o.floatProperty && 10.25 > o.floatProperty);
   do_check_eq("Z", o.charProperty);
+  do_check_eq(1, o.timeProperty);
 
   // Assign values that differ from the expected type to verify conversion.
 
   function SetAndTestBooleanProperty(newValue, expectedValue) {
     o.booleanProperty = newValue;
     do_check_eq(expectedValue, o.booleanProperty);
   };
   SetAndTestBooleanProperty(false, false);
@@ -69,9 +72,10 @@ function test_component_readonly(contrac
 
   // Test the initial values.
   do_check_eq("XPConnect Read-Only String", o.strReadOnly);
   do_check_eq(true, o.boolReadOnly);
   do_check_eq(32767, o.shortReadOnly);
   do_check_eq(2147483647, o.longReadOnly);
   do_check_true(5.25 < o.floatReadOnly && 5.75 > o.floatReadOnly);
   do_check_eq("X", o.charReadOnly);
+  do_check_eq(-1, o.timeReadOnly);
 }
--- a/xpcom/base/nsrootidl.idl
+++ b/xpcom/base/nsrootidl.idl
@@ -25,17 +25,17 @@ class nsACString;
 %}
 
 typedef boolean             bool   ;
 typedef octet               PRUint8  ;
 typedef unsigned short      PRUint16 ;
 typedef unsigned short      PRUnichar;
 typedef unsigned long       PRUint32 ;
 typedef unsigned long long  PRUint64 ;
-typedef unsigned long long  PRTime   ;
+typedef long long           PRTime   ;
 typedef short               PRInt16  ;
 typedef long                PRInt32  ;
 typedef long long           PRInt64  ;
 
 typedef unsigned long       nsrefcnt ;
 typedef unsigned long       nsresult ;
 
 // XXX need this built into xpidl compiler so that it's really size_t or PRSize