Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / chrome / test / data / extensions / api_test / executescript / in_frame / script.js
blob59555b3ce19daac9aecaf896e5718bc198399930
1 // Copyright (c) 2013 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.
5 function getStyle(elem, name) {
6 if (document.defaultView && document.defaultView.getComputedStyle) {
7 name = name.toLowerCase();
9 try {
10 var s = document.defaultView.getComputedStyle(elem, '');
11 return s && s.getPropertyValue(name);
12 } catch (ex) {
13 return null;
15 } else {
16 return null;
20 var bElement = document.getElementById('test2');
21 var display = getStyle(bElement, 'display').toLowerCase();
22 var extensionPort = chrome.runtime.connect();
23 extensionPort.postMessage({message: display});