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

Side by Side 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 chrome.test.runTests([
6 function noMutationEvents() {
7 var failures = [];
8 function addListener(node) {
9 return function(type) {
10 node.addEventListener(type, function() {
11 failures.push('Received a ' + type + ' event');
12 });
13 };
14 };
15 var body = document.body;
16 [ 'DOMSubtreeModified',
17 'DOMNodeInserted',
18 'DOMNodeRemoved',
19 'DOMAttrModified',
20 'DOMCharacterDataModified' ].forEach(addListener(body));
21
22 var div = document.createElement('div');
23 [ 'DOMNodeInsertedIntoDocument',
24 'DOMNodeRemovedFromDocument' ].forEach(addListener(div));
25
26 // DOMSubtreeModified, DOMNodeInserted{,IntoDocument}
27 body.appendChild(div);
28 // DOMSubtreeModified, DOMAttrModified
29 div.setAttribute('data-foo', 'bar');
30 // DOMNodeInserted
31 var text = div.appendChild(document.createTextNode('hello'));
32 // DOMCharacterDataModified
33 text = 'goodbye';
34 // DOMNodeRemoved, DOMNodeRemovedFromDocument
35 body.removeChild(div);
36
37 if (failures.length)
38 chrome.test.fail(failures.join('\n'));
39 else
40 chrome.test.succeed();
41 }
42 ]);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698