Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(503)

Unified Diff: chrome/test/data/extensions/api_test/bindings/override_exports.html

Issue 1417513003: [Extensions] Don't allow built-in extensions code to be overridden (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Jochen's Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/test/data/extensions/api_test/bindings/override_exports.html
diff --git a/chrome/test/data/extensions/api_test/bindings/override_exports.html b/chrome/test/data/extensions/api_test/bindings/override_exports.html
new file mode 100644
index 0000000000000000000000000000000000000000..c3bec0202f0f4690227a4866cf568c7cd5a3f225
--- /dev/null
+++ b/chrome/test/data/extensions/api_test/bindings/override_exports.html
@@ -0,0 +1,44 @@
+<!doctype html>
+<html>
+<body>
+This is a body
+<span id="status"></span>
+</body>
+<script>
+var error = '';
+var addError = function(newError) {
+ error += newError;
+ var status = error.length == 0 ? 'success' : error;
+ document.getElementById('status').textContent = status;
+};
+
+Object.defineProperty(Object.prototype,
+ 'handleResponse',
+ {configurable: true, set: function(v) {
+ addError('Intercepted handleResponse\n');
+ Object.defineProperty(
+ this, "handleResponse", {configurable: true, value: v});
+}});
+
+Object.defineProperty(Object.prototype,
+ "$set",
+ {configurable: true, set: function(v) {
+ addError('Intercepted $set\n');
+ Object.defineProperty(this, "$set", {configurable: true, value: v});
+}});
+
+Object.defineProperty(Object.prototype,
+ "clear",
+ {configurable: true, set: function(v) {
+ addError('Intercepted clear\n');
+ Object.defineProperty(this, 'clear', {configurable: true, value: v});
+}});
+
+// Bindings are lazily initialized. Poke it.
+chrome.runtime;
+// If the runtime bindings aren't created, we didn't test anything.
+if (!chrome.runtime)
+ addError('chrome.runtime was not created.\n');
+
+addError('');
+</script>

Powered by Google App Engine
This is Rietveld 408576698