OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 947 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
958 | 958 |
959 _onMessage: function(event) | 959 _onMessage: function(event) |
960 { | 960 { |
961 var request = event.data; | 961 var request = event.data; |
962 var handler = this._handlers[request.command]; | 962 var handler = this._handlers[request.command]; |
963 if (handler) | 963 if (handler) |
964 handler.call(this, request); | 964 handler.call(this, request); |
965 } | 965 } |
966 } | 966 } |
967 | 967 |
968 function populateInterfaceClass(interface, implementation) | 968 function populateInterfaceClass(interfaze, implementation) |
969 { | 969 { |
970 for (var member in implementation) { | 970 for (var member in implementation) { |
971 if (member.charAt(0) === "_") | 971 if (member.charAt(0) === "_") |
972 continue; | 972 continue; |
973 var descriptor = null; | 973 var descriptor = null; |
974 // Traverse prototype chain until we find the owner. | 974 // Traverse prototype chain until we find the owner. |
975 for (var owner = implementation; owner && !descriptor; owner = owner.__p
roto__) | 975 for (var owner = implementation; owner && !descriptor; owner = owner.__p
roto__) |
976 descriptor = Object.getOwnPropertyDescriptor(owner, member); | 976 descriptor = Object.getOwnPropertyDescriptor(owner, member); |
977 if (!descriptor) | 977 if (!descriptor) |
978 continue; | 978 continue; |
979 if (typeof descriptor.value === "function") | 979 if (typeof descriptor.value === "function") |
980 interface[member] = descriptor.value.bind(implementation); | 980 interfaze[member] = descriptor.value.bind(implementation); |
981 else if (typeof descriptor.get === "function") | 981 else if (typeof descriptor.get === "function") |
982 interface.__defineGetter__(member, descriptor.get.bind(implementatio
n)); | 982 interfaze.__defineGetter__(member, descriptor.get.bind(implementatio
n)); |
983 else | 983 else |
984 Object.defineProperty(interface, member, descriptor); | 984 Object.defineProperty(interfaze, member, descriptor); |
985 } | 985 } |
986 } | 986 } |
987 | 987 |
988 // extensionServer is a closure variable defined by the glue below -- make sure
we fail if it's not there. | 988 // extensionServer is a closure variable defined by the glue below -- make sure
we fail if it's not there. |
989 if (!extensionServer) | 989 if (!extensionServer) |
990 extensionServer = new ExtensionServerClient(); | 990 extensionServer = new ExtensionServerClient(); |
991 | 991 |
992 return new InspectorExtensionAPI(); | 992 return new InspectorExtensionAPI(); |
993 } | 993 } |
994 | 994 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1050 { | 1050 { |
1051 return "(function(injectedScriptId){ " + | 1051 return "(function(injectedScriptId){ " + |
1052 "var extensionServer;" + | 1052 "var extensionServer;" + |
1053 defineCommonExtensionSymbols.toString() + ";" + | 1053 defineCommonExtensionSymbols.toString() + ";" + |
1054 injectedExtensionAPI.toString() + ";" + | 1054 injectedExtensionAPI.toString() + ";" + |
1055 buildPlatformExtensionAPI(extensionInfo) + ";" + | 1055 buildPlatformExtensionAPI(extensionInfo) + ";" + |
1056 "platformExtensionAPI(injectedExtensionAPI(injectedScriptId));" + | 1056 "platformExtensionAPI(injectedExtensionAPI(injectedScriptId));" + |
1057 "return {};" + | 1057 "return {};" + |
1058 "})"; | 1058 "})"; |
1059 } | 1059 } |
OLD | NEW |