util 모듈

mozrepl.util.convertToJs(obj)

입력받은 값을 javascript에서 사용 가능한 값으로 변환합니다.

Parameters:obj (Object, Function, Array, Raw 외 python 기본 타입.) – 변환할 값. 만약 list와 tuple타입을 인자로 준다면, 포함된 값은 convertToJs() 함수가 변환 할 수 있는 값이어야 합니다.
Returns:JSON string
Return type:unicode
mozrepl.util.getAllTabs(repl)

접속한 브라우져에 존재하는 모든 탭 오브젝트를 가져옵니다.

Parameters:repl (Mozrepl) – mozrepl 객체.
Yield:각 탭 Object 객체.
mozrepl.util.getCookiesFromHost(repl, host)

Returns an generator of cookies that would be returned to a given host, ignoring the cookie flags isDomain, isSecure, and isHttpOnly. Therefore, if the specified host is “weather.yahoo.com”, host or domain cookies for “weather.yahoo.com” and “yahoo.com” would both be returned, while a cookie for “my.weather.yahoo.com” would not.

Parameters:
  • repl (Mozrepl) – mozrepl.Mozrepl 객체
  • host (unicode) – The host unicode string to look for, such as “google.com”. This should consist only of the host portion of the URI and should not contain a leading dot, port number, or other information.
Yield:

An cookielib.Cookie objects representing the matching cookies.

mozrepl.util.openTab(repl, url, isPrivate=False, inNewWindow=False, inBackground=False, isPinned=False)

Opens a new tab. The new tab will open in the active window or in a new window, depending on the inNewWindow option.

Parameters:
  • repl (Mozrepl) – mozrepl 객체.
  • url (unicode) – String URL to be opened in the new tab. This is a required property.
  • isPrivate (bool) – bool which will determine whether the new tab should be private or not. If your add-on does not support private browsing this will have no effect. See the private-browsing documentation for more information. Defaults to false.
  • inNewWindow (bool) – If present and true, a new browser window will be opened and the URL will be opened in the first tab in that window. This is an optional property.
  • inBackground (bool) – If present and true, the new tab will be opened to the right of the active tab and will not be active. This is an optional property.
  • isPinned (bool) – If present and true, then the new tab will be pinned as an app tab.