fix: load manifest before init in bootstrap.js
This commit is contained in:
		
							parent
							
								
									3d1cf9ded3
								
							
						
					
					
						commit
						4ff9c79263
					
				
							
								
								
									
										24
									
								
								addon/bootstrap.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										24
									
								
								addon/bootstrap.js
									
									
									
									
										vendored
									
									
								
							@ -64,6 +64,18 @@ function install(data, reason) {}
 | 
				
			|||||||
async function startup({ id, version, resourceURI, rootURI }, reason) {
 | 
					async function startup({ id, version, resourceURI, rootURI }, reason) {
 | 
				
			||||||
  await waitForZotero();
 | 
					  await waitForZotero();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  if (Zotero.platformMajorVersion >= 102) {
 | 
				
			||||||
 | 
					    var aomStartup = Components.classes[
 | 
				
			||||||
 | 
					      "@mozilla.org/addons/addon-manager-startup;1"
 | 
				
			||||||
 | 
					    ].getService(Components.interfaces.amIAddonManagerStartup);
 | 
				
			||||||
 | 
					    var manifestURI = Services.io.newURI(rootURI + "manifest.json");
 | 
				
			||||||
 | 
					    chromeHandle = aomStartup.registerChrome(manifestURI, [
 | 
				
			||||||
 | 
					      ["content", "__addonRef__", rootURI + "chrome/content/"],
 | 
				
			||||||
 | 
					      ["locale", "__addonRef__", "en-US", rootURI + "chrome/locale/en-US/"],
 | 
				
			||||||
 | 
					      ["locale", "__addonRef__", "zh-CN", rootURI + "chrome/locale/zh-CN/"],
 | 
				
			||||||
 | 
					    ]);
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // String 'rootURI' introduced in Zotero 7
 | 
					  // String 'rootURI' introduced in Zotero 7
 | 
				
			||||||
  if (!rootURI) {
 | 
					  if (!rootURI) {
 | 
				
			||||||
    rootURI = resourceURI.spec;
 | 
					    rootURI = resourceURI.spec;
 | 
				
			||||||
@ -83,18 +95,6 @@ async function startup({ id, version, resourceURI, rootURI }, reason) {
 | 
				
			|||||||
    `${rootURI}/chrome/content/scripts/index.js`,
 | 
					    `${rootURI}/chrome/content/scripts/index.js`,
 | 
				
			||||||
    ctx
 | 
					    ctx
 | 
				
			||||||
  );
 | 
					  );
 | 
				
			||||||
 | 
					 | 
				
			||||||
  if (Zotero.platformMajorVersion >= 102) {
 | 
					 | 
				
			||||||
    var aomStartup = Components.classes[
 | 
					 | 
				
			||||||
      "@mozilla.org/addons/addon-manager-startup;1"
 | 
					 | 
				
			||||||
    ].getService(Components.interfaces.amIAddonManagerStartup);
 | 
					 | 
				
			||||||
    var manifestURI = Services.io.newURI(rootURI + "manifest.json");
 | 
					 | 
				
			||||||
    chromeHandle = aomStartup.registerChrome(manifestURI, [
 | 
					 | 
				
			||||||
      ["content", "__addonRef__", rootURI + "chrome/content/"],
 | 
					 | 
				
			||||||
      ["locale", "__addonRef__", "en-US", rootURI + "chrome/locale/en-US/"],
 | 
					 | 
				
			||||||
      ["locale", "__addonRef__", "zh-CN", rootURI + "chrome/locale/zh-CN/"],
 | 
					 | 
				
			||||||
    ]);
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function shutdown({ id, version, resourceURI, rootURI }, reason) {
 | 
					function shutdown({ id, version, resourceURI, rootURI }, reason) {
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user