1/* 2 * Copyright 2014 The Chromium Authors. All rights reserved. 3 * Use of this source code is governed by a BSD-style license that can be 4 * found in the LICENSE file. 5 */ 6 7window.WebInspector = { 8 _queryParamsObject: {} 9} 10 11WebInspector.Events = { 12 InspectorLoaded: "InspectorLoaded" 13} 14 15/** 16 * @param {string} name 17 * @return {?string} 18 */ 19WebInspector.queryParam = function(name) 20{ 21 return WebInspector._queryParamsObject.hasOwnProperty(name) ? WebInspector._queryParamsObject[name] : null; 22} 23 24{(function parseQueryParameters() 25{ 26 var queryParams = window.location.search; 27 if (!queryParams) 28 return; 29 var params = queryParams.substring(1).split("&"); 30 for (var i = 0; i < params.length; ++i) { 31 var pair = params[i].split("="); 32 WebInspector._queryParamsObject[pair[0]] = pair[1]; 33 } 34 35 // Patch settings from the URL param (for tests). 36 var settingsParam = WebInspector.queryParam("settings"); 37 if (settingsParam) { 38 try { 39 var settings = JSON.parse(window.decodeURI(settingsParam)); 40 for (var key in settings) 41 window.localStorage[key] = settings[key]; 42 } catch(e) { 43 // Ignore malformed settings. 44 } 45 } 46})();} 47