From 8d9d3bcb024aaa664165e1d89b0324a742473f60 Mon Sep 17 00:00:00 2001 From: piro Date: Sun, 13 Jun 2010 12:48:22 +0000 Subject: [PATCH] =?UTF-8?q?=E3=83=A1=E3=82=BD=E3=83=83=E3=83=89=E5=88=86?= =?UTF-8?q?=E5=89=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: http://www.cozmixng.org/repos/piro/treestyletab/trunk@6678 599a83e7-65a4-db11-8015-0010dcdd6dc2 --- content/treestyletab/treestyletab.js | 29 ++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/content/treestyletab/treestyletab.js b/content/treestyletab/treestyletab.js index 0bb07805..b75287b6 100644 --- a/content/treestyletab/treestyletab.js +++ b/content/treestyletab/treestyletab.js @@ -778,17 +778,7 @@ catch(e) { if (!draggedTab) { aEvent.stopPropagation(); - let url; - let types = ['text/x-moz-url', 'text/uri-list', 'text/plain', 'application/x-moz-file']; - for (let i = 0; i < types.length; i++) { - let dataType = types[i]; - let isURLList = dataType == 'text/uri-list'; - let urlData = dt.mozGetDataAt(isURLList ? 'URL' : dataType , 0); - if (urlData) { - url = this.retrieveURLFromData(urlData, isURLList ? 'text/plain' : dataType); - break; - } - } + let url = this.retrieveURLFromDataTransfer(dt); if (!url || !url.length || url.indexOf(' ', 0) != -1 || /^\s*(javascript|data):/.test(url)) return; @@ -842,7 +832,22 @@ catch(e) { } } }, - retrieveURLFromData: function TSTService_retrieveURLFromData(aData, aType) + retrieveURLFromDataTransfer : function TSTService_retrieveURLFromDataTransfer(aDataTransfer) + { + let url; + let types = ['text/x-moz-url', 'text/uri-list', 'text/plain', 'application/x-moz-file']; + for (let i = 0; i < types.length; i++) { + let dataType = types[i]; + let isURLList = dataType == 'text/uri-list'; + let urlData = aDataTransfer.mozGetDataAt(isURLList ? 'URL' : dataType , 0); + if (urlData) { + url = this.retrieveURLFromData(urlData, isURLList ? 'text/plain' : dataType); + break; + } + } + return url; + }, + retrieveURLFromData : function TSTService_retrieveURLFromData(aData, aType) { switch (aType) {