OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007 Apple Inc. All rights reserved. |
3 * Copyright (C) 2012 Google Inc. All rights reserved. | 3 * Copyright (C) 2012 Google Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * | 8 * |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 687 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
698 ++this._size; | 698 ++this._size; |
699 this._map[objectIdentifier] = [key, value]; | 699 this._map[objectIdentifier] = [key, value]; |
700 }, | 700 }, |
701 | 701 |
702 /** | 702 /** |
703 * @param {Object} key | 703 * @param {Object} key |
704 */ | 704 */ |
705 remove: function(key) | 705 remove: function(key) |
706 { | 706 { |
707 var result = this._map[key.__identifier]; | 707 var result = this._map[key.__identifier]; |
| 708 if (!result) |
| 709 return undefined; |
| 710 --this._size; |
708 delete this._map[key.__identifier]; | 711 delete this._map[key.__identifier]; |
709 --this._size; | 712 return result[1]; |
710 return result ? result[1] : undefined; | |
711 }, | 713 }, |
712 | 714 |
713 /** | 715 /** |
714 * @return {Array.<Object>} | 716 * @return {Array.<Object>} |
715 */ | 717 */ |
716 keys: function() | 718 keys: function() |
717 { | 719 { |
718 return this._list(0); | 720 return this._list(0); |
719 }, | 721 }, |
720 | 722 |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
853 function importScript(scriptName) | 855 function importScript(scriptName) |
854 { | 856 { |
855 if (_importedScripts[scriptName]) | 857 if (_importedScripts[scriptName]) |
856 return; | 858 return; |
857 _importedScripts[scriptName] = true; | 859 _importedScripts[scriptName] = true; |
858 var xhr = new XMLHttpRequest(); | 860 var xhr = new XMLHttpRequest(); |
859 xhr.open("GET", scriptName, false); | 861 xhr.open("GET", scriptName, false); |
860 xhr.send(null); | 862 xhr.send(null); |
861 window.eval(xhr.responseText + "\n//@ sourceURL=" + scriptName); | 863 window.eval(xhr.responseText + "\n//@ sourceURL=" + scriptName); |
862 } | 864 } |
OLD | NEW |