Hello nigeltao,
I'd like you to do a code review. Please execute
g4 diff -c 8551099
or point your web browser to
http://mondrian/8551099
to review the following code:
Change 8551099 by [EMAIL PROTECTED] on 2008/10/10 10:56:18 *pending*
Add a primitive DOM Element test for NPAPI.
PRESUBMIT=passed
R=nigeltao
[EMAIL PROTECTED]
DELTA=10 (8 added, 0 deleted, 2 changed)
OCL=8551099
Affected files ...
... //depot/googleclient/gears/opensource/gears/base/common/js_dom_element.cc#4
edit
... //depot/googleclient/gears/opensource/gears/base/common/js_dom_element.h#1
edit
10 delta lines: 8 added, 0 deleted, 2 changed
Also consider running:
g4 lint -c 8551099
which verifies that the changelist doesn't introduce new style violations.
If you can't do the review, please let me know as soon as possible. During
your review, please ensure that all new code has corresponding unit tests and
that existing unit tests are updated appropriately. Visit
http://www/eng/code_review.html for more information.
This is a semiautomated message from "g4 mail". Complaints or suggestions?
Mail [EMAIL PROTECTED]
Change 8551099 by [EMAIL PROTECTED] on 2008/10/10 10:56:18 *pending*
Add a primitive DOM Element test for NPAPI.
OCL=8551099
Affected files ...
... //depot/googleclient/gears/opensource/gears/base/common/js_dom_element.cc#4
edit
... //depot/googleclient/gears/opensource/gears/base/common/js_dom_element.h#1
edit
====
//depot/googleclient/gears/opensource/gears/base/common/js_dom_element.cc#4 -
c:\Users\noel\src-gears3/googleclient/gears/opensource/gears/base/common/js_dom_element.cc
====
# action=edit type=text
--- googleclient/gears/opensource/gears/base/common/js_dom_element.cc
2008-10-10 10:48:54.000000000 +1100
+++ googleclient/gears/opensource/gears/base/common/js_dom_element.cc
2008-10-10 10:51:19.000000000 +1100
@@ -320,9 +320,12 @@
bool JsDomElement::InitJsDomElement(JsContextPtr context, JsToken token) {
- // TODO(nigeltao): implement on NPAPI.
+ // A DOM element is at least an NPObject, but an NPObject can also be
+ // an arbitrary javascript object. So this is not a strong test, just
+ // a hint that the token might be a DOM element.
assert(!is_initialized_);
- return false;
+ is_initialized_ = js_object_.SetObject(token, context);
+ return is_initialized_;
}
==== //depot/googleclient/gears/opensource/gears/base/common/js_dom_element.h#1
-
c:\Users\noel\src-gears3/googleclient/gears/opensource/gears/base/common/js_dom_element.h
====
# action=edit type=text
--- googleclient/gears/opensource/gears/base/common/js_dom_element.h
2008-10-10 10:48:54.000000000 +1100
+++ googleclient/gears/opensource/gears/base/common/js_dom_element.h
2008-10-10 10:51:19.000000000 +1100
@@ -60,6 +60,10 @@
return dispatch_;
}
#elif BROWSER_NPAPI
+ JsObject *js_object() {
+ assert(is_initialized_);
+ return &js_object_;
+ }
#endif
private:
@@ -68,6 +72,7 @@
#elif BROWSER_IE
CComPtr<IDispatch> dispatch_;
#elif BROWSER_NPAPI
+ JsObject js_object_;
#endif
bool is_initialized_;