Index: test/intl/break-iterator/property-override.js |
diff --git a/src/extensions/i18n/i18n-extension.h b/test/intl/break-iterator/property-override.js |
similarity index 63% |
copy from src/extensions/i18n/i18n-extension.h |
copy to test/intl/break-iterator/property-override.js |
index 050c336a67a21fd6cb32892e14215cac11971111..af6fc22dde3d8ba72393cfccbd242d4276b8403e 100644 |
--- a/src/extensions/i18n/i18n-extension.h |
+++ b/test/intl/break-iterator/property-override.js |
@@ -26,26 +26,40 @@ |
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
// limitations under the License. |
-#ifndef V8_EXTENSIONS_I18N_I18N_EXTENSION_H_ |
-#define V8_EXTENSIONS_I18N_I18N_EXTENSION_H_ |
- |
-#include "v8.h" |
- |
-namespace v8_i18n { |
+// Checks for security holes introduced by Object.property overrides. |
+// For example: |
+// Object.defineProperty(Array.prototype, 'locale', { |
+// set: function(value) { |
+// throw new Error('blah'); |
+// }, |
+// configurable: true, |
+// enumerable: false |
+// }); |
+// |
+// would throw in case of (JS) x.locale = 'us' or (C++) x->Set('locale', 'us'). |
+// |
+// Update both break-iterator.js and break-iterator.cc so they have the same |
+// list of properties. |
-class Extension : public v8::Extension { |
- public: |
- Extension(); |
+// First get supported properties. |
+var properties = []; |
+var options = Intl.v8BreakIterator().resolvedOptions(); |
+for (var prop in options) { |
+ if (options.hasOwnProperty(prop)) { |
+ properties.push(prop); |
+ } |
+} |
- virtual v8::Handle<v8::FunctionTemplate> GetNativeFunction( |
- v8::Handle<v8::String> name); |
+var expectedProperties = [ |
+ 'type', 'locale' |
+]; |
- static void Register(); |
+assertEquals(expectedProperties.length, properties.length); |
- private: |
- static Extension* extension_; |
-}; |
+properties.forEach(function(prop) { |
+ assertFalse(expectedProperties.indexOf(prop) === -1); |
+}); |
-} // namespace v8_i18n |
+taintProperties(properties); |
-#endif // V8_EXTENSIONS_I18N_I18N_EXTENSION_H_ |
+var locale = Intl.v8BreakIterator().resolvedOptions().locale; |