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

Unified Diff: chrome/test/data/extensions/platform_apps/mutation_events/main.js

Issue 10870013: Disable DOM MutationEvents for platform apps (Closed) Base URL: http://git.chromium.org/chromium/src.git@git-svn
Patch Set: Added test Created 8 years, 4 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/platform_apps/mutation_events/main.js
diff --git a/chrome/test/data/extensions/platform_apps/mutation_events/main.js b/chrome/test/data/extensions/platform_apps/mutation_events/main.js
new file mode 100644
index 0000000000000000000000000000000000000000..b42ae071af4cf4c4d33f3ee0c95420af6621ffd4
--- /dev/null
+++ b/chrome/test/data/extensions/platform_apps/mutation_events/main.js
@@ -0,0 +1,42 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+chrome.test.runTests([
+ function noMutationEvents() {
+ var failures = [];
+ function addListener(node) {
+ return function(type) {
+ node.addEventListener(type, function() {
+ failures.push('Received a ' + type + ' event');
+ });
+ };
+ };
+ var body = document.body;
+ [ 'DOMSubtreeModified',
+ 'DOMNodeInserted',
+ 'DOMNodeRemoved',
+ 'DOMAttrModified',
+ 'DOMCharacterDataModified' ].forEach(addListener(body));
+
+ var div = document.createElement('div');
+ [ 'DOMNodeInsertedIntoDocument',
+ 'DOMNodeRemovedFromDocument' ].forEach(addListener(div));
+
+ // DOMSubtreeModified, DOMNodeInserted{,IntoDocument}
+ body.appendChild(div);
+ // DOMSubtreeModified, DOMAttrModified
+ div.setAttribute('data-foo', 'bar');
+ // DOMNodeInserted
+ var text = div.appendChild(document.createTextNode('hello'));
+ // DOMCharacterDataModified
+ text = 'goodbye';
+ // DOMNodeRemoved, DOMNodeRemovedFromDocument
+ body.removeChild(div);
+
+ if (failures.length)
+ chrome.test.fail(failures.join('\n'));
+ else
+ chrome.test.succeed();
+ }
+]);

Powered by Google App Engine
This is Rietveld 408576698