浏览代码

minor safari fix

David Rose 16 年之前
父节点
当前提交
b58639d5e9
共有 1 个文件被更改,包括 20 次插入3 次删除
  1. 20 3
      direct/src/plugin_npapi/ppObject.cxx

+ 20 - 3
direct/src/plugin_npapi/ppObject.cxx

@@ -208,8 +208,15 @@ set_property(NPIdentifier name, const NPVariant *value) {
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 bool PPObject::
 bool PPObject::
 remove_property(NPIdentifier name) {
 remove_property(NPIdentifier name) {
-  logfile << "remove_property: " << this << "\n" << flush;
-  return false;
+  string property_name = identifier_to_string(name);
+  logfile << "remove_property: " << this << ", " << property_name << "\n" << flush;
+  if (_p3d_object == NULL) {
+    // Not powered up yet.
+    return false;
+  }
+
+  bool result = P3D_OBJECT_SET_PROPERTY(_p3d_object, property_name.c_str(), NULL);
+  return result;
 }
 }
 
 
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
@@ -234,7 +241,8 @@ enumerate(NPIdentifier **value, uint32_t *count) {
 //     Function: PPObject::identifier_to_string
 //     Function: PPObject::identifier_to_string
 //       Access: Private, Static
 //       Access: Private, Static
 //  Description: Gets the string equivalent of the indicated
 //  Description: Gets the string equivalent of the indicated
-//               identifier.
+//               identifier, whether it is an integer identifier or a
+//               string identifier.
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 string PPObject::
 string PPObject::
 identifier_to_string(NPIdentifier ident) {
 identifier_to_string(NPIdentifier ident) {
@@ -245,6 +253,15 @@ identifier_to_string(NPIdentifier ident) {
       browser->memfree(result);
       browser->memfree(result);
       return strval;
       return strval;
     }
     }
+  } else {
+    // An integer identifier.  We could treat this as a special case,
+    // like Firefox does, but Safari doesn't appear to use integer
+    // identifiers and just sends everything as a string identifier.
+    // So to make things consistent internally, we also send
+    // everything as a string.
+    ostringstream strm;
+    strm << browser->intfromidentifier(ident);
+    return strm.str();
   }
   }
 
 
   return string();
   return string();