michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: "use strict"; michael@0: michael@0: const memory = require("sdk/deprecated/memory"); michael@0: const { gc } = require("sdk/test/memory"); michael@0: michael@0: exports.testMemory = function(assert) { michael@0: var obj = {}; michael@0: memory.track(obj, "testMemory.testObj"); michael@0: michael@0: var objs = memory.getObjects("testMemory.testObj"); michael@0: assert.equal(objs[0].weakref.get(), obj); michael@0: obj = null; michael@0: michael@0: gc().then(function() { michael@0: assert.equal(objs[0].weakref.get(), null); michael@0: }); michael@0: }; michael@0: michael@0: require('sdk/test').run(exports);